-
Notifications
You must be signed in to change notification settings - Fork 2
unforgiven - function _contractFallback()
is always revert because IERC677Receiver has wrong function signature for onTokenTransfer()
#152
Comments
1 comment(s) were left on this issue during the judging contest. Shaheen commented:
|
This is invalid. The function signature that the actual 667 code uses does not have a bool, and the delployed link contracts also do not have bools on both Eth and Base mainnets |
@IllIllI000 ethereum/EIPs#677 |
@IllIllI000 https://github.com/truflation/truflation-contracts/pull/8 |
You've linked to an open issue in the EIP repo, from which a standard is usually created. In this case, the filer closed the issue without it becoming a standard, so whatever its contents at that point were, aren't really relevant. |
@IllIllI000 I agree with this, then we can mark this issue as invalid, |
@IllIllI000 Could I understand what is the purpose of the fallback function? From my understanding it is to ensure tokens are correctly received within a smart contract correct? So even if a boolean return value is not implemented, can it be assumed that the callback function would correct revert based on its logic if tokens are not successfully received? |
The purpose of EIP677's |
_contractFallback()
is always revert because IERC677Receiver has wrong function signature for onTokenTransfer()_contractFallback()
is always revert because IERC677Receiver has wrong function signature for onTokenTransfer()
unforgiven
medium
function
_contractFallback()
is always revert because IERC677Receiver has wrong function signature for onTokenTransfer()Summary
because IERC677Receiver has wrong function signature for
onTokenTransfer()
so thetransferAndCall()
will always revert if it callsonTokenTransfer()
of the target contract(which correctly implement the ERC)Vulnerability Detail
This is
transferAndCall()
code:as you can see it uses
IERC677Receiver
to callonTokenTransfer()
function of theto
address. This isIERC677Receiver
:the issue is that function signature of the
onTokenTransfer()
is not according to the ERC677 and it doesn't define the return value of the function and if a target contract implements ERC677 correctly then it's gonna return thebool
variable and because function signature is wrong in ERC677Token so solidity would revert that call and the whole transaction would revert. as result ERC677Token won't gonna work according to the EIP.Impact
token ERC677Token would always revert in
transferAndCall()
function if theto
is contract and that contract implements EIP correctly.Code Snippet
https://github.com/sherlock-audit/2023-12-truflation/blob/37ddbb69e0c7fb6510f1ec99162fd9172ec44733/truflation-contracts/src/token/ERC677Token.sol#L26-L29
https://github.com/sherlock-audit/2023-12-truflation/blob/37ddbb69e0c7fb6510f1ec99162fd9172ec44733/truflation-contracts/src/interfaces/IERC677Receiver.sol#L4-L6
Tool used
Manual Review
Recommendation
change IERC677Receiver to be like this:
The text was updated successfully, but these errors were encountered: