Skip to content

Instantly share code, notes, and snippets.

@tolak
Created July 4, 2021 01:37
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 tolak/d41d8f76f59ce8541efd11ac88a56a4d to your computer and use it in GitHub Desktop.
Save tolak/d41d8f76f59ce8541efd11ac88a56a4d to your computer and use it in GitHub Desktop.
const ethers = require('ethers');
const ERC20HandlerJson = require('../build/contracts/ERC20Handler.json');
async function main() {
const handlerAddress = '0xDf2E83f33dB8A9CcF3a00FCe18C3F509b974353D';
const provider = new ethers.providers.JsonRpcProvider('https://kovan.infura.io/v3/6d61e7957c1c489ea8141e947447405b');
const handler = new ethers.Contract(handlerAddress, ERC20HandlerJson.abi, provider);
const depositRecord = await handler.getDepositRecord(50, 1);
console.log(depositRecord);
}
main();
// ================= result =================
// [
// '0x512F7a3C14b6eE86c2015bc8AC1fe97E657f75f2',
// 32,
// 1,
// '0x00000000000000000000000000000063a7e2be78898ba83824b0c0cc8dfb6001',
// '0x7804e66ec9eea3d8daf6273ffbe0a8af25a8879cf43f14d0ebbb30941f578242',
// '0xA29D4E0F035cb50C0d78c8CeBb56Ca292616Ab20',
// BigNumber { _hex: '0xe8d4a51000' },
// _tokenAddress: '0x512F7a3C14b6eE86c2015bc8AC1fe97E657f75f2',
// _lenDestinationRecipientAddress: 32,
// _destinationChainID: 1,
// _resourceID: '0x00000000000000000000000000000063a7e2be78898ba83824b0c0cc8dfb6001',
// _destinationRecipientAddress: '0x7804e66ec9eea3d8daf6273ffbe0a8af25a8879cf43f14d0ebbb30941f578242',
// _depositer: '0xA29D4E0F035cb50C0d78c8CeBb56Ca292616Ab20',
// _amount: BigNumber { _hex: '0xe8d4a51000' }
// ]
@tolak
Copy link
Author

tolak commented Jul 4, 2021

Example code for deposit record query

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment