-
Notifications
You must be signed in to change notification settings - Fork 4
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 Migrator #410
Add Migrator #410
Conversation
Code Review - MigratorRequirementsWe wish to provide one transaction + approval of OGV and veOGV stakes to OGN and xOGN stakes. This contract collects ogv to the user's address, and then burns it there using an approval. OGN is then sent to a new stake for the user's address and/or sent directly to the user. A simple migrate method can just burn and transfers without touching the staking system. Authentication
Ethereum
Cryptographic codeNo crypto Gas problems
Black magic
Overflow
Proxy
Events
Medium ChecksRounding
Dependencies
External calls
Tests
DeployDeploy file not yet written Logic
Logic looks correct. Deployment ConsiderationsNo deploy yet Internal State
AttackThis code will hold and then distribute 40%ish of the circulating supply of OGN. An exploit could have major financial consequences for token holders. Although OGV is the current governance token and xOGN will be the future governance token, this migration contract should not be able to directly cause a loss of governance, since during the migration period, a multisig will temporary control governance. We will be topping off the code with excess OGN tokens, since we don't know precisely when the migration will start. If the deployer still had governance, they could skim off excess tokens. We plan to move tokens to this contract and start() it from the same governance transaction, which means the governance action would fail if the migration contract was not owned by governance. A concern would be if a user could take OGV tokens from someone else. This does not appear to be possible since all funds pulls are from msg.sender. Another concern would be getting too many tokens for a conversion. The conversion rate matches the governance proposal. We will have another sanity check in that the amount of OGN initially transferred to the contract will be checked. Finally, the isSolvent modifier should revert if we give out too many tokens. FlavorFlavor is good. |
Code Review - veOGVRequirements
Authentication
Ethereum
Cryptographic codeno crypto Gas problems
Black magic
Overflow
Proxy
Events
Rounding
Dependencies
External calls
DeployNo deploy code written When deploy code is written, a collect call should be made just before this upgrade. LogicLogic appears correct. Internal State
AttackThis contract holds 3.7 billion OGV, which will soon be convertible to OGN - 40 something million at today's prices. An attack would attempt to gain access to another user's tokens, get more tokens than owed, or double withdraw.
FlavorThe code is slightly awkward because of the tension between keeping backwards compatibility versus most functionality no longer being needed. However there is not any anticipated future work on this contract, and it's okay as is. |
Noting that we should do some fork testing of this during the audit. |
* Add OGNRewardsSource contract * Make collectRewards only callable by RewardsTarget * Draft xOGN staking contract * Correct maxStakeDuration * Add penalty event * Change names * Fix lockup ID * Revert change and cast properly * Gas opts * Remove casting * Add `getLockupsCount` method (#411) * Allow non-duration change amount increase staking extends * Add tests, add move lockupid code * Add Migrator (#410) * Add Migrator contract * Fix some tests * Code review changes * Update OgvStaking tests * Disable delegation tests * Allow just unstakes * Fix comment * More cleanup * Fix brownie tests * Return 0 if uninitialized (#415) * Check available balance in `previewRewards` (#413) * Check available balance in `previewRewards` * Chore: forge fmt --------- Co-authored-by: Daniel Von Fange <[email protected]> --------- Co-authored-by: Daniel Von Fange <[email protected]>
* Add OGNRewardsSource contract * Make collectRewards only callable by RewardsTarget * Draft xOGN staking contract * Correct maxStakeDuration * Add penalty event * Change names * Fix lockup ID * Revert change and cast properly * Gas opts * Remove casting * Add `getLockupsCount` method (#411) * Allow non-duration change amount increase staking extends * Add tests, add move lockupid code * Add Migrator (#410) * Add Migrator contract * Fix some tests * Code review changes * Update OgvStaking tests * Disable delegation tests * Allow just unstakes * Fix comment * More cleanup * Fix brownie tests * Return excess OGN rather than burn * Simplify calculation * Return 0 if uninitialized (#415) * Check available balance in `previewRewards` (#413) * Check available balance in `previewRewards` * Chore: forge fmt --------- Co-authored-by: Daniel Von Fange <[email protected]> * Fix: Remove unused errors (#416) * First draft of deploy file * Add fork test tooling (#419) --------- Co-authored-by: Shahul Hameed <[email protected]>
If you made a contract change, make sure to complete the checklist below before merging it in master.
Contract change checklist: