ProtocolAdapterRegistry

Structs

// The struct consists of protocol adapter's name
// and array of TokenBalance structs
// with token addresses and absolute amounts.
struct AdapterBalance {
    bytes32 protocolAdapterName;
    TokenBalance[] tokenBalances;
}

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

// The struct consists of token address
// and its absolute amount (may be negative).
struct TokenBalance {
    address token;
    int256 amount;
}

view functions

getBalances

function getBalances(address account) returns (AdapterBalance[])

Iterates over all the supported adapters and supported tokens and appends balances.

NOTE! Filters out zero balances, adapters, and adapters without positive balances.

getAdapterBalances

function getAdapterBalances(address account, bytes32[] protocolAdapterNames) returns (AdapterBalance[])

Iterates over the protocolAdapterNames and their supported tokens and appends balances.

getAdapterBalance

function getAdapterBalance(
    address account,
    address adapter,
    address[] tokens
) returns (AdapterBalance)

Iterates over tokens and appends balances.

getProtocolAdapterNames

function getProtocolAdapterNames() returns (bytes32[])

Returns list of protocol adapters' names.

getProtocolAdapterAddress

function getProtocolAdapterAddress(bytes32 protocolAdapterName) returns (address)

Returns list of protocol adapters' names.

getSupportedTokens

function getSupportedTokens(bytes32 protocolAdapterName) returns (address[])

Returns adapter's supported tokens.

getTokenAdapterNames

function getTokenAdapterNames() returns (bytes32[])

Returns list of token adapters' names.

onlyOwner functions

function addProtocolAdapters(
    bytes32[] calldata newProtocolAdapterNames,
    address[] calldata newProtocolAdapterAddresses,
    address[][] calldata newSupportedTokens
)
function updateProtocolAdapters(
    bytes32[] calldata protocolAdapterNames,
    address[] calldata newProtocolAdapterAddresses,
    address[][] calldata newSupportedTokens
)
function removeProtocolAdapters(
    bytes32[] calldata protocolAdapterNames
)

Last updated