Interface
IWETH9
deposit
Deposit ether to get wrapped ether
withdraw
Withdraw wrapped ether to get ether
Params:
Name | Type | Description |
amount | uint256 | Amount of wrapped ether to be withdrawn |
IBattleInitializer
createAndInitializeBattle
Creates and initializes a battle contract
Params:
Name | Type | Description |
CreateAndInitBattleParams | params | Parameters for creating and initializing a pool. See Params |
Returns:
Name | Type | Description |
battle | address | The address of the created battle contract |
IManagerActions
addLiquidity
Adds liquidity to the protocol.
Params:
Name | Type | Description |
AddLiqParams | params | The params necessary to add liquidity, encoded as AddLiqParams in calldata. See Params |
Returns:
Name | Type | Description |
tokenId | uint256 | The ID of the NFT |
liquidity | uint128 | The amount of added liquidity |
removeLiquidity
Removes liquidity from the pool, given the tokenId of a position. Only to be called once by the liquidity provider.
Params:
Name | Type | Description |
tokenId | uint256 | The ID of the NFT that represents the liquidity position |
Returns:
Name | Type | Description |
collateral | uint256 | The amount of collateral to be received by the liqudity 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 |
withdrawObligation
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:
Name | Type | Description |
tokenId | uint256 | The ID of the NFT representing the liquidity position |
redeemObligation
Returns the amount of collateral reserved for the liquidity providers' open short interest. The LP gets one collateral for sending one Spear or Shield token back to the pool to close the net amount of short options exposure.Can be called once before expiry by the LP and must be called after liquidity has been removed.
Params:
Name | Type | Description |
tokenId | uint256 | The ID of the NFT representing the liquidity position |
IManagerTrade
trade
Calls the battle contract to execute a trade
Params:
Name | Type | Description |
mtp | TradeParams | The parameters of the trade |
Returns:
Type | Description |
uint256 | Amount of collateral token input spent to be spent for the trade |
uint256 | Amount of Spear or Shield token output to be received for the trade |
uint256 | The amount of fee in collateral token to be spent for the trade |
IManagerState
Returns information about positions held by accounts
positions
Returns position details belonging to a NFT
Params:
Name | Type | Description |
tokenId | uint256 | The ID of the NFT |
Returns:
Name | Type | Description |
Position | memory | Position details |
nextId
Returns the next token ID for an NFT to be created
Returns:
Type | Description |
uint256 | The next token ID for an NFT |
IPeripheryImmutableState
Functions that return immutable state of the router
arena
Returns the address of the arena contract
Returns:
Name | Type | Description |
arena | address | The address for the arena contract |
WETH9
Returns the address of the wrapped ether
Returns:
Name | Type | Description |
WETH9 | address | The address for WETH9 |
IQuoter
accountPositions
Returns all the position details belonging to an account
Params:
Name | Type | Description |
account | address | The account address |
Returns:
Name | Type | Description |
Position | memory | Position details |
quoteExactInput
Returns the amount of collateral input and options token output for the given parameters
Params:
Name | Type | Description |
BattleTradeParams | params | The params for the trade function of a battle |
battleAddr | address | The address for a battle |
Returns:
Name | Type | Description |
spend | uint256 | Amount of collateral token input spent to be spent for the trade |
get | uint256 | Amount of Spear or Shield token output to be received for the trade |
Last updated