3

Now I am getting trouble on checking the USDC balance in my wallet address using web3.

USDC is also said that it is ERC20 token, but when I checked the token contract

0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48

This doesn't contain the erc20 standard. So I guess I can't use the traditional token balance checking way in this coin. Also I tried in traditional way, but it never work. How can I check the USDC balance / and create transfer transaction from one address to another using Web3?

2

This is proxy contract, which means that it delegates actual work to another contract, probably to this one: 0x0882477e7895bdc5cea7cb1552ed914ab157fe56, which in turn is ERC-20 compliant. Proxy contract allows its administrator to change address of the contract actual work is delegated to, effectively changing smart contract logic. Proxy contracts like this one are implemented via DELEGATECALL opcode that executes code of another contract on behalf of this contract, i.e. called code has access to the storage and balance of calling contract.

0

This doesn't contain the erc20 standard.

Not sure what you mean here.

Solidity contracts do not have a way to explicitly tell if a contract supports some interface or not. The only way to ensure interface compatibility is through so called duck typing - test that balanceOf method returns values and contract does not revert when the method is called.

You need to follow the "social contract" and as by the authors instructions assume that the balance method exist.

What comes to actual checking balance and making a token transaction in front end JavaScript, there are plenty of generic tutorials available for ERC-20 tokens. Furthermore you should find answers on this StackExchange as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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