Contracts Overview
Last updated
Last updated
The system design of the Increment protocol is as follows:
Insurance: 0xBfE90e7cC908569d102393bf948E6700e6aCc1b3
ClearingHouse: 0x9200536A28b0Bf5d02b7d8966cd441EDc173dE61
ClearingHouseViewer: 0xc8A34A3cfB835018B800c9A50ab0a71149Da13Fb
Perpetual (ETH): 0xeda91B6d87A257d209e947BD7f1bC25FC49272B6
Which contracts do we need to deploy once, for all trading pairs:
ClearingHouse (+ ClearingHouseViewer)
Vault
Insurance
UA
Oracle
Which contracts do we need to deploy for a new trading pair, ie. ETHUSD:
2 virtual tokens, one vBase (e.g. ETH) and a vQuote (e.g. USD)
1 Curve v2 pool for these 2 tokens, at their current ratio
1 Perpetual contract, that users will interact with from the ClearingHouse
And, as the name suggests, we don't need to deploy the external contracts.
The peripheral contracts are used for distributing reward tokens to liquidity providers in the Perpetual markets, as well as a Safety Module which rewards stakers for providing economic security to the protocol.
The system is able to support more than one reward token.
The central part of our protocol and all core functionalities of the protocol can be accessed via the ClearingHouse contract. These actions include opening/closing positions, providing/removing liquidity, liquidating positions, and listing new markets through governance.
The Perpetual contract is the access point for all trading and liquidity provision-related activities (accessed via ClearingHouse). The Perpetual contract mints and burns virtual tokens (vBase & vQuote) and trades with the CryptoSwap contract deployed from the Curve Factory contract.
All trader and liquidity provider balances are stored in the contract. The contract further stores historical market and oracle prices to compute TWAPs and funding payments. TWAPs are computed for every trade (once per timestamp).
The Vault contract stores the whitelisted collaterals deposited by liquidity providers and traders. We fix a price of 1 for every unit of USDC. LPs and traders can deposit and withdraw from the Vault through the ClearingHouse contract.
Lender of last resort. When balances in the Vault contract are insufficient to cover claims, the remaining balances are filled from the Insurance contract. Can be replenished with Governance funds.
Oracle contract used to fetch the spot prices of the whitelisted collaterals. Current implementation uses Chainlink, but could be swap for another provider later.
Viewer contract used to estimate the dynamic trading fees of Curve with the help of the CurveMath contract.
UA is the "unit of account" used as the reference value to deal with most accounting operations across the protocol, mostly PnL operations.
Tokens are traded in the CryptoSwap contract. Basic ERC20 implementations. vBase queries a Chainlink oracle and returns the index price of the respective market.
Curve V2 CryptoSwap implementation. Deployed from the V2 factory contract. (https://github.com/curvefi/curve-factory)
Curve V2 token to account for the deposited liquidity of LPs.
Curve Math contract implementing the Newton Methods used inside of Curve CryptoSwap.
Chainlink oracle is used to compute the index price.
Handles reward accrual and distribution for liquidity providers in the Perpetual markets.
Base contract for storing and updating reward info for multiple reward tokens, each with:
a gradually decreasing emission rate, based on an initial inflation rate, reduction factor, and time elapsed
a list of markets for which the reward token is distributed
a list of weights representing the percentage of rewards that go to each market
Abstract contract responsible for accruing and distributing rewards to users for providing liquidity to perpetual markets (handled by PerpRewardDistributor) or staking tokens (with the SafetyModule).
Stores ERC20 tokens, and allows to dispose of them via approval or transfer dynamics.
Handles reward accrual and distribution for staking tokens, and allows governance to auction a percentage of user funds in the event of an insolvency in the Vault.
Reward distributor for the Safety Module.
Based on Aave's StakedToken, but with reward management outsourced to the SafetyModule.
Handles auctioning tokens slashed by the SafetyModule, triggered by governance in the event of an insolvency in the vault which cannot be covered by the insurance fund.