You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using this doc (https://docs.alchemy.com/docs/how-to-get-erc-20-token-balance-at-a-given-block#step-5-get-usdt-balance-at-a-particular-block) to pull block specific balances with Alchemy and Ethers v6.x. The doc is referencing what looks to be Ethers v5.x but I was able to find the v6.x equivalent. The problem I'm facing is that none of the code after creating an ethers interface is being executed. I've confirmed that all of my Alchemy related code is working as expected and that the issue lies with ethers or my use of ethers. I'm also not seeing any errors reported in the console.
Code Snippet
const getBalance = async (walletAddress) => {
...
console.log("CREATING INTERFACE");
// Create functioncall data -- eth_call
let iface = new ethers.Interface([
"function balanceOf(address) view returns (uint)"
]);
// code below this comment never gets executed
console.log("IFACE", iface);let data = iface.encodeFunctionData("balanceOf", [walletAddress]);
console.log("DATA", data);
// Get balance at a particular block -- usage of eth_call
let balancedData = await alchemy.core.call({
to: USDC_CONTRACT_ADDRESS,
data: data,
}, blockTag);
console.log("BALANCE", balancedData)
balancedData = (parseInt(balancedData) / 10 ** FIXED_DECIMAL_PLACE).toFixed(2);
console.log("Balance:", balancedData, "USDT");
}
Ethers Version
6.11.1
Search Terms
No response
Describe the Problem
I'm using this doc (https://docs.alchemy.com/docs/how-to-get-erc-20-token-balance-at-a-given-block#step-5-get-usdt-balance-at-a-particular-block) to pull block specific balances with Alchemy and Ethers v6.x. The doc is referencing what looks to be Ethers v5.x but I was able to find the v6.x equivalent. The problem I'm facing is that none of the code after creating an ethers interface is being executed. I've confirmed that all of my Alchemy related code is working as expected and that the issue lies with ethers or my use of ethers. I'm also not seeing any errors reported in the console.
Code Snippet
Contract ABI
["function balanceOf(address) view returns (uint)"]
Errors
Environment
Ethereum (mainnet/ropsten/rinkeby/goerli), node.js (v12 or newer)
Environment (Other)
No response
The text was updated successfully, but these errors were encountered: