-
Notifications
You must be signed in to change notification settings - Fork 374
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
Implementation of tickets 1604, 1597 and 1365 #2368
Changes from 1 commit
493aed6
b090978
62cca9b
735755f
144c8d2
b5f4935
8c6c65a
978ae1e
22071bd
8028b05
c833e0c
661043b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ contract MultiSig is Initializable { | |
event OwnerAddition(address indexed owner); | ||
event OwnerRemoval(address indexed owner); | ||
event RequirementChange(uint256 required); | ||
event RequirementSet(uint256 required); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this used? |
||
|
||
/* | ||
* Constants | ||
|
@@ -109,6 +110,15 @@ contract MultiSig is Initializable { | |
initializer | ||
validRequirement(_owners.length, _required) | ||
{ | ||
setInitialOwners(_owners); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the idea here is to call And since those functions are |
||
setInitialRequired(_required); | ||
} | ||
|
||
/** | ||
* @notice Sets the initial owners of the wallet. | ||
* @param _owners List of initial owners. | ||
*/ | ||
function setInitialOwners(address[] memory _owners) private { | ||
for (uint256 i = 0; i < _owners.length; i++) { | ||
require( | ||
!isOwner[_owners[i]] && _owners[i] != address(0), | ||
|
@@ -117,7 +127,16 @@ contract MultiSig is Initializable { | |
isOwner[_owners[i]] = true; | ||
jfoutts-celo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
owners = _owners; | ||
} | ||
|
||
/** | ||
* @notice Sets the required number of tx confirmations. | ||
* @param _required The number of required tx confirmations. | ||
*/ | ||
function setInitialRequired(uint256 _required) private { | ||
require(_required > 0, "Required confirmations must be greater than zero"); | ||
required = _required; | ||
emit RequirementSet(_required); | ||
} | ||
|
||
/// @dev Allows to add a new owner. Transaction has to be sent by wallet. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,8 @@ contract EpochRewards is Ownable, Initializable, UsingPrecompiles, UsingRegistry | |
uint256 underspendAdjustmentFactor, | ||
uint256 overspendAdjustmentFactor | ||
); | ||
event StartTimeSet(uint256 startTime); | ||
event TargetVotingYield(uint256 targetVotingYield); | ||
|
||
/** | ||
* @notice Initializes critical variables. | ||
|
@@ -101,8 +103,8 @@ contract EpochRewards is Ownable, Initializable, UsingPrecompiles, UsingRegistry | |
); | ||
setTargetVotingGoldFraction(_targetVotingGoldFraction); | ||
setTargetValidatorEpochPayment(_targetValidatorEpochPayment); | ||
targetVotingYieldParams.target = FixidityLib.wrap(targetVotingYieldInitial); | ||
startTime = now; | ||
setTargetVotingYield(targetVotingYieldInitial); | ||
setStartTime(block.timestamp); | ||
} | ||
|
||
/** | ||
|
@@ -159,6 +161,29 @@ contract EpochRewards is Ownable, Initializable, UsingPrecompiles, UsingRegistry | |
return true; | ||
} | ||
|
||
/** | ||
* @notice Sets the target voting yield for validators. | ||
* @param _targetVotingYield The value of the target voting yield. | ||
jfoutts-celo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* @return True upon success. | ||
*/ | ||
function setTargetVotingYield(uint256 _targetVotingYield) public onlyOwner returns (bool) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure for this contract, but we are changing the semantics here... since dureing the lifetime of the contract we can change the target voting yield. @asaj @marekolszewski comments? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1, the scope of this ticket was more about reducing tech debt than exposing setters for values that were previously not possible to set externally |
||
targetVotingYieldParams.target = FixidityLib.wrap(_targetVotingYield); | ||
emit TargetVotingYield(_targetVotingYield); | ||
return true; | ||
} | ||
|
||
/** | ||
* @notice Sets the start time. | ||
* @param _startTime The time in unix. | ||
* @return True upon success. | ||
*/ | ||
function setStartTime(uint256 _startTime) public onlyOwner returns (bool) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
require(_startTime >= block.timestamp, "The start time must not be in the past"); | ||
startTime = _startTime; | ||
emit StartTimeSet(_startTime); | ||
return true; | ||
} | ||
|
||
/** | ||
* @notice Sets the rewards multiplier parameters. | ||
* @param max The max multiplier on target epoch rewards. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,6 +118,8 @@ contract Governance is | |
|
||
event ExecutionStageDurationSet(uint256 executionStageDuration); | ||
|
||
event LastDequeueSet(uint256 lastDequeue); | ||
|
||
event ConstitutionSet(address indexed destination, bytes4 indexed functionId, uint256 threshold); | ||
|
||
event ProposalQueued( | ||
|
@@ -217,27 +219,37 @@ contract Governance is | |
); | ||
_transferOwnership(msg.sender); | ||
setRegistry(registryAddress); | ||
approver = _approver; | ||
concurrentProposals = _concurrentProposals; | ||
minDeposit = _minDeposit; | ||
queueExpiry = _queueExpiry; | ||
dequeueFrequency = _dequeueFrequency; | ||
stageDurations.approval = approvalStageDuration; | ||
stageDurations.referendum = referendumStageDuration; | ||
stageDurations.execution = executionStageDuration; | ||
setApprover(_approver); | ||
setConcurrentProposals(_concurrentProposals); | ||
setMinDeposit(_minDeposit); | ||
setQueueExpiry(_queueExpiry); | ||
setDequeueFrequency(_dequeueFrequency); | ||
setApprovalStageDuration(approvalStageDuration); | ||
setReferendumStageDuration(referendumStageDuration); | ||
setExecutionStageDuration(executionStageDuration); | ||
setParticipationBaseline(participationBaseline); | ||
setParticipationFloor(participationFloor); | ||
setBaselineUpdateFactor(baselineUpdateFactor); | ||
setBaselineQuorumFactor(baselineQuorumFactor); | ||
setLastDequeue(block.timestamp); | ||
} | ||
|
||
/** | ||
* @notice Updates the last dequeue timestamp. | ||
* @param _lastDequeue The last dequeue timestamp. | ||
*/ | ||
function setLastDequeue(uint256 _lastDequeue) public onlyOwner { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same... |
||
require(_lastDequeue >= block.timestamp, "last dequeuing time must not be in the past"); | ||
// solhint-disable-next-line not-rely-on-time | ||
lastDequeue = now; | ||
lastDequeue = _lastDequeue; | ||
emit LastDequeueSet(_lastDequeue); | ||
} | ||
|
||
/** | ||
* @notice Updates the address that has permission to approve proposals in the approval stage. | ||
* @param _approver The address that has permission to approve proposals in the approval stage. | ||
*/ | ||
function setApprover(address _approver) external onlyOwner { | ||
function setApprover(address _approver) public onlyOwner { | ||
require(_approver != address(0) && _approver != approver); | ||
approver = _approver; | ||
emit ApproverSet(_approver); | ||
|
@@ -247,7 +259,7 @@ contract Governance is | |
* @notice Updates the number of proposals to dequeue at a time. | ||
* @param _concurrentProposals The number of proposals to dequeue at at a time. | ||
*/ | ||
function setConcurrentProposals(uint256 _concurrentProposals) external onlyOwner { | ||
function setConcurrentProposals(uint256 _concurrentProposals) public onlyOwner { | ||
require(_concurrentProposals > 0 && _concurrentProposals != concurrentProposals); | ||
concurrentProposals = _concurrentProposals; | ||
emit ConcurrentProposalsSet(_concurrentProposals); | ||
|
@@ -257,7 +269,7 @@ contract Governance is | |
* @notice Updates the minimum deposit needed to make a proposal. | ||
* @param _minDeposit The minimum Celo Gold deposit needed to make a proposal. | ||
*/ | ||
function setMinDeposit(uint256 _minDeposit) external onlyOwner { | ||
function setMinDeposit(uint256 _minDeposit) public onlyOwner { | ||
require(_minDeposit != minDeposit); | ||
minDeposit = _minDeposit; | ||
emit MinDepositSet(_minDeposit); | ||
|
@@ -267,7 +279,7 @@ contract Governance is | |
* @notice Updates the number of seconds before a queued proposal expires. | ||
* @param _queueExpiry The number of seconds a proposal can stay in the queue before expiring. | ||
*/ | ||
function setQueueExpiry(uint256 _queueExpiry) external onlyOwner { | ||
function setQueueExpiry(uint256 _queueExpiry) public onlyOwner { | ||
require(_queueExpiry > 0 && _queueExpiry != queueExpiry); | ||
queueExpiry = _queueExpiry; | ||
emit QueueExpirySet(_queueExpiry); | ||
|
@@ -279,7 +291,7 @@ contract Governance is | |
* @param _dequeueFrequency The number of seconds before the next batch of proposals can be | ||
* dequeued. | ||
*/ | ||
function setDequeueFrequency(uint256 _dequeueFrequency) external onlyOwner { | ||
function setDequeueFrequency(uint256 _dequeueFrequency) public onlyOwner { | ||
require(_dequeueFrequency > 0 && _dequeueFrequency != dequeueFrequency); | ||
dequeueFrequency = _dequeueFrequency; | ||
emit DequeueFrequencySet(_dequeueFrequency); | ||
|
@@ -289,7 +301,7 @@ contract Governance is | |
* @notice Updates the number of seconds proposals stay in the approval stage. | ||
* @param approvalStageDuration The number of seconds proposals stay in the approval stage. | ||
*/ | ||
function setApprovalStageDuration(uint256 approvalStageDuration) external onlyOwner { | ||
function setApprovalStageDuration(uint256 approvalStageDuration) public onlyOwner { | ||
require(approvalStageDuration > 0 && approvalStageDuration != stageDurations.approval); | ||
stageDurations.approval = approvalStageDuration; | ||
emit ApprovalStageDurationSet(approvalStageDuration); | ||
|
@@ -299,7 +311,7 @@ contract Governance is | |
* @notice Updates the number of seconds proposals stay in the referendum stage. | ||
* @param referendumStageDuration The number of seconds proposals stay in the referendum stage. | ||
*/ | ||
function setReferendumStageDuration(uint256 referendumStageDuration) external onlyOwner { | ||
function setReferendumStageDuration(uint256 referendumStageDuration) public onlyOwner { | ||
require(referendumStageDuration > 0 && referendumStageDuration != stageDurations.referendum); | ||
stageDurations.referendum = referendumStageDuration; | ||
emit ReferendumStageDurationSet(referendumStageDuration); | ||
|
@@ -309,7 +321,7 @@ contract Governance is | |
* @notice Updates the number of seconds proposals stay in the execution stage. | ||
* @param executionStageDuration The number of seconds proposals stay in the execution stage. | ||
*/ | ||
function setExecutionStageDuration(uint256 executionStageDuration) external onlyOwner { | ||
function setExecutionStageDuration(uint256 executionStageDuration) public onlyOwner { | ||
require(executionStageDuration > 0 && executionStageDuration != stageDurations.execution); | ||
stageDurations.execution = executionStageDuration; | ||
emit ExecutionStageDurationSet(executionStageDuration); | ||
|
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.
nit: s/ratio/rate