Skip to content

Instantly share code, notes, and snippets.

@elmariachi111
Last active October 21, 2021 14:58
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 elmariachi111/82700cdb05f788e2ce7a0fbb80e4fc4b to your computer and use it in GitHub Desktop.
Save elmariachi111/82700cdb05f788e2ce7a0fbb80e4fc4b to your computer and use it in GitHub Desktop.
Storage Interaction
const { ethers } = require("ethers");
const abi = require("./storage.abi.json");
const INFURA_KEY = "..."; //get at https://infura.io/product/ethereum
const CONTRACT_ADDRESS = "0x7DA77f8a834369dDc5e9e47407C9746Ed55C3b72";
const provider = new ethers.providers.InfuraProvider(42, INFURA_KEY);
const contract = new ethers.Contract(CONTRACT_ADDRESS, abi, provider);
(async function main() {
const currentNumber = await contract.retrieve();
console.log(currentNumber.toNumber());
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment