Manager
Sets up the necessary state variables, mappings, and inheritance to handle position NFTs, manage liquidity, and interact with the battle contracts
Last updated
Sets up the necessary state variables, mappings, and inheritance to handle position NFTs, manage liquidity, and interact with the battle contracts
Last updated
Adds liquidity to a battle contract, mints a new token representing the liquidity position, and records the position information for later reference.
Params:
Returns:
Updates the growth of fees and token deltas as of the last action on the individual position
Params:
Removes liquidity from the pool, given the tokenId of a position. Only to be called once by the liquidity provider.
Params:
Returns:
Calculates the obligatory reserve of collateral amounts for settling sold Spear and Shield amounts, and the remaining collateral/Spear/Shield token amounts receivable for a given position.
Params:
Returns:
Returns the amount of collateral reserved for options that settle out-of-money. Can be called once after expiry by the liquidity provider and must be called after liquidity has been removed.
Params:
Returns the amount of collateral reserved for the liquidity providers' open short interest in call or put options, after the pool receives the equavalent amount of call or put option tokens. Can be called once before expiry and must be called when liquidity has been removed.
Params:
Calls the battle contract to execute a trade
Params:
Returns:
Called to msg.sender after executing a swap via Manager.
Params:
Retrieves the position data for the given TokenId
Params:
Returns:
Retrieves and updates the position data
Params:
Returns:
Retrieves all the positions associated with an account
Params:
Returns:
Name
Type
Description
AddLiqParams
calldata
The parameters for adding liquidity to the position See Params
Name
Type
Description
tokenId
uint256
The ID of the NFT that represents the liquidity position
liquidity
uint128
The amount of liquidity for this position
Name
Type
Description
pb
PositionInfo
The position info struct
pm
Position
The position owed info struct
Name
Type
Description
tokenId
uint256
The ID of the NFT that represents the liquidity position
Name
Type
Description
collateral
uint256
The amount of collateral to be received by the liquidity provider
spear
uint256
The amount of Spear to be received by the liquidity provider
shield
uint256
The amount of Shield to be received by the liquidity provider
spearObligation
uint256
The obligatory reserve of collateral amount for settling Spear tokens sold by the position
shieldObligation
uint256
The obligatory reserve of collateral amount for settling shield tokens sold by the position
Name
Type
Description
pm
Position
The position for which to calculate the obligation amounts and receivable token amounts
Name
Type
Description
collateral
uint256
The amount of collateral that can be received by the liquidity provider
spear
uint256
The remaining Spear amount that can be received by the liquidity provider, after adjusting for obligations
shield
uint256
The remaining shield amount that can be received by the liquidity provider, after adjusting for obligations
spearObligation
uint256
The obligatory reserve of collateral amount for settling Spear tokens sold by the position
shieldObligation
uint256
The obligatory reserve of collateral amount for settling Shield tokens sold by the position
Name
Type
Description
tokenId
uint256
The ID of the NFT that represents the liquidity position
Name
Type
Description
tokenId
uint256
The ID of the NFT that represents the liquidity position
Name
Type
Description
p
TradeParams
Params required to complete a trade. See Params
Name
Type
Description
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
amountFee
uint256
The amount of fee in collateral token to be spent for the trade
Name
Type
Description
cAmount
uint256
The amount of collateral transferred in the trade
sAmount
uint256
The amount of Spear or Shield transferred in the trade
_data
bytes
Data passed through by the caller
Name
Type
Description
tokenId
uint256
The ID of the NFT that represents the liquidity position
Type
Description
Position
The position data
Name
Type
Description
tokenId
uint256
The ID of the NFT that represents the liquidity position
Name
Type
Description
p
Position
The position data
Name
Type
Description
account
address
The address of the account for which to retrieve the positions
Name
Type
Description
p
Position
The positions owned by the account