TokenAdapter

Structs

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


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

view functions

getComponents

function getComponents(address token) view returns (Component[])

The function returns underlying tokens and price of the base token's full share (1e18).

getMetadata

function getMetadata(address token) view returns (ERC20Metadata) {
    return ERC20Metadata({
        name: getName(token),
        symbol: getSymbol(token),
        decimals: getDecimals(token)
    });
}

The function returns ERC20-style metadata. It is recommended to override getName(), getSymbol(), and getDecimals() functions, although the whole function may be overridden.

Last updated