VaultUtils
Function
This is a function for checking confirmDelay status, so if it is available to execute confirmDelayTransaction, then it returns true.
vaultUtils.validateConfirmDelay(
address _account,
address _indexToken,
bool _isLong,
uint256 _posId,
bool _raise
)
Example Input
('0x70997970c51812dc3a010c7d01b50e0d17dc79c8', '0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec', true, false)
Example Output
true
Function
This is a function for checking decreasePosition, so if it is available to execute decreasePosition, then it returns true. for example, the user are going to execute more size than the position size the user opened, then it will revert that and return false.
vaultUtils.validateDecreasePosition(
address _account,
address _indexToken,
bool _isLong,
uint256 _posId,
bool _raise
)
Example Input
('0x70997970c51812dc3a010c7d01b50e0d17dc79c8', '0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec', true, false)
Example Output
false
Function
This is a function for checking liquidatePosition, so if it is available to execute liquidatePosition, then it returns true. for example, the user are going to liquidate any position which is not hitted liquidate condition, then it will revert that.
vaultUtils.validateLiquidation(
address _account,
address _indexToken,
bool _isLong,
uint256 _posId,
bool _raise
)
Example Input
('0x70997970c51812dc3a010c7d01b50e0d17dc79c8', '0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec', true, false)
Example Output
false
Function
This is a function for checking user position input data. if user doesn't input the data correctly, then it will revert that.
vaultUtils.validatePosData(
bool _isLong,
address _indexToken,
OrderType _orderType,
uint256[] memory _triggerPrices,
bool _raise
)
Example Input
(true, '0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec', 0, ['19172000000000000000000000000000000', '1000', '10000000000000000000000000000000', '100000000000000000000000000000000'], false)
Example Output
false
Function
This is a function for checking user trailing stop input data. if user doesn't input the data correctly, then it will revert that.
vaultUtils.validateTrailingStopInputData(
address _account,
address _indexToken,
bool _isLong,
uint256 _posId,
uint256[] memory _triggerPrices
)
Example Input
('0x70997970c51812dc3a010c7d01b50e0d17dc79c8', '0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec', true, 0, [
'10000000000000000000000000000000',
'100000000000000000000000000000000',
0,
'1000000000000000000000000000000'
])
Example Output
false
Function
This is a function to check whether a user's trailing stop price can be updated or not.
vaultUtils.validateTrailingStopPrice(
address _account,
address _indexToken,
bool _isLong,
uint256 _posId
)
Example Input
('0x70997970c51812dc3a010c7d01b50e0d17dc79c8', '0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec', true, 0)
Example Output
false
Function
This is a function to check whether trigger can be executed or not.
vaultUtils.validateTrigger(
address _account,
address _indexToken,
bool _isLong,
uint256 _posId
)
Example Input
('0x70997970c51812dc3a010c7d01b50e0d17dc79c8', '0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec', true, 0)
Example Output
false
Function
This is a function to check whether position size is bigger than collateral system supports only leverage 1.x+ So if position size is smaller than collateral, then it returns false.
vaultUtils.validateSizeCollateralAmount(
uint256 _size,
uint256 _collateral
)
Example Input
('100', '10')
Example Output
false
Last modified 4mo ago