Interface

IWETH9

deposit

Deposit ether to get wrapped ether

function deposit()  external  payable

withdraw

Withdraw wrapped ether to get ether

function withdraw(uint256 amount)  external

Params:

Name

Type

Description

amount

uint256

Amount of wrapped ether to be withdrawn

IBattleInitializer

createAndInitializeBattle

Creates and initializes a battle contract

function createAndInitializeBattle(CreateAndInitBattleParams memory params)  external  returns  (address battle);

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.

function addLiquidity(AddLiqParams calldata params) external returns (uint256 tokenId, uint128 liquidity)

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.

function removeLiquidity(uint256 tokenId) external
returns (uint256 collateral, uint256 spear, uint256 shield, uint256 spearObligation, uint256 shieldObligation);

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.

function withdrawObligation(uint256 tokenId) external;

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.

function redeemObligation(uint256 tokenId) external

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

function trade(TradeParams calldata mtp) external returns (uint256, uint256, uint256)

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

function positions(uint256 tokenId) external view returns (Position memory);

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

function nextId() external view returns (uint256)

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

function arena()  external  view  returns  (address)

Returns:

Name

Type

Description

arena

address

The address for the arena contract

WETH9

Returns the address of the wrapped ether

function WETH9()  external  view  returns  (address)

Returns:

Name

Type

Description

WETH9

address

The address for WETH9

IQuoter

accountPositions

Returns all the position details belonging to an account

function accountPositions(address account) external view returns (Position[] memory)

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

function quoteExactInput(BattleTradeParams memory params, address battleAddr) external returns (uint256 spend, uint256 get)

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