Skip to content
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

Add express queue params #311

Open
wants to merge 4 commits into
base: v1.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ contract RocketDAOProtocolSettingsDeposit is RocketDAOProtocolSettings, RocketDA
setSettingUint("deposit.assign.maximum", 90);
setSettingUint("deposit.assign.socialised.maximum", 2);
setSettingUint("deposit.fee", 0.0005 ether); // Set to approx. 1 day of rewards at 18.25% APR
setSettingUint("deposit.express.queue.rate", 2);
setSettingUint("deposit.express.queue.tickets.base.provision", 2);
// Settings initialised
setBool(keccak256(abi.encodePacked(settingNameSpace, "deployed")), true);
}
Expand Down Expand Up @@ -73,4 +75,14 @@ contract RocketDAOProtocolSettingsDeposit is RocketDAOProtocolSettings, RocketDA
return getSettingUint("deposit.fee");
}

/// @notice Returns the rate at which the deposit queue is processed
function getExpressQueueRate() override external view returns (uint256) {
return getSettingUint("deposit.express.queue.rate");
}

/// @notice Returns the number of express tickets provisioned
function getExpressQueueTicketsBaseProvision() override external view returns (uint256) {
return getSettingUint("deposit.express.queue.tickets.base.provision");
}

}
5 changes: 3 additions & 2 deletions contracts/contract/deposit/RocketDepositPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,9 @@ contract RocketDepositPool is RocketBase, RocketDepositPoolInterface, RocketVaul
uint256 queueIndex = getUint("megapool.queue.index");
uint256 nodeBalanceUsed = 0;

// TODO: Parameterise express_queue_rate
uint256 expressQueueRate = 2;
// Get the rate at which the deposit queue is processed
RocketDAOProtocolSettingsDepositInterface rocketDAOProtocolSettingsDeposit = RocketDAOProtocolSettingsDepositInterface(getContractAddress("rocketDAOProtocolSettingsDeposit"));
uint256 expressQueueRate = rocketDAOProtocolSettingsDeposit.getExpressQueueRate();
uint256 totalSent = 0;

for (uint256 i = 0; i < _count; i++) {
Expand Down
10 changes: 7 additions & 3 deletions contracts/contract/node/RocketNodeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {RocketDAONodeTrustedSettingsRewardsInterface} from "../../interface/dao/
import {RocketDAOProtocolSettingsMinipoolInterface} from "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsMinipoolInterface.sol";
import {RocketDAOProtocolSettingsNodeInterface} from "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNodeInterface.sol";
import {RocketDAOProtocolSettingsRewardsInterface} from "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsRewardsInterface.sol";
import {RocketDAOProtocolSettingsDepositInterface} from "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsDepositInterface.sol";
import {RocketMegapoolFactoryInterface} from "../../interface/megapool/RocketMegapoolFactoryInterface.sol";
import {RocketMinipoolInterface} from "../../interface/minipool/RocketMinipoolInterface.sol";
import {RocketMinipoolManagerInterface} from "../../interface/minipool/RocketMinipoolManagerInterface.sol";
Expand Down Expand Up @@ -194,8 +195,9 @@ contract RocketNodeManager is RocketBase, RocketNodeManagerInterface {
setBool(keccak256(abi.encodePacked("node.voting.enabled", msg.sender)), true);
setString(keccak256(abi.encodePacked("node.timezone.location", msg.sender)), _timezoneLocation);
setBool(keccak256(abi.encodePacked("node.express.provisioned", msg.sender)), true);
// TODO: Parameterise `express_queue_tickets_base_provision`
uint256 expressQueueTicketsBaseProvision = 2;
// Get the number of express tickets to provision
RocketDAOProtocolSettingsDepositInterface rocketDAOProtocolSettingsDeposit = RocketDAOProtocolSettingsDepositInterface(getContractAddress("rocketDAOProtocolSettingsDeposit"));
uint256 expressQueueTicketsBaseProvision = rocketDAOProtocolSettingsDeposit.getExpressQueueTicketsBaseProvision();
setUint(keccak256(abi.encodePacked("node.express.tickets")), expressQueueTicketsBaseProvision);
// Add node to index
bytes32 nodeIndexKey = keccak256(abi.encodePacked("nodes.index"));
Expand Down Expand Up @@ -476,7 +478,9 @@ contract RocketNodeManager is RocketBase, RocketNodeManagerInterface {
uint256 expressTickets = 0;
if (!provisioned) {
// Nodes prior to Saturn should receive 2 express tickets (initial value of `express_queue_tickets_base_provision`)
expressTickets += 2;
RocketDAOProtocolSettingsDepositInterface rocketDAOProtocolSettingsDeposit = RocketDAOProtocolSettingsDepositInterface(getContractAddress("rocketDAOProtocolSettingsDeposit"));
uint256 expressQueueTicketsBaseProvision = rocketDAOProtocolSettingsDeposit.getExpressQueueTicketsBaseProvision();
expressTickets += expressQueueTicketsBaseProvision;
// Each node SHALL be provided additional express_queue_tickets equal to (bonded ETH in legacy minipools)/4
RocketNodeStakingInterface rocketNodeStaking = RocketNodeStakingInterface(getContractAddress("rocketNodeStaking"));
uint256 ethProvided = rocketNodeStaking.getNodeETHProvided(_nodeAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ interface RocketDAOProtocolSettingsDepositInterface {
function getMaximumDepositAssignments() external view returns (uint256);
function getMaximumDepositSocialisedAssignments() external view returns (uint256);
function getDepositFee() external view returns (uint256);
function getExpressQueueRate() external view returns (uint256);
function getExpressQueueTicketsBaseProvision() external view returns (uint256);
}
Loading