Skip to main content

Bin

Implements​

  • Serializable

Table of contents​

Constructors​

Properties​

Methods​

Constructors​

constructor​

• new Bin(reserveX?, reserveY?, accTokenXPerShare?, accTokenYPerShare?): Bin

Parameters​

NameTypeDefault valueDescription
reserveXu256ZEROThe current reserve of tokenX of the bin
reserveYu256ZEROThe current reserve of tokenY of the bin
accTokenXPerShareu256ZERO-
accTokenYPerShareu256ZERO-

Returns​

Bin

Defined in​

assembly/structs/Bin.ts:13

Properties​

accTokenXPerShare​

• accTokenXPerShare: u256 = ZERO

Defined in​

assembly/structs/Bin.ts:16


accTokenYPerShare​

• accTokenYPerShare: u256 = ZERO

Defined in​

assembly/structs/Bin.ts:17


reserveX​

• reserveX: u256 = ZERO

The current reserve of tokenX of the bin

Defined in​

assembly/structs/Bin.ts:14


reserveY​

• reserveY: u256 = ZERO

The current reserve of tokenY of the bin

Defined in​

assembly/structs/Bin.ts:15

Methods​

deserialize​

▸ deserialize(data, offset): Result<i32>

Parameters​

NameType
dataStaticArray<u8>
offseti32

Returns​

Result<i32>

Implementation of​

Serializable.deserialize

Defined in​

assembly/structs/Bin.ts:97


serialize​

▸ serialize(): StaticArray<u8>

Returns​

StaticArray<u8>

Implementation of​

Serializable.serialize

Defined in​

assembly/structs/Bin.ts:88


updateFees​

▸ updateFees(pair, fees, swapForY, totalSupply): void

Update the fees of the pair and accumulated token per share of the bin

Parameters​

NameTypeDescription
pairPairInformation-
feesFeesDistributionThe fees amounts added to the pairFees
swapForYboolwhether the token sent was Y (true) or X (false)
totalSupplyu256The total supply of the token id

Returns​

void

Defined in​

assembly/structs/Bin.ts:28


updateReserves​

▸ updateReserves(pair, swapForY, amountInToBin, amountOutOfBin): void

Update reserves

Parameters​

NameTypeDescription
pairPairInformationThe pair information
swapForYboolwhether the token sent was Y (true) or X (false)
amountInToBinu256The amount of token that is added to the bin without fees
amountOutOfBinu256The amount of token that is removed from the bin

Returns​

void

Defined in​

assembly/structs/Bin.ts:61