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
reserveXu256u256.ZeroThe current reserve of tokenX of the bin
reserveYu256u256.ZeroThe current reserve of tokenY of the bin
accTokenXPerShareu256u256.Zero-
accTokenYPerShareu256u256.Zero-

Returns

Bin

Defined in

assembly/structs/Bin.ts:12

Properties

accTokenXPerShare

accTokenXPerShare: u256 = u256.Zero

Defined in

assembly/structs/Bin.ts:15


accTokenYPerShare

accTokenYPerShare: u256 = u256.Zero

Defined in

assembly/structs/Bin.ts:16


reserveX

reserveX: u256 = u256.Zero

The current reserve of tokenX of the bin

Defined in

assembly/structs/Bin.ts:13


reserveY

reserveY: u256 = u256.Zero

The current reserve of tokenY of the bin

Defined in

assembly/structs/Bin.ts:14

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:96


serialize

serialize(): StaticArray<u8>

Returns

StaticArray<u8>

Implementation of

Serializable.serialize

Defined in

assembly/structs/Bin.ts:87


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:27


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:60