Technical Architecture
Last updated
Last updated
Persistence DEX's base is made up of the following contracts:
Vault
Keeper
Router
Multistaking
Stableswap Pool
Weighted Pool
LP Token
The Vault is the core of Persistence DEX; it is a smart contract that holds and manages all tokens in each Persistence DEX Pool. It is also the portal through which most Persistence DEX operations (swaps/joins/exits) occur.
Code: https://github.com/dexter-zone/dexter_core/tree/main/contracts/vault
Vault
persistence1k8re7jwz6rnnwrktnejdwkwnncte7ek7gt29gvnl3sdrg9mtnqkstujtpg
The Keeper contract accounts for all the protocol fees collected by the Persistence DEX Vault. The fee charged during swaps by the Persistence DEX Vault is transferred to the keeper contract.
Code: https://github.com/dexter-zone/dexter_core/tree/main/contracts/keeper
Keeper
persistence1sthrn5ep8ls5vzz8f9gp89khhmedahhdqd244dh9uqzk3hx2pzrsvpslsg
A router contract is a helper contract that facilitates multi-hop swaps via Persistence DEX pools.
Code: https://github.com/dexter-zone/dexter_core/tree/main/contracts/router
Router
persistence132xmxm33vwjlur2pszl4hu9r32lqmqagvunnuc5hq4htps7rr3kqsf4dsk
Persistence DEX allows projects/teams to incentivize liquidity by rewarding liquidity providers in multiple tokens.
The Multistaking contract is used to provide incentives to LPs of the protocol. Incentivizers can propose rewards for a particular LP token for a given period of time, and LPs can bond their LP tokens with the multistaking contract to earn those rewards during the rewardβs schedule. The implementation is similar to the Anchor Staking Contract but differs in the sense that it supports multiple LP tokens and multiple rewards per LP token.
Code: https://github.com/dexter-zone/dexter_core/tree/main/contracts/multi_staking
Multistaking
persistence1ery8l6jquynn9a4cz2pff6khg8c68f7urt33l5n9dng2cwzz4c4qs72n0q
The Stable Pool contract implements the curveβs stableswap invariant for up to 5 assets in the pool and implements compute calculations on Liquidity provision/withdrawal and swaps. In addition, it also supports liquid staking derivatives by the use of a scaling factor.
Code: https://github.com/dexter-zone/dexter_core/tree/main/contracts/pools/stable_pool
The Weighted Pool contract is based on a particular N-dimensional surface which defines a cost function for the exchange of any pair of tokens held in a Pool which was introduced by Balancer. Persistence DEX's weighted pool accepts a maximum of 8 tokens and the weights cannot be updated once the pool has been initialized.
Code: https://github.com/dexter-zone/dexter_core/tree/main/contracts/pools/weighted_pool
The LP token contract is the standard cw-20 token contract used for LP tokens minted when liquidity is provided to the Persistence DEX pools.
Code: https://github.com/dexter-zone/dexter_core/tree/main/contracts/lp_token