Quoter
Gets the expected token deltas without executing a swap or providing liquidity. Returns position information for liquidity providers.
tradeCallback
Callback function that handles the result of a trade. It reverts with the trade amounts.
Params:
Name | Type | Description |
cAmount | uint256 | Amount of collateral token input spent to be spent for the trade |
sAmount | uint256 | Amount of Spear or Shield token output to be received for the trade |
data | bytes | Data passed through by the caller |
parseRevertReason
Parses a revert reason that should contain the numeric quote
Params:
Name | Type | Description |
reason | bytes | The revert reason bytes |
Returns:
Type | Description |
uint256 | The first parsed value |
uint256 | The second parsed value |
quoteExactInput
Returns the amounts to spend or receive for a given exact input swap without executing the swap
Params:
Name | Type | Description |
BattleTradeParams | memory | Parameters for a trade action. See Params |
battleAddr | address | The address of the battle contract |
Returns:
Name | Type | Description |
spend | uint256 | The amount of collateral to spend |
get | uint256 | The amount of Spear or shield to receive |
getSTokenByLiquidity
Calculates the amount of Spear or shield tokens based on the given liquidity
Params:
Name | Type | Description |
AddLiqParams | params | Params required for adding liquidity. See Params |
Returns:
Name | Type | Description |
SToken | uint256 | The amount of Spear or Shield token calculated based on the given liquidity |
getSTokenByLiquidityWhenCreate
Calculates the amount of Spear or shield tokens based on the given amount of seed collateral when a liquidity position is created
Params:
Name | Type | Description |
sqrtPriceX96 | uint160 | The current sqrt price |
tickLower | int24 | The lower tick boundary of the position |
tickUpper | int24 | The upper tick boundary of the position |
amount | uint256 | The seed collateral amount for minting the liquidity position |
Returns:
Type | Description |
uint256 | The amount of Spear or Shield token calculated based on the given liquidity |
positions
Gets the position information for the given token ID
Params:
Name | Type | Description |
tokenId | uint256 | The ID of the NFT that represents the liquidity position |
Returns:
Type | Description |
Position | The position data |
handlePosition
Gets the position information for the given token ID
Params:
Name | Type | Description |
tokenId | uint256 | The ID of the NFT that represents the liquidity position |
Returns:
Type | Description |
Position | The position data |
accountPositions
Gets the positions for the given account
Params:
Name | Type | Description |
account | address | The account address |
Returns:
Name | Type | Description |
Position | memory | Position details |
Last updated