Skip to content

ethanh6/Cornell-Token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cornell Token

ERC20 token with Solidity, Brownie and Python

Demo

Check out Cornell Token on Rinnkeby network with Etherscan.

demo

Installation

  1. Install brownie with pipx

    $ python3 -m pip install --user pipx
    $ python3 -m pipx ensurepath
    $ pipx install eth-brownie
    
    # test installation
    $ brownie 
  2. Install ganache-cli with npm

    npm install -g ganache-cli

Create the Project

  1. Initialize the project

    $ mkdir cornell_token ; cd cornell_token
    $ brownie init
  2. Create token contract in ./contracts/CornellToken.sol

    • inherit ERC20 implementation from OpenZeppelin to avoid re-inventing the wheel.
  3. Add ./brownie-config.yaml

    1. create mapping @openzeppelin to the github repo
    2. add other config:
      • dotenv
      • private key of local dev
  4. Add .env for the environment variables

    • dotenv -> for private key stuff, as a safer way
  5. Change the name of the Token (e.g. CornellToken)

  6. Creat deploy script deploy_cornell_token.py

    • define initial supply, token name, token sybol
  7. Creat deploy script helper.py

    • get account function

Deploy to local blockchain development environment

$ brownie run scripts/deploy_cornell_token.sol

Deploy to live network

  1. in brownie-config.yaml, add:

    networks:
    rinkeby: active
  2. in .env, add:

    export WEB3_INFURA_PROJECT_ID=<YOUR INFURA PROJECT ID>
    export PRIVATE_KEY=<YOUR PRIVATE KEY>

    To have infura project id, you need to create an infura account and a new project. The id is the endpoint to the live network.

    To access your private key, you can check out the metamask -> account details

  3. run the same script with an extra --network option

    $ brownie run scripts/deploy_cornell_token.sol --network rinkeby

    then wait for a moment to see the address being active on the live network.

  4. add this token to metamask

    • Metamask -> assets -> import tokens
    • grab the token contract address and add it into metamask.

About

Create and deploy ERC20 token to live network.

Resources

Stars

Watchers

Forks