Skip to content
Xiliang Chen edited this page Jan 23, 2020 · 8 revisions

Laminar Chain

Laminar Chain Implementation

The Laminar Chain contains the following modules

  • orml-oracle: is part of the Open Runtime Module Library, takes price feed, and allows other modules to get price for particular currency

    // Dispatchable methods
    fn feed_value(origin, key: T::Key, value: T::Value)
    fn feed_values(origin, values: Vec<(T::Key, T::Value)>)
    // Module callable methods
    fn read_raw_values(key: &T::Key)
    fn get(key: &T::Key)
    
  • orml-currencies: is part of the Open Runtime Module Library, supports MultiCurrency and native token via balance

    // Dispatchable methods
    pub fn transfer(origin,
    		dest: <T::Lookup as StaticLookup>::Source,
    		currency_id: CurrencyIdOf<T>,
    		#[compact] amount: BalanceOf<T>,)
    pub fn transfer_native_currency(origin,
    		dest: <T::Lookup as StaticLookup>::Source,
    		#[compact] amount: BalanceOf<T>,)
    
  • liquidity_pools: assets in the liquidity pool are used as collaterals in synthetic asset and margin trading. Anyone can create_pool and deposit_liquidity, only owner can remove_pool and disable_pool, owner can set bid_spread and additional_collateral_ratio, and specify which trades are supported by this pool

    // Dispatchable methods
    fn create_pool(origin)
    fn disable_pool(origin, pool: LiquidityPoolId)
    fn remove_pool(origin, pool: LiquidityPoolId)
    fn deposit_liquidity(origin, pool: LiquidityPoolId, amount: Balance)
    fn withdraw_liquidity(origin, pool: LiquidityPoolId, amount: Balance)
    fn set_bid_spread(origin, pool: LiquidityPoolId, currency_id: CurrencyId, ask: Permill, bid: Permill)
    fn set_additional_collateral_ratio(origin, pool: LiquidityPoolId, currency_id: CurrencyId, ratio: Option<Permill>)
    fn set_enabled_trades(origin, pool: LiquidityPoolId, currency_id: CurrencyId, long: Leverages, short: Leverages)
    
  • synthetic_tokens: represents synthetic assets like fEUR. It is an implementation of MultiCurrency from our Open Runtime Module Library

    // Storage
    ExtremeRatio: CurrencyId => Option<Permill>
    LiquidationRatio: CurrencyId => Option<Permill>
    CollateralRatio: CurrencyId => Option<Permill>
    Positions: map (LiquidityPoolId, CurrencyId) => Position
    // Module callable methods
    addPosition(who: AccountId, pool: LiquidityPoolId, collaterals: Balance, minted: Balance)
    removePosition(who: AccountId, pool: LiquidityPoolId, collaterals: Balance, minted: Balance)
    
  • synthetic_protocol: it is the entry/proxy module for people to trade 1:1 with synthetic assets. You can mint and redeem a particular synthetic asset, liquidate a position that's below required collateral ratio. Later version we will use off-chain worker to implement liquidation process to improve responsiveness to risks.

    // Dispatchable methods
    fn mint(origin, currency_id: CurrencyId, pool: LiquidityPoolId, base_amount: Balance, max_slippage: fn Permill)
    fn redeem(origin, currency_id: CurrencyId, pool: LiquidityPoolId, flow_amount: Balance, max_slippage: Permill)
    fn liquidate(origin, currency_id: CurrencyId, pool: LiquidityPoolId, flow_amount: Balance)
    
  • margin_protocol: people can use this module to openPosition and closePosition for leveraged long or short trades

    // Dispatchable methods
    fn openPosition(origin, pair: TradingPair, pool: LiquidityPoolId, base_amount: Balance)
    fn closePosition(origin, position_id: PositionId)
    
  • primitives: constants for supported leverages, currencies etc

Our margin trading protocol is currently under review by financial advisors. While the MVP testnet will implement the current version of margin trading protocol, it is expected that the next version will be upgraded to a more elaborated margin trading mechanisms. More details on the upgrade will be disclosed as we progress.

See more details here

Clone this wiki locally