0

This might take a while to describe but I'll be as concise as possible.

I have written a contract who encodes the calldatas of a function as well as its arguments.

enter image description here

For example, if I were to say that I want to swap 1000 tokens, through path ["0xFBf02764ca98778F07b5bF6677ce09B85476a7aC", "0xa1091A624AFcab43575298447c6c60Fc54966917"], sent to 0x28EEd3aC3eBD21F849C4c0cA969ddb90fa01a9d3 with a deadline of 11111111111 I would get this calldatas :

0x8a657e6700000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000008000000000000000000000000028eed3ac3ebd21f849c4c0ca969ddb90fa01a9d300000000000000000000000000000000000000000000000000000002964619c70000000000000000000000000000000000000000000000000000000000000002000000000000000000000000fbf02764ca98778f07b5bf6677ce09b85476a7ac000000000000000000000000a1091a624afcab43575298447c6c60fc54966917

Now I want to make the amountOutMin of tokens, the path and the deadline constant variables, so that I doesn't have to fill the inputs when I call the function, is that possible ?

I've tried this but it doesn't seems to work since I still have to fill the inputs when I want to call the function (through Remix or Etherscan).

enter image description here

Maybe I have to use a structure ? I don't know.

If anyone could help, it would be much appreciated, thank y'all !

1
  • Please include the code as text. It will make testing much easier.
    – Ismael
    Commented May 7, 2022 at 3:24

1 Answer 1

0

So; I've managed to do it that way

contract

Now I can simply query the function without entering any inputs and it returns me the correct calldatas

calldatas

enter image description here

As you can see, the calldatas are the same, which means that the function works correctly. Unfortunately it works only when I call the function on Remix, when I try to call it through Etherscan it doesn't return the same calldatas, well it does but not really. Look at the signature of the calldatas a2a1623d

enter image description here

As you can see there is 000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000e4 between the 0x and the a2a1623d which isn't supposed to be here, and isn't here on Remix ! I've tried some things but I can't figure it out, if anyone have an answer thank y'all.

1
  • I'd say the issue is a bug in Etherscan.
    – Ismael
    Commented May 7, 2022 at 3:27

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.