Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MockFeeManager

Git Source

Inherits: IFeeManager

Title: MockFeeManager

Mock implementation of IFeeManager for testing Mayan contracts

Handles fee calculations and deposits with configurable values

State Variables

_feeCollector

address public _feeCollector

_defaultProtocolBps

uint8 public _defaultProtocolBps

protocolBps

mapping(address => mapping(bytes32 => mapping(uint16 => uint8))) public protocolBps

Functions

constructor

constructor(address feeCollector_, uint8 defaultProtocolBps_) ;

feeCollector

Get the fee collector address

function feeCollector() external view returns (address);

depositFee

Deposit fee for a relayer

function depositFee(address relayer, address token, uint256 amount) external;

Parameters

NameTypeDescription
relayeraddressThe relayer address
tokenaddressThe token address
amountuint256The fee amount

calcProtocolBps

Calculate protocol basis points for MayanCircle

function calcProtocolBps(uint64 amount, address tokenIn, bytes32 tokenOut, uint16 destChain, uint8 referrerBps)
    external
    view
    returns (uint8);

Parameters

NameTypeDescription
amountuint64The transaction amount
tokenInaddressThe input token
tokenOutbytes32The output token (bytes32)
destChainuint16The destination chain
referrerBpsuint8The referrer basis points

Returns

NameTypeDescription
<none>uint8The protocol basis points

calcFastMCTPProtocolBps

Calculate protocol basis points for FastMCTP

function calcFastMCTPProtocolBps(
    uint8 payloadType,
    address localToken,
    uint256 cctpAmount,
    address tokenOut,
    address referrerAddr,
    uint8 referrerBps
) external view returns (uint8);

Parameters

NameTypeDescription
payloadTypeuint8The payload type
localTokenaddressThe local token
cctpAmountuint256The CCTP amount
tokenOutaddressThe output token
referrerAddraddressThe referrer address
referrerBpsuint8The referrer basis points

Returns

NameTypeDescription
<none>uint8The protocol basis points

setProtocolBps

Set protocol basis points for a specific configuration (testing only)

function setProtocolBps(address tokenIn, bytes32 tokenOut, uint16 destChain, uint8 bps) external;

setFeeCollector

Set the fee collector (testing only)

function setFeeCollector(address newFeeCollector) external;

setDefaultProtocolBps

Set the default protocol basis points (testing only)

function setDefaultProtocolBps(uint8 newBps) external;

rescueTokens

Rescue tokens from this contract (testing only)

function rescueTokens(address token, address to, uint256 amount) external;