Code Monkey home page Code Monkey logo

bep20token's Introduction

BEP20Token

Requrements

  • truffle v5.1.43 (Solidity v0.5.16 (solc-js), Node v14.8.0, Web3.js v1.2.1)
  • ganache test rpc.

Getting started

$ npm install 

Deploy BEP-20 token

$ export SEED=<your seed phrase> 
$ truffle migrate --network {development/bsc_testnet}

Binding BEP20 token to BEP-2 token (for bsc_testnet)

Please have a look this instuction and make sure all of requrements for binding.

Step 1. Import your key to bnbcli

$ tbnbcli keys add owner --recover

Step 2. BEP-2 token issue (example 1 billion tokens and symbol TESTONE-A43)

$ tbnbcli token issue --symbol TESTONE --token-name "TEST one token" --total-supply 100000000000000000 --from owner --chain-id Binance-Chain-Ganges --node http://data-seed-pre-0-s3.binance.org:80

Step 3. BEP-20 token issue

See the above deploy command. You have to check the following things before deploy token.

  • Token symbol should have to same (if the BEP-2 token name is SWINGBY-888, symbol should be SWINGBY)
  • Total supply should be same as BEP-2 token supply
  • It may be better to disable the mintable on the Token.sol.

Step 4. Make a binding tx for BC

In thie case, the total supply is 100000000000000000and 60000000000000000 600 million BEP-2 tokens will be locked into the pure-code-controlled address on BC. then, 40000000000000000 400 million BEP-20 tokens will be locked into the tokenManager contract on BSC.

$ tbnbcli bridge bind --symbol TESTONE-A43 --amount 60000000000000000 --expire-time <expiry time e.g. 1603011072> --contract-decimals 18 --from owner --chain-id Binance-Chain-Ganges --contract-address <your token contract address> --node http://data-seed-pre-0-s3.binance.org:80

Step 5. Allowance tokens to token manager contract

$ AMOUNT=40000000000000000 truffle exec scripts/approveTokens.js --network bsc_testnet

Step 6. Make a binding tx for BSC

$ SYMBOL=TESTONE-A43 truffle exec scripts/bindTokenContract.js --network bsc_testnet

Step 7. Confirm bind result on BC

$ tbnbcli token info --symbol TESTONE-A43 --trust-node --node http://data-seed-pre-0-s3.binance.org:80

TrasnferOut BSC from BC (100 TESTONE-A43 tokens will be transferred to BSC address)

$ tbnbcli bridge transfer-out --to <your bsc address> --expire-time <expiry time e.g. 1603011072> --chain-id Binance-Chain-Ganges --from owner --amount 10000000000:TESTONE-A43 --node http://data-seed-pre-0-s3.binance.org:80

TransferOut BC from BSC (100 TESTONE-A43 tokens will be transferred to BC address)

$ AMOUNT=<your amount e.g. if decimals == 18, should be set 100> TO=<your bc address> truffle exec scripts/transferOutToBC.js --network bsc_testnet

Test

$ truffle test

bep20token's People

Contributors

syrohei 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.