Position Vault
This is main contract for managing all positions, and orders
As already explained above, we are putting delayTime for adding position. So this function can be called by the position owner or webservice position manager for adding the position.
positionVault.confirmDelayTransaction(
address _account, // position owner address
address _indexToken,
bool _isLong,
uint256 _posId
)
Example Input
('0x70997970c51812dc3a010c7d01b50e0d17dc79c8', '0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec', true, '0')
Example Output
This is a function for fetching user's position info
positionVault.getPosition(
address _account,
address _indexToken,
bool _isLong,
uint256 _posId
)
Example Input
(
'0x70997970c51812dc3a010c7d01b50e0d17dc79c8', '0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec',
true,
'0'
)
Example Output
[
{
owner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
refer: '0x0000000000000000000000000000000000000000',
realisedPnl: 0,
averagePrice: '191200000000000000000000000000000',
collateral: '10000000000000000000000000000',
entryFundingRate: 0,
lastIncreasedTime: 1674526212,
lastPrice: 171200000000000000000000000000000,
reserveAmount: 1008000000000000000000000000,
size: 100000000000000000000000000000
},
{
2,
status: 2,
lmtPrice: 0,
pendingSize: 0,
pendingCollateral: 0,
positionType: 0,
stepAmount: 0,
stepType: 0,
stpPrice: 0
},
{
confirmDelayStatus: false,
pendingDelayCollateral: 10000000000000000000000000000,
pendingDelaySize: 100000000000000000000000000000,
delayStartTime: 1674529815
}
]
This is a function for liquidating user's position on that case when user's loss exceeds user's original collateral. users can participate for liquidating any position for getting bounty. before our server liquidating any position, the user will receive the bounty.
vault.liquidatePosition(
address _account,
address _indexToken,
bool _isLong,
uint256 _posId
)
Example Input
('0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec', '10000000000000000000000000000000', true, '0')
Example Output
This is a function for executing user's TP or SL, or pending orders(limit order, stop-market order, stop limit order or trailing-stop). This function can be called by position owner or platform position manager.
vault.triggerPosition(
address _account,
address _indexToken,
bool _isLong,
uint256 _posId
)
Example Input
('0x70997970c51812dc3a010c7d01b50e0d17dc79c8', '0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec', true, '0')
Example Output
This is a function for updating user's trailing stop order data. according to price change, the user trailing stop price will be changed. So for Long position, if the price rises, the the trailing stop price also rise This function can be called by position owner or platform position manager.
vault.updateTrailingStop(
address _account,
address _indexToken,
bool _isLong,
uint256 _posId
)
Example Input
('0x70997970c51812dc3a010c7d01b50e0d17dc79c8', '0xa36F5ea837A1925252eB5dc5A3605C9C3ba840ec', true, '0')
Example Output
Last modified 4mo ago