Bin
Implements
Serializable
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new Bin(reserveX?, reserveY?, accTokenXPerShare?, accTokenYPerShare?): Bin
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
reserveX | u256 | ZERO | The current reserve of tokenX of the bin |
reserveY | u256 | ZERO | The current reserve of tokenY of the bin |
accTokenXPerShare | u256 | ZERO | - |
accTokenYPerShare | u256 | ZERO | - |
Returns
Defined in
Properties
accTokenXPerShare
• accTokenXPerShare: u256 = ZERO
Defined in
accTokenYPerShare
• accTokenYPerShare: u256 = ZERO
Defined in
reserveX
• reserveX: u256 = ZERO
The current reserve of tokenX of the bin
Defined in
reserveY
• reserveY: u256 = ZERO
The current reserve of tokenY of the bin
Defined in
Methods
deserialize
▸ deserialize(data, offset): Result<i32>
Parameters
| Name | Type |
|---|---|
data | StaticArray<u8> |
offset | i32 |
Returns
Result<i32>
Implementation of
Serializable.deserialize
Defined in
serialize
▸ serialize(): StaticArray<u8>
Returns
StaticArray<u8>
Implementation of
Serializable.serialize
Defined in
updateFees
▸ updateFees(pair, fees, swapForY, totalSupply): void
Update the fees of the pair and accumulated token per share of the bin
Parameters
| Name | Type | Description |
|---|---|---|
pair | PairInformation | - |
fees | FeesDistribution | The fees amounts added to the pairFees |
swapForY | bool | whether the token sent was Y (true) or X (false) |
totalSupply | u256 | The total supply of the token id |
Returns
void
Defined in
updateReserves
▸ updateReserves(pair, swapForY, amountInToBin, amountOutOfBin): void
Update reserves
Parameters
| Name | Type | Description |
|---|---|---|
pair | PairInformation | The pair information |
swapForY | bool | whether the token sent was Y (true) or X (false) |
amountInToBin | u256 | The amount of token that is added to the bin without fees |
amountOutOfBin | u256 | The amount of token that is removed from the bin |
Returns
void