Ethernaut Puzzle 15 Naught Coin
In ERC20, there is not only transfer
function, but also transferfrom
function.
In this question, even if the transfer
function is overridden and there is a lockTokens
modifier to prevent transfers, the transferFrom
function in ERC20 is not overridden. We can utilize this function to perform transfers.
1 | await contract.approve(player, "1000000000000000000000000"); |
1 | contract.transferFrom(player, '{%ANOTHER_ADDRESS%}', "1000000000000000000000000"); |