Create New Reserve
Last updated
Was this helpful?
Last updated
Was this helpful?
You are referring to the Legacy
version of KyberSwap docs.
For the most updated information, please refer to:
We believe there are a lot more reserve models that have yet to be created for unique use cases, which will benefit the whole DeFi space, such as new AMM models. As such, there is no restriction on the type of reserves that can be developed, as long as they follow the following guidelines:
For getConversionRate
, require statements should be avoided. Returning zero rate is suggested as the alternative.
Developers must ensure that they are not using the same liquidity source for multiple reserves, i.e., must have unique liquidity sources for each reserve
Coders should not exploit taker’s gas, and be gas efficient.
We believe there are many possibilities for new reserve types. Some potential ideas could be:
Bridge Reserves for connecting one or more external on-chain sources to Kyber
Yield Farming Reserves that keeps a portion of the funds in yield generating farms and the rest for small volume MM
New AMM models
OTC style reserves, where traders request big size trades, and makers authorize the takers to trade after awhile while they prepare inventory for the trades
IEO / IDO model for new token launches
This section below lists some guidelines on creating a new reserve model.
Implement the Reserve Interface
The reserve interface provides a generic template of the contract functions one should implement in their smart contract. This interface may be tweaked depending on the needs and features of each blockchain. All existing reserve types, like the ones covered in the developer portal (e.g. Fed Price Reserve), as well as integrated reserves (e.g. Bridge Reserve), implement this interface.
Implement getConversionRate function
Implement doTrade function
Deploying the new reserve model
Implement The KyberReserveInterface For the exact functions and inputs to implement, refer to the contract.
All Kyber reserves that enable liquidity provision have to use KyberReserveInterface. The example below, a snippet of kyber , illustrates how to implement the 2 functions of the reserve interface.
You can refer to the reserve contract for detailed code .
You may refer to the for how to deploy a new reserve model.