TokenAdapterRegistry

Structs

// The struct consists of TokenBalanceMeta structs for
// (base) token and its underlying tokens (if any).
struct FullTokenBalance {
    TokenBalanceMeta base;
    TokenBalanceMeta[] underlying;
}

// The struct consists of TokenBalance struct
// with token address and absolute amount
// and ERC20Metadata struct with ERC20-style metadata.
// NOTE: 0xEeee...EEeE address is used for ETH.
struct TokenBalanceMeta {
    TokenBalance tokenBalance;
    ERC20Metadata erc20metadata;
}

// The struct consists of ERC20-style token metadata.
struct ERC20Metadata {
    string name;
    string symbol;
    uint8 decimals;
}


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


// The struct consists of token address,
// and price per full share (1e18).
struct Component {
    address token;
    uint256 rate;
}

view functions

getFullTokenBalance

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.

getFinalFullTokenBalance

function getFinalFullTokenBalances(
    bytes32[] tokenAdapterNames,
    address[] tokens
) returns (FullTokenBalance[])

function getFinalFullTokenBalances(
    TokenBalance[] tokenBalances
) returns (FullTokenBalance[])

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

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

getTokenAdapterNames

function getTokenAdapterNames() returns (bytes32[])

Returns list of token adapters' names.

getTokenAdapterAddress

function getTokenAdapterAddress(bytes32 tokenAdapterName) returns (address)

Returns token adapter address.

getTokenAdapterName

function getTokenAdapterName(address token) returns (bytes32)

getTokenHash

function getTokenHash(address token) returns (bytes32)

onlyOwner functions

function addTokenAdapterNames(
    address[] newTokens,
    bytes32[] newTokenAdapterNames
)
function updateTokenAdapterNames(
    address[] tokens,
    bytes32[] newTokenAdapterNames
)
function removeTokenAdapterNames(address[] tokens)
function addTokenAdapters(
    bytes32[] newTokenAdapterNames,
    address[] newTokenAdapterAddresses
)
function updateTokenAdapters(
    bytes32[] tokenAdapterNames,
    address[] newTokenAdapterAddresses
)
function removeTokenAdapters(
    bytes32[] tokenAdapterNames
)

Last updated