2

I'm currently trying to call Etherscan's API eth_call to check data from a smart contract. To do that, I need to pass the function ABI code and data. However, the data I need is stored in a map and I'm not sure what code that would map to.

The contract in question is here with the variable being

mapping (address => bool) public sendAllowed;

However, by doing

Keccack ("sendAllowed(address)") = 2f0c92d385bd4391c0edec32b0ac39252f8a9ecbcfb630748ddb154a80318288

I got the ABI code of 0x2f0c92d3. Plugging that into the Etherscan API, I didn't get the proper data though:

http://api-rinkeby.etherscan.io/api?module=proxy&action=eth_call&address=0xf455105e41f84e3f980d0908887a311233bb9953&data=0x2f0c92d3dc1f5d644e4016f3da89fe002f63fbeb8e071cf1&apikey=YOURAPIKEY

{
jsonrpc: "2.0",
id: 1,
result: "0x"
}

(should return true)

What is the correct ABI code to use for the public getter / how do I properly call the Etherscan API to get the data?

1 Answer 1

2

You got the function selector right (0x2f0c92d3), but you failed to correctly ABI encode the address parameter. It should be left-padded with zeros so that it's 32 bytes wide. Try this instead:

0x2f0c92d3000000000000000000000000dc1f5d644e4016f3da89fe002f63fbeb8e071cf1
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.