-
Notifications
You must be signed in to change notification settings - Fork 0
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
268 potencial fixes contracts from review #81
Conversation
Pull Request Test Coverage Report for Build 11955075956Details
💛 - Coveralls |
contracts/HydraChain/modules/ValidatorManager/ValidatorManager.sol
Outdated
Show resolved
Hide resolved
* @dev Only callable by the admin | ||
* @dev the rate should be between 10 and 150 (0.1% and 1.5%) | ||
*/ | ||
function setPenaltyDecreasePerWeek(uint256 newRate) external; |
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.
Why is this function declared here, when the variable is part of the vesting 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.
Added internal function in vesting so we can easily call later
@@ -20,6 +20,7 @@ contract PriceOracle is IPriceOracle, System, Initializable, HydraChainConnector | |||
mapping(uint256 => uint256) public pricePerDay; | |||
mapping(uint256 => List) public priceVotesForDay; | |||
|
|||
uint256 constant MAX_UINT224 = type(uint224).max; |
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.
add visibility modifier
@@ -37,8 +39,7 @@ contract VestingManager is IVestingManager, Initializable, OwnableUpgradeable { | |||
*/ | |||
function openVestedDelegatePosition(address staker, uint256 durationWeeks) external payable onlyOwner { | |||
HYDRA_DELEGATION.delegateWithVesting{value: msg.value}(staker, durationWeeks); | |||
address liquidToken = HYDRA_DELEGATION.liquidToken(); | |||
_sendLiquidTokens(msg.sender, IERC20(liquidToken).balanceOf(address(this))); | |||
_sendLiquidTokens(msg.sender, IERC20(LIQUIDITY_TOKEN).balanceOf(address(this))); |
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.
it is already IERC20. No need to cast
const { hydraChain } = await loadFixture(this.fixtures.initializedHydraChainStateFixture); | ||
|
||
const validatorsData = [{ validator: this.signers.validators[1].address, votingPower: 12 }]; | ||
await expect(hydraChain.connect(this.signers.system).syncValidatorsData(validatorsData)).to.emit( |
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.
ensure proper data is emited
struct StakingRewardsHistory { | ||
uint256 totalReward; | ||
uint256 epoch; | ||
uint256 timestamp; | ||
} | ||
|
||
interface IVestedStaking { | ||
interface IVestedStaking is IVesting { |
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.
why this is not IStaking as well?
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.
Well since Vesting is used only in VestedStaking/Delegation and before it was part of this contract, I thought it would be better to be in this interface (IVestedStaking), which is also included in the IStaking, so we should have all the functions.
/** | ||
* @inheritdoc IVesting | ||
*/ | ||
function setPenaltyDecreasePerWeek(uint256 newRate) external onlyRole(DEFAULT_ADMIN_ROLE) { |
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 create a reusable modifier to wrap onlyRole(DEFAULT_ADMIN_ROLE)
- ```onlyGovernance()```` so we can use it everywhere for better readability
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 agree, wouldn't that be better to be in the ticket (governance consistency) so I can modify it in every contract?
6348492
to
2d9f77c
Compare
Update ValData:
Add extra checks:
Penalty now changeable:
Base APR constant:
Update vestingManager: