constructor
setBorrowingPairParams
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _pairIndex | uint16 | index of the pair |
| _value | IBorrowingFees.BorrowingPairParams | new value |
setBorrowingPairParamsArray
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _indices | uint16[] | indices of the pairs |
| _values | IBorrowingFees.BorrowingPairParams[] | new values |
setBorrowingGroupParams
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _groupIndex | uint16 | index of the borrowing group |
| _value | IBorrowingFees.BorrowingGroupParams | new value |
setBorrowingGroupParamsArray
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _indices | uint16[] | indices of the groups |
| _values | IBorrowingFees.BorrowingGroupParams[] | new values |
handleTradeBorrowingCallback
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _trader | address | address of the trader |
| _pairIndex | uint16 | index of the pair |
| _index | uint32 | index of the trade |
| _positionSizeCollateral | uint256 | position size of the trade in collateral tokens |
| _open | bool | true if trade has been opened, false if trade has been closed |
| _long | bool | true if trade is long, false if trade is short |
resetTradeBorrowingFees
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _trader | address | address of the trader |
| _pairIndex | uint16 | index of the pair |
| _index | uint32 | index of the trade |
| _long | bool | true if trade is long, false if trade is short |
getBorrowingPairPendingAccFees
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _pairIndex | uint16 | index of the pair |
| _currentBlock | uint256 | current block number |
Return Values
| Name | Type | Description |
|---|---|---|
| accFeeLong | uint64 | new pair acc borrowing fee on long side |
| accFeeShort | uint64 | new pair acc borrowing fee on short side |
| pairAccFeeDelta | uint64 | pair acc borrowing fee delta (for side that changed) |
getBorrowingGroupPendingAccFees
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _groupIndex | uint16 | index of the borrowing group |
| _currentBlock | uint256 | current block number |
Return Values
| Name | Type | Description |
|---|---|---|
| accFeeLong | uint64 | new group acc borrowing fee on long side |
| accFeeShort | uint64 | new group acc borrowing fee on short side |
| groupAccFeeDelta | uint64 | group acc borrowing fee delta (for side that changed) |
getTradeBorrowingFee
Parameters
| Name | Type | Description |
|---|---|---|
| _input | IBorrowingFees.BorrowingFeeInput | input data (collateralIndex, trader, pairIndex, index, long, collateral, leverage) |
Return Values
| Name | Type | Description |
|---|---|---|
| feeAmountCollateral | uint256 | borrowing fee (collateral precision) |
getTradeLiquidationPrice
Parameters
| Name | Type | Description |
|---|---|---|
| _input | IBorrowingFees.LiqPriceInput | input data (collateralIndex, trader, pairIndex, index, openPrice, long, collateral, leverage) |
getPairOisCollateral
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _pairIndex | uint16 | index of the pair |
Return Values
| Name | Type | Description |
|---|---|---|
| longOi | uint256 | open interest on long side |
| shortOi | uint256 | open interest on short side |
getBorrowingPairGroupIndex
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _pairIndex | uint16 | index of the pair |
Return Values
| Name | Type | Description |
|---|---|---|
| groupIndex | uint16 | borrowing group index |
getPairOiCollateral
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _pairIndex | uint16 | index of the pair |
| _long | bool | true if long side |
withinMaxBorrowingGroupOi
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _pairIndex | uint16 | index of the pair |
| _long | bool | true if long side |
| _positionSizeCollateral | uint256 | position size of the trade in collateral tokens |
getBorrowingGroup
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _groupIndex | uint16 | index of the borrowing group |
getBorrowingGroupOi
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _groupIndex | uint16 | index of the borrowing group |
getBorrowingPair
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _pairIndex | uint16 | index of the pair |
getBorrowingPairOi
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _pairIndex | uint16 | index of the pair |
getBorrowingPairGroups
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _pairIndex | uint16 | index of the pair |
getAllBorrowingPairs
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
getBorrowingGroups
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _indices | uint16[] | indices of the groups |
getBorrowingInitialAccFees
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _trader | address | address of trader |
| _index | uint32 | index of trade |
getPairMaxOi
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _pairIndex | uint16 | index of the pair |
getPairMaxOiCollateral
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
| _pairIndex | uint16 | index of the pair |
