FeeHelper

Git Sourcearrow-up-right

Author: Trader Joe

This library contains functions to calculate fees

Functions

verifyFee

Modifier to check that the fee is not too large

modifier verifyFee(uint128 fee);

Parameters

Name
Type
Description

fee

uint128

The fee

verifyProtocolShare

Modifier to check that the protocol share is not too large

modifier verifyProtocolShare(uint128 protocolShare);

Parameters

Name
Type
Description

protocolShare

uint128

The protocol share

getFeeAmountFrom

Calculates the fee amount from the amount with fees, rounding up

Parameters

Name
Type
Description

amountWithFees

uint128

The amount with fees

totalFee

uint128

The total fee

Returns

Name
Type
Description

<none>

uint128

feeAmount The fee amount

getFeeAmount

Calculates the fee amount that will be charged, rounding up

Parameters

Name
Type
Description

amount

uint128

The amount

totalFee

uint128

The total fee

Returns

Name
Type
Description

<none>

uint128

feeAmount The fee amount

getCompositionFee

Calculates the composition fee amount from the amount with fees, rounding down

Parameters

Name
Type
Description

amountWithFees

uint128

The amount with fees

totalFee

uint128

The total fee

Returns

Name
Type
Description

<none>

uint128

The amount with fees

getProtocolFeeAmount

Calculates the protocol fee amount from the fee amount and the protocol share, rounding down

Parameters

Name
Type
Description

feeAmount

uint128

The fee amount

protocolShare

uint128

The protocol share

Returns

Name
Type
Description

<none>

uint128

protocolFeeAmount The protocol fee amount

_verifyFee

Internal function to check that the fee is not too large

Parameters

Name
Type
Description

fee

uint128

The fee

Errors

FeeHelper__FeeTooLarge

FeeHelper__ProtocolShareTooLarge

Last updated