Suite of Solidity smart contracts governing the creation, offering, and trading of BrianCoin (standard ERC-20 token). Deployed to Ethereum test net (Rinkeby), used as a fun learning project for building ERC-20 security and architecture.
- ERC-20 Token: establishes BrianCoin (BRI), standard ERC-20 with toggled transfer fee (BrianCoin.sol)
- Initial Coin Offering: mints BRI through ICO contract, allows buy in through multiple phases (Ico.sol)
- Liquidity Pool: provides token liquidity with ETH/BRI via automated market maker pool, modeled on Uniswap V2. Provides swap functionality for BRI/ETH pair (Pair.sol/Router.sol)
- BrianCoin.sol:
0x6f2CA1D00748cfe95c4B1cbC151ebACE8FbAEA6D
- Ico.sol:
0xDC58d35E083F28D398333670b25F28501E4f2C74
- Pair.sol:
0x2aC0DBe6fA76d959cBA5eB1F86390bEb83F3406A
- Router.sol:
0xFD6026bfbaFcA0e12f190C7aD31054408C0408cF
- Clone repository:
git clone https://github.com/brianwatroba/briancoin.git
- Install base project dependencies: cd into root, run
npm install
- Install front end dependencies: cd into
frontend
, runnpm install
- Add local .env file to project root. Include below env variables (replace keys with your own):
/.env
ALCHEMY_API_KEY=XXX
RINKEBY_PRIVATE_KEY=xxx
- Front end (localhost): cd into
frontend
, runnpm start
to boot server (port 1234) - Local testing: tests written in Chai/Mocha using Hardhat/Ethers.js. Run
npx hardhat test
for test suite. - Deployment to Rinkeby: ensure your .env file includes your Rinkeby private key. Then run
npx hardhat run scripts/deploy.js --network rinkeby
- Deployment to other test nets: add your desired network to the
networks
object inhardhat-config.js
using the following format:
/hardhat.config.js
rinkeby: {
url: `https://eth-rinkeby.alchemyapi.io/v2/${process.env.ALCHEMY_API_KEY}`,
accounts: [`${process.env.RINKEBY_PRIVATE_KEY}`],
},
Pull requests are welcome. Feel free to use this project as reference or for learning! It helped me a lot to better understand ERC-20 creation, ICO structures, and how liquidity pools work. Thanks!