Skip to content

A smart contract that lets people buy or sell a TOK token from it, using another ERC20 token. The contract holds the total amount of tokens received in exchange for all bought TOK tokens and accepts Dai as the payment method. The token price varies with the number of tokens already sold, following a bonding curve

Notifications You must be signed in to change notification settings

alofeoluwafemi/protofire-continous-token-task

Repository files navigation

Requirements

You must have the following installed on your Machine to run this code:

  • Solidity compiler
  • Metamask chrome or Firefox plugin
  • NPM
  • Truffle

Setup

  • First clone this repository git clone https://github.com/slim12kg/protofire-continous-token-task.git

  • cd into the cloned project folder on your terminal from your machine

  • Run npm install

  • Copy secret.example.json to secret.json and replace the details with yours

Test Option 1 (Ganache)

  • Run everything locally using ganache-cli, and skip requesting Ether and Dai process

  • Start Ganache-cli with this command

ganache-cli \
-m "coockle coockle coockle doole doole doole quack quack quack quack quack quack" \
-i 4
  • Replace the mnemonic passed to the -m option with your own mnemonic and add the same mnemonic to the secret.json file

  • Run test test/linear_curve_test.js for Linear Bond Curve Token

Test Option 2 (Rinkeby)

  • Request 7.5 Ethers from the rinkeby faucet https://faucet.rinkeby.io/ from your metamask wallet

  • Visit https://app.compound.finance/ to borrow atleast 500 Dai with your test Ether from your metamask wallet

  • Add Dai token to your metamask wallet using this contract address 0x5592ec0cfb4dbc12d3ab100b257153436a1f0fea

  • Spread 1 Ether each to the first 3 addresses on your Metamask wallet, and 250 Dai each also.

  • Get an Infura API key if don't have one from https://infura.io/

  • Run truffle console --network rinkeby

  • Run test test/linear_curve_test.js for Linear Bond Curve Token

References

Any Questions

You can reach out to me via the follwing medium

About

A smart contract that lets people buy or sell a TOK token from it, using another ERC20 token. The contract holds the total amount of tokens received in exchange for all bought TOK tokens and accepts Dai as the payment method. The token price varies with the number of tokens already sold, following a bonding curve

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published