• Stars
    star
    231
  • Rank 173,434 (Top 4 %)
  • Language
    TypeScript
  • License
    GNU General Publi...
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rapid AMM Development Framework

Trident: SushiSwap Next Generation Exchange

Codechecks

Coverage Status

TRIDENT πŸ”± is a newly developed AMM and routing system from SushiSwap (Sushi). As a system, Trident is not a fork of any existing AMM, though to start, it incorporates popular AMM concepts into a single, upgradeable framework. The Sushi core team began development with Andre Cronje as Deriswap. This development continued on as Mirin developed by LevX. On May 12th, 2021, Sushi began building Trident in earnest on the Mirin/Deriswap foundation.

Extensibility

Trident is designed as an extensible AMM framework that allows developers to add new pool types that conform to the IPool interface. Before launch, an EIP will be submitted for the IPool interface design to help standardize pool interfaces across Ethereum. As new AMM pool types are designed or experimented with, they can be added to Trident so long as they conform to the interface. In this way Trident will at minimum be a superset of all popular AMM pool designs as well as a future-proof architecture for Sushi to build on.

Launch Pools

Initially, Trident has been developed with four primary pool types for launch:

ConstantProductPool

Constant product pools are the "classic" pools that users will be most familiar with, where trading happens between two assets over the x*y=k constant product formula. In this pool type, liquidity providers own both of the pool's assets in a 50:50 ratio, but the pool also supports a native zap-in feature where liquidity can be added in any ratio of the two tokens. This pool is our most "gas optimized" pool, where swaps are up to 25% cheaper than swaps on the existing Sushi AMM.

ConcentratedLiquidityPool

Concentrated liquidity pools allow liquidity providers to specify a price range on which to provide liquidity. Providing liquidity on a narrower price range has a multiplying effect on the added liquidity, meaning traders will experience lesser price impacts. This makes the Concentrated Liquidity pool more capital efficient than the classic pool, with the tradeoff being that liquidity providers can suffer greater impermanent loss. Each concentrated liquidity pool supports two assets.

HybridPool

Hybrid pools are designed for swapping like-kind assets. They are an implementation of the stableswap curve which is a hybrid of the x*y=k and x+y=k formulas. The pool works by concentrating liquidity around the price of 1 (e.g., 1 USDC per DAI or 1 renBTC per WBTC). Each hybrid pool supports two assets, with larger baskets supported in upcoming implementations.

IndexPool

Index pools are designed to hold from two to eight tokens, each with a different weight. Trading between two assets of the pool happens over a modified version of the constant product formula used in classic pools. The advantage of these pools is liquidity providers can utilize them to create auto rebalancing indices (e.g., a DeFi blue-chip index) that best match their risk profile.

All of these pools will have configurable fees that allow liquidity providers to strike a balance between offsetting their impermanent loss and having the pool stay market competitive.

As a gas-saving measure, Trident further allows pool deployers to disable TWAP oracles. Architecturally, this makes the most sense for common pairs that already have accurate Chainlink price oracles.

BentoBox Integration

Trident is a native application on the Sushi BentoBox vault platform. BentoBox is part of the broader Sushi infrastructure that allows users to build complex, capital-efficient applications on top. BentoBox works by storing tokens to be utilized in strategies and flash lending. Meanwhile, a virtual "share" balance tracked by BentoBox is used by applications like Trident. The yield from BentoBox strategies and flash lending are returned to users, such as liquidity providers, enabling an optimized AMM experience. Indeed, Trident will be the most capital efficient AMM in existence at launch from this DeFi-optimized design.

For instance, if a user were to place a limit order or provide liquidity for a Trident pool, the underlying tokens would be making additional yield even if no swaps were occurring.

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.

Tines: Routing Engine

Tines is a new routing engine designed by Sushi for the Trident front end. Tines is an efficient multihop/multiroute swap router. Tines will query Trident pool types and consider factors such as gas costs, price impacts, and graph topology to generate a best price solution.

  • Multihop - Tines can swap between multiple pools to get the best price for users.
  • Multiroute - Tines can distribute a trade horizontally to minimize price impacts (slippage).

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.

License (GPL3)

At Sushi, we believe deeply in growing the open source ecosystem of DeFi. Our Trident contract set will be GPL3. As a matter of principle, Sushi will continue to release all software that we develop or own under GPL3 or other permissive OSS licenses.

Post Launch Roadmap

  • Franchised pools

    • Following the launch of Trident, Sushi will begin formalizing franchised pools for institutional and other permissioned use cases. Franchised pools are a way to allow users to provide liquidity on decentralized exchanges while meeting their compliance needs. As such, these pools will be differentiated from the main Trident AMM system and will allow whitelisting and similar features for liquidity providers and swappers.
  • Storage Proof TWAP

    • The Trident implementation will also eventually allow for the presentation of a storage proof to give two simultaneous snapshots of a 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, Trident contracts will validate such storage proof and related values to allow an instant TWAP snapshot. Sushi has repurposed another implementation for [Kashi] and is currently deployed on Polygon. Sushi is currently working on a reduced gas consumption version for deployment on Ethereum mainnet.

More Repositories

1

sushiswap

Sushi 2.0 🍣
TypeScript
1,902
star
2

sushiswap-interface

🍣 An open source interface for the SushiSwap Protocol
TypeScript
372
star
3

bentobox

177
star
4

shoyu

Shoyu contracts
TypeScript
168
star
5

sushiswap-legacy-frontend

Legacy interface for Sushiswap (deprecated)
TypeScript
165
star
6

sushiswap-subgraph

Sushiswap Subgraph
150
star
7

kashi-lending

82
star
8

sushi-data

A utility to query for data on SushiSwap.
JavaScript
80
star
9

mirin

A Sushi AMM v3 implementation
Solidity
66
star
10

furo

53
star
11

sushiswap-settlement

Solidity contracts to enable limit orders on Sushiswap
Solidity
52
star
12

sushiswap-analytics

Analytics for the SushiSwap protocol
JavaScript
50
star
13

design-patterns

Curated collection of design patterns targeting the Solidity language
TypeScript
50
star
14

list

List
JavaScript
41
star
15

miso

Solidity
40
star
16

subgraphs

Sushi subgraphs
TypeScript
38
star
17

sdk

SDK
TypeScript
36
star
18

bentobox-strategies

Repository for BentoBox strategy implementations
Solidity
33
star
19

miso-random-nft

A library designed to create a random ERC721 drawing from an ERC20 (Miso token) using Chainlink VRF
Solidity
27
star
20

StakingContract

Solidity
25
star
21

sushiswap-exchange

Legacy interface for Sushiswap standalone exchange
TypeScript
23
star
22

sushixswap-v2

SushiXSwap V2
Solidity
23
star
23

sushiswap-lite

Expo App for https://lite.sushiswap.fi
TypeScript
21
star
24

mochi

defi-based organizations using sushi and bentobox
Solidity
20
star
25

limit-order

Solidity
17
star
26

v3-periphery

This repository contains the periphery smart contracts for the SushiSwap V3 Protocol.
TypeScript
16
star
27

hardhat-foundation

Hardhat foundation
TypeScript
16
star
28

meiji

Solidity
14
star
29

masterchef

This repository contains the core smart contracts for the MasterChefV1 & MasterChefV2 Protocols.
Solidity
13
star
30

sushixswap

This repository contains the core smart contracts for the SushiXSwap Protocol.
TypeScript
13
star
31

interface

Sushi Monorepo
TypeScript
12
star
32

bentobox-sdk

Deployed contracts, helper contract, js and ts bindings
Solidity
12
star
33

sushiswapV1

SushiswapV1
Solidity
12
star
34

sushiswap-zapper

Solidity
11
star
35

mev-router-devkit

TypeScript
11
star
36

sushi-vesting

Vesting stats and weekly updated merkle roots
11
star
37

v3-core

This repository contains the core smart contracts for the SushiSwap V3 Protocol.
TypeScript
11
star
38

v2-core

This repository contains the core smart contracts for the SushiSwap V2 Protocol.
Solidity
11
star
39

sushi-oracle

A adaptation on the uniswap-oracle
TypeScript
10
star
40

lsd-contracts

Contracts for the redemption of the $LSD token
Solidity
10
star
41

strategies

Strategies for BentoBox
Solidity
10
star
42

limit-order-relayer

TypeScript
9
star
43

contracts

Reusable contracts found throughout Sushi products
Solidity
9
star
44

sushi-docs

JavaScript
9
star
45

sushiswap-vision

SushiSwap History
JavaScript
9
star
46

Inari

Simple Sushi Zap contract
Solidity
9
star
47

.github

9
star
48

faucet

Faucet
TypeScript
7
star
49

hardhat-framework

JavaScript
7
star
50

sushiswap-classic

Classic interface for Sushiswap (maintained -> deprecating)
CSS
6
star
51

xsushi-exchange-rate

A contract to provide the exchange rate of xSushi to Sushi
JavaScript
5
star
52

unwindooor

TypeScript
5
star
53

sushi-vesting-protocols

Python
5
star
54

minichef-servers

MiniChef Servers
TypeScript
5
star
55

sushi-partner-portal

TypeScript
4
star
56

sushiswap-relayer

Automated relayer bot for sushiswap-settlement
TypeScript
4
star
57

bento-data

JavaScript
3
star
58

config

SushiSwap config monorepo
TypeScript
3
star
59

bentobox-stargate

Solidity
3
star
60

whitelist

Whitelist monorepo
JavaScript
2
star
61

hardhat-dotenv

Dotenv wrapper for Hardhat
TypeScript
2
star
62

sushi-content

Shared images and static content
2
star
63

bentobox-subgraph

TypeScript
2
star
64

art

Public branding assets for SushiSwap products
2
star
65

sips

Sushi Improvement Proposals
2
star
66

sake-landing

JavaScript
2
star
67

sushi-operations

Python
2
star
68

contribution-guidelines

Sushiswap contribution guidelines
2
star
69

kashi-analytics

TypeScript
2
star
70

sushi-aptos-contracts

Sushi Aptos Contract Modules
Move
2
star
71

default-market-list

SushiSwap default market list
1
star
72

gnosis-safe-app-sushi

JavaScript
1
star
73

hardhat-plugin-foundation

Hardhat plugin foundation
TypeScript
1
star
74

market-lists

The Market Lists specification
1
star
75

sushi-peripherals

Solidity
1
star
76

kashi-foundry

Solidity
1
star
77

auction-maker

Sushi Auction Maker
TypeScript
1
star
78

translations

1
star
79

sak3-snapshot

TypeScript
1
star
80

typescript-foundation

TypeScript foundation
JavaScript
1
star
81

kashi-tools

TypeScript
1
star