-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add EpochRewards smart contract to calculate epoch rewards and payments #1558
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed up to EpochRewards.sol.
Would be great to get a clear explanation of how this works in the docs, though probably out of scope of this PR if we want to get it in soon.
@@ -119,6 +125,23 @@ describe('governance tests', () => { | |||
return blockNumber % epochSize === 0 | |||
} | |||
|
|||
const assertAlmostEqual = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe move this to utils.ts?
packages/protocol/contracts/governance/test/EpochRewardsTest.sol
Outdated
Show resolved
Hide resolved
const rewardsMultiplier = { | ||
max: toFixed(new BigNumber(2)), | ||
adjustments: { | ||
underspend: toFixed(new BigNumber(1 / 2)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will we always want underspend
< 1 and overspend
> 1? If so, should these conditions be required in the contract?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, after thinking about this more, I think this doesn't strictly need to be true, wdyt @rcroessmann?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should enforce both. Especially the condition overspend > 1 seems necessary as the protocol could end up trying to spend more than the remaining cGLD for overspend <= 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending outstanding comments.
* master: (56 commits) Adjust e2e transfer and governance tests to match new fee distribution and eliminate ProposerFraction (#1585) [Wallet] Add more local currencies (#1698) Switch to correct cluster when fauceting (#1687) [Wallet] Use the country of the phone number for determining the default local currency (#1684) [Wallet] Limit QR code scanner to 1 code per second (#1676) Update Dark backgrounds text color (#1677) Remove integration sync test Minor attestation service fixes (#1680) [wallet] Fixed Native phone picker Use native API instead (#1669) Fix token addresses for notification service (#1674) Add golang to setup docs [wallet] Hide invite education copy after invite was redeemed (#1670) [Wallet] Add spinner, timer, and tip text to Verification input screen (#1656) [Wallet] Fix app deprecation check mechanism (#1358) Point end-to-end governance test back to master (#1665) Add EpochRewards smart contract to calculate epoch rewards and payments (#1558) Optimized Attestation view calls and removal of the reveal TX (#1578) Support claim signatures and support Keybase claims (#1575) [Wallet] Add timestamp to top banner messages (#1657) Export geth metrics on VM testnet (#1351) ... # Conflicts: # yarn.lock
Description
This PR adds
EpochRewards.sol
, a smart contract for calculating the actual epoch reward to voters and payments to validators.Tested
Unit and end-to-end tests.
Other changes
None
Related issues
Backwards compatibility
Not backwards compatible