Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP: Staking * Add Truffle * Lint * Increase coverage to 100% * Convert ternary conditions into if-else clauses Because solidity-coverage don't support them. * Add Echidna scripts * Fix echidna config * Remove unnecessary checks commented out * Change locksCount parameter name for consistency * Add function headers to Staking * Remove unnecessary variable from locking test * Fix function order * Fix embark test script at package.json * Remove comment from Checkpointing * Optimize gas in checkpointing library * Add tests to echidna * Change error name and description * Check that staking token is a contract * Change functions order * Change stake and unstake inner logic order 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. * Add Transferred event * Modify comments * Add test for canUnlock with an EOA manager * Remove unnecessary check from transferFromLock function * Unlock lock if after transfer from it amount goes down to zero 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. * Add Echidna tests * Clean locking.js * Add temporary README * Change default amounts to 120 * Add `truffleit` script to `npm run test:truffle` * Add conversions to `truffleit` script * Rename stakeHistory to stakedHistory for consistency With totalStakedHistory mainly. * Add Manticore instructions to README * Update contracts/Checkpointing.sol Co-Authored-By: bingen <bingentxu@gmail.com> * Update contracts/Checkpointing.sol Co-Authored-By: bingen <bingentxu@gmail.com> * Update contracts/Staking.sol Comments Co-Authored-By: bingen <bingentxu@gmail.com> * Update contracts/Staking.sol Comments Co-Authored-By: bingen <bingentxu@gmail.com> * Update contracts/ERCStaking.sol Comments Co-Authored-By: bingen <bingentxu@gmail.com> * Update contracts/Staking.sol Comments Co-Authored-By: bingen <bingentxu@gmail.com> * Update contracts/Staking.sol Comments Co-Authored-By: bingen <bingentxu@gmail.com> * Update contracts/Staking.sol Comments Co-Authored-By: bingen <bingentxu@gmail.com> * Update contracts/Staking.sol Comments Co-Authored-By: bingen <bingentxu@gmail.com> * Update contracts/Staking.sol Comments Co-Authored-By: bingen <bingentxu@gmail.com> * Update contracts/Staking.sol Comments Co-Authored-By: bingen <bingentxu@gmail.com> * Update contracts/Staking.sol Comments Co-Authored-By: bingen <bingentxu@gmail.com> * Update contracts/Staking.sol Comments Co-Authored-By: bingen <bingentxu@gmail.com> * Update contracts/Staking.sol Comments Co-Authored-By: bingen <bingentxu@gmail.com> * Update contracts/Staking.sol Comments Co-Authored-By: bingen <bingentxu@gmail.com> * Update contracts/Staking.sol Comments Co-Authored-By: bingen <bingentxu@gmail.com> * Move TimeLockManager to lock-managers folder * Add IStakingLocking interface * Minor changes Addressing PR #1 comments. * Account only for properly staked balance See: #1 (comment) * Rearrange function order and other minor changes Address PR #1 comments. * Optimize _unlock function * Fix test, wrong staking address * Update contracts/Staking.sol Add space after `mapping` Co-Authored-By: bingen <bingentxu@gmail.com> * Rename event * Fix checkpointing test using BN * Move packages from devDependencies to dependencies * Fix weird issue with embark dependency If placed inside devDependencies, it complains saying "could not find specified in dependencies or devdependencies but was found in node_modules relative to that file" * Update test_embark/locking.js Co-Authored-By: bingen <bingentxu@gmail.com> * Apply suggestions from code review Cosmetic changes for tests Co-Authored-By: bingen <bingentxu@gmail.com> * Cosmetic change to contracts/Staking.sol Co-Authored-By: bingen <bingentxu@gmail.com> * Cosmetic changes to tests Address PR#1 comments. * Add functions to interface * Apply suggestions from code review Co-Authored-By: bingen <bingentxu@gmail.com> * Add Embark blockchain connector See: https://embark.status.im/docs/javascript_usage.html#Installing-a-blockchain-connector * Optimize some gas in checkpointing library?? (#4) * Optimize some gas in checkpointing library * Address PR #4 comments * Address PR #1 comments * Switch from embark to Truffle * Address PR #1 comments - Add getLatestValue for Checkpointing - Optimize Checkpointing binary search - Add max locks per account - Move stakedhistory into Account struct * chore: update .gitignore * chore: update readme * Address PR #1 comments * Address PR #1 comments
- Loading branch information