Learn
Spark

Spark

Disassembling

Swap sDAI

  • Label: Exit_Swap-sDAI-USDC-CoW
  • Description: Swap sDAI for USDC in CoW
  • Actions in execution process:
    1. Swap sDAI for USDC in CowSwap

Note: When using the Pilot Extension and the Agile Execution App, all swaps will be routed through a delegate call to the OrderSigner(opens in a new tab) (opens in a new tab) in order to facilitate parameter scoping and minimize risks.

SELL_TOKEN · approve

Approve GPv2VaultRelayer to spend sDAI tokens on behalf of the avatar.

  • Contract: SELL_TOKEN

  • Function: approve(address,uint256)

    ParameterConstraint
    spenderequal to GPv2VaultRelayer
    amountequal to the sDAI amount to swap

OrderSigner · signOrder

Sign order to swap sDAI to USDC.

  • Contract: OrderSigner

  • Function: signOrder((address,address,address,uint256,uint256,uint32,bytes32,uint256,bytes32,bool,bytes32,bytes32),uint32,uint256) → delegatecall

    ParameterConstraint
    order.sellTokenequal to sDAI
    order.buyTokenequal to USDC
    order.receiverequal to AVATAR
    order.sellAmountequal to the sDAI amount to swap
    order.buyAmountequal to the sDAI amount to swap minus the maximum slippage
    order.validToequal to time_now + validDuration
    order.appData-
    order.feeAmountequal to 0
    order.kindequal to sell
    order.partiallyFillableFalse
    order.sellTokenBalance-
    order.buyTokenBalance-
    validDurationequal to 10 mins
    feeAmountBplower or equal to FEE_AMOUNT_BP

Redeem sDAI for DAI

  • Label: Exit_Spark-sDAI
  • Description: Redeem sDAI and withdraw DAI
  • Actions in execution process:
    1. Redeem

sDAI · redeem

Redeem sDAI and withdraw DAI.

  • Contract: sDAI

  • Function: redeem(uint256,address,address)

    ParameterConstraint
    sharesamount of sDAI tokens to redeem
    receiverequal to AVATAR
    ownerequal to AVATAR