-
Notifications
You must be signed in to change notification settings - Fork 1
Liquidity Pool
Anyone can implement the LiquidityPoolInterface and deploy their own liquidity pool to participate in the synthetic asset and margin trading protocols.
The getBidSpread function returns the bid spread in percent of this liquidity pool.
function getBidSpread(address fToken) external view returns (uint)
-
fToken
: the account for the fToken -
return
: spread in percent e.g. 1 as 1%, return 0 if this fToken is not supported
The bid price is the exchange rate for selling fToken provided by a given liquidity pool.
bidPrice = oraclePrice * (1 - bidSpread)
The getAskSpread function returns the ask spread in percent of this liquidity pool.
function getAskSpread(address fToken) external view returns (uint)
-
fToken
: the account for the fToken -
return
: spread in percent e.g. 1 as 1%, return 0 if this fToken is not supported
The ask price is the exchange rate for buying fToken provided by a given liquidity pool.
askPrice = oraclePrice * (1 + askSpread)
The getAdditionalCollateralRatio function returns the additional collateral ratio for a fToken. A liquidity pool can set a higher collateral ratio than the fToken default to achieve a higher level of security.
function getAdditionalCollateralRatio(address fToken) external view returns (uint);
-
fToken
: the account for the fToken -
return
: the collateral ratio in percent
The enableToken function registers a supported fToken.
function enableToken(address token) external onlyOwner
The disableToken function removes a fToken from supported list.
function disableToken(address token) external onlyOwner
The depositLiquidity functions injects liquidity in base token DAI for the liquidity pool to be used as collaterals.
function depositLiquidity(uint amount) external
The withdrawLiquidity functions allows the liquidity pool owner withdraw excessive liquidity from the pool.
function withdrawLiquidity(uint amount) external onlyOwner
The addCollateral function increases the collateral of given fToken for given liquidity pool. Liquidity pool owner can use this function to strengthen a fToken position, to rescue a dangerous or liquidating fToken.
function addCollateral(FlowProtocol protocol, FlowToken token, uint baseTokenAmount)
-
token
: the account of a fToken, e.g. address of deployed fEUR or fJPY -
pool
: the account of a liquidity pool chosen to add collateral to -
flowTokenAmount
: amount of fToken to exchange
The addCollateral function withdraws collateral of given fToken for given liquidity pool. Pool owner can use this function to withdraw excessive collateral (when current collateral ratio is higher than required).
function withdrawCollateral(FlowProtocol protocol, FlowToken token)