/pools

Pool.sol implements k=xy style AMM token pools, with every token on the exchange being paired with both WETH and USDC.

Standard methods such as addLiquidity and removeLiquidity are present along with convenience functions such as dualZapInLiquidity (to fully deposit arbitrary amounts of tokens regardless of ratio by automatically swapping them first as necessary).

As a means to save gas, users are able to deposit tokens into the Pools contract for later use in multiple swaps - eliminating the token transfer normally required on each swap.

There are two main functions for swapping:

swap(): requires that the tokenIn has already been deposited by the user.

depositSwapWithdraw(): allows swaps without having to deposit tokenIn first (at a higher gas cost).

Arbitrage trades are performed within Pools.sol as well. Arbitrage profits (generated in WETH) are swapped to SALT and deposited for the DAO.sol contract so that the DAO can withdraw them on upkeep.

PoolStats.sol keeps track of which pools have taken part in generating recent arbitrage profits so that those pools can receive proportional pending rewards on the next call to performUpkeep().

Last updated