-
Notifications
You must be signed in to change notification settings - Fork 9
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
Staking #1
Conversation
Because solidity-coverage don't support them.
To avoid reentrancy. Although staking token should be safe, it's better to have it this way. Besides, it's better to have require first too.
For consistency with check that amount is not zero when creating a lock. Besides it will avoid having 'garbage' in active lock ids array, which would make operations like checking unlocked balance more expensive.
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.
Mostly some small setup-related comments from an in-progress review
contracts/test/TestImports.sol
Outdated
|
||
contract TestImports { | ||
constructor() public { | ||
// to avoid lint error |
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.
We can upgrade solium to eth-lint and use the new ignore syntax: https://github.com/aragon/aragon-apps/blob/master/apps/voting/contracts/test/TestImports.sol#L25
@@ -0,0 +1,218 @@ | |||
// Copied from https://github.com/OpenZeppelin/openzeppelin-solidity/blob/a9f910d34f0ab33a1ae5e714f69f9596a02b4d91/contracts/token/ERC20/StandardToken.sol |
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.
The token mocks used by aragon-apps
are now available as part of @aragon/test-helpers
"license": "(GPL-3.0-or-later OR MIT)", | ||
"repository": "https://github.com/aragon/staking", | ||
"devDependencies": { | ||
"@aragon/apps-shared-migrations": "1.0.0", |
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.
What do you think about just adding the file?
package.json
Outdated
}, | ||
"dependencies": { | ||
"@aragon/test-helpers": "^1.0.1", | ||
"@aragon/os": "^4.0.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.
Let's upgrade and pin this.
console.log(1) | ||
const echidnaStaking = await EchidnaStaking.new() | ||
//console.log(echidnaStaking.constructor._json) | ||
console.log(2, echidnaStaking.address) |
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 assume we could clean this up a bit, or remove it (seems like we should be using the .sh
version?)
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.
Nice job @bingen! Looks really good, left some suggestions and questions as well, and some other cosmetic stuff. Let me know if I can help addressing those comments that you agree if it makes sense 🤗
Co-Authored-By: bingen <bingentxu@gmail.com>
* Optimize some gas in checkpointing library * Address PR #4 comments
- Add getLatestValue for Checkpointing - Optimize Checkpointing binary search - Add max locks per account - Move stakedhistory into Account struct
- Add getLatestValue for Checkpointing - Optimize Checkpointing binary search - Add max locks per account - Move stakedhistory into Account struct
- Add getLatestValue for Checkpointing - Optimize Checkpointing binary search - Add max locks per account - Move stakedhistory into Account struct
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! Left really minor comments 👏
// assuming a safety max gas of ~6M, 5,000 locks is a safe value to avoid OOG issues | ||
// it's a sanity check, because as lock uses unlockedBalanceOf, and it's the most expensive | ||
// it's unlikely that locks enough could be created to brick the account | ||
uint256 internal constant MAX_LOCKS = 5000; |
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.
👏
No description provided.