Router & Adapters
In order to eliminate the necessity for an approval transaction and to apply a service fee to our Smart Ramp orders, we've implemented a system comprising a central Router contract, in conjunction with adapters tailored to each of our partner swap protocols.
For Smart Ramp orders requiring a swap, after the optimal route for the swap and corresponding calldata is computed off-chain, the swap transaction goes as follow, through the execution of
- Calldata intended for the swap protocol contract is passed to our
Routercontract along with a signed permit. This permit grants
Routerpermission to spend input tokens for the swap.
- Subsequently, the permit undergoes validation, and the approval is executed.
Routertransfers the requisite tokens from user's wallet to the relevant adapter. The calldata is also transmitted alongside, trough a call to adapter's
- In turn, the adapter engages directly with the swap protocol through the provided calldata, using Solidity's
- If execution is successful,