dAPP to stake Mock Wrapped ETH or any ERC20 token to earn DAPP Tokens of the same equivalent staked value in USD using API3's dAPIs on Polygon Mumbai Testnet.
- Install dependencies
yarn
- Enter credentials
cp credentials.example.json credentials.json
# ..and populate credentials.json with your mnemonic
- Compile the contracts
yarn compile
- To deploy and set all the dAPI and Contract addresses
yarn deploy
- Head on to API3 Market and get access to the dAPIs so that the dAPP can access them. They are free to use on Mumbai Testnet. Just head on to it, enter your Staking contract's address, click on request access and approve the transactions.
- For
ETH/USD
on Polygon Mumbai - ETH/USD dAPI - For
USDC/USD
on Polygon Mumbai - USDC/USD dAPI
- For
-
Import the
DappToken
contract address in your account's Metamask and send all theDAPP
to the Staking Contract. The Staking contract will control all theDAPP
Tokens -
Also import the
Wrapped ETH
contract address in your account's Metamask.WETH
will be used to stake and earnDAPP
Tokens. Don't send this directly to the staking contract.
- To stake
WETH
yarn stake
- To issue and send
DAPP
rewards back to the Staker
yarn issue
- To unstake and get back your WETH
yarn unstake
-
As any user can stake/unstake WETH, you can try running
yarn stake
andyarn unstake
with a different mnemonic with enough gas to make the trasnactions. -
Only the owner (the address that deployed the contract) can issue the rewards - run
yarn stake
command.