Types
Common
BattleKey
Info struct containing a pool's specifications
Params:
Name | Type | Description |
collateral | address | The address of the token used as collateral |
underlying | string | The underlying asset symbol |
expiries | uint256 | The expiry timestamp |
strikeValue | uint256 | The strike price of options within the pool |
Fee
Info struct representing the fee ratios used in a battle
Params:
Name | Type | Description |
transactionFee | uint256 | The fee ratio taken on every trade |
protocolFee | uint256 | The ratio of the transaction fee that goes to the protocol |
exerciseFee | uint256 | The fee ratio applied when Spear or Shield tokens are exercised at maturity |
GrowthX128
Info struct tracking the cumulative amounts of fees and deltas of collateral, Spear and Shield tokens involved in transactions
Params:
Name | Type | Description |
fee | uint256 | The all-time growth in transaction fee, per unit of liquidity, in collateral token |
collateralIn | uint256 | The all-time growth in the received collateral inputs, per unit of liquidity, as options premium |
spearOut | uint256 | The all-time growth in Spear token outputs per unit of liquidity |
shieldOut | uint256 | The all-time growth in Shield token outputs per unit of liquidity |
Owed
Info struct tracking the amounts of fees and deltas of collateral, Spear and Shield tokens that are owed to a position
Params:
Name | Type | Description |
fee | uint128 | The amount of transaction fee owed to the position as of the last computation |
collateralIn | uint128 | The collateral inputs owed to the position as of the last computation |
spearOut | uint128 | The Spear token outputs owed to the position as of the last computation |
shieldOut | uint128 | The Shield token outputs owed to the position as of the last computation |
TickInfo
Info struct tracking the state of a tick
Params:
Name | Type | Description |
liquidityGross | uint128 | The total amount of liquidity that the pool uses either at tickLower or tickUpper |
liquidityNet | int128 | The amount of liquidity added (subtracted) when tick is crossed from left to right (right to left) |
outside | GrowthX128 | The GrowthX128 info recorded on the other side of the tick from the current tick |
initialized | bool | Whether the tick is initialized |
PositionInfo
Info struct tracking the state of a position
Params:
Name | Type | Description |
liquidity | uint128 | The amount of usable liquidity |
insideLast | GrowthX128 | The GrowthX128 info per unit of liquidity inside the a position's bound as of the last action |
Enums
LiquidityType
Tracks the type of liquidity used by the LP
Outcome
Tracks the status of a battle
TradeType
Tracks the type of trade
TradeTypes
TradeCache
Represents cached trade information
Params:
Name | Type | Description |
feeProtocol | uint256 | The protocol fee for the trade |
TradeState
Represents the state of the trade
Params:
Name | Type | Description |
amountSpecifiedRemaining | uint256 | How much collateral input or SToken output amount is remaining to be swapped in/out |
amountCalculated | uint256 | The amount of collateral input or SToken output that has been calculated for the swap |
sqrtPriceX96 | uint160 | A fixed point Q64.96 number representing the sqrt of the ratio of shieldPrice/spearPrice |
tick | int24 | The current tick |
global | GrowthX128 | The GrowthX128 info per unit of liquidity as of the last update to the pool's global state |
protocolFee | uint128 | The amount of collateral token to be paid as protocol fee |
liquidity | uint128 | The amount of usable liquidity |
transactionFee | uint256 | The transaction fee for the trade |
StepComputations
Info struct used in computing the result of swapping some amount in, or amount out, given the parameters of the swap.
Params:
Name | Type | Description |
sqrtPriceStartX96 | uint160 | The sqrtPrice from which to start step computation |
tickNext | int24 | The next tick up to the max or min tick of the virtual curve |
initialized | bool | Whether the next tick is initialized |
sqrtPriceNextX96 | uint160 | The price after swapping the amount in/out, not to exceed the price target |
amountIn | uint256 | The collateral amount to be swapped in, based on the direction of the swap |
amountOut | uint256 | The amount to be received, of either Spear or Shield token, based on the direction of the swap |
feeAmount | uint256 | The amount of collateral input that will be taken as a fee |
tickLower | int24 | The lower tick for the step |
tickUpper | int24 | The upper tick for the step |
Last updated