Created
February 11, 2020 22:13
-
-
Save ajb413/95c58027642e170a0d82f797ca1b56b9 to your computer and use it in GitHub Desktop.
Snippet for supplying DAI to Compound
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Mint some cDAI by sending DAI to the Compound Protocol | |
console.log('MyContract is now minting cDAI...'); | |
let supplyResult = await myContract.methods.supplyErc20ToCompound( | |
daiMainNetAddress, | |
compoundCDaiContractAddress, | |
web3.utils.toHex(10e18) // 10 DAI to supply | |
).send({ | |
from: myWalletAddress, | |
gasLimit: web3.utils.toHex(5000000), // posted at compound.finance/developers#gas-costs | |
gasPrice: web3.utils.toHex(20000000000), // use ethgasstation.info (mainnet only) | |
}); | |
// console.log('Supplied DAI to Compound via MyContract', JSON.stringify(supplyResult)); | |
console.log('Supplied DAI to Compound via MyContract'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment