Skip to content

Instantly share code, notes, and snippets.

@petejkim
Created July 14, 2020 21:03
Show Gist options
  • Save petejkim/ec125f2217226dbc43bb7479ee4ce855 to your computer and use it in GitHub Desktop.
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
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