Links

Upkeep

A keeper's role in Perpetual Pools is to perform a maintenance task called upkeep. Pool upkeep is a contract call to trigger the rebalancing event. Because the pool contract is unable to perform the rebalance without this call, a keeper has to transact with the pool. Keepers need to be paid to perform upkeep so they transact with a keeper contract that determines the payment. See fees for more details. This is also the contract that triggers the rebalancing event.
Keepers can perform upkeep only if one hour has passed since the previous rebalance. The upkeep process occurs from 3.0 in the rebalancing flow detailed below.

Rebalancing Flow

A diagram of the rebalancing process for Perpetual Pools.
1.0 Trader deposits collateral into a Perpetual Pool. 2.0 Collateral accumulates into the pool contract. 3.0 Keepers trigger the keeper contract to begin the rebalance. 3.1a The pool contract asks the committer contract to verify the tokens past the time interval that qualify for minting, burning, or transfer. 3.1b The price feed is pulled from the oracle to inform rebalancing calculations. 3.1c The library calculates the rebalance. 4.0 Long and short tokens are minted and/or burned and the rebalance is complete.

Contract Descriptions

Pool Factory High level: contains the logic determining pool parameters (both global and local). Local parameters include pool name, oracle wrapper, front running interval, update interval, leverage amount, and quote token. Global parameters include the fee taken by Tracer DAO.
Leveraged Pool Contract High level: contains logic to manage pool liquidity of a specific marketplace. There are both pool specific (local) parameters determined by the pool contract owner at launch, and global parameters that are determined by Tracer DAO. Post launch pool parameters cannot be upgraded.
Pool Keeper High level: keeps track of, and triggers, the rebalance period for all pools. The Keeper:Pool contract relationship is 1:N. Keepers take a fee and compete with each other over this by triggering pool rebalancing. The keeper fee paid by a pool equates to the gas cost plus a fixed tip percentage of that cost (currently 5%). Fees are paid in the pool base token.
Pool Committer High level: contains the logic behind the time interval informing the Pool contract of the long and short tokens ready to Mint and Burn, as well as the quote tokens ready to transfer. This time interval mitigates front running in the system.
Pool Swap Library High level: calculates rebalancing needs based on current pricing, past pricing, and fees. The Pool Swap Library has a 1:N relationship with Leveraged Pools.
Chainlink Oracle Wrapper The Oracle Wrapper provides live price feeds to inform the rebalance calculations.
Pool Token Every pool has a long and short pool token contract that the pool controls to manage collateral and rebalancing needs based on market movement.
Last modified 10mo ago