RFP 16: Dynamic COMP reward distribution

@dakeshi for each deposit, borrow, repay, withdraw, or COMP claim transaction, please report a link to the transaction on Etherscan. We can figure out all details from those.

To get the portion of the market,

  1. Go to the network config file
  2. Find the address of the cToken you’re interacting with (ex: cUSDC)
  3. Go to the Etherscan page for the contract (search by address), go to the “Contract” tab, then click on “Read Contract” (ex: https://ropsten.etherscan.io/address/0x2973e69b20563bcc66dC63Bde153072c33eF37fe#readContract)
  4. If borrowing in this cToken market, read totalBorrows. Otherwise, read totalSupply.
  5. Add the amount you are borrowing/supplying to totalBorrows/totalSupply (respectively)
  6. Divide the amount of the underlying you are borrowing/supplying (mantissa) by totalBorrows/totalSupply (respectively) to get the portion of the market.

Example for borrowing 1000 USDC:

  • USDC has 6 decimal places, so the mantissa USDC amount is 1000e6 = 1000000000
  • At this time, totalBorrows = 1115004256069
  • After my borrow transaction, totalBorrows = 1115004256069 + 1000000000 = 1116004256069
  • Portion of market = 1000000000/1116004256069 = 0.000896 = 0.0896%
1 Like