Skip to main content

FeeParameters

Implements

  • Serializable

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new FeeParameters(binStep?, baseFactor?, filterPeriod?, decayPeriod?, reductionFactor?, variableFeeControl?, protocolShare?, maxVolatilityAccumulated?, volatilityAccumulated?, volatilityReference?, indexRef?, time?): FeeParameters

Parameters

NameTypeDefault valueDescription
binStepu320The bin step
baseFactoru320The base factor
filterPeriodu320The filter period, where the fees stays constant
decayPeriodu320The decay period, where the fees are halved
reductionFactoru320The reduction factor, used to calculate the reduction of the accumulator
variableFeeControlu320The variable fee control, used to control the variable fee, can be 0 to disable them
protocolShareu320The share of fees sent to protocol
maxVolatilityAccumulatedu320The max value of volatility accumulated
volatilityAccumulatedu320The value of volatility accumulated
volatilityReferenceu320The value of volatility reference
indexRefu320The index reference
timeu64undefinedThe last time the accumulator was called

Returns

FeeParameters

Defined in

assembly/structs/FeeParameters.ts:28

Properties

baseFactor

baseFactor: u32 = 0

The base factor

Defined in

assembly/structs/FeeParameters.ts:30


binStep

binStep: u32 = 0

The bin step

Defined in

assembly/structs/FeeParameters.ts:29


decayPeriod

decayPeriod: u32 = 0

The decay period, where the fees are halved

Defined in

assembly/structs/FeeParameters.ts:32


filterPeriod

filterPeriod: u32 = 0

The filter period, where the fees stays constant

Defined in

assembly/structs/FeeParameters.ts:31


indexRef

indexRef: u32 = 0

The index reference

Defined in

assembly/structs/FeeParameters.ts:39


maxVolatilityAccumulated

maxVolatilityAccumulated: u32 = 0

The max value of volatility accumulated

Defined in

assembly/structs/FeeParameters.ts:36


protocolShare

protocolShare: u32 = 0

The share of fees sent to protocol

Defined in

assembly/structs/FeeParameters.ts:35


reductionFactor

reductionFactor: u32 = 0

The reduction factor, used to calculate the reduction of the accumulator

Defined in

assembly/structs/FeeParameters.ts:33


time

time: u64

The last time the accumulator was called

Defined in

assembly/structs/FeeParameters.ts:40


variableFeeControl

variableFeeControl: u32 = 0

The variable fee control, used to control the variable fee, can be 0 to disable them

Defined in

assembly/structs/FeeParameters.ts:34


volatilityAccumulated

volatilityAccumulated: u32 = 0

The value of volatility accumulated

Defined in

assembly/structs/FeeParameters.ts:37


volatilityReference

volatilityReference: u32 = 0

The value of volatility reference

Defined in

assembly/structs/FeeParameters.ts:38

Methods

deserialize

deserialize(data, offset): Result<i32>

Parameters

NameType
dataStaticArray<u8>
offseti32

Returns

Result<i32>

Implementation of

Serializable.deserialize

Defined in

assembly/structs/FeeParameters.ts:213


getBaseFee

getBaseFee(): u256

Returns

u256

Notice

Returns the base fee added to a swap, with 18 decimals

Defined in

assembly/structs/FeeParameters.ts:124


getFeeAmount

getFeeAmount(_amount): u256

Parameters

NameTypeDescription
_amountu256The amount of token sent

Returns

u256

The fee amount to add to the amount

Notice

Return the fees to add to an amount

Dev

Rounds amount up, follows amountWithFees = amount + getFeeAmount(amount)

Defined in

assembly/structs/FeeParameters.ts:66


getFeeAmountDistribution

getFeeAmountDistribution(_fees): FeesDistribution

Return the fees distribution added to an amount

Parameters

NameTypeDescription
_feesu256The fee amount

Returns

FeesDistribution

Defined in

assembly/structs/FeeParameters.ts:49


getFeeAmountForC

getFeeAmountForC(_amountWithFees): u256

Parameters

NameTypeDescription
_amountWithFeesu256The amount of token sent

Returns

u256

The fee amount

Notice

Return the fees added when an user adds liquidity and change the ratio in the active bin

Dev

Rounds amount up

Defined in

assembly/structs/FeeParameters.ts:97


getFeeAmountFrom

getFeeAmountFrom(_amountWithFees): u256

Parameters

NameTypeDescription
_amountWithFeesu256The amount of token sent

Returns

u256

The fee amount from the amount sent

Notice

Return the amount of fees from an amount

Dev

Rounds amount up, follows amount = amountWithFees - getFeeAmountFrom(amountWithFees)

Defined in

assembly/structs/FeeParameters.ts:81


getTotalFee

getTotalFee(): u256

Returns

u256

The total fee, with 18 decimals

Notice

Return the total fee, i.e. baseFee + variableFee

Defined in

assembly/structs/FeeParameters.ts:116


getVariableFee

getVariableFee(): u256

Returns

u256

Notice

Returns the variable fee added to a swap, with 18 decimals

Defined in

assembly/structs/FeeParameters.ts:134


serialize

serialize(): StaticArray<u8>

Returns

StaticArray<u8>

Implementation of

Serializable.serialize

Defined in

assembly/structs/FeeParameters.ts:196


updateVariableFeeParameters

updateVariableFeeParameters(_activeId): void

Update the value of the volatility accumulated

Parameters

NameTypeDescription
_activeIdu64The current active id

Returns

void

Defined in

assembly/structs/FeeParameters.ts:156


updateVolatilityAccumulated

updateVolatilityAccumulated(_activeId): void

Update the volatility accumulated

Parameters

NameTypeDescription
_activeIdu64The current active id

Returns

void

Defined in

assembly/structs/FeeParameters.ts:180