Hello,
I try to withdraw matic tokens from my smart contract, that I deployed on mumbai testnet.
My withdraw functions looks like this:
function withdrawOnlyOwner(address token) public onlyOwner {
IERC20 token_transfer = IERC20(token);
uint256 transfer_amount = balance(token);
require(transfer_amount > 0, "Balance too low");
SafeERC20.safeTransfer(token_transfer, owner, transfer_amount);
emit Withdrawal(owner, transfer_amount);
}
balance is a public function that works correctly, I get the balance of the token I put the address in.
If I run the .js code snippet to withdrwa all funds from the contract, the code works correctly. But I do not get the tokens and if I do have a look at the transaction [here].(https://mumbai.polygonscan.com/tx/0xceada0fe6fa8ffe95d90e033c9bb221dc3ce8907408510871424147f4ca91933)
Does someone have an idea what is going wrong here?