Skip to content

Instantly share code, notes, and snippets.

@anubhavgirdhar
Created May 13, 2020 15:58
Show Gist options
  • Save anubhavgirdhar/2fccae4553b3c2bb5f655983ecb08935 to your computer and use it in GitHub Desktop.
Save anubhavgirdhar/2fccae4553b3c2bb5f655983ecb08935 to your computer and use it in GitHub Desktop.
Front End for a DApp to deposit Ether into Compound Finance
const contractAddress = "0x722870Eca028c681994c4d82DA3b82f1263Ca07e";
const contractAbi = [{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]
const myContract = new web3.eth.Contract(contractAbi, contractAddress);
(function deposit(){
await myContract.methods.deposit.send({from : userAddress,value :1000000000000000000})})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment