Skip to content

AbstractFeeModule

Git Source

Inherits: IAbstractFeeModule

Author: Originally developed by DEFYCA Labs S.a.r.l., maintained by Nestor Exchange OÜ

MIT Licence. Originally Copyright © 2023 DEFYCA Labs S.a.r.l.

State Variables

ZERO_FEES_IN_BPS

Represents 0 bps in fees (the minima of fees or 0%)

uint256 public constant ZERO_FEES_IN_BPS = 0;

MAX_FEES_IN_BPS

Represents 10000 bps in fees (the maxima of fees or 100%)

uint256 public constant MAX_FEES_IN_BPS = 10000;

_feesInfo

mapping(bytes32 => FeeInfo) private _feesInfo;

Functions

getFeeInfo

function getFeeInfo(bytes32 tokenFeeKey_) public view override returns (FeeInfo memory);

getFeeInBps

function getFeeInBps(bytes32 tokenFeeKey_) public view override returns (uint256);

getFeeRecipient

function getFeeRecipient(bytes32 tokenFeeKey_) public view override returns (address);

calculateFeeAmount

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

_setTokenFee

function _setTokenFee(bytes32 feeKey_, FeeInfo memory feeInfo_) internal;

_transferFees

function _transferFees(bytes32 feeKey_, IERC20 token_, address tokenSender_, uint256 tokensAmount_) internal returns (uint256);

_validateFeeInfo

Validates the FeeInfo. Throws AbstractFeeModuleInvalidFeeRecipient if zero address. Throws AbstractFeeModuleInvalidFee if out of range.

function _validateFeeInfo(FeeInfo memory feeInfo_) internal pure;