The Comptroller contract has an array called
allMarkets that contains the addresses of each sToken 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.
SToken public allMarkets;
Comptroller troll = Comptroller(0xABCD...);SToken sTokens = troll.allMarkets();
const comptroller = new web3.eth.Contract(comptrollerAbi, comptrollerAddress);const sTokens = await comptroller.methods.allMarkets().call();const sToken = sTokens; // address of a sToken