๐Ÿ›ฐ๏ธRouter

This page describes multipool router smart contract

Visit GitHub to see full implementation

MultipoolRouter

State Variables

isContractAllowedToCall

mapping(address => bool) isContractAllowedToCall;

Functions

toggleContract

function toggleContract(address contractAddress) public onlyOwner;

processCall

function processCall(Call memory call, uint index, bool isPredecessing) internal;

swap

function swap(
    address poolAddress,
    SwapArgs calldata swapArgs,
    Call[] calldata paramsBefore,
    Call[] calldata paramsAfter
)
    external
    payable;

Errors

CallFailed

error CallFailed(uint callNumber, bool isPredecessing);

InsufficientEthBalance

error InsufficientEthBalance(uint callNumber, bool isPredecessing);

InsufficientEthBalanceCallingSwap

error InsufficientEthBalanceCallingSwap();

ContractCallNotAllowed

error ContractCallNotAllowed(address target);

Structs

TokenTransferParams

struct TokenTransferParams {
    address token;
    address targetOrOrigin;
    uint amount;
}

RouterApproveParams

struct RouterApproveParams {
    address token;
    address target;
    uint amount;
}

WrapParams

struct WrapParams {
    address weth;
    bool wrap;
    uint ethValue;
}

Call

struct Call {
    CallType callType;
    bytes data;
}

SwapArgs

struct SwapArgs {
    ForcePushArgs forcePushArgs;
    AssetArgs[] assetsToSwap;
    bool isExactInput;
    address receiverAddress;
    bool refundEthToReceiver;
    address refundAddress;
    uint ethValue;
}

Enums

CallType

enum CallType {
    ERC20Transfer,
    ERC20Approve,
    Any,
    Wrap
}

Last updated