TokenAdapter (v3)

Structs

struct ERC20Metadata {
string name;
string symbol;
uint8 decimals;
}
// The struct consists of token address
// and price per full share (1e18).
struct Component {
address tokenAddress;
uint256 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).

In case base token has a component with negative rate, this negative value should be converted to uint256, e.g. if exchangeRate is amount of debt per 1e18 base tokens, rate will beuint256(-exchangeRate).

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.