GithubHelp home page GithubHelp logo

token-sample-erc20's Introduction

token-sample-erc20

The purpose of this sample project is demonstrating ERC20 token contracts based on the awesome openzeppelin contract library, and features of the ERC20 token specification with truffel test scenarios.

Token Contracts Demonstrated

The contracts with the features and tested scenarios are listed below.

Fixed Supply

contracts/ERC20FixedSupply.sol

constructor
  ✓ initialized with the correct supply (118ms)
  ✓ check the contract deployer is the new owner and has all the money (45ms)
adding spenders that can transfer money on behalf of the token owner
  ✓ current owner approves a new account to be the spender (60ms)
transfer
  ✓ current owner transfers to the spender (131ms)
  ✓ spender transfers from its own pocket to user1 (81ms)
  ✓ spender transfers from the custody account to user1 (109ms)

Mintable

contracts/ERC20MintableWithInitialSupply.sol

constructor
  ✓ initialized with the correct supply (144ms)
  ✓ check the contract deployer is the new owner and has all the money
adding spenders that can transfer money on behalf of the token owner
  ✓ current owner approves a new account to be the spender (50ms)
transfer
  ✓ current owner transfers to the spender (49ms)
  ✓ spender transfers from its own pocket to user1 (75ms)
  ✓ spender transfers from the custody account to user1 (96ms)
minters
  ✓ current owner is by default a minter and can mint more tokens out of thin air (60ms)
  ✓ current owner can add a new minter (60ms)
  ✓ a minter can make tokens as well (69ms)
  ✓ an altruistic minter can make tokens and give it to user1 (89ms)

Burnable

contracts/ERC20BurnableWithInitialSupply.sol

constructor
  ✓ initialized with the correct supply (109ms)
  ✓ check the contract deployer is the new owner and has all the money
adding spenders that can transfer money on behalf of the token owner
  ✓ current owner approves a new account to be the spender (92ms)
transfer
  ✓ current owner transfers to the spender (61ms)
  ✓ spender transfers from its own pocket to user1 (119ms)
  ✓ spender transfers from the custody account to user1 (164ms)
burn baby burn!
  ✓ current owner can burn tokens (117ms)
  ✓ spender can also burn its own tokens (84ms)
  ✓ spender can also burn tokens from its allowance (104ms)

Getting Started

Instal truffle

Install Ganache and start it

npm i
truffle test

token-sample-erc20's People

Contributors

jimthematrix avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.