Libraries
Functionalities used by other contracts
Last updated
Was this helpful?
Functionalities used by other contracts
Computes the amount of liquidity to be received by the pool, for a given amount of collateral and price range
function getLiquidityFromCs(
uint160 sqrtRatioX96,
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
uint256 amount
)
internal
pure
returns (uint128 liquidity)Params:
Name
Type
Description
sqrtRatioX96
uint160
The current square root ratio
sqrtRatioAX96
uint160
A sqrt ratio
sqrtRatioBX96
uint160
Another sqrt ratio
amount
uint256
The seed collateral amount for minting the liquidity position
Returns:
Name
Type
Description
liquidity
uint128
The amount of liquidity to be received by the pool
Computes the amount of liquidity to be received by the pool, for a given amount of Spear or Shield tokens and price range
Params:
Name
Type
Description
sqrtRatioAX96
uint160
A sqrt ratio
sqrtRatioBX96
uint160
Another sqrt ratio
amount
uint256
The seed Spear or Shield amount for minting the liquidity position
Returns:
Name
Type
Description
liquidity
uint128
The calculated liquidity amount
Provides validation for callbacks from battle
Verifies the arena address of the battle
Params:
Name
Type
Description
arenaAddr
address
The address for the arena contract
battleKey
BattleKey
The battle Key containing a battle's specifications
Last updated
Was this helpful?
Was this helpful?
function getLiquidityFromSToken(uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint256 amount) internal pure returns (uint128 liquidity)function verifyCallback(address arenaAddr, BattleKey memory battleKey) internal view