Core

Structs & enums used in the contract

// The struct consists of name of the protocol adapter,
// action type, array of token amounts,
// and some additional data (depends on the protocol).
struct Action {
    bytes32 protocolAdapterName;
    ActionType actionType;
    TokenAmount[] tokenAmounts;
    bytes data;
}

// The struct consists of token address
// and its absolute amount.
struct AbsoluteTokenAmount {
    address token;
    uint256 amount;
}

enum ActionType { None, Deposit, Withdraw }

enum AmountType { None, Relative, Absolute }

Functions

executeActions

The main function for interaction with Core contract. For smart contract integration without Router contract, this function should be used.

function executeActions(
    Action[] actions,
    AbsoluteTokenAmount[] requiredOutputs,
    address payable account
) payable returns (AbsoluteTokenAmount[] actualOutputs)

Parameter

Description

actions

Array of actions to be executed on Core contract.

requiredOutputs

Array of required token amounts to be returned after the execution of all the actions from actions array.

account

Address of the user that receives the resulting tokens.

actualOutputs

Array of actual token amounts to be returned after the execution of all the actions from actions array (note: only tokens from requiredOutputs are listed).

Last updated