1

SwapByInterface works, swapByCall doesn't. Edit: have changed code to require success of internal call, previously both calls succeeding because errors not bubbling up, made the question more confusing.

Mostly tested on Quickswap on Polygon mainnet fork (hardhat) but have also tested on Polygon mainnet. Fresh mainnet address here: 0x5CB0161fe95b6CFD8be9CA31bBB4C2c6E9a1B145

Have tried every possible avenue I can think of - this is the simplest reproducible example. Hoping I've overlooked something simple...

Calling both functions with the parameters amountOut:1000, path (wrapped matic, dai) : ["0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270","0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063"] to:0x69910Dcf0628c8f0AbAE43cf51540871090D88DF deadline:2662944689

pragma solidity >=0.7.0 <0.9.0;

interface swapInterface {
  function swapETHForExactTokens(
    uint256 amountOut,
    address[] calldata path,
    address to,
    uint256 deadline
  ) external payable returns (uint256[] memory amounts);
}

contract test2 {
  receive() external payable {}

  fallback() external payable {}

  address routerAddress = payable(0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff); //quickswap router addr

  function swapByInterface(
    uint256 amountOut,
    address[] calldata path,
    address to,
    uint256 deadline
  ) public payable {
    swapInterface(routerAddress).swapETHForExactTokens{value: msg.value}(
      amountOut,
      path,
      to,
      deadline
    );
  }

  function swapByCall(
    uint256 amountOut,
    address[] calldata path,
    address to,
    uint256 deadline
  ) public payable {
    (bool swapSuccess, ) = routerAddress.call{
      value: msg.value,
      gas: 10000000000000
    }(
      abi.encodeWithSignature(
        "swapETHForExactTokens(uint256,address[],address,uint256)",
        amountOut,
        path,
        to,
        deadline
      )
    );
    require(swapSuccess, "swap failed");
  }
}

other data:

Have used hardhat's console.log with a dummy contract with the same interface as swapETHForExactTokens to log the msg object, as far as I can tell everything is being encoded/passed similarly to swapByInterface - except for the gasleft() which is always lower in call vs interface... was thinking gas was maybe running out in call so specified very high amount to mitigate, doesn't seem to help

pragma solidity >=0.7.0 <0.9.0;
import "hardhat/console.sol";

contract swapDummy {
  modifier ensure(uint256 deadline) {
    require(deadline >= block.timestamp, "UniswapV2Router: EXPIRED");
    _;
  }

  function swapETHForExactTokens(
    uint256 amountOut,
    address[] calldata path,
    address to,
    uint256 deadline
  )
    external
    payable
    virtual
    ensure(deadline)
    returns (uint256[] memory amounts)
  {
    console.log(gasleft());
    console.log("inside swap");
    console.log(msg.value);
    console.log(msg.value);
    console.logBytes(msg.data);
    console.log(msg.sender);
    console.logBytes4(msg.sig);
    console.log(amountOut);
    for (uint256 i; i < path.length; i++) {
      console.log(path[i]);
    }
    console.log(to);
    console.log(deadline);
    console.log(tx.gasprice);
    console.log(tx.origin);
  }
}

Call:

console.log:
12939
inside swap
2000
2000
    0xfb3bdb4100000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000008000000000000000000000000069910dcf0628c8f0abae43cf51540871090d88df000000000000000000000000000000000000000000000000000000009eb9d98200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a063
0x6ef20487354a60f87dd8575cc787f1bd2fd5b4d9
0xfb3bdb41
1000
0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270
0x8f3cf7ad23cd3cadbd9735aff958023239c6a063
0x69910dcf0628c8f0abae43cf51540871090d88df
2662979970
2500000008
0x69910dcf0628c8f0abae43cf51540871090d88df

Interface:

console.log:
13149
inside swap
2000
2000
    0xfb3bdb4100000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000008000000000000000000000000069910dcf0628c8f0abae43cf51540871090d88df000000000000000000000000000000000000000000000000000000009eb9d98200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a063
0x6ef20487354a60f87dd8575cc787f1bd2fd5b4d9
0xfb3bdb41
1000
0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270
0x8f3cf7ad23cd3cadbd9735aff958023239c6a063
0x69910dcf0628c8f0abae43cf51540871090d88df
2662979970
2500000008
0x69910dcf0628c8f0abae43cf51540871090d88df

bytecode of contract test2:

{
    "functionDebugData": {},
    "generatedSources": [],
    "linkReferences": {},
    "object": "608060405273a5e0829caced8ffdd4de3c43696c57f7d7a678ff6000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034801561006457600080fd5b50610860806100746000396000f3fe60806040526004361061002d5760003560e01c806359b25d3914610036578063e89b117c1461005257610034565b3661003457005b005b610050600480360381019061004b9190610420565b61006e565b005b61006c60048036038101906100679190610420565b6101e3565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16346509184e72a0009088888888886040516024016100ca9594939291906105d5565b6040516020818303038152906040527ffb3bdb41000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610154919061059e565b600060405180830381858888f193505050503d8060008114610192576040519150601f19603f3d011682016040523d82523d6000602084013e610197565b606091505b50509050806101db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101d2906105b5565b60405180910390fd5b505050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fb3bdb413487878787876040518763ffffffff1660e01b81526004016102459594939291906105d5565b6000604051808303818588803b15801561025e57600080fd5b505af1158015610272573d6000803e3d6000fd5b50505050506040513d6000823e3d601f19601f8201168201806040525081019061029c91906103d7565b505050505050565b60006102b76102b284610648565b610623565b905080838252602082019050828560208602820111156102da576102d96107b3565b5b60005b8581101561030a57816102f088826103c2565b8452602084019350602083019250506001810190506102dd565b5050509392505050565b600081359050610323816107fc565b92915050565b60008083601f84011261033f5761033e6107ae565b5b8235905067ffffffffffffffff81111561035c5761035b6107a9565b5b602083019150836020820283011115610378576103776107b3565b5b9250929050565b600082601f830112610394576103936107ae565b5b81516103a48482602086016102a4565b91505092915050565b6000813590506103bc81610813565b92915050565b6000815190506103d181610813565b92915050565b6000602082840312156103ed576103ec6107bd565b5b600082015167ffffffffffffffff81111561040b5761040a6107b8565b5b6104178482850161037f565b91505092915050565b60008060008060006080868803121561043c5761043b6107bd565b5b600061044a888289016103ad565b955050602086013567ffffffffffffffff81111561046b5761046a6107b8565b5b61047788828901610329565b9450945050604061048a88828901610314565b925050606061049b888289016103ad565b9150509295509295909350565b60006104b483836104c0565b60208301905092915050565b6104c9816106da565b82525050565b6104d8816106da565b82525050565b60006104ea8385610696565b93506104f582610674565b8060005b8581101561052e5761050b82846106c3565b61051588826104a8565b975061052083610689565b9250506001810190506104f9565b5085925050509392505050565b60006105468261067e565b61055081856106a7565b9350610560818560208601610716565b80840191505092915050565b6000610579600b836106b2565b9150610584826107d3565b602082019050919050565b6105988161070c565b82525050565b60006105aa828461053b565b915081905092915050565b600060208201905081810360008301526105ce8161056c565b9050919050565b60006080820190506105ea600083018861058f565b81810360208301526105fd8186886104de565b905061060c60408301856104cf565b610619606083018461058f565b9695505050505050565b600061062d61063e565b90506106398282610749565b919050565b6000604051905090565b600067ffffffffffffffff8211156106635761066261077a565b5b602082029050602081019050919050565b6000819050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b60006106d26020840184610314565b905092915050565b60006106e5826106ec565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015610734578082015181840152602081019050610719565b83811115610743576000848401525b50505050565b610752826107c2565b810181811067ffffffffffffffff821117156107715761077061077a565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f73776170206661696c6564000000000000000000000000000000000000000000600082015250565b610805816106da565b811461081057600080fd5b50565b61081c8161070c565b811461082757600080fd5b5056fea264697066735822122097d9ead97d8e1230796b3f2a27e7aa22b8390b0bd344e1f81c5c0efc99b5c0fd64736f6c63430008070033",
    "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH20 0xA5E0829CACED8FFDD4DE3C43696C57F7D7A678FF PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP CALLVALUE DUP1 ISZERO PUSH2 0x64 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x860 DUP1 PUSH2 0x74 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x2D JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x59B25D39 EQ PUSH2 0x36 JUMPI DUP1 PUSH4 0xE89B117C EQ PUSH2 0x52 JUMPI PUSH2 0x34 JUMP JUMPDEST CALLDATASIZE PUSH2 0x34 JUMPI STOP JUMPDEST STOP JUMPDEST PUSH2 0x50 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x4B SWAP2 SWAP1 PUSH2 0x420 JUMP JUMPDEST PUSH2 0x6E JUMP JUMPDEST STOP JUMPDEST PUSH2 0x6C PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x67 SWAP2 SWAP1 PUSH2 0x420 JUMP JUMPDEST PUSH2 0x1E3 JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLVALUE PUSH6 0x9184E72A000 SWAP1 DUP9 DUP9 DUP9 DUP9 DUP9 PUSH1 0x40 MLOAD PUSH1 0x24 ADD PUSH2 0xCA SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x5D5 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE PUSH32 0xFB3BDB4100000000000000000000000000000000000000000000000000000000 PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH1 0x20 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 DUP2 DUP4 AND OR DUP4 MSTORE POP POP POP POP PUSH1 0x40 MLOAD PUSH2 0x154 SWAP2 SWAP1 PUSH2 0x59E JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP RETURNDATASIZE DUP1 PUSH1 0x0 DUP2 EQ PUSH2 0x192 JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH1 0x0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0x197 JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP POP SWAP1 POP DUP1 PUSH2 0x1DB JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1D2 SWAP1 PUSH2 0x5B5 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xFB3BDB41 CALLVALUE DUP8 DUP8 DUP8 DUP8 DUP8 PUSH1 0x40 MLOAD DUP8 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x245 SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x5D5 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP9 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x25E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x272 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x0 DUP3 RETURNDATACOPY RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x29C SWAP2 SWAP1 PUSH2 0x3D7 JUMP JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2B7 PUSH2 0x2B2 DUP5 PUSH2 0x648 JUMP JUMPDEST PUSH2 0x623 JUMP JUMPDEST SWAP1 POP DUP1 DUP4 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP DUP3 DUP6 PUSH1 0x20 DUP7 MUL DUP3 ADD GT ISZERO PUSH2 0x2DA JUMPI PUSH2 0x2D9 PUSH2 0x7B3 JUMP JUMPDEST JUMPDEST PUSH1 0x0 JUMPDEST DUP6 DUP2 LT ISZERO PUSH2 0x30A JUMPI DUP2 PUSH2 0x2F0 DUP9 DUP3 PUSH2 0x3C2 JUMP JUMPDEST DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH1 0x20 DUP4 ADD SWAP3 POP POP PUSH1 0x1 DUP2 ADD SWAP1 POP PUSH2 0x2DD JUMP JUMPDEST POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x323 DUP2 PUSH2 0x7FC JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 PUSH1 0x1F DUP5 ADD SLT PUSH2 0x33F JUMPI PUSH2 0x33E PUSH2 0x7AE JUMP JUMPDEST JUMPDEST DUP3 CALLDATALOAD SWAP1 POP PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x35C JUMPI PUSH2 0x35B PUSH2 0x7A9 JUMP JUMPDEST JUMPDEST PUSH1 0x20 DUP4 ADD SWAP2 POP DUP4 PUSH1 0x20 DUP3 MUL DUP4 ADD GT ISZERO PUSH2 0x378 JUMPI PUSH2 0x377 PUSH2 0x7B3 JUMP JUMPDEST JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 PUSH1 0x1F DUP4 ADD SLT PUSH2 0x394 JUMPI PUSH2 0x393 PUSH2 0x7AE JUMP JUMPDEST JUMPDEST DUP2 MLOAD PUSH2 0x3A4 DUP5 DUP3 PUSH1 0x20 DUP7 ADD PUSH2 0x2A4 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x3BC DUP2 PUSH2 0x813 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH2 0x3D1 DUP2 PUSH2 0x813 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x3ED JUMPI PUSH2 0x3EC PUSH2 0x7BD JUMP JUMPDEST JUMPDEST PUSH1 0x0 DUP3 ADD MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x40B JUMPI PUSH2 0x40A PUSH2 0x7B8 JUMP JUMPDEST JUMPDEST PUSH2 0x417 DUP5 DUP3 DUP6 ADD PUSH2 0x37F JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x80 DUP7 DUP9 SUB SLT ISZERO PUSH2 0x43C JUMPI PUSH2 0x43B PUSH2 0x7BD JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x44A DUP9 DUP3 DUP10 ADD PUSH2 0x3AD JUMP JUMPDEST SWAP6 POP POP PUSH1 0x20 DUP7 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x46B JUMPI PUSH2 0x46A PUSH2 0x7B8 JUMP JUMPDEST JUMPDEST PUSH2 0x477 DUP9 DUP3 DUP10 ADD PUSH2 0x329 JUMP JUMPDEST SWAP5 POP SWAP5 POP POP PUSH1 0x40 PUSH2 0x48A DUP9 DUP3 DUP10 ADD PUSH2 0x314 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 PUSH2 0x49B DUP9 DUP3 DUP10 ADD PUSH2 0x3AD JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 POP SWAP3 SWAP6 SWAP1 SWAP4 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x4B4 DUP4 DUP4 PUSH2 0x4C0 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x4C9 DUP2 PUSH2 0x6DA JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH2 0x4D8 DUP2 PUSH2 0x6DA JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x4EA DUP4 DUP6 PUSH2 0x696 JUMP JUMPDEST SWAP4 POP PUSH2 0x4F5 DUP3 PUSH2 0x674 JUMP JUMPDEST DUP1 PUSH1 0x0 JUMPDEST DUP6 DUP2 LT ISZERO PUSH2 0x52E JUMPI PUSH2 0x50B DUP3 DUP5 PUSH2 0x6C3 JUMP JUMPDEST PUSH2 0x515 DUP9 DUP3 PUSH2 0x4A8 JUMP JUMPDEST SWAP8 POP PUSH2 0x520 DUP4 PUSH2 0x689 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x1 DUP2 ADD SWAP1 POP PUSH2 0x4F9 JUMP JUMPDEST POP DUP6 SWAP3 POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x546 DUP3 PUSH2 0x67E JUMP JUMPDEST PUSH2 0x550 DUP2 DUP6 PUSH2 0x6A7 JUMP JUMPDEST SWAP4 POP PUSH2 0x560 DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x716 JUMP JUMPDEST DUP1 DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x579 PUSH1 0xB DUP4 PUSH2 0x6B2 JUMP JUMPDEST SWAP2 POP PUSH2 0x584 DUP3 PUSH2 0x7D3 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x598 DUP2 PUSH2 0x70C JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x5AA DUP3 DUP5 PUSH2 0x53B JUMP JUMPDEST SWAP2 POP DUP2 SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x5CE DUP2 PUSH2 0x56C JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x80 DUP3 ADD SWAP1 POP PUSH2 0x5EA PUSH1 0x0 DUP4 ADD DUP9 PUSH2 0x58F JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x5FD DUP2 DUP7 DUP9 PUSH2 0x4DE JUMP JUMPDEST SWAP1 POP PUSH2 0x60C PUSH1 0x40 DUP4 ADD DUP6 PUSH2 0x4CF JUMP JUMPDEST PUSH2 0x619 PUSH1 0x60 DUP4 ADD DUP5 PUSH2 0x58F JUMP JUMPDEST SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x62D PUSH2 0x63E JUMP JUMPDEST SWAP1 POP PUSH2 0x639 DUP3 DUP3 PUSH2 0x749 JUMP JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x663 JUMPI PUSH2 0x662 PUSH2 0x77A JUMP JUMPDEST JUMPDEST PUSH1 0x20 DUP3 MUL SWAP1 POP PUSH1 0x20 DUP2 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x6D2 PUSH1 0x20 DUP5 ADD DUP5 PUSH2 0x314 JUMP JUMPDEST SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x6E5 DUP3 PUSH2 0x6EC JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x734 JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x719 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x743 JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH2 0x752 DUP3 PUSH2 0x7C2 JUMP JUMPDEST DUP2 ADD DUP2 DUP2 LT PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT OR ISZERO PUSH2 0x771 JUMPI PUSH2 0x770 PUSH2 0x77A JUMP JUMPDEST JUMPDEST DUP1 PUSH1 0x40 MSTORE POP POP POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x41 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x73776170206661696C6564000000000000000000000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH2 0x805 DUP2 PUSH2 0x6DA JUMP JUMPDEST DUP2 EQ PUSH2 0x810 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH2 0x81C DUP2 PUSH2 0x70C JUMP JUMPDEST DUP2 EQ PUSH2 0x827 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SWAP8 0xD9 0xEA 0xD9 PUSH30 0x8E1230796B3F2A27E7AA22B8390B0BD344E1F81C5C0EFC99B5C0FD64736F PUSH13 0x63430008070033000000000000 ",
    "sourceMap": "255:966:0:-:0;;;378:42;346:75;;;;;;;;;;;;;;;;;;;;255:966;;;;;;;;;;;;;;;;"
}

1 Answer 1

0

Weird.

I tried your code in Remix and modified it a bit to use it locally and they both work alright for me.

enter image description here

Can you share the encoded data that you are sending to the smart contract? I would like to see the function selector you are sending.

Are you calling the contract with something like web3, etherjs, etherscan or something else?

Can you share the bytecode of the code you deployed?

Is it possible to share the address of the deployed smart contract?

There are some things I would like to test and need some more information.

2
  • absolutely - i'll get those asap. Sep 13, 2022 at 5:02
  • ah - and I should have specified - the outer call - my account calling swapByCall - always succeeds because the errors don't bubble up through address.call() - but if you call balanceOf() on the token specified out of the swap, at least on my end it shows no change when using swapByCall - so I surmise the internal call swapETHForExactTokens is failing. On the other hand, calling balanceOf() will show change after swapByInterface. will add this to the question Sep 13, 2022 at 5:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.