Walkthroughs
Check Pool Info
1. Find out all online pools
All Pool contracts are linked with PoolGuardian’s state variables, 4 identity status of Pool: RUNNING/LIQUIDATING/RECOVER/ENDED
The address of strPool is an indicator of one identity pool.
2. Get details about the specific pool
Head to Pool Lifecycle for more insights about Pool.
Deal with Positions
1. Query all positions created by a user
- 0x...{1} Address of
TradingHubcontract - 0x...{2} User’s account
2. Get infos of a position in a specific pool
- 0x...{1} Address of
StrPoolcontract - 0x...{2} Address of the position
An alternative way of getting ideal result by wildcard matching,
- 0x...{1} Address of
TradingHubcontract - 0x...{2} Address of the position
or filter them by state, there are 4 identity status of Position: OPEN/CLOSING/OVERDRAWN/CLOSED:
- 0x...{1} Address of
TradingHubcontract
Trading
1. Sell Short
Before setting up a position, estimateMargin is a prerequisite to spare the trader from Sandwich attacks. A key involved number to quantify the terminology: Slippage.
- 0x...{1} Address of
TradingHubcontract
Then pass the margin calculated as a parameter of sellShort
Notice: All positions opened within one pool have the exact meters, so the linkage between Pool and Position is one-on-one. That means the actions of increasing or decreasing position size would NOT create another position for one user.
After the on-chain confirmation of sellShort transaction, the position’s data fields can be located somewhere in the Pool contract.
2. Buy to Cover
buyCover is the opposite side of sellShort, as the literal meaning: