Skip to content

Instantly share code, notes, and snippets.

@gnardini
Created December 29, 2021 04:33
Show Gist options
  • Save gnardini/02c14d80b7a069e2d8f043a45da06aa1 to your computer and use it in GitHub Desktop.
Save gnardini/02c14d80b7a069e2d8f043a45da06aa1 to your computer and use it in GitHub Desktop.
const kit = await getContractKit()
const dollar = await kit.contracts.getStableToken(StableToken.cUSD);
const rewardsTransfers = await dollar.getPastEvents('Transfer', {
fromBlock: '0',
toBlock: 'latest',
filter: {
// from is a list of all the rewards contract addresses
from: ['0x811d62024653F95219Cd011F9058f79aCDa2Af0f', '0x7dA1bBa5f1C146A1873035CEEe216411B7fCa379', '0xa84172A779798e9b75131595614b3130E8E13Dc5'],
to: '0xf44e0c4e32f83a4b862d31e221dd462dcccbb6b4'
}
})
// This logs a list of all the earnings. We'd need to add them up to show the total
console.log(rewardsTransfers.map(r => r.returnValues.value))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment