Fortress
Search…
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

1
fToken[] public allMarkets;
Copied!

Solidity

1
Unitroller troll = Unitroller(0xABCD...);
2
fToken fTokens[] = troll.allMarkets();
Copied!

Web3 1.0

1
const unitroller = new web3.eth.Contract(unitrollerAbi, unitrollerAddress);
2
const fTokens = await unitroller.methods.allMarkets().call();
3
const fToken = fTokens[0]; // address of a fToken
Copied!
Last modified 8mo ago