ACME project is holding a sale of their ACME token. In order to make the token price fair the company decided to peg the price of the token to 1 USD which leverages Chainlink ETH/USD Data Feed. They created a dapp which facilitates the sale of 1,000,000 tokens and they only accept ETH as the payment method.
The fronend web app for the token sale serves as an interface for the dapp and it allows a seamless exchange of ETH for ACME with the ETH/ACME price automatically updating to ensure that 1 ACME = 1 USD. The web app supports connecting with Metamask for easy user experice.
https://main.dtqo6rsppdapw.amplifyapp.com
project_walkthrough.mov
- Node.js >= v14
- Yarn
- Truffle and Ganache
frontend
: Project's React frontend.contracts
: Smart contracts that are deployed in the Ropsten testnet.migrations
: Migration files for deploying contracts incontracts
directory.test
: Tests for smart contracts..github
: Github Actions config to run the test suite on every code push
- Run
yarn install
in the project root to install Truffle build and smart contract dependencies - Run local testnet on port
7545
with an Ethereum client, e.g. Ganache - Run
truffle deploy
to deploy the contracts to the testnet - Run
truffle test
to run the test suite
cd frontend
yarn install
yarn start
- Open
http://localhost:3000
- Stop the frontend if it's already running
cd frontend
- Open the
constants.js
file and update the address of theVendor
contract (ACME_TOKEN_CONTRACT_ADDRESS
) and save the file yarn start
- Open
http://localhost:3000
RINKEBY_MNEMONIC
RINKEBY_INFURA_PROJECT_ID
RINKEBY_FROM_ADDRESS
RINKEBY_CHAINLINK_DATA_FEED_ADDRESS
- Make sure your Metamask is configured with the correct network type (local testnet or Rinkeby) and has some ETH available
- Click
Connect
in the top-right corner of the UI to connect Metamast - Enterh the amount of ETH you'd like to spend on ACME tokens
- Take note of the current exchange rate below
- Click the
Confirm
button - Confirm the transaction in Metamask
- Wait for the transaction to complete
- Click "Go back" button to go back to the main screen
- Take note of the current ACME token balance in the top-left corner
0x225D0A7C8832E0Dcb9bF60F13D17b4D32128BE8b