AdapterRegistry (v3)

Structs

struct ProtocolBalance {
bytes32 protocolName;
AdapterBalance[] adapterBalances;
}
struct ProtocolMetadata {
string name;
string description;
string websiteURL;
string iconURL;
uint256 version;
}
struct AdapterBalance {
AdapterMetadata metadata;
TokenBalance[] balances;
}
// The struct consists of adapter address and its
// type, which may be "Asset", "Debt", or "Exchange".
struct AdapterMetadata {
address adapterAddress;
bytes32 adapterType;
}
// The struct consists of token and its
// underlying tokens (if exist) balances.
struct FullTokenBalance {
TokenBalance base;
TokenBalance[] underlying;
}
struct TokenBalance {
TokenMetadata metadata;
uint256 amount;
}
// The struct consists of token address,
// token type, and ERC20-style token metadata.
// NOTE: 0xEeee...EEeE address is used for ETH.
struct TokenMetadata {
address tokenAddress;
bytes32 tokenType;
ERC20Metadata erc20;
}
struct ERC20Metadata {
string name;
string symbol;
uint8 decimals;
}

view functions

getBalances

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

Iterates over all the supported protocols, their adapters and supported tokens and appends balances.

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

getProtocolBalances

function getProtocolBalances(address account, bytes32[] protocolNames) returns (ProtocolBalance[])

Iterates over the protocolNames, their adapters and supported tokens and appends balances.

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

getAdapterBalances

function getAdapterBalances(address account, address[] adapters) returns (AdapterBalance[])

Iterates over adapters and their tokens and appends balances.

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

getAdapterBalance

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

Iterates over tokens and appends balances.

NOTE! Filters out zero balances.

getFullTokenBalance

function getFullTokenBalances(bytes32[] tokenType, address[] token) returns (FullTokenBalance[])

Returns the representation of the token's full share (1e18) in the underlying tokens. This function will show the real underlying tokens (e.g. cDAI and cUSDC for Curve Compound pool).

getFinalFullTokenBalance

function getFinalFullTokenBalances(bytes32[] tokenType, address[] token) returns (FullTokenBalance[])

Returns the representation of the token's full share (1e18) in the underlying tokens. This function will try to recover the "deepest" underlying tokens (e.g. DAI and USDC for Curve Compound Pool).

getProtocolNames

function getProtocolNames() returns (bytes32[])

Returns list of protocols' names.

getProtocolsMetadata

function getProtocolsMetadata(bytes32[] protocolName) returns (ProtocolMetadata[])

Returns metadata (name, description, websiteURL, iconURL and version) for the given protocols.

getProtocolAdapters

function getProtocolAdapters(bytes32 protocolName) returns (address[])

Returns adapters addresses.

getSupportedTokens

function getSupportedTokens(address adapter) returns (address[])

Returns adapter's supported tokens.

isValidProtocol

function isValidProtocol(bytes32 protocolName) returns (bool)

Returns true if protocol name is listed in the registry and false otherwise.

getTokenAdapterNames

function getTokenAdapterNames() returns (bytes32[])

Returns list of token adapters' names.

getTokenAdapter

function getTokenAdapter(bytes32 tokenAdapterName) returns (address)

Returns token adapter address.

isValidTokenAdapter

function isValidTokenAdapter(bytes32 tokenAdapterName) returns (bool)

Returns true if token adapter name is listed in the registry and false otherwise.

onlyOwner functions

function addProtocols(bytes32[] protocolNames, ProtocolMetadata[] metadata, address[][] adapters, address[][][] tokens)
function removeProtocols(bytes32[] protocolNames)
function updateProtocolMetadata(bytes32 protocolName, string name, string description, string websiteURL, string iconURL)

Increases protocol version by 1.

function addProtocolAdapters(bytes32 protocolName, address[] adapters, address[][] tokens)

Increases protocol version by 1.

function removeProtocolAdapters(bytes32 protocolName, uint256[] adapterIndices)

Increases protocol version by 1.

function updateProtocolAdapter(bytes32 protocolName, uint256 index, address newAdapterAddress, address[] newSupportedTokens)

Increases protocol version by 1.

function addTokenAdapters(bytes32[] tokenAdapterNames, address[] adapters)
function removeTokenAdapters(bytes32[] tokenAdapterNames)
function updateTokenAdapter(bytes32 tokenAdapterName, address adapter)