@@ -17,7 +17,7 @@ contract RocketNetworkBalances is RocketBase, RocketNetworkBalancesInterface {
1717 using SafeMath for uint ;
1818
1919 // Events
20- event BalancesSubmitted (address indexed from , uint256 block , uint256 totalEth , uint256 stakingEth , uint256 rethSupply , uint256 time );
20+ event BalancesSubmitted (address indexed from , uint256 block , uint256 totalEth , uint256 stakingEth , uint256 stakingQueueEth , uint256 rethSupply , uint256 time );
2121 event BalancesUpdated (uint256 block , uint256 totalEth , uint256 stakingEth , uint256 rethSupply , uint256 time );
2222
2323 // Construct
@@ -33,22 +33,31 @@ contract RocketNetworkBalances is RocketBase, RocketNetworkBalancesInterface {
3333 setUint (keccak256 ("network.balances.updated.block " ), _value);
3434 }
3535
36- // The current RP network total ETH balance
36+ // The current RP network total user ETH balance
3737 function getTotalETHBalance () override public view returns (uint256 ) {
3838 return getUint (keccak256 ("network.balance.total " ));
3939 }
4040 function setTotalETHBalance (uint256 _value ) private {
4141 setUint (keccak256 ("network.balance.total " ), _value);
4242 }
4343
44- // The current RP network staking ETH balance
44+ // The current RP network staking ETH balance from users
4545 function getStakingETHBalance () override public view returns (uint256 ) {
4646 return getUint (keccak256 ("network.balance.staking " ));
4747 }
4848 function setStakingETHBalance (uint256 _value ) private {
4949 setUint (keccak256 ("network.balance.staking " ), _value);
5050 }
5151
52+ // The current RP network total staking ETH balance from the minipool queue
53+ // - Note: this does not contribute to getTotalETHBalance, as it isn't from User deposits
54+ function getStakingQueueETHBalance () override public view returns (uint256 ) {
55+ return getUint (keccak256 ("network.balance.queuestaking " ));
56+ }
57+ function setStakingQueueETHBalance (uint256 _value ) private {
58+ setUint (keccak256 ("network.balance.queuestaking " ), _value);
59+ }
60+
5261 // The current RP network total rETH supply
5362 function getTotalRETHSupply () override external view returns (uint256 ) {
5463 return getUint (keccak256 ("network.balance.reth.supply " ));
@@ -68,7 +77,7 @@ contract RocketNetworkBalances is RocketBase, RocketNetworkBalancesInterface {
6877
6978 // Submit network balances for a block
7079 // Only accepts calls from trusted (oracle) nodes
71- function submitBalances (uint256 _block , uint256 _totalEth , uint256 _stakingEth , uint256 _rethSupply ) override external onlyLatestContract ("rocketNetworkBalances " , address (this )) onlyTrustedNode (msg .sender ) {
80+ function submitBalances (uint256 _block , uint256 _totalEth , uint256 _stakingEth , uint256 _stakingQueueEth , uint256 _rethSupply ) override external onlyLatestContract ("rocketNetworkBalances " , address (this )) onlyTrustedNode (msg .sender ) {
7281 // Check settings
7382 RocketDAOProtocolSettingsNetworkInterface rocketDAOProtocolSettingsNetwork = RocketDAOProtocolSettingsNetworkInterface (getContractAddress ("rocketDAOProtocolSettingsNetwork " ));
7483 require (rocketDAOProtocolSettingsNetwork.getSubmitBalancesEnabled (), "Submitting balances is currently disabled " );
@@ -78,8 +87,8 @@ contract RocketNetworkBalances is RocketBase, RocketNetworkBalancesInterface {
7887 // Check balances
7988 require (_stakingEth <= _totalEth, "Invalid network balances " );
8089 // Get submission keys
81- bytes32 nodeSubmissionKey = keccak256 (abi.encodePacked ("network.balances.submitted.node " , msg .sender , _block, _totalEth, _stakingEth, _rethSupply));
82- bytes32 submissionCountKey = keccak256 (abi.encodePacked ("network.balances.submitted.count " , _block, _totalEth, _stakingEth, _rethSupply));
90+ bytes32 nodeSubmissionKey = keccak256 (abi.encodePacked ("network.balances.submitted.node " , msg .sender , _block, _totalEth, _stakingEth, _stakingQueueEth, _rethSupply));
91+ bytes32 submissionCountKey = keccak256 (abi.encodePacked ("network.balances.submitted.count " , _block, _totalEth, _stakingEth, _stakingQueueEth, _rethSupply));
8392 // Check & update node submission status
8493 require (! getBool (nodeSubmissionKey), "Duplicate submission from node " );
8594 setBool (nodeSubmissionKey, true );
@@ -88,16 +97,16 @@ contract RocketNetworkBalances is RocketBase, RocketNetworkBalancesInterface {
8897 uint256 submissionCount = getUint (submissionCountKey).add (1 );
8998 setUint (submissionCountKey, submissionCount);
9099 // Emit balances submitted event
91- emit BalancesSubmitted (msg .sender , _block, _totalEth, _stakingEth, _rethSupply, block .timestamp );
100+ emit BalancesSubmitted (msg .sender , _block, _totalEth, _stakingEth, _stakingQueueEth, _rethSupply, block .timestamp );
92101 // Check submission count & update network balances
93102 RocketDAONodeTrustedInterface rocketDAONodeTrusted = RocketDAONodeTrustedInterface (getContractAddress ("rocketDAONodeTrusted " ));
94103 if (calcBase.mul (submissionCount).div (rocketDAONodeTrusted.getMemberCount ()) >= rocketDAOProtocolSettingsNetwork.getNodeConsensusThreshold ()) {
95- updateBalances (_block, _totalEth, _stakingEth, _rethSupply);
104+ updateBalances (_block, _totalEth, _stakingEth, _stakingQueueEth, _rethSupply);
96105 }
97106 }
98107
99108 // Executes updateBalances if consensus threshold is reached
100- function executeUpdateBalances (uint256 _block , uint256 _totalEth , uint256 _stakingEth , uint256 _rethSupply ) override external onlyLatestContract ("rocketNetworkBalances " , address (this )) {
109+ function executeUpdateBalances (uint256 _block , uint256 _totalEth , uint256 _stakingEth , uint256 , _stakingQueueEth, uint256 _rethSupply ) override external onlyLatestContract ("rocketNetworkBalances " , address (this )) {
101110 // Check settings
102111 RocketDAOProtocolSettingsNetworkInterface rocketDAOProtocolSettingsNetwork = RocketDAOProtocolSettingsNetworkInterface (getContractAddress ("rocketDAOProtocolSettingsNetwork " ));
103112 require (rocketDAOProtocolSettingsNetwork.getSubmitBalancesEnabled (), "Submitting balances is currently disabled " );
@@ -113,7 +122,7 @@ contract RocketNetworkBalances is RocketBase, RocketNetworkBalancesInterface {
113122 // Check submission count & update network balances
114123 RocketDAONodeTrustedInterface rocketDAONodeTrusted = RocketDAONodeTrustedInterface (getContractAddress ("rocketDAONodeTrusted " ));
115124 require (calcBase.mul (submissionCount).div (rocketDAONodeTrusted.getMemberCount ()) >= rocketDAOProtocolSettingsNetwork.getNodeConsensusThreshold (), "Consensus has not been reached " );
116- updateBalances (_block, _totalEth, _stakingEth, _rethSupply);
125+ updateBalances (_block, _totalEth, _stakingEth, _stakingQueueEth, _rethSupply);
117126 }
118127
119128 // Update network balances
@@ -122,9 +131,10 @@ contract RocketNetworkBalances is RocketBase, RocketNetworkBalancesInterface {
122131 setBalancesBlock (_block);
123132 setTotalETHBalance (_totalEth);
124133 setStakingETHBalance (_stakingEth);
134+ setStakingQueueETHBalance (_stakingQueueEth);
125135 setTotalRETHSupply (_rethSupply);
126136 // Emit balances updated event
127- emit BalancesUpdated (_block, _totalEth, _stakingEth, _rethSupply, block .timestamp );
137+ emit BalancesUpdated (_block, _totalEth, _stakingEth, _stakingQueueEth, _rethSupply, block .timestamp );
128138 }
129139
130140 // Returns the latest block number that oracles should be reporting balances for
0 commit comments