-
Notifications
You must be signed in to change notification settings - Fork 25
Home
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, supportsMultiCurrency
and native token viabalance
// 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>,)
-
margin_liquidity_pools
: assets in the liquidity pool are used as collaterals in margin trading. Anyone cancreate_pool
anddeposit_liquidity
, only owner canremove_pool
anddisable_pool
, owner can setspread
,additional_swap
andmin_leveraged_amount
, 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_spread(origin, pool: LiquidityPoolId, pair: TradingPair, bid: Permill, ask: Permill) fn liquidity_pool_enable_trading_pair(origin, pool_id: LiquidityPoolId, pair: TradingPair) fn liquidity_pool_disable_trading_pair(origin, pool_id: LiquidityPoolId, pair: TradingPair) fn set_min_leveraged_amount(origin, pool_id: LiquidityPoolId, amount: Balance)
// Dispatchable methods by ROOT or financial council fn set_swap_rate(origin, pair: TradingPair, rate: SwapRate) fn set_max_spread(origin, pair: TradingPair, max_spread: Permill) fn enable_trading_pair(origin, pair: TradingPair) fn disable_trading_pair(origin, pair: TradingPair) fn set_default_min_leveraged_amount(origin, amount: Balance)
-
synthetic_liquidity_pools
: assets in the liquidity pool are used as collaterals in synthetic asset. Anyone cancreate_pool
anddeposit_liquidity
, only owner canremove_pool
anddisable_pool
, owner can setspread
andadditional_collateral_ratio
, and specify enabled synthetics// 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_spread(origin, pool: LiquidityPoolId, currency_id: CurrencyId, bid: Permill, ask: Permill) fn set_additional_collateral_ratio(origin, pool: LiquidityPoolId, currency_id: CurrencyId, ratio: Option<Permill>) fn set_synthetic_enabled(origin, pool_id: LiquidityPoolId, currency_id: CurrencyId, enabled: bool)
// Dispatchable methods by ROOT or financial council fn set_min_additional_collateral_ratio(origin, ratio: Permill) fn set_max_spread(origin, currency_id: CurrencyId, max_spread: Permill)
-
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 canmint
andredeem
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 toopenPosition
andclosePosition
for leveraged long or short trades// Dispatchable methods fn open_position(origin, pool: LiquidityPoolId, pair: TradingPair, leverage: Leverage, #[compact] leveraged_amount: Balance, price: Price) fn close_position(origin, position_id: PositionId, price: Price) fn deposit(origin, #[compact] amount: Balance) fn withdraw(origin, #[compact] amount: Balance)
// RPC methods #[rpc(name = "marginProtocol_equity_of_trader")] fn equity_of_trader(who: AccountId) -> Option<Fixed128> #[rpc(name = "marginProtocol_margin_level")] fn margin_level(who: AccountId) -> Option<Fixed128> #[rpc(name = "marginProtocol_free_margin")] fn free_margin(who: AccountId) -> Option<Fixed128>; #[rpc(name = "marginProtocol_margin_held")] fn margin_held(who: AccountId) -> Fixed128; #[rpc(name = "marginProtocol_unrealized_pl_of_trader")] fn unrealized_pl_of_trader(who: AccountId) -> Option<Fixed128>
-
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