BaseOftMessageExecutor

Git Source

Inherits: IOftMessageExecutor

Title: BaseOftMessageExecutor

Author: Malda Protocol

Base implementation for OFT message executors used via delegatecall by bridges.

Functions

processUncomposed

Processes stored/uncomposed messages for a market by falling back to underlying.

function processUncomposed(address market, address underlying, address bridgeContract)
    external
    payable
    virtual
    override;

Parameters

NameTypeDescription
marketaddressThe market address.
underlyingaddressThe underlying token address.
bridgeContractaddressThe bridge contract used for OFT operations.

executeCompose

Executes a compose step for a market by falling back to underlying.

function executeCompose(address market, address underlying, address bridgeContract)
    external
    payable
    virtual
    override;

Parameters

NameTypeDescription
marketaddressThe market address.
underlyingaddressThe underlying token address.
bridgeContractaddressThe bridge contract used for OFT operations.

_pullFromRebalancer

Pulls tokens from the rebalancer.

function _pullFromRebalancer(address underlying, uint256 amount, address rebalancer) internal;

Parameters

NameTypeDescription
underlyingaddressThe underlying token address.
amountuint256The amount of tokens to pull.
rebalanceraddressThe rebalancer address.

_approve

Approves tokens to a spender.

function _approve(address token, address spender, uint256 amount) internal;

Parameters

NameTypeDescription
tokenaddressThe token address.
spenderaddressThe spender address.
amountuint256The amount of tokens to approve.

_sendOFT

Sends tokens via OFT.

function _sendOFT(address oft, SendParam calldata params, MessagingFee calldata fees, address refundAddress)
    internal
    returns (MessagingReceipt memory receipt);

Parameters

NameTypeDescription
oftaddressThe OFT address.
paramsSendParamThe send parameters.
feesMessagingFeeThe messaging fees.
refundAddressaddressThe refund address.

Returns

NameTypeDescription
receiptMessagingReceiptThe messaging receipt.

_fallbackToUnderlying

Falls back to underlying if the bridge contract is not the underlying.

function _fallbackToUnderlying(address market, address underlying, address bridgeContract) internal;

Parameters

NameTypeDescription
marketaddressThe market address.
underlyingaddressThe underlying token address.
bridgeContractaddressThe bridge contract used for OFT operations.

_verifyMinted

Verifies the minted tokens.

function _verifyMinted(address oft, uint256 required) internal view;

Parameters

NameTypeDescription
oftaddressThe OFT address.
requireduint256The required amount of tokens.

Errors

Executor_NoOft

error Executor_NoOft();

Executor_AmountMismatch

error Executor_AmountMismatch();

Executor_WrongUnderlying

error Executor_WrongUnderlying();

Executor_NotRebalancer

error Executor_NotRebalancer();