Ref Finance: Rated Stable Pools on DEX
Generic rated swap pool with custom peg on NEAR Protocol
Ref Finance is a core project in the DeFi ecosystem on Near Protocol. Its main objective is to bring together the core components of DeFi, namely, decentralized exchange (DEX), lending protocol, synthetic asset issuer, and more.
To develop a generic rated swap pool with custom peg and implementation for stNEAR/NEAR.
To develop a complex smart contract on Rust.
Based on the StableSwapPool source code, we developed a generic RatedSwapPool and implementation for stNEAR/wNEAR pool with the next changes:
- Added rates to swap & add / predict / remove_liquidity calculations.
- Math upgraded to 24 decimals using U384.
- Generic rates acquisition from another smart contract via cross-contract call with caching.
- Added minimum boilerplate for rates acquisition implementation.
- Added sample implementation of rates acquisition for stNEAR.
We implemented support for stable pools with an accurate calculation of the value of liquid staking assets on NEAR. It allowed for attracting additional liquidity and led to an increase in the number of transactions and users.