F
Flow6mo ago
NiAlexSan

Alex Ni | Flow 4D (2024-05-17)

I'm trying to get ERC721 balance for a specific address in evm, but the command throws an error:
cast call 0xa7aF43d9AB4dcbEcf1326BF3a4E4c206d203404 \ --rpc-url https://previewnet.evm.nodes.onflow.org \ "balanceOf(address)(uint256)" \ 0x00000000000000000000000250b5f4961ea72c2c
Error:
Failed to get resolver from the ENS registry: buffer overrun while deserializing
Error:
Failed to get resolver from the ENS registry: buffer overrun while deserializing
5 Replies
Needle
Needle6mo ago
I've created a thread for your message. Please continue any relevant discussion in this thread. You can rename this thread using /title <new title> If this is a technical question that others may benefit from, considering also asking it on Stackoverflow: https://stackoverflow.com/questions/ask?tags=onflow-cadence
NiAlexSan
NiAlexSan6mo ago
how do you usually run scripts with foundry? am I missing anything? here's some more context: transaction that deployed the ERC721 contract: https://previewnet.flowdiver.io/tx/f0d929533682179c3b5e480b37b81d6a0aa92eb003e0cc5f06c396054583a2af?tab=evm-tx transaction that minted an ERC721 token: https://previewnet.flowdiver.io/tx/c23d6b0a35766470de794d42d3a225a2b92d371ea7614fb9240461028108b725?tab=evm-tx contract code:
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract FlowNFT is ERC721URIStorage, Ownable {
constructor(address initialOwner) ERC721("Flow Ducks", "FDX") Ownable(initialOwner) {}

function mint(
address _to,
uint256 _tokenId,
string calldata _uri
) external onlyOwner {
_mint(_to, _tokenId);
_setTokenURI(_tokenId, _uri);
}
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract FlowNFT is ERC721URIStorage, Ownable {
constructor(address initialOwner) ERC721("Flow Ducks", "FDX") Ownable(initialOwner) {}

function mint(
address _to,
uint256 _tokenId,
string calldata _uri
) external onlyOwner {
_mint(_to, _tokenId);
_setTokenURI(_tokenId, _uri);
}
}
Giovanni S
Giovanni S6mo ago
Looking at the events, looks like the ERC721 contract address is 0xa87827e9c64c44b8BD8284Ae94F8ab49612E733A and I believe you'll want to remove the return type from the signature Try running again with
cast call --rpc-url https://previewnet.evm.nodes.onflow.org \
0xa87827e9c64c44b8BD8284Ae94F8ab49612E733A \
"balanceOf(address)" \
0x00000000000000000000000250b5f4961ea72c2c
cast call --rpc-url https://previewnet.evm.nodes.onflow.org \
0xa87827e9c64c44b8BD8284Ae94F8ab49612E733A \
"balanceOf(address)" \
0x00000000000000000000000250b5f4961ea72c2c
It returns a value of 0, so I'm not sure that mint txn went through as intend. How are you encoding the calldata for the mint call?
NiAlexSan
NiAlexSan6mo ago
I used this command to deploy the contract:
forge create --rpc-url https://previewnet.evm.nodes.onflow.org \
--private-key <private key> \
--constructor-args 0xa7aF43d9AB4dcbEcf1326BF3a4E4c206d2034041 \
--legacy \
src/FlowNFT.sol:FlowNFT
forge create --rpc-url https://previewnet.evm.nodes.onflow.org \
--private-key <private key> \
--constructor-args 0xa7aF43d9AB4dcbEcf1326BF3a4E4c206d2034041 \
--legacy \
src/FlowNFT.sol:FlowNFT
I think I'm using a wrong address after the contract deployment
Giovanni S
Giovanni S5mo ago
In the txns you linked to earlier, the deployed contract address is emitted in the event as A.b6763b4399a888c8.EVM.TransactionExecuted.contractAddress which is 0xa87827e9c64c44b8BD8284Ae94F8ab49612E733A as the ERC721 contract You can also use the interim ethernal EVM block explorer to look up the deployment EVM txn - https://flow-foundation.tryethernal.com/transaction/0x2a77b458f67a5fd0ab203d20f71086149811bf0140a332ffb7d551e757125779 which has the same contract address listed
Want results from more Discord servers?
Add your server