paco0x / amm-arbitrageur

An arbitrage bot between Uniswap AMMs
Do What The F*ck You Want To Public License
1.93k stars 826 forks source link

TypeError: Fallback function cannot take parameters. #59

Closed PhatJay76 closed 2 years ago

PhatJay76 commented 2 years ago

Compiling 12 files with 0.7.0 contracts/FlashArb.sol:228:53: TypeError: Return values for fallback functions are not yet implemented. fallback(bytes calldata input) external returns (bytes memory) { ^------------^

contracts/FlashArb.sol:228:13: TypeError: Fallback function cannot take parameters. fallback(bytes calldata input) external returns (bytes memory) { ^--------------------^

Error HH600: Compilation failed

PhatJay76 commented 2 years ago

Solution:


fallback() external {
        (address sender, 
        uint256 amount0, 
        uint256 amount1, 
        bytes memory data) = abi.decode(msg.data[4:], 
            (address, 
             uint256, 
             uint256, 
             bytes));
        _callback(sender, amount0, amount1, data);
    }

    function _callback(
        address sender,
        uint256 amount0,
        uint256 amount1,
        bytes memory data
    ) internal {
   ...