Fortress
Search…
⌃K

Market Metadata

The Unitroller contract has an array called allMarkets that contains the addresses of each fToken contract. Each address in the allMarkets array can be used to fetch a metadata struct in the Unitroller’s markets constant.

Unitroller

fToken[] public allMarkets;

Solidity

Unitroller troll = Unitroller(0xABCD...);
fToken fTokens[] = troll.allMarkets();

Web3 1.0

const unitroller = new web3.eth.Contract(unitrollerAbi, unitrollerAddress);
const fTokens = await unitroller.methods.allMarkets().call();
const fToken = fTokens[0]; // address of a fToken