Extensions

As previously said, we are creating a modular and composable architecture. At the base of it, the Swap Adapter is defining common behaviors that will be used by other extensions to enable different (but similar) actions.

A lot of these extensions define similar actions, that is why they also share some of their data structures. These data structures are hosted and documented in Shared.sol.

Current extensions and a summary of them:

  • CollectableWithGovernor: Allows a governor to retrieve idle funds in a contract

  • GetBalances: Implements a function that will retrieve given token's contract balance.

  • RevokableWithGovernor: Allows a governor to remove the token approvals for spenders.

  • RunSwap: Executes a swap with the given swapper. The input tokens are expected to be on the contract before this function is executed.

  • TakeAndRunSwap: Takes tokens from the caller, and executes a swap with the given swapper.

  • TakeRunSwapAndTransfer: Takes tokens from the caller, executes a swap with the given swapper and transfer resulting (or unspent) tokens to recipient.

  • TakeRunSwapsAndTransferMany: Takes tokens from the caller, and executes many different swaps. After the swaps are executed, the caller can specify where to send the resulting (or unspent) tokens to.

  • TakeManyRunSwapAndTransferMany: Takes many tokens from the caller, and executes a swap. After the swap is executed, the caller can specify where to send the resulting (or unspent) tokens to.

  • TakeManyRunSwapsAndTransferMany: Takes many tokens from the caller, and executes many different swaps. After the swaps are executed, the caller can specify where to send the resulting (or unspent) tokens to.

This is an simplified overview of what each extension does. You will need to read their nat-spec in order to use them safely. There you will be able to read the pre-conditions, execution and post-conditions needed.

Last updated