LiquidityConfigurations
Last updated
Last updated
This library contains functions to encode and decode the config of a pool and interact with the encoded bytes32.
Encode the distributionX, distributionY and id into a single bytes32
Parameters
distributionX
uint64
The distribution of the first token
distributionY
uint64
The distribution of the second token
id
uint24
The id of the pool
Returns
config
bytes32
The encoded config as follows: [0 - 24[: id [24 - 88[: distributionY [88 - 152[: distributionX [152 - 256[: empty
Decode the distributionX, distributionY and id from a single bytes32
Parameters
config
bytes32
The encoded config as follows: [0 - 24[: id [24 - 88[: distributionY [88 - 152[: distributionX [152 - 256[: empty
Returns
distributionX
uint64
The distribution of the first token
distributionY
uint64
The distribution of the second token
id
uint24
The id of the bin to add the liquidity to
Get the amounts and id from a config and amountsIn
Parameters
config
bytes32
The encoded config as follows: [0 - 24[: id [24 - 88[: distributionY [88 - 152[: distributionX [152 - 256[: empty
amountsIn
bytes32
The amounts to distribute as follows: [0 - 128[: x1 [128 - 256[: x2
Returns
<none>
bytes32
amounts The distributed amounts as follows: [0 - 128[: x1 [128 - 256[: x2
<none>
uint24
id The id of the bin to add the liquidity to