← Back to home

AutoSwapper

A multisig plugin that automatically swaps your tokens by computing the optimal path offchain

Screenshots

AutoSwapper screenshot 1
AutoSwapper screenshot 2
AutoSwapper screenshot 3
AutoSwapper screenshot 4

Problem Statement

The current liquidity pool landscape is so vast, that optimising path between all the pools has become too computationally intensive to perform onchain. Aggregators such as 1inch solve this problem by moving pathfinding offchain, but this now means swaps can no longer be initiated from onchain; the product resides in web2 land.Using Chainlink Functions, we call our own custom built API endpoint that performs the resource intensive path-finding offchain. The result is then encoded into a blog of bytes and sent back to the blockchain. Here, the AutoSwapperModule now is able to perform the most optimal path for its tokens.By adding Chainlink Keepers to this, we can now automatically perform these swaps (e.g. at regular intervals, or at a certain threshold).

Solution

Chainlink Functions:Needs to be aware of the arguments needed for the swapping intention (a target Safe multisig address, chain id, token out)Calls the endpoint and returns the response on-chain to enable the swap executionChainlink Keeper:Keepers are watching subscribed Safe address to initiate the necessary functionsLeverage Chainlink Functions to call the web2 API endpointSafe Protocol Compliance:The entire system adheres to the principles of the Safe Protocol white paper, ensuring all Safe multisigs can benefit from the auto swap feature by enabling the SmartGardenManagerInstructions and Execution:The endpoint returns the instructions, outlining the steps needed for the swapOnce these instructions are transmitted onto the blockchain, it triggers the autonomous execution of the targeted swap via fulfillRequest

Hackathon

ETHOnline 2023

2023

Prizes

  • 🏆

    🥉 Safe — Best Use of Safe{Core} Protocol

Contributors