TokenAdapter (v3)

Structs

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

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.

tokenType

function tokenType()
view
returns (bytes32)

The function is implemented using the public state variable:

bytes32 public immutable tokenType

The variable is set in the contract's constructors and always returns token type this adapter should be used for.