scrtlabs / Grants

Repository for grant proposal submissions
38 stars 28 forks source link

Polymer.fi: Balancer-like Secret DEX #45

Open turtlebasket opened 2 years ago

turtlebasket commented 2 years ago

Polymer.fi: The First Balancer-like DEX on the Secret Network

Introduction

Polymer.fi is the first Balancer-style DEX to exist on Secret Network. Polymer aims to streamline the process of privately swapping both native and bridged assets, with weighted and stable asset pools.

Problem

Existing DEXes on the Secret Network have the problem of unsustainable economies, whether that be through rampant governance token inflation or LP/user reward systems that are profitable but ultimately short-lived.

Traders on Secret Network, often experience:

Similarly, liquidity providers suffer from:

Furthermore, Secret Network's TVL remains relatively low, with a total of ~$30 million in bridged assets as of May 2022. This lack of bridged assets present on Secret Network can largely be attributed to the high friction associated with bridging assets to Secret Network.

Solution: Polymer.fi

We're building Polymer.fi with an emphasis on...

Team Members

Team’s Experience

1.1 - Detailed Product Description

Polymer offers a variety of features that set it apart from other DEXs currently deployed on Secret Network. The most notable feature is the Balancer vault design, which allows for gas-efficient swapping and two separate types of pools. The first pool type offered is regular weighted pools which can scale up to 8 assets per pool with customizable asset ratios. The second pool offered is a Curve-style StableSwap pool that facilitates the swapping of large amounts of stablecoins with minimal slippage.

Polymer will feature an intuitive trading interface, easy user-facing portfolio overview and management methods, an interest-bearing token backed by dividends from swap fees, and a built-in staking derivative called pSCRT (backed by 1:1 by SCRT, which allows LPs to earn staking yield and swap fees while providing liquidity). Finally, Polymer's interface will integrate directly with the existing IBC, Ethereum, and BSC bridges to offer tightly-integrated asset bridging from Cosmos chains as well as non-Cosmos chains.

2.1 - Pools

2.2 - Weighted Pools

Balancer-style weighted pools allow for users to deposit more than 2 assets with different weights (e.g. 50% SCRT, 30% BTC, 20% ETH). Selecting or creating a weighted pool enables liquidity providers to tightly control their exposure to each asset in the pool while earning trading fees. The rate across two assets in a weighted pool can be determined with the following rule:

$$P = \frac{\frac{B_i}{W_i}}{\frac{B_o}{W_o}}$$

...where:

Impermenant Loss Reduction

Compared to the standard Uniswap-style 50/50 pools, custom-weight pools offer an improvement in impermenant loss for LPs:

2.3 - Stable Pools

Polymer's stable pools utilize Curve.fi's pool functions to enable stable-stable pools with both low slippage and almost exactly 1:1 conversion rates. This enables users to earn yield on assets with similar trading prices, like stablecoins, the same asset from different Cosmos bridges (e.g. Nomic BTC & Shinobi BTC), or the same asset bridged from different chains (e.g. USDC-BSC & USDC.e). Further details on stable pool math can be found in Curve.fi's StableSwap whitepaper.

2.4 - Gas Optimization

Polymer's vault design allows trades to incur very low gas fees— because pools are represented not as individual contracts but rather within the vault contract as data structures, there is much lower overhead (i.e. no cross-contract calls required) to execute a swap. The functionality of Polymer's Vault Contract is detailed below:

flowchart TB
subgraph Users
u1(Alice)
u2(Bob)
end

subgraph vc[Vault Contract]
direction BT
v[(User Balance Store)]
p1{{Pool}}
p2{{Pool}}
end

u1 --> |Conduct Swap| vc
u2 --> |Conduct Withdraw| vc

p1 -.- |Check price| v
p2 -.- |Check price| v

p1 --> |Routed Swap| p2

v --> |Update balance| v

2.5 - Swap Path Optimization

Typically, decentralized exchange swap routers use linear routing to find the best swap path to minimize slippage.

Linear Routing

flowchart LR

si(Swap in) --> SSCRT --> ATOM --> USDC --> so(Swap out)

Polymer's router, however, uses split routing to ensure traders receive the best rate. Split routing involves dividing a single swap across multiple swap paths while taking into account gas and slippage constraints. This method provides consistently lower slippage for end users compared to linear routing.

3.1 - Liquid Staking

Polymer's staking derivatives are backed 1:1 by staked assets, which enables the end user to earn rewards while maintaining full liquidity. Users will be able to freely swap or liquidate their assets without having to wait for the 21-day unbonding period. Polymer's main staking derivative is pSCRT, which is backed by SCRT distributed among active set validators on the network.

flowchart TB

lsc{{Liquid Staking Contract}}

subgraph Users
u1(Alice)
u2(Bob)
end

subgraph Validators
v1((Validator))
v2((Validator))
end

u1 --> |Send SCRT| lsc
lsc --> |Mint pSCRT| u1
u1 --> |Transfer pSCRT| u2
lsc --> |Stake SCRT| v1
lsc --> |Stake SCRT| v2
lsc --> |Reallocate Staking Rewards| u2

3.2 - Architecture Advantages

Unlike other liquid staking protocols, Polymer's staking derivatives offers a superior UX by maintaining a 1:1 peg with the underlying assets. Polymer fixes this issue by dynamically increasing the supply of pSCRT to match the supply of the staked SCRT. For LPs, staking rewards from pSCRT will be auto-compounded and reinvested in their desired LP pool.

3.3 - Polymer Staking Derivatives

Aside from native SCRT, Polymer is exploring supporting other interchain assets. The initial set of proposed liquid staking contracts are as followed:

3.4 - Protocol Sustainability

Liquid staking allows liquidity providers to earn high passive yields without relying on unsustainable governance token inflation. LPs will receive both swap fees and staking rewards - a combination that results in higher yields compared to other exchanges. Polymer aims to become a popular staking platform for Cosmos that provides both private staking derivatives and deep liquidity for these assets.

4.1 - Bridging

Currently, the primary way that users can bridge their assets onto Secret Network is by using wrap.scrt.network and bridge.scrt.network. Although these are usable, they're far from user-friendly, and navigating to these pages adds additional steps for users to trade and bridge assets.

As an answer to this need, Polymer will include an integrated bridge tab which will enable users to transfer assets directly to Secret Network without leaving the Polymer interface. Once users have bridged in, all trades and LP actions will be done with Secret-wrapped assets to maintain both user privacy and SNIP-20 compatibility within the DEX contracts.

4.1 - IBC Bridge

IBC / Secret wrapping support is rather straightforward— Polymer will support all the interchain assets on wrap.scrt.network.

4.2 - ETH & BSC Bridge

Polymer will integrate with the existing Secret EVM bridges (the same ones used by bridge.scrt.network) at launch. Support for additional Cosmos EVM bridges (like Gravity Bridge and Axelar) is on the roadmap and is planned as a future addition after launch.

4.3 - Bitcoin (Future Consideration)

We are considering adding support for bridged Bitcoin. This could be done through Shinobi protocol, or another trustless BTC bridge such as Nomic. Bitcoin has the highest market capitalization of any cryptocurrency by far. Allowing users to bridge BTC to Secret Network could be a possible method for increasing TVL of Polymer.

5.1 - Token

5.2 - Token Distribution

Percent Use Case Vesting
5% Cross-chain Cosmos airdrop to incentivize new users Instant, at launch
10% Seeding PLMR/SCRT, PLMR/USDC exchange pools N/A, owned by the protocol
63% Liquidity Mining Logarithmic, spread across 2-3 weeks after launch. Fixed supply, no continuous minting.
12% Development Team Linear, spread across 4 years
10% Community Treasury (Grants) Linear, spread across 2 years

5.3 - Dividends

Dividends will be continuously released as they accumulate, with the amount received being proportional to the amount of PLMR staked per user. The dividends are paid out in sSCRT (by default) or a user can use the Claim & Swap feature to swap to another asset.

When a user executes a swap, a 0.3% fee is collected. 1/3 of the collected fee is distributed to PLMR stakers as dividends. The remaining 2/3 is given to LP providers.

Fee Architecture

flowchart LR

si(Swap In) --> sUSDC --> sDAI --> d[sUSDT] --> uw(User Withdraw)

d --> sSCRT --> fp(Fee Payout)

When executing a swap, if the swap path calculated by the router includes sSCRT, the 0.1% fee is automatically collected when the route reaches sSCRT. If the swap path does not include sSCRT, the router adds a swap at the end of the path that converts the target asset to sSCRT. This is possible at competitive rates due to Polymer's gas-optimized vault design and enables dividends from swap fees to be paid in only sSCRT, rather than a basket of miscellaneous assets.

6.1 - Go To Market Plan

The target audience for Polymer's exchange functionality is the broader cryptocurrency userbase, whereas its target audience for liquid staking, PLMR holding, and dividend payouts is the Secret Network community. We will support existing Secret bridges with first-class frontend integration and potentially other bridging methods such as Gravity Bridge in the future. Reducing the

Trader-focused incentives include low fees, as well as unique and useful features that are rare on Secret DEXes (such as a built-in IBC bridge interface) or even on Cosmos DEXes more broadly (notably the ability to bridge assets from any EVM-supported chain or view/rebalance your portfolio from within Polymer).

flowchart LR
subgraph Outside Ecosystems
a(BSC User)
b(ETH User)
end

subgraph Secret Network
c(SCRT User)
subgraph Polymer.fi
s{{Swap}}
ls{{pSCRT}}
end
end

a <-- Swap --> s
b <-- Swap --> s
s -- Dividends --> c
ls -- Staking rewards --> c

6.2 - User Acquisition

At launch, 5% of the PLMR token supply will be airdropped to addresses on Secret Network, Juno, Osmosis, and Sifchain. The airdrop specifically targets addresses that are active DEX protocol participants in the Cosmos ecosystem, especially liquidity providers. The goal of the airdrop is to incentivize major LPs on Cosmos chains to switch to Polymer for more sustainable yields, private transactions, and easier portfolio management / tracking. Once the airdrop snapshot is taken, users will be able to clam PLMR tokens by interacting with Polymer's contracts on Secret Network.

We will incentivize early LPs on our DEX with PLMR token rewards. Unlike other DEXes, rewards will be non-inflationary and available for a brief period of time. A fixed supply of 3,150,000 $PLMR will be distributed across a 3-week timeframe following the mainnet launch, with the goal of bootstrapping initial liquidity from a variety of cross-chain sources.

7.1 - Frontend

The domain app.polymer.fi will point to a Cloudflare Pages instance of the exchange interface, but a static copy will be deployed on IPFS as well to ensure proper decentralization. An onion site is also being considered, but would probably come after the initial launch.

7.2 - Portfolio Storage

Polymer privately stores users' portfolio history on-chain in a way that is only viewable using a query permit. Every time a user conducts a deposit or withdraw on Polymer, a record of this action is stored and viewable only by the user that signed the transaction.

flowchart BT

subgraph Polymer
stc{{Storage Contract}}
plc{{Pool Contract}}
end

u(User)
u --> |Deposit| plc
u --> |Viewing Permit| stc
plc --> |Record Event| stc
stc --> |Trading History| u

7.3 - Figma Mockup & Prototypes (In Progress)

8.1 - Grant Request

We are requesting a grant of 24k SCRT in 3 payments: one upon grant acceptance, one after we have completed all contracts and the frontend, and one when we launch Polymer. We would be willing to consider part payment in SCRT or Secret-wrapped stablecoins.

The grant will go towards marketing / community-building, bootstrapping initial liquidity in Polymer's pools, and compensation for the time we are spending developing the DEX.

The overarching grant timeline & milestone breakdown is as follows:

Milestone Estimated Date Amount
1. Grant Accepted Present 7k SCRT
2. Contracts Completed June 2022 7k SCRT
3. Polymer.fi V1 Launch August 2022 10k SCRT
End Total N/A 24k SCRT

8.2 - Milestone 1: Grant Accepted (7k SCRT)

Currently, the DEX contracts are almost complete— we've recently finished a complete rewrite under a more gas-efficient architecture, we're currently adding support for Curve.fi-style stable pools, and the liquid staking contract is well underway.

8.3 - Milestone 2: Contracts Completed (7k SCRT)

Our second payout is requested once we have completed the frontend (landing page, swap page, bridge interface, staking interface, portfolio tracking page). A testnet version will be deployed as a deliverable.

8.4 - Milestone 3: Mainnet Launch (10K SCRT)

We aim to launch Polymer by this August. By launch, our frontend as well as our DEX & liquid staking contracts will be done, and we will move our focus to additional features like Bitcoin bridging (whether via Shinobi or other methods).

Users can find and participate in our community through Discord.

JayScrtNetwork commented 2 years ago

Hi team can you please reach out to me via DM so I can discuss this grant in greater detail. I'm the SCRT network BD lead and can help get this reviewed accordingly. Telegram = @LongFellow21 Discord = Jay | 𝕊hadowRealm🥷🏼#0086 Cheers