LiquidityProtectionStore
This contract serves as the storage of the liquidity protection mechanism.
It holds the data and tokens, and it is generally non-upgradable.
Functions:
Events:
Function withdrawTokens(contract IReserveToken _token, address _to, uint256 _amount)
withdrawTokens(contract IReserveToken _token, address _to, uint256 _amount)
withdraws tokens held by the contract
can only be called by the contract owner
Parameters:
_token
: token address_to
: recipient address_amount
: amount to withdraw
Function protectedLiquidityCount(address _provider) → uint256
protectedLiquidityCount(address _provider) → uint256
returns the number of protected liquidities for the given provider
Parameters:
_provider
: liquidity provider
Return Values:
number of protected liquidities
Function protectedLiquidityIds(address _provider) → uint256[]
protectedLiquidityIds(address _provider) → uint256[]
returns the list of protected liquidity ids for the given provider
Parameters:
_provider
: liquidity provider
Return Values:
protected liquidity ids
Function protectedLiquidityId(address _provider, uint256 _index) → uint256
protectedLiquidityId(address _provider, uint256 _index) → uint256
returns the id of a protected liquidity for the given provider at a specific index
Parameters:
_provider
: liquidity provider_index
: protected liquidity index
Return Values:
protected liquidity id
Function protectedLiquidity(uint256 _id) → address, contract IDSToken, contract IReserveToken, uint256, uint256, uint256, uint256, uint256
protectedLiquidity(uint256 _id) → address, contract IDSToken, contract IReserveToken, uint256, uint256, uint256, uint256, uint256
returns an existing protected liquidity details
Parameters:
_id
: protected liquidity id
Return Values:
liquidity provider
pool token address
reserve token address
pool token amount
reserve token amount
rate of 1 protected reserve token in units of the other reserve token (numerator)
rate of 1 protected reserve token in units of the other reserve token (denominator)
Function addProtectedLiquidity(address _provider, contract IDSToken _poolToken, contract IReserveToken _reserveToken, uint256 _poolAmount, uint256 _reserveAmount, uint256 _reserveRateN, uint256 _reserveRateD, uint256 _timestamp) → uint256
addProtectedLiquidity(address _provider, contract IDSToken _poolToken, contract IReserveToken _reserveToken, uint256 _poolAmount, uint256 _reserveAmount, uint256 _reserveRateN, uint256 _reserveRateD, uint256 _timestamp) → uint256
adds protected liquidity
can only be called by the contract owner
Parameters:
_provider
: liquidity provider_poolToken
: pool token address_reserveToken
: reserve token address_poolAmount
: pool token amount_reserveAmount
: reserve token amount_reserveRateN
: rate of 1 protected reserve token in units of the other reserve token (numerator)_reserveRateD
: rate of 1 protected reserve token in units of the other reserve token (denominator)_timestamp
: timestamp
Return Values:
new protected liquidity id
Function updateProtectedLiquidityAmounts(uint256 _id, uint256 _newPoolAmount, uint256 _newReserveAmount)
updateProtectedLiquidityAmounts(uint256 _id, uint256 _newPoolAmount, uint256 _newReserveAmount)
updates an existing protected liquidity pool/reserve amounts
can only be called by the contract owner
Parameters:
_id
: protected liquidity id_newPoolAmount
: new pool tokens amount_newReserveAmount
: new reserve tokens amount
Function removeProtectedLiquidity(uint256 _id)
removeProtectedLiquidity(uint256 _id)
removes protected liquidity
can only be called by the contract owner
Parameters:
_id
: protected liquidity id
Function lockedBalanceCount(address _provider) → uint256
lockedBalanceCount(address _provider) → uint256
returns the number of network token locked balances for a given provider
Parameters:
_provider
: locked balances provider
Return Values:
the number of network token locked balances
Function lockedBalance(address _provider, uint256 _index) → uint256, uint256
lockedBalance(address _provider, uint256 _index) → uint256, uint256
returns an existing locked network token balance details
Parameters:
_provider
: locked balances provider_index
: start index
Return Values:
amount of network tokens
lock expiration time
Function lockedBalanceRange(address _provider, uint256 _startIndex, uint256 _endIndex) → uint256[], uint256[]
lockedBalanceRange(address _provider, uint256 _startIndex, uint256 _endIndex) → uint256[], uint256[]
returns a range of locked network token balances for a given provider
Parameters:
_provider
: locked balances provider_startIndex
: start index_endIndex
: end index (exclusive)
Return Values:
locked amounts
expiration times
Function addLockedBalance(address _provider, uint256 _amount, uint256 _expirationTime) → uint256
addLockedBalance(address _provider, uint256 _amount, uint256 _expirationTime) → uint256
adds new locked network token balance
can only be called by the contract owner
Parameters:
_provider
: liquidity provider_amount
: token amount_expirationTime
: lock expiration time
Return Values:
new locked balance index
Function removeLockedBalance(address _provider, uint256 _index)
removeLockedBalance(address _provider, uint256 _index)
removes a locked network token balance
can only be called by the contract owner
Parameters:
_provider
: liquidity provider_index
: index of the locked balance
Function systemBalance(contract IReserveToken _token) → uint256
systemBalance(contract IReserveToken _token) → uint256
returns the system balance for a given token
Parameters:
_token
: token address
Return Values:
system balance
Function incSystemBalance(contract IReserveToken _token, uint256 _amount)
incSystemBalance(contract IReserveToken _token, uint256 _amount)
increases the system balance for a given token
can only be called by the contract owner
Parameters:
_token
: token address_amount
: token amount
Function decSystemBalance(contract IReserveToken _token, uint256 _amount)
decSystemBalance(contract IReserveToken _token, uint256 _amount)
decreases the system balance for a given token
can only be called by the contract owner
Parameters:
_token
: token address_amount
: token amount
Function totalProtectedPoolAmount(contract IDSToken _poolToken) → uint256
totalProtectedPoolAmount(contract IDSToken _poolToken) → uint256
returns the total protected pool token amount for a given pool
Parameters:
_poolToken
: pool token address
Return Values:
total protected amount
Function totalProtectedReserveAmount(contract IDSToken _poolToken, contract IReserveToken _reserveToken) → uint256
totalProtectedReserveAmount(contract IDSToken _poolToken, contract IReserveToken _reserveToken) → uint256
returns the total protected reserve amount for a given pool
Parameters:
_poolToken
: pool token address_reserveToken
: reserve token address
Return Values:
total protected amount
Event ProtectionAdded(address _provider, contract IDSToken _poolToken, contract IReserveToken _reserveToken, uint256 _poolAmount, uint256 _reserveAmount)
ProtectionAdded(address _provider, contract IDSToken _poolToken, contract IReserveToken _reserveToken, uint256 _poolAmount, uint256 _reserveAmount)
triggered when liquidity protection is added
Parameters:
_provider
: liquidity provider_poolToken
: pool token address_reserveToken
: reserve token address_poolAmount
: amount of pool tokens_reserveAmount
: amount of reserve tokens
Event ProtectionUpdated(address _provider, uint256 _prevPoolAmount, uint256 _prevReserveAmount, uint256 _newPoolAmount, uint256 _newReserveAmount)
ProtectionUpdated(address _provider, uint256 _prevPoolAmount, uint256 _prevReserveAmount, uint256 _newPoolAmount, uint256 _newReserveAmount)
triggered when liquidity protection is updated
Parameters:
_provider
: liquidity provider_prevPoolAmount
: previous amount of pool tokens_prevReserveAmount
: previous amount of reserve tokens_newPoolAmount
: new amount of pool tokens_newReserveAmount
: new amount of reserve tokens
Event ProtectionRemoved(address _provider, contract IDSToken _poolToken, contract IReserveToken _reserveToken, uint256 _poolAmount, uint256 _reserveAmount)
ProtectionRemoved(address _provider, contract IDSToken _poolToken, contract IReserveToken _reserveToken, uint256 _poolAmount, uint256 _reserveAmount)
triggered when liquidity protection is removed
Parameters:
_provider
: liquidity provider_poolToken
: pool token address_reserveToken
: reserve token address_poolAmount
: amount of pool tokens_reserveAmount
: amount of reserve tokens
Event BalanceLocked(address _provider, uint256 _amount, uint256 _expirationTime)
BalanceLocked(address _provider, uint256 _amount, uint256 _expirationTime)
triggered when network tokens are locked
Parameters:
_provider
: provider of the network tokens_amount
: amount of network tokens_expirationTime
: lock expiration time
Event BalanceUnlocked(address _provider, uint256 _amount)
BalanceUnlocked(address _provider, uint256 _amount)
triggered when network tokens are unlocked
Parameters:
_provider
: provider of the network tokens_amount
: amount of network tokens
Event SystemBalanceUpdated(contract IReserveToken _token, uint256 _prevAmount, uint256 _newAmount)
SystemBalanceUpdated(contract IReserveToken _token, uint256 _prevAmount, uint256 _newAmount)
triggered when the system balance for a given token is updated
Parameters:
_token
: token address_prevAmount
: previous amount_newAmount
: new amount
Last updated