0

I will try to describe my problem as clearly as possible so that I can get feedback on whether I am going in the right direction for resolution.

I'm running tests on mainnet fork trying to implement a vault on top of Zapper. They have implemented an easy way to interact with many of protocols where I can "swap" a Token for a LP Token or another yield-bearing-token. The problem is that they are not answering how to use they API in contexts that they don't documented.

Taking as example that transaction where the user bought a proportional investment in a pool with the token LOOK and WETH starting with his USDC.

Looking at their contract code you can see that everything is done through the function ZapIn (the function that I'm trying to use) and this function require some parameters pretty self explanatory but one specific called swapData in a bytes format. I realized the data passed in this field will just be used in the step: _swapTarget.call.value(valueToSend)(swapCallData); and until there I did'n know about it but studying I discovered that is encoded function call where the bytes hash encodes the name and parameters of the function.

Now, I have some questions. Inspecting the transaction we can see that their are using 0x to perform the swaps and I read their documentations trying to find how can I build this swapData field and use the ZapIn function but I'm blocked.

The guys on 0x discord said that 0x doesn't perform multi-swap of tokens but you can see on this transaction that Zapper are swapping USDC for WTH and then for LOOKS and their code just call the 0x once.enter image description here

To summarize my question is:

How can I build this bytes sequence to pass through the ZapIn function and call the 0x to swap the tokens?

1 Answer 1

0

You can go to your transaction and : click to see more .

Where you can debug and see what raw bytes was passed to the function .

remeber that the first 4 bytes is used to call the function ZapIn() and the rest are arguments passed .

You can decode it . enter image description here

1
  • I already decoded and saw the parameters but the swapData I couldn't decode without the encode signature/schema.
    – Yan Luiz
    Apr 15 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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