IAbstractFeeModule

Git Source

Author: DEFYCA Labs S.à.r.l

Copyright © 2023 DEFYCA Labs S.à.r.l Permission is hereby granted, free of charge, to any person obtaining a copy of the Frictionless protocol smart contracts (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DEFYCA LABS S.à.r.l BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Functions

getFeeInfo

get the FeeInfo for a given key.

function getFeeInfo(bytes32 feeKey_) external view returns (FeeInfo memory);

Parameters

NameTypeDescription

feeKey_

bytes32

the key as generated by the function getTokenFeeKey

Returns

NameTypeDescription

<none>

FeeInfo

FeeInfo the fees associated with a token transfer.

getFeeInBps

get the feeInBps value for a given key

function getFeeInBps(bytes32 tokenFeeKey_) external view returns (uint256);

Parameters

NameTypeDescription

tokenFeeKey_

bytes32

the key as generated by the function getTokenFeeKey

Returns

NameTypeDescription

<none>

uint256

the feeInBps value

getFeeRecipient

get the feeRecipientAddr value for a given key

function getFeeRecipient(bytes32 tokenFeeKey_) external view returns (address);

Parameters

NameTypeDescription

tokenFeeKey_

bytes32

the key as generated by the function getTokenFeeKey

Returns

NameTypeDescription

<none>

address

the feeRecipientAddr value

calculateFeeAmount

Calculates the actual fee in absolute terms for a given fee in basis points.

function calculateFeeAmount(uint256 tokensAmount_, uint256 feeInBps_) external pure returns (uint256 feeAmount_);

Parameters

NameTypeDescription

tokensAmount_

uint256

the amount of tokens used to determine the base calculation.

feeInBps_

uint256

the fee in basis points for calculation.

Returns

NameTypeDescription

feeAmount_

uint256

the actual fee in absolute terms for a given fee in basis points.

Events

FrictionlessFeeSet

Event emitted during _setTokenFee

event FrictionlessFeeSet(bytes32 indexed feeKey, FeeInfo feeInfo);

Errors

AbstractFeeModuleInvalidFeeRecipient

error thrown if the recipient is a zero address

error AbstractFeeModuleInvalidFeeRecipient();

AbstractFeeModuleInvalidFee

error thrown if the feesInBps is outside the valid range

error AbstractFeeModuleInvalidFee(uint256 feeInBps);

Structs

FeeInfo

Struct which defines the FeeInfo, representing the fee in basis points and the recipient of the fees on-chain.

struct FeeInfo {
    uint256 feeInBps;
    address feeRecipientAddr;
}
Logo

Copyright © 2024 Frictionless Markets S.à.r.l