Sushiswap Bounties(Trident)

    The Sushi Next Generation AMM: Trident Description of work: In this article, using search and research on trident, we examined how it works and its features and compared it with other products on Defi.

    What is AMM?

    AMM stands for ‘Automated Market Maker’. DEXs like SushiSwap and Uniswap use an AMM to facilitate the exchange of tokens on their platform. Most AMMs are smart contracts that use something called ‘Constant Product Market Maker’- a mathematical function that algorithmically determines the price of an asset based on the ratio of assets within the liquidity pool.

    db_img

    The function is represented as x*y=k, where ‘x’ and ‘y’ refer to the quantity of the two assets in the liquidity pool and ‘k’ is the product of ‘x’ multiplied with ‘y’. The idea behind the function is that ‘k’ must always remain constant. To achieve that, when the supply of x increases, the supply of y must proportionally decrease and vice versa. If we were to graph an automated market maker equation, we would see something known as a ‘bonding curve’. It shows that the more of an asset in a pool is purchased relative to the others, the more expensive it becomes, increasing exponentially up to a theoretically infinite price. This makes it practically impossible for anyone to buy all of the cryptocurrency in the pool and gives arbitrage traders more incentive to come in and restore balance when the ratio between the pooled assets (and, therefore, price) deviates too much.

    How Does SushiSwap Work?

    Like many other DEXs, SushiSwap fundamentally consists of several asset pools. Each pool contains two assets, such as ETH and LINK (Chainlink). This is because it uses an Automated Market Maker (AMM). This smart contract uses the ratio between two assets in each pool to determine their price. Additionally, SushiSwap also has a limit order market that users can use to trade assets stored in BentoBox.

    db_img

    When SushiSwap was initially released, it focused around Uniswap LP (liquidity provider) tokens. LP tokens on Uniswap are ERC-20 tokens issued to liquidity providers when they deposit assets into pools on Uniswap. These tokens can be exchanged for the underlying deposited funds, used in other DeFi protocols, and even exchanged for other LP tokens. Liquidity providers also receive a share of the trading fees of the assets in the pools they provide liquidity for via the LP tokens.

    SushiSwap ‘Trident Framework’

    Trident is the latest product from the SushiSwap team built on top of BentoBox. Trident is a framework for developing and deploying AMMs, but it is not an AMM in and of itself. So while the Trident code can be used to generate AMMs, there is no specific AMM at the heart of Trident. Instead, there is a framework that can be used to create any AMM that anyone would require.

    db_img

    The concept behind this framework is to standardize AMM pool types, similar to how the ERC-20 token standard was needed for token types to become efficient. The Trident Framework will streamline the development process for creating and designing liquidity pools and AMMs. Currently, the Trident Framework is in its beta on Polygon. Users can battle and security test the different elements before the team can clear them for porting them over to other chains. Trident was first developed with the core focus of capital efficiency and cryptocurrency volatility protection using powerful, yet intuitive and easy-to-use, tools to provide DeFi with its new protocol standard. Goal was to reinvent the wheel, without sacrificing user familiarity with Sushi’s newly revamped and consolidated interface. Trident’s beginnings originate with inspirations from the Sushi team’s original discussions with Yearn Finance’s Andre Cronje about Deriswap and from the Mirin, Sushi AMM V2 proposal written by Sushi Core Developer, LevX.

    The trident focus have placed on next generation AMM’s capital efficiency.

    1- First Prong on Trident

    BentoBox’s First Native AMM Elevates Trident to New Heights The term “Next Generation AMM” is very justified to describe Trident, thanks to the power of Sushi’s token vault, BentoBox. The BentoBox can also be considered as an architectural platform that allows developers to build complex, capital-efficient applications on top of it, such as Trident, for example. BentoBox allows for single token approval for usage across all its apps, saving you time and gas money! Not only that, BentoBox applies something called “strategies” to the assets deposited within it, earning its users passive yields at no fee cost. To better illustrate, take the BentoBox Sushi Strategy for example. If you were to take your $SUSHI tokens from your wallet and deposit them into your BentoBox token vault, without doing anything else and without paying any gas fees other than the send fee from your wallet, you will start earning Sushi.com platform fees, accrued from staking $SUSHI in the SushiBar. Even if your assets are sitting in your BentoBox balance idly, you will automatically be earning yields from strategies that are applied to the vault. The Sushi Strategy is one of many strategies that can be applied at once to BentoBox. The potential that this powerful treasury offers users and the limitless possibilities of strategy design was the reason why Trident was built.

    2- Second Prong on Trident

    As of now, many decentralized exchanges rely on the constant product pool formula as their infrastructure. Trident is intended to be, at minimum, a superset of all AMM pool designs, by adding multiple pool types to provide relief for many of the pain points experienced due to the siloed liquidity problem and to protect users from price impacts and other risks that are faced by cryptocurrency holders. Due to the nature of DeFi, technology, ideas and possibilities go from ideation to implementation at lightning-fast speeds and to ensure that the Sushi protocol is prepared for unforeseen updates to the DeFi horizon, Trident allows for simple integration of added pool types. This integration is made possible by standardizing the pool interface which allows adding new pool designs as long as they conform to the interface. Initially, Trident has been developed with four pool types 1- Constant Product Pool: To refresh we memory, constant product pools are made up of two assets at an equal monetary value of each. To better explain, if you wanted to add $200 of liquidity to the current Sushi AMM’s SUSHI-WETH pair, you would have to add $100 of SUSHI tokens and $100 of WETH tokens to complete your transaction. If you only have $80 worth of SUSHI tokens, than you can only match it with $80 worth of WETH to make a $160 addition of liquidity to the AMM. Luckily, thanks to the zap in/zap out feature, these limitations are no more! In this pool type, swaps function automatically, hence the term Automated Market Maker (AMM), thanks to the formula: x*y=k, also known as the, constant product formula. 2- Hybrid Pool Hybrid pools were included to allow users to swap like-kind assets at reduced price impacts. In hybrid pools, users can include up to 32 assets in just one pool! Based on a stableswap curve, this allows for similar assets to be traded amongst one another in a single pool, with less interference from other market factors or obviously dissimilar tokens. 3- Concentrated Liquidity Pool One of the more exciting pool types to splash onto Trident is the concentrated liquidity pool, which asks users to specify the token asset’s price range to add liquidity to. Traditionally, when you are a liquidity provider on SushiSwap, you receive platform transaction fees from swaps within your LP pool at a rate of your share of the entire pool itself, regardless of a token’s price. As DeFi protocols, such as Sushi, increase in popularity, your share of the pool can get smaller and smaller, until it’s almost miniscule. This pool style aims to tackle that lack of LP incentivization due to unattractive pool shares. As shown in the picture to the left, liquidity providers will be able to select the token price range in which they wish to receive platform fees. This is in the hopes that the amount of the pool that you need to share with fellow providers will spread more evenly between several ranges, offering you a bigger piece of the pie in your selected range, which means in higher fee accumulation.

    db_img

    4- Weighted Pool Weighted pools will be similar to constant product pools with the exception that the pools allow different weight types, breaking the limitation of requiring a 1:1 value match between both assets in a pair, as is the case with constant product pools. Even better, weighted pools can support up to 8 tokens at the same time. Again, weighted pools allow liquidity providers to specify the percentage of each asset in the pair. Being no longer restricted to 50% — 50%, users will have the ability to give 20% of the pool in one asset and 80% of the other, just as long as together they total 100%. To use the illustration above, let’s say you had $80 worth of SUSHI tokens and $100 worth of WETH. Together you can add $180 worth of liquidity, with your $80 of SUSHI tokens making up 44.44% of the pair and your $100 in WETH comprising of the remaining 55.56%. A constant product pool has 50/50 weights of Token X to Token Y. Weighted pools will allow an arbitrary weight of Token X to Token Y. The advantage of this pool type is that it shifts the price impacts by the token weights. A variety of pool types gives users the power to choose pools that best suit their risk profile and a more refined method of crypto money management.

    3- Third Prong on Trident

    a- Tines

    Tines Motor is a new router designed for the front to make the sushi interface more intuitive. Tines is an efficient multi-way router. Multihop deals with searching multiple pools for one-way and multi-way searching for multiple routes a token travels to exchange with another. Tines queries different types of pools and considers factors such as gas cost, price effects, and chart topology to create the best price solution. Now that Sushi will have multiple pools with Trident, the multihop can search for through more possibilities for low price opportunities, maximizing the ability of the SushiSwap swap function. When exchanging at Sushi.com, the exchange path is displayed as part of the transaction details (for example, SUSHI → WETH → AXS). There is no Axie Infinity sushi pool in sushi, but there are AXS-WETH pairs and SUSHI-WETH pairs, so moving a pair of tokens to a common denominator when switching is what is called a path. When doing a swap in the past, we were limited to route styles, but with the Tines multi-route capability, we can trade horizontally to minimize price (slip) effects. Different asset types perform better in different pool types. For instance, like-kind assets such as wBTC and renBTC tend to perform better in hybrid pools. Tines will allow routing more effectively to make multiple pools act as a unified pool resulting in drastically reduced price impacts.

    b-Architecture

    MasterDeployer is used to add/remove factories for various pool types. Users call MasterDeployer to deploy new pools from whitelisted factories. MasterDeployer also controls the fee percentage that goes to xSUSHI, the barFeeTo address. MasterDeployer has an owner (ops multisig), that'll control these parameters. TridentRouter is the main contract that allows interacting with various pools. It is used to initiate swaps and manage liquidity. TridentRouter is the contract that gets whitelisted in BentoBox as the master app to transfer user tokens in/out of Trident pools and BentoBox. One of Sushi's ambitious features is its design for franchise pools. This AMM function hopes to drive liquidity by encouraging LPs to keep their assets centralized. After launching Trident, the organization will begin work on these anticipated franchise packages that will unite CEX and DEX for a mutually beneficial purpose. The Trident implementation will allow for the presentation of a storage proof to give two simultaneous snapshots of the cumulative price. To do this, the user using the TWAP price will present a merkle proof where the block root is less than 256 blocks behind the canonical head. On chain, the contracts will confirm the validity of the storage proof and value to allow an instant TWAP snapshot. Currently deployed on Polygon, as well as working on a reduced gas consumption version for a deployment on Ethereum. The benefit of TWAP is that it’s a fully decentralized, trustless price oracle for all assets.

    Comparing Uniswap V3, Kyber DMM and Trident:

    a- Uniswap V3 – Centralized liquidity:

    The Uniswap V3 whitepaper was published in March 2021, introducing the “Centralized Liquidity” mechanism.

    db_img

    The basic plan is that the green curve – virtual reserves is closer to the authentic axis (i.e. the orange line – actual reserves). This assists cut down exchange price fluctuations when there is a modify in the sum of X, Y tokens in the pool. It goes devoid of saying that Uni v3 even now has a number of weakness as follows:

     1- Non self-reinvested transaction charges: With versions V1, V2, the collected transaction charges will carry on to be deposited back into the liquidity pool, assisting to thicken the liquidity in the pool and at the identical time assisting liquidity companies (LP – Liquidity Provider) accrues compound curiosity. However, due to the particularity of V3 the cost assortment (cost assortment LP offers liquidity), the collected transaction charge can not carry on to be deposited back into the LP pool.

     2- If the market place cost goes out of the cost assortment for which the LP has presented liquidity, the LP will not be entitled to a share of the income from the transaction charges collected by the pool. There are for that reason several answers this kind of as Gelato that “must” be born to fill this gap in Uni V3.

    b- Kyber DMM – Coefficient of variation of amplitude

    Kyber DMM (or Dynamic Market Making) is a new item from KyberSwap, now this platform migrated the item to Krystal (with positioning as a DeFi Hub – in which all the operations a consumer wants in the DeFi discipline). This plan is fine The Kyber workforce announced in February 2021 – even in advance of Uniswap V3 presented its whitepaper. In essence, Kyber also aims to focus liquidity in a particular spot. Kyber also has an method for bringing the exchange price curve closer to the authentic axis (i.e. the dashed blue line in the picture under).

    db_img

    Differences with Uniswap V3:

     1- Dynamic price: When giving liquidity on Uniswap’s V3, consumers can only binding in three trading solutions the commissions are .05, .three and one%. However, Kyber DMM’s pool will offer transaction charges which differ in accordance to market place fluctuations. For instance, when the market place is heavily traded, the transaction charges are elevated, hence assisting to cut down the long lasting reduction (estimated reduction) for LPs.

     2- Amplitude index: Instead of asking consumers to pick out Price Range this kind of as V3, Kyber will simplify the preliminary choice procedure for consumers by applying the dimension index for every single pool. The decrease the index, the decrease the exchange price volatility in the pool, hence assisting to much more optimally use the sum of capital in the pool. This method assists LP to even now get pleasure from the share of the transaction charges even if the exchange price fluctuates outdoors a particular cost assortment like Uni V3.

    Trident (item branch of Sushi)

    Trident’s method will be to synthesize the most well-known pool kinds these days, namely Curve, Balancer and Uniswap. Point of variation of the Trident that is developed on the BentoBox liquidity platform, alternatively of possessing to entice liquidity in the standard way of the two aforementioned names. This must be 1 of the pieces to enable the Sushi ecosystem shut down to keep money movement.