DOCS

Zap router

This is what you interact with as a user, and approve tokens with.

It receives your Intent: (Zap X for a min of Y). Zap 10000 USDC for (at least) 9999.4 eUSD or Redeem 10 hyUSD for (at least) 10.3 USDC.

The intent is what you see in the UI. It is the minimum amount of RTokens you will receice when interacting with the router.

After pressing 'send transaction', to the router. The following happens:

Then it pulls your tokens via the approval and sends it to the zap executor.

It then forwards execution to the zap executor, with an encoded list of commands and data it needs to execute the zap.

Zap executor

The zap executor is a fork of the weiroll VM

It takes a bundle of instructions and data, and executes it. The instructions and data is generated by our token zapper:

We simulate the generated zaps using before returning the result - this means if we were to execute them on the EVM right here and now, it would commit.

But if the user waits too long with submitting their zap transaction it might still revert for various reasons. The state of the blockchain change a lot in a few blocks, so it’s best not to sit too long on a finalized zap transaction as it makes it more likely to revert.

Once the zap executor has finished, control returns the the router.

Zap router (Post execution)

The zap router verifies that the users intent has been met, or reverts if it has not.

  • If the bundle the executor executed resulted in it stealing the users funds, the router will revert the whole thing, as the intent was not met.
  • If the bundle the executor executed resulted in the user receiving less than the specified in the intent (The market conditions resulted in a worse result than expected) it reverts.

(The slippage setting in the settings menu large controls how sensitive the zapper is to the above by lowering the expected output of the whole zap)

Deployments

Ethereum:

  • Zap (router): 0xcc2b9b55952718b210660b56ca12eb88694dc60f
  • Zap executor: 0x675D37489A7A64c051D0204e5c72a469f6558a47

Base:

  • Zap (router): 0xe811b62AB97d9370cE2e25F9ceBC904522b81FE1
  • Zap executor: 0xA4b275feAf3A1450fc57270Ed863923261aBFD05

Arbitrum:

  • Zap Zap (router): 0x39Eb11db86140d5bd0Cc24d411d833e53b0ACAf8
  • Zap Zap executor: 0x59B56F9e965445f007bCc73960F6d0D034562c3e