-1

here is my code snippet and i have no idea why its not working

function Testdeposit(address _assetAddress) public returns (uint256 status)
    {
        //IERC20 erc20 = IERC20(_assetAddress);
        //erc20.transferFrom(senderAddress, address(this), _amount));
        //uint256 amount = erc20.allowance(senderAddress, address(this));
        uint256 amount = IERC20(_assetAddress).balanceOf(address(this));
        return amount; 
    }

i am using a standard IERC20 interface. just it dsnt have an event to emit. i assume it to return me 0 if there is no balance but its gvng me erro. Transcation not going through.

Any suggestions??

1 Answers1

0

It is not working because you may have not overridden the IERC20 functions. At least as they should. I would highly recommend using the ERC20 standard instead, just for how easy it is to implement.

NuMa
  • 588
  • 2
  • 7