-
Notifications
You must be signed in to change notification settings - Fork 43
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
Update Referee for TBR and TK #455
base: develop
Are you sure you want to change the base?
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.
The test helper function in Referee9 need to be commented out, the rest is ready to merge.
function updateMaxStakePerLicense(uint256 newAmount) external onlyRole(DEFAULT_ADMIN_ROLE) { | ||
require(newAmount != 0, "31"); | ||
uint256 prevAmount = maxStakeAmountPerLicense; | ||
maxStakeAmountPerLicense = newAmount; | ||
emit UpdateMaxStakeAmount(prevAmount, newAmount); | ||
} | ||
|
||
/** | ||
* @dev Admin update the maximum number of NodeLicense staked in a pool | ||
* @param newAmount The new maximum amount per NodeLicense | ||
*/ | ||
function updateMaxKeysPerPool(uint256 newAmount) external onlyRole(DEFAULT_ADMIN_ROLE) { | ||
require(newAmount != 0, "32"); | ||
uint256 prevAmount = maxKeysPerPool; | ||
maxKeysPerPool = newAmount; | ||
emit UpdateMaxKeysPerPool(prevAmount, newAmount); | ||
} | ||
|
||
/** | ||
* @dev Admin update the tier thresholds and the corresponding reward chance boost | ||
* @param index The index if the tier to update | ||
* @param newThreshold The new threshold of the tier | ||
* @param newBoostFactor The new boost factor for the tier | ||
*/ | ||
function updateStakingTier(uint256 index, uint256 newThreshold, uint256 newBoostFactor) external onlyRole(DEFAULT_ADMIN_ROLE) { | ||
|
||
require(newBoostFactor > 0 && newBoostFactor <= 10000, "33"); | ||
|
||
uint256 lastIndex = stakeAmountTierThresholds.length - 1; | ||
if (index == 0) { | ||
require(stakeAmountTierThresholds[1] > newThreshold, "34"); | ||
} else if (index == lastIndex) { | ||
require(stakeAmountTierThresholds[lastIndex - 1] < newThreshold, "35"); | ||
} else { | ||
require(stakeAmountTierThresholds[index + 1] > newThreshold && stakeAmountTierThresholds[index - 1] < newThreshold, "36"); | ||
} | ||
|
||
stakeAmountTierThresholds[index] = newThreshold; | ||
stakeAmountBoostFactors[index] = newBoostFactor; | ||
} | ||
|
||
/** | ||
* @dev Admin add a new staking tier to the end of the tier array | ||
* @param newThreshold The new threshold of the tier | ||
* @param newBoostFactor The new boost factor for the tier | ||
*/ | ||
function addStakingTier(uint256 newThreshold, uint256 newBoostFactor) external onlyRole(DEFAULT_ADMIN_ROLE) { | ||
require(newBoostFactor > 0 && newBoostFactor <= 10000, "37"); | ||
|
||
uint256 lastIndex = stakeAmountTierThresholds.length - 1; | ||
require(stakeAmountTierThresholds[lastIndex] < newThreshold, "38"); | ||
|
||
stakeAmountTierThresholds.push(newThreshold); | ||
stakeAmountBoostFactors.push(newBoostFactor); | ||
} |
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 don't need them in version 9 do we ?
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.
These have been removed, however, I do need the other PR #456 to be reviewed/approved and merged into this branch before converting this from Draft
// Leaving these functions in the contract for test coverage purposes | ||
// In the future these can be removed if size becomes an issue | ||
function toggleAssertionChecking() public { | ||
isCheckingAssertions = !isCheckingAssertions; | ||
emit AssertionCheckingToggled(isCheckingAssertions); | ||
} | ||
|
||
//TEST FUNCTION this is used only for test coverage | ||
// function setRollupAddress(address newRollupAddress) public { | ||
// rollupAddress = newRollupAddress; | ||
// emit RollupAddressChanged(newRollupAddress); | ||
// } | ||
} No newline at end of file | ||
function setRollupAddress(address newRollupAddress) public { | ||
rollupAddress = newRollupAddress; | ||
emit RollupAddressChanged(newRollupAddress); | ||
} | ||
} |
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.
These need to be commented out in version 9 too !
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.
Should we comment these out if we can fit them in the contract size?
We can always still remove in the future, but this would allow us to run the tests without having to manually uncomment every time?
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.
If we leave them they need restricted access control.
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.
These have been removed. Once the test case PR is approved, I can merge it into this branch before merging this into develop.
Ticket
Updated current Referee to be compatible with time based rewards.
Testing: tests updated and passing in this PR #456 which should be merged into this branch before this PR is Approved/Merged.