Search code examples
solidityweb3py

web3py ABIFunctionNotFound


I'm new to web3 development, trying to signing transaction over web3py and got an exception ABIFunctionNotFound when I try to create transfer via contract.functions.transfer() function for USDC token on BSC network.

web3.exceptions.ABIFunctionNotFound: ("The function 'transfer' was not found in this contract's abi. ", 'Are you sure you provided the correct contract abi?')

Token ABI

[{"inputs":[{"internalType":"address","name":"logic","type":"address"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"changeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

If there are no function transfer in this contact, how can I transfer USDC to another wallet?


Solution

  • As I guessed in the comment, you're passing the ABI of the proxy contract.

    The solution is simple: Pass the ABI of the implementation contract (you can see it linked from the Proxy contract on BSCScan) but keep the proxy address.

    This rule applies to all other proxy contracts if you encounter this issue another time. Always pass the proxy address and the implementation ABI.