Skip to content

Instantly share code, notes, and snippets.

@ajb413
Last active February 16, 2020 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajb413/29b8332fdcf683bfab2624d227193ed1 to your computer and use it in GitHub Desktop.
Save ajb413/29b8332fdcf683bfab2624d227193ed1 to your computer and use it in GitHub Desktop.
Supply DAI to Compound snippet
console.log('Now transferring DAI from my wallet to MyContract...');
let transferResult = await daiContract.methods.transfer(
myContractAddress,
web3.utils.toHex(10e18) // 10 DAI to send to MyContract
).send({
from: myWalletAddress,
gasLimit: web3.utils.toHex(150000), // posted at compound.finance/developers#gas-costs
gasPrice: web3.utils.toHex(20000000000), // use ethgasstation.info (mainnet only)
});
console.log('MyContract now has DAI to supply to the Compound Protocol.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment