AdapterRegistry (v2/current)

Structs

struct ProtocolBalance {
ProtocolMetadata metadata;
AdapterBalance[] adapterBalances;
}
struct ProtocolMetadata {
string name;
string description;
string websiteURL;
string iconURL;
uint256 version;
}
struct AdapterBalance {
AdapterMetadata metadata;
FullTokenBalance[] balances;
}
// Adapter type may be "Asset" or "Debt"
struct AdapterMetadata {
address adapterAddress;
string adapterType;
}
// Base token and its underlying tokens (if exist) balances
struct FullTokenBalance {
TokenBalance base;
TokenBalance[] underlying;
}
struct TokenBalance {
TokenMetadata metadata;
uint256 amount;
}
// ERC20-style token metadata
// 0xEeee...EEeE address is used for ETH
struct TokenMetadata {
address token;
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, string[] 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 getFullTokenBalance(string 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 getFinalFullTokenBalance(string 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 (string[])

Returns list of protocols' names.

getProtocolMetadata

function getProtocolMetadata(string protocolName) returns (ProtocolMetadata)

Returns name, description, websiteURL, iconURL and version of the protocol.

getProtocolAdapters

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

Returns adapters addresses.

getSupportedTokens

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

Returns adapter's supported tokens.

isValidProtocol

function isValidProtocol(string protocolName) returns (bool)

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

getTokenAdapterNames

function getTokenAdapterNames() returns (string[])

Returns list of token adapters' names.

getTokenAdapter

function getTokenAdapter(string tokenAdapterName) returns (address)

Returns token adapter address.

isValidTokenAdapter

function isValidTokenAdapter(string tokenAdapterName) returns (bool)

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

onlyOwner functions

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

Increases protocol version by 1.

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

Increases protocol version by 1.

function removeProtocolAdapters(string protocolName, uint256[] adapterIndices)

Increases protocol version by 1.

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

Increases protocol version by 1.

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