Get the value of COMP earned for an address that uses the Compound protocol. This can be done using the Lens contract with JSON RPC or another Smart Contract. If you do an eth_call
with JSON RPC, it is free (no gas costs).
- Use the
getCompBalanceMetadataExt
method in the Lens contract https://etherscan.io/address/0xdCbDb7306c6Ff46f77B349188dC18cEd9DF30299#code - Lens address is posted here https://github.com/compound-finance/compound-protocol/blob/master/networks/mainnet.json#L31
- Here is the definition https://github.com/compound-finance/compound-protocol/blob/master/contracts/Lens/CompoundLens.sol#L453
- pass: COMP contract address, Comptroller contract address, and the address you want to know the amount of COMP earned
Alternatively there is a cool tool from KZen networks that does the same thing. https://github.com/KZen-networks/compound-playground#comp
KZen also created the COMP checker page: https://kzen-networks.github.io/comp-checker/
👍