Created
July 14, 2020 21:03
-
-
Save petejkim/ec125f2217226dbc43bb7479ee4ce855 to your computer and use it in GitHub Desktop.
Introduction to Building on DeFi with Ethereum and USDC - Part 1 - getTestnetUSDC.js
This file contains hidden or 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
const ethers = require("ethers"); | |
const wallet = require("./wallet"); | |
const provider = require("./provider"); | |
async function main() { | |
const account = wallet.connect(provider); | |
const usdc = new ethers.Contract( | |
"0x68ec573C119826db2eaEA1Efbfc2970cDaC869c4", | |
["function gimmeSome() external"], | |
account | |
); | |
const tx = await usdc.gimmeSome({ gasPrice: 20e9 }); | |
console.log(`Transaction hash: ${tx.hash}`); | |
const receipt = await tx.wait(); | |
console.log(`Transaction confirmed in block ${receipt.blockNumber}`); | |
console.log(`Gas used: ${receipt.gasUsed.toString()}`); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment