TriggerOrderManager
This is a contract for updating user's TP or SL trigger orders.
This is a function for adding or updating User's TP or SL orders.
triggerOrderManager.updateTriggerOrders(
address _indexToken,
bool _isLong,
uint256 _posId,
uint256[] memory _tpPrices,
uint256[] memory _slPrices,
uint256[] memory _tpAmountPercents,
uint256[] memory _slAmountPercents,
uint256[] memory _tpTriggeredAmounts,
uint256[] memory _slTriggeredAmounts
)
Example Input
('0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec', true, '0',
[
'5750000000000000000000000000000000000',
'5820000000000000000000000000000000000',
'5900000000000000000000000000000000000'
],
[
50000,
30000,
20000
],
[
0,
0,
0
],
[
'5400000000000000000000000000000000000'
]
[
100000
]
[
0
]
)
Example Output
This is a function for cancelling User's TP or SL orders.
triggerOrderManager.cancelTriggerOrders(
address _token,
bool _isLong,
uint256 _posId
)
Example Input
('0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec', true, '0')
Example Output
This is a function for cancelling User's TP or SL orders.
triggerOrderManager.getTriggerOrderInfo(
address _account,
address _indexToken,
bool _isLong,
uint256 _posId
)
Example Input
('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec', true, '0')
Example Output
triggerOrderInfo: [
key: '0x8a7ab2cdf5d3b138b3576addd7d3a9765c360b076d02467901a09ac8c1d2dcde',
slPrices: ['5400000000000000000000000000000000000'],
slAmountPercents: [100000],
slTriggeredAmounts: [0],
tpPrices: ['5750000000000000000000000000000000000', 820000000000000000000000000000000000', '5900000000000000000000000000000000000'],
tpAmountPercents: [50000, 30000, 20000],
tpTriggeredAmounts: [0, 0, 0],
status: 0 // 0 -> Open, 1 - Triggered, 2 - Cancelled
]
This is a function for checking user's TP or SL triggerable status to excute user's TP or SL.
triggerOrderManager.validateTPSLTriggers(
address _account,
address _token,
bool _isLong,
uint256 _posId
)
Example Input
('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec', true, '0')
Example Output
true // if it is triggerable, true
Last modified 4mo ago