Skip to content

Instantly share code, notes, and snippets.

@jarrodlilkendey
Last active April 21, 2022 05:12
Show Gist options
  • Save jarrodlilkendey/881376b0ab92d055a7ab6951673ae179 to your computer and use it in GitHub Desktop.
Save jarrodlilkendey/881376b0ab92d055a7ab6951673ae179 to your computer and use it in GitHub Desktop.
const abi = require("./abi.json");
const ethers = require('ethers');
require('dotenv').config();
const network = {
name: "polygon",
chainId: 137,
_defaultProvider: (providers) => new providers.JsonRpcProvider(process.env.ALCHEMY_URL)
};
const provider = ethers.getDefaultProvider(network);
const aavegotchiDiamond = new ethers.Contract('0x86935F11C86623deC8a25696E1C19a8659CbF95d', abi, provider);
aavegotchiDiamond.on("GotchiLendingAdd", async (listingId) => {
console.log("GotchiLendingAdd", listingId);
const lendingInfo = await aavegotchiDiamond.getGotchiLendingListingInfo(listingId);
console.log("lendingInfo", lendingInfo);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment