Market Metadata
The Comptroller contract has an array called allMarkets
that contains the addresses of each bToken contract. Each address in the allMarkets
array can be used to fetch a metadata struct in the Comptroller’s markets constant. See the Comptroller Storage contract for the Market struct definition.
Comptroller
BToken[] public allMarkets;
Solidity
Comptroller troll = Comptroller(0xABCD...);
BToken bTokens[] = troll.allMarkets();
Web3 1.2.6
const comptroller = new web3.eth.Contract(comptrollerAbi, comptrollerAddress);
const bTokens = await comptroller.methods.allMarkets().call();
const bToken = bTokens[0]; // address of a bToken
Last updated