AdapterRegistry (v3)


// The struct consists of TokenBalance structs for
// (base) token and its underlying tokens (if exist).
struct FullTokenBalance {
TokenBalanceMeta base;
TokenBalanceMeta[] underlying;
// The struct consists of token's address,
// amount, and ERC20-style metadata.
// NOTE: 0xEeee...EEeE address is used for ETH.
struct TokenBalanceMeta {
address token;
uint256 amount;
ERC20Metadata erc20metadata;
// The struct consists of ERC20-style token metadata.
struct ERC20Metadata {
string name;
string symbol;
uint8 decimals;
// The struct consists of protocol adapter's name
// and array of TokenBalanceWithAdapter structs.
struct AdapterBalance {
bytes32 protocolAdapterName;
TokenBalance[] tokenBalances;
// The struct consists of TokenBalance struct
// and token adapter's name, which should be used
// to retrieve underlying tokens and rates.
struct TokenBalance {
bytes32 tokenAdapterName;
address token;
uint256 amount;
// The struct consists of token address,
// and price per full share (1e18).
struct Component {
address token;
uint256 rate;

Naming convention and adapters' types

We use the following naming convention for the 32-bytes adapters' names.

Bytes indices



Human readable adapter name


Adapter type

Currently, there are the following types:

  • 01 - asset

  • 02 - debt (returned value should be considered as negative)

  • 03 - exchange (does not return any balances; used only for interactive adapters)

view functions


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.


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

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


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

Iterates over tokens and appends balances.


function getFullTokenBalances(bytes32[] tokenAdapterNames, address[] tokens) returns (FullTokenBalance[])
function getFullTokenBalances(TokenBalance[] tokenBalances) 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).

If used function with tokenBalances as arguments, amounts of underlying tokens will be also calculated.


function getProtocolAdapterNames() returns (bytes32[])

Returns list of protocol adapters' names.


function getProtocolAdapterAddress(bytes32 protocolAdapterName) returns (address)

Returns list of protocol adapters' names.


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

Returns adapter's supported tokens.


function getTokenAdapterNames() returns (bytes32[])

Returns list of token adapters' names.


function getTokenAdapterAddress(bytes32 tokenAdapterName) returns (address)

Returns token adapter address.

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
function addTokenAdapters(
bytes32[] calldata newTokenAdapterNames,
address[] calldata newTokenAdapterAddresses
function updateTokenAdapters(
bytes32[] calldata names,
address[] calldata newTokenAdapterAddresses
function removeTokenAdapters(
bytes32[] calldata names