Skip to content

Commit

Permalink
added minipool watchtower check interval setting
Browse files Browse the repository at this point in the history
  • Loading branch information
moles1 committed Aug 21, 2019
1 parent b2d8423 commit 3efb0bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion contracts/contract/settings/RocketMinipoolSettings.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ contract RocketMinipoolSettings is RocketBase {
setMinipoolStakingDuration("3m", 526000); // Set the possible staking times for minipools in blocks given avg 15sec blocktime, 3 months (the withdrawal time from Casper is added onto this, it is not included)
setMinipoolStakingDuration("6m", 1052000); // 6 Months
setMinipoolStakingDuration("12m", 2104000); // 12 Months
setMinipoolCheckInterval(1 hours); // The interval that a watchtower should check active minipools in seconds
setMinipoolWithdrawalFeeDepositAddress(msg.sender); // The account to send Rocket Pool Fees too, must be an account, not a contract address
setMinipoolBackupCollectEnabled(true); // Are user backup addresses allowed to collect on behalf of the user after a certain time limit
setMinipoolBackupCollectDuration(526000); // The block count limit of which after a deposit is received back from Casper, that the user backup address can get access to the deposit - 3months default
Expand Down Expand Up @@ -96,14 +97,19 @@ contract RocketMinipoolSettings is RocketBase {
return rocketStorage.getUint(keccak256("settings.minipool.deposit.gas"));
}

/// @dev Get staking duration blocks for a given staking time ID, throw if its not a valid ID
/// @dev Get staking duration blocks for a given staking time ID, throw if its not a valid ID
function getMinipoolStakingDuration(string memory _durationID) public view returns (uint256) {
// Make sure the staking ID exists
uint256 stakingTime = rocketStorage.getUint(keccak256(abi.encodePacked("settings.minipool.staking.option", _durationID)));
require(stakingTime > 0, "Minipool staking duration ID specified does not match any current staking durations.");
return stakingTime;
}

/// @dev The interval that a watchtower should check active minipools in seconds
function getMinipoolCheckInterval() public view returns (uint256) {
return rocketStorage.getUint(keccak256(abi.encodePacked("settings.minipool.check.interval")));
}

/// @dev The account to send Rocket Pool Fees too, must be an account, not a contract address
function getMinipoolWithdrawalFeeDepositAddress() public view returns (address) {
return rocketStorage.getAddress(keccak256(abi.encodePacked("settings.minipool.fee.withdrawal.address")));
Expand Down Expand Up @@ -146,6 +152,11 @@ contract RocketMinipoolSettings is RocketBase {
rocketStorage.setUint(keccak256(abi.encodePacked("settings.minipool.staking.option", _duration)), _blocks);
}

/// @dev The interval that a watchtower should check active minipools in seconds
function setMinipoolCheckInterval(uint256 _interval) public onlySuperUser {
rocketStorage.setUint(keccak256(abi.encodePacked("settings.minipool.check.interval")), _interval);
}

/// @dev The account to send Rocket Pool Fees too, must be an account, not a contract address
function setMinipoolWithdrawalFeeDepositAddress(address _depositAddress) public onlySuperUser {
rocketStorage.setAddress(keccak256(abi.encodePacked("settings.minipool.fee.withdrawal.address")), _depositAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ contract RocketMinipoolSettingsInterface {
function getMinipoolNewGas() public view returns (uint256);
function getMinipoolDepositGas() public view returns (uint256);
function getMinipoolStakingDuration(string memory _durationID) public view returns (uint256);
function getMinipoolCheckInterval() public view returns (uint256);
function getMinipoolWithdrawalFeeDepositAddress() public view returns (address);
function getMinipoolBackupCollectEnabled() public view returns (bool);
function getMinipoolBackupCollectDuration() public view returns (uint256);
Expand Down

0 comments on commit 3efb0bb

Please sign in to comment.