From e5eea5396f3a43507fa0573747c30d8b1c4199ac Mon Sep 17 00:00:00 2001 From: doylet Date: Mon, 3 Mar 2025 16:34:21 +1100 Subject: [PATCH 1/6] Update the stagenet w/ the new event emissions for staking portal tracking --- .openzeppelin/unknown-421614.json | 151 ++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) diff --git a/.openzeppelin/unknown-421614.json b/.openzeppelin/unknown-421614.json index d6c46b0..ea09759 100644 --- a/.openzeppelin/unknown-421614.json +++ b/.openzeppelin/unknown-421614.json @@ -9597,6 +9597,157 @@ ] } } + }, + "f0e6806b9f2219c6795f14306df0ad132ac017d47bf9cef3525d4a6c2c115f3d": { + "address": "0x215fE1C2F3A46500081b0FBC34e310EF1953a58e", + "txHash": "0xf088f19f962290beda1f9803800f175dea5f253d0398996fda78e1e2546e33de", + "layout": { + "solcVersion": "0.8.26", + "storage": [ + { + "label": "stakingRewardsContract", + "offset": 0, + "slot": "0", + "type": "t_contract(IServiceNodeRewards)7885", + "contract": "ServiceNodeContributionFactory", + "src": "contracts/ServiceNodeContributionFactory.sol:11" + }, + { + "label": "deployedContracts", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)", + "contract": "ServiceNodeContributionFactory", + "src": "contracts/ServiceNodeContributionFactory.sol:15" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_struct(InitializableStorage)141_storage": { + "label": "struct Initializable.InitializableStorage", + "members": [ + { + "label": "_initialized", + "type": "t_uint64", + "offset": 0, + "slot": "0" + }, + { + "label": "_initializing", + "type": "t_bool", + "offset": 8, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(Ownable2StepStorage)13_storage": { + "label": "struct Ownable2StepUpgradeable.Ownable2StepStorage", + "members": [ + { + "label": "_pendingOwner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(OwnableStorage)74_storage": { + "label": "struct OwnableUpgradeable.OwnableStorage", + "members": [ + { + "label": "_owner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(PausableStorage)233_storage": { + "label": "struct PausableUpgradeable.PausableStorage", + "members": [ + { + "label": "_paused", + "type": "t_bool", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_uint64": { + "label": "uint64", + "numberOfBytes": "8" + }, + "t_contract(IServiceNodeRewards)7885": { + "label": "contract IServiceNodeRewards", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", + "numberOfBytes": "32" + } + }, + "namespaces": { + "erc7201:openzeppelin.storage.Pausable": [ + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol:21", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable2Step": [ + { + "contract": "Ownable2StepUpgradeable", + "label": "_pendingOwner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol:23", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable": [ + { + "contract": "OwnableUpgradeable", + "label": "_owner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:24", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Initializable": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_uint64", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:69", + "offset": 0, + "slot": "0" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:73", + "offset": 8, + "slot": "0" + } + ] + } + } } } } From 50848a2d8f9e68ad6d8a83d48dd213bd3a2f1ffc Mon Sep 17 00:00:00 2001 From: doylet Date: Mon, 24 Mar 2025 11:45:13 +1100 Subject: [PATCH 2/6] Add upgraded stagenet contracts metadata to repo --- .openzeppelin/unknown-421614.json | 691 +++++++++++++++++++++++++++++- 1 file changed, 689 insertions(+), 2 deletions(-) diff --git a/.openzeppelin/unknown-421614.json b/.openzeppelin/unknown-421614.json index ea09759..0be9f50 100644 --- a/.openzeppelin/unknown-421614.json +++ b/.openzeppelin/unknown-421614.json @@ -9608,7 +9608,7 @@ "label": "stakingRewardsContract", "offset": 0, "slot": "0", - "type": "t_contract(IServiceNodeRewards)7885", + "type": "t_contract(IServiceNodeRewards)10540", "contract": "ServiceNodeContributionFactory", "src": "contracts/ServiceNodeContributionFactory.sol:11" }, @@ -9688,7 +9688,694 @@ "label": "uint64", "numberOfBytes": "8" }, - "t_contract(IServiceNodeRewards)7885": { + "t_contract(IServiceNodeRewards)10540": { + "label": "contract IServiceNodeRewards", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", + "numberOfBytes": "32" + } + }, + "namespaces": { + "erc7201:openzeppelin.storage.Pausable": [ + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol:21", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable2Step": [ + { + "contract": "Ownable2StepUpgradeable", + "label": "_pendingOwner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol:23", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable": [ + { + "contract": "OwnableUpgradeable", + "label": "_owner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:24", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Initializable": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_uint64", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:69", + "offset": 0, + "slot": "0" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:73", + "offset": 8, + "slot": "0" + } + ] + } + } + }, + "a40e18aa3849662b04df58b0f1725021f4c1dff17848695871dc70520bd3f27e": { + "address": "0x4e0e4b4bc86d7EC64608621d9320702B61a2bdf5", + "txHash": "0x7a8458581dec639cb5318b23edd313966326bc2c8053299973be38bcc3e73276", + "layout": { + "solcVersion": "0.8.26", + "storage": [ + { + "label": "isStarted", + "offset": 0, + "slot": "0", + "type": "t_bool", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:19" + }, + { + "label": "designatedToken", + "offset": 1, + "slot": "0", + "type": "t_contract(IERC20)1710", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:21" + }, + { + "label": "foundationPool", + "offset": 0, + "slot": "1", + "type": "t_contract(IERC20)1710", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:22" + }, + { + "label": "nextServiceNodeID", + "offset": 20, + "slot": "1", + "type": "t_uint64", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:33" + }, + { + "label": "totalNodes", + "offset": 0, + "slot": "2", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:34" + }, + { + "label": "blsNonSignerThreshold", + "offset": 0, + "slot": "3", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:35" + }, + { + "label": "blsNonSignerThresholdMax", + "offset": 0, + "slot": "4", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:36" + }, + { + "label": "signatureExpiry", + "offset": 0, + "slot": "5", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:37" + }, + { + "label": "proofOfPossessionTag", + "offset": 0, + "slot": "6", + "type": "t_bytes32", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:39" + }, + { + "label": "rewardTag", + "offset": 0, + "slot": "7", + "type": "t_bytes32", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:40" + }, + { + "label": "exitTag", + "offset": 0, + "slot": "8", + "type": "t_bytes32", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:41" + }, + { + "label": "liquidateTag", + "offset": 0, + "slot": "9", + "type": "t_bytes32", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:42" + }, + { + "label": "hashToG2Tag", + "offset": 0, + "slot": "10", + "type": "t_bytes32", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:43" + }, + { + "label": "stakingRequirement", + "offset": 0, + "slot": "11", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:45" + }, + { + "label": "maxContributors", + "offset": 0, + "slot": "12", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:46" + }, + { + "label": "liquidatorRewardRatio", + "offset": 0, + "slot": "13", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:47" + }, + { + "label": "poolShareOfLiquidationRatio", + "offset": 0, + "slot": "14", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:48" + }, + { + "label": "recipientRatio", + "offset": 0, + "slot": "15", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:49" + }, + { + "label": "_serviceNodes", + "offset": 0, + "slot": "16", + "type": "t_mapping(t_uint64,t_struct(ServiceNode)10297_storage)", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:108" + }, + { + "label": "recipients", + "offset": 0, + "slot": "17", + "type": "t_mapping(t_address,t_struct(Recipient)10303_storage)", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:109" + }, + { + "label": "serviceNodeIDs", + "offset": 0, + "slot": "18", + "type": "t_mapping(t_bytes_memory_ptr,t_uint64)", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:111" + }, + { + "label": "_aggregatePubkey", + "offset": 0, + "slot": "19", + "type": "t_struct(G1Point)10550_storage", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:113" + }, + { + "label": "lastHeightPubkeyWasAggregated", + "offset": 0, + "slot": "21", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:114" + }, + { + "label": "numPubkeyAggregationsForHeight", + "offset": 0, + "slot": "22", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:115" + }, + { + "label": "claimThreshold", + "offset": 0, + "slot": "23", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:138" + }, + { + "label": "claimCycle", + "offset": 0, + "slot": "24", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:144" + }, + { + "label": "currentClaimTotal", + "offset": 0, + "slot": "25", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:147" + }, + { + "label": "currentClaimCycle", + "offset": 0, + "slot": "26", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:153" + }, + { + "label": "ed25519ToServiceNodeID", + "offset": 0, + "slot": "27", + "type": "t_mapping(t_uint256,t_uint64)", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:156" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_struct(InitializableStorage)141_storage": { + "label": "struct Initializable.InitializableStorage", + "members": [ + { + "label": "_initialized", + "type": "t_uint64", + "offset": 0, + "slot": "0" + }, + { + "label": "_initializing", + "type": "t_bool", + "offset": 8, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(Ownable2StepStorage)13_storage": { + "label": "struct Ownable2StepUpgradeable.Ownable2StepStorage", + "members": [ + { + "label": "_pendingOwner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(OwnableStorage)74_storage": { + "label": "struct OwnableUpgradeable.OwnableStorage", + "members": [ + { + "label": "_owner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(PausableStorage)233_storage": { + "label": "struct PausableUpgradeable.PausableStorage", + "members": [ + { + "label": "_paused", + "type": "t_bool", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_uint64": { + "label": "uint64", + "numberOfBytes": "8" + }, + "t_array(t_struct(Contributor)10253_storage)dyn_storage": { + "label": "struct IServiceNodeRewards.Contributor[]", + "numberOfBytes": "32" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_memory_ptr": { + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(IERC20)1710": { + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_struct(Recipient)10303_storage)": { + "label": "mapping(address => struct IServiceNodeRewards.Recipient)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes_memory_ptr,t_uint64)": { + "label": "mapping(bytes => uint64)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_uint64)": { + "label": "mapping(uint256 => uint64)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint64,t_struct(ServiceNode)10297_storage)": { + "label": "mapping(uint64 => struct IServiceNodeRewards.ServiceNode)", + "numberOfBytes": "32" + }, + "t_struct(Contributor)10253_storage": { + "label": "struct IServiceNodeRewards.Contributor", + "members": [ + { + "label": "staker", + "type": "t_struct(Staker)10247_storage", + "offset": 0, + "slot": "0" + }, + { + "label": "stakedAmount", + "type": "t_uint256", + "offset": 0, + "slot": "2" + } + ], + "numberOfBytes": "96" + }, + "t_struct(G1Point)10550_storage": { + "label": "struct BN256G1.G1Point", + "members": [ + { + "label": "X", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "Y", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Recipient)10303_storage": { + "label": "struct IServiceNodeRewards.Recipient", + "members": [ + { + "label": "rewards", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "claimed", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_struct(ServiceNode)10297_storage": { + "label": "struct IServiceNodeRewards.ServiceNode", + "members": [ + { + "label": "next", + "type": "t_uint64", + "offset": 0, + "slot": "0" + }, + { + "label": "prev", + "type": "t_uint64", + "offset": 8, + "slot": "0" + }, + { + "label": "operator", + "type": "t_address", + "offset": 0, + "slot": "1" + }, + { + "label": "blsPubkey", + "type": "t_struct(G1Point)10550_storage", + "offset": 0, + "slot": "2" + }, + { + "label": "addedTimestamp", + "type": "t_uint256", + "offset": 0, + "slot": "4" + }, + { + "label": "leaveRequestTimestamp", + "type": "t_uint256", + "offset": 0, + "slot": "5" + }, + { + "label": "latestLeaveRequestTimestamp", + "type": "t_uint256", + "offset": 0, + "slot": "6" + }, + { + "label": "deposit", + "type": "t_uint256", + "offset": 0, + "slot": "7" + }, + { + "label": "contributors", + "type": "t_array(t_struct(Contributor)10253_storage)dyn_storage", + "offset": 0, + "slot": "8" + }, + { + "label": "ed25519Pubkey", + "type": "t_uint256", + "offset": 0, + "slot": "9" + } + ], + "numberOfBytes": "320" + }, + "t_struct(Staker)10247_storage": { + "label": "struct IServiceNodeRewards.Staker", + "members": [ + { + "label": "addr", + "type": "t_address", + "offset": 0, + "slot": "0" + }, + { + "label": "beneficiary", + "type": "t_address", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "label": "bytes" + } + }, + "namespaces": { + "erc7201:openzeppelin.storage.Pausable": [ + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol:21", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable2Step": [ + { + "contract": "Ownable2StepUpgradeable", + "label": "_pendingOwner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol:23", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable": [ + { + "contract": "OwnableUpgradeable", + "label": "_owner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:24", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Initializable": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_uint64", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:69", + "offset": 0, + "slot": "0" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:73", + "offset": 8, + "slot": "0" + } + ] + } + } + }, + "bc49b99c91b55bd11f53f7864aa5ba2a7f56faa902b681a2510f57efb2dda0db": { + "address": "0x5971134F785b367407f9BdE00ea256a2cb776032", + "txHash": "0xb8f4384413b0efbac0fcaaa64fa431e25b12a7f9b6095c21c537e0bcc8f5c53f", + "layout": { + "solcVersion": "0.8.26", + "storage": [ + { + "label": "stakingRewardsContract", + "offset": 0, + "slot": "0", + "type": "t_contract(IServiceNodeRewards)7888", + "contract": "ServiceNodeContributionFactory", + "src": "contracts/ServiceNodeContributionFactory.sol:11" + }, + { + "label": "deployedContracts", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)", + "contract": "ServiceNodeContributionFactory", + "src": "contracts/ServiceNodeContributionFactory.sol:15" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_struct(InitializableStorage)141_storage": { + "label": "struct Initializable.InitializableStorage", + "members": [ + { + "label": "_initialized", + "type": "t_uint64", + "offset": 0, + "slot": "0" + }, + { + "label": "_initializing", + "type": "t_bool", + "offset": 8, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(Ownable2StepStorage)13_storage": { + "label": "struct Ownable2StepUpgradeable.Ownable2StepStorage", + "members": [ + { + "label": "_pendingOwner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(OwnableStorage)74_storage": { + "label": "struct OwnableUpgradeable.OwnableStorage", + "members": [ + { + "label": "_owner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(PausableStorage)233_storage": { + "label": "struct PausableUpgradeable.PausableStorage", + "members": [ + { + "label": "_paused", + "type": "t_bool", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_uint64": { + "label": "uint64", + "numberOfBytes": "8" + }, + "t_contract(IServiceNodeRewards)7888": { "label": "contract IServiceNodeRewards", "numberOfBytes": "20" }, From c8152d8a7eb305b0fe80dfb1c4f5231a1a0eb1ec Mon Sep 17 00:00:00 2001 From: doylet Date: Mon, 24 Mar 2025 13:23:46 +1100 Subject: [PATCH 3/6] Update stagenet contracts again, this time using the Testnet contracts, the correct one --- .openzeppelin/unknown-421614.json | 536 ++++++++++++++++++++++++++++++ 1 file changed, 536 insertions(+) diff --git a/.openzeppelin/unknown-421614.json b/.openzeppelin/unknown-421614.json index 0be9f50..e2f6add 100644 --- a/.openzeppelin/unknown-421614.json +++ b/.openzeppelin/unknown-421614.json @@ -10435,6 +10435,542 @@ ] } } + }, + "24437d28dad5f8d43a83145024b534f403de1d62ed7ffef566d47f964417763c": { + "address": "0xBc9835bd5Bd2aAB8071ecDD000b35ed26Aa078B9", + "txHash": "0xaddc0392e64ae2a68e2ac2b986bd1dc95634d62603a4bfbc1e93963f484fd746", + "layout": { + "solcVersion": "0.8.26", + "storage": [ + { + "label": "isStarted", + "offset": 0, + "slot": "0", + "type": "t_bool", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:19" + }, + { + "label": "designatedToken", + "offset": 1, + "slot": "0", + "type": "t_contract(IERC20)1710", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:21" + }, + { + "label": "foundationPool", + "offset": 0, + "slot": "1", + "type": "t_contract(IERC20)1710", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:22" + }, + { + "label": "nextServiceNodeID", + "offset": 20, + "slot": "1", + "type": "t_uint64", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:33" + }, + { + "label": "totalNodes", + "offset": 0, + "slot": "2", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:34" + }, + { + "label": "blsNonSignerThreshold", + "offset": 0, + "slot": "3", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:35" + }, + { + "label": "blsNonSignerThresholdMax", + "offset": 0, + "slot": "4", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:36" + }, + { + "label": "signatureExpiry", + "offset": 0, + "slot": "5", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:37" + }, + { + "label": "proofOfPossessionTag", + "offset": 0, + "slot": "6", + "type": "t_bytes32", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:39" + }, + { + "label": "rewardTag", + "offset": 0, + "slot": "7", + "type": "t_bytes32", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:40" + }, + { + "label": "exitTag", + "offset": 0, + "slot": "8", + "type": "t_bytes32", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:41" + }, + { + "label": "liquidateTag", + "offset": 0, + "slot": "9", + "type": "t_bytes32", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:42" + }, + { + "label": "hashToG2Tag", + "offset": 0, + "slot": "10", + "type": "t_bytes32", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:43" + }, + { + "label": "stakingRequirement", + "offset": 0, + "slot": "11", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:45" + }, + { + "label": "maxContributors", + "offset": 0, + "slot": "12", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:46" + }, + { + "label": "liquidatorRewardRatio", + "offset": 0, + "slot": "13", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:47" + }, + { + "label": "poolShareOfLiquidationRatio", + "offset": 0, + "slot": "14", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:48" + }, + { + "label": "recipientRatio", + "offset": 0, + "slot": "15", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:49" + }, + { + "label": "_serviceNodes", + "offset": 0, + "slot": "16", + "type": "t_mapping(t_uint64,t_struct(ServiceNode)10297_storage)", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:108" + }, + { + "label": "recipients", + "offset": 0, + "slot": "17", + "type": "t_mapping(t_address,t_struct(Recipient)10303_storage)", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:109" + }, + { + "label": "serviceNodeIDs", + "offset": 0, + "slot": "18", + "type": "t_mapping(t_bytes_memory_ptr,t_uint64)", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:111" + }, + { + "label": "_aggregatePubkey", + "offset": 0, + "slot": "19", + "type": "t_struct(G1Point)10550_storage", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:113" + }, + { + "label": "lastHeightPubkeyWasAggregated", + "offset": 0, + "slot": "21", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:114" + }, + { + "label": "numPubkeyAggregationsForHeight", + "offset": 0, + "slot": "22", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:115" + }, + { + "label": "claimThreshold", + "offset": 0, + "slot": "23", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:138" + }, + { + "label": "claimCycle", + "offset": 0, + "slot": "24", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:144" + }, + { + "label": "currentClaimTotal", + "offset": 0, + "slot": "25", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:147" + }, + { + "label": "currentClaimCycle", + "offset": 0, + "slot": "26", + "type": "t_uint256", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:153" + }, + { + "label": "ed25519ToServiceNodeID", + "offset": 0, + "slot": "27", + "type": "t_mapping(t_uint256,t_uint64)", + "contract": "ServiceNodeRewards", + "src": "contracts/ServiceNodeRewards.sol:156" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_struct(InitializableStorage)141_storage": { + "label": "struct Initializable.InitializableStorage", + "members": [ + { + "label": "_initialized", + "type": "t_uint64", + "offset": 0, + "slot": "0" + }, + { + "label": "_initializing", + "type": "t_bool", + "offset": 8, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(Ownable2StepStorage)13_storage": { + "label": "struct Ownable2StepUpgradeable.Ownable2StepStorage", + "members": [ + { + "label": "_pendingOwner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(OwnableStorage)74_storage": { + "label": "struct OwnableUpgradeable.OwnableStorage", + "members": [ + { + "label": "_owner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(PausableStorage)233_storage": { + "label": "struct PausableUpgradeable.PausableStorage", + "members": [ + { + "label": "_paused", + "type": "t_bool", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_uint64": { + "label": "uint64", + "numberOfBytes": "8" + }, + "t_array(t_struct(Contributor)10253_storage)dyn_storage": { + "label": "struct IServiceNodeRewards.Contributor[]", + "numberOfBytes": "32" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_memory_ptr": { + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(IERC20)1710": { + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_struct(Recipient)10303_storage)": { + "label": "mapping(address => struct IServiceNodeRewards.Recipient)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes_memory_ptr,t_uint64)": { + "label": "mapping(bytes => uint64)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_uint64)": { + "label": "mapping(uint256 => uint64)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint64,t_struct(ServiceNode)10297_storage)": { + "label": "mapping(uint64 => struct IServiceNodeRewards.ServiceNode)", + "numberOfBytes": "32" + }, + "t_struct(Contributor)10253_storage": { + "label": "struct IServiceNodeRewards.Contributor", + "members": [ + { + "label": "staker", + "type": "t_struct(Staker)10247_storage", + "offset": 0, + "slot": "0" + }, + { + "label": "stakedAmount", + "type": "t_uint256", + "offset": 0, + "slot": "2" + } + ], + "numberOfBytes": "96" + }, + "t_struct(G1Point)10550_storage": { + "label": "struct BN256G1.G1Point", + "members": [ + { + "label": "X", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "Y", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Recipient)10303_storage": { + "label": "struct IServiceNodeRewards.Recipient", + "members": [ + { + "label": "rewards", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "claimed", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_struct(ServiceNode)10297_storage": { + "label": "struct IServiceNodeRewards.ServiceNode", + "members": [ + { + "label": "next", + "type": "t_uint64", + "offset": 0, + "slot": "0" + }, + { + "label": "prev", + "type": "t_uint64", + "offset": 8, + "slot": "0" + }, + { + "label": "operator", + "type": "t_address", + "offset": 0, + "slot": "1" + }, + { + "label": "blsPubkey", + "type": "t_struct(G1Point)10550_storage", + "offset": 0, + "slot": "2" + }, + { + "label": "addedTimestamp", + "type": "t_uint256", + "offset": 0, + "slot": "4" + }, + { + "label": "leaveRequestTimestamp", + "type": "t_uint256", + "offset": 0, + "slot": "5" + }, + { + "label": "latestLeaveRequestTimestamp", + "type": "t_uint256", + "offset": 0, + "slot": "6" + }, + { + "label": "deposit", + "type": "t_uint256", + "offset": 0, + "slot": "7" + }, + { + "label": "contributors", + "type": "t_array(t_struct(Contributor)10253_storage)dyn_storage", + "offset": 0, + "slot": "8" + }, + { + "label": "ed25519Pubkey", + "type": "t_uint256", + "offset": 0, + "slot": "9" + } + ], + "numberOfBytes": "320" + }, + "t_struct(Staker)10247_storage": { + "label": "struct IServiceNodeRewards.Staker", + "members": [ + { + "label": "addr", + "type": "t_address", + "offset": 0, + "slot": "0" + }, + { + "label": "beneficiary", + "type": "t_address", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "label": "bytes" + } + }, + "namespaces": { + "erc7201:openzeppelin.storage.Pausable": [ + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol:21", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable2Step": [ + { + "contract": "Ownable2StepUpgradeable", + "label": "_pendingOwner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol:23", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable": [ + { + "contract": "OwnableUpgradeable", + "label": "_owner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:24", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Initializable": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_uint64", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:69", + "offset": 0, + "slot": "0" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:73", + "offset": 8, + "slot": "0" + } + ] + } + } } } } From a57e511f8ef66dbb7166a824c2c62ee55d184ffa Mon Sep 17 00:00:00 2001 From: doylet Date: Wed, 26 Mar 2025 10:30:31 +1100 Subject: [PATCH 4/6] Remove indexed parameters from UpdatePubkeys and push the new metadata for the upgraded contracts --- .openzeppelin/unknown-421614.json | 151 ++++++++++++++++++ .../interfaces/IServiceNodeContribution.sol | 2 +- 2 files changed, 152 insertions(+), 1 deletion(-) diff --git a/.openzeppelin/unknown-421614.json b/.openzeppelin/unknown-421614.json index e2f6add..27e793f 100644 --- a/.openzeppelin/unknown-421614.json +++ b/.openzeppelin/unknown-421614.json @@ -10971,6 +10971,157 @@ ] } } + }, + "aa8320a168b939fb4c24d87a98f108e46be379bd5532ef09d797d966a7d55218": { + "address": "0x35Cd88C1d3242dD2223Ab4B8C8D9979b98D1B288", + "txHash": "0xccd0bf0296fc04c039cdfe239b6e68811bf403f9d4fd7359e3c2f27aa6d82fbb", + "layout": { + "solcVersion": "0.8.26", + "storage": [ + { + "label": "stakingRewardsContract", + "offset": 0, + "slot": "0", + "type": "t_contract(IServiceNodeRewards)7888", + "contract": "ServiceNodeContributionFactory", + "src": "contracts/ServiceNodeContributionFactory.sol:11" + }, + { + "label": "deployedContracts", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)", + "contract": "ServiceNodeContributionFactory", + "src": "contracts/ServiceNodeContributionFactory.sol:15" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_struct(InitializableStorage)141_storage": { + "label": "struct Initializable.InitializableStorage", + "members": [ + { + "label": "_initialized", + "type": "t_uint64", + "offset": 0, + "slot": "0" + }, + { + "label": "_initializing", + "type": "t_bool", + "offset": 8, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(Ownable2StepStorage)13_storage": { + "label": "struct Ownable2StepUpgradeable.Ownable2StepStorage", + "members": [ + { + "label": "_pendingOwner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(OwnableStorage)74_storage": { + "label": "struct OwnableUpgradeable.OwnableStorage", + "members": [ + { + "label": "_owner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(PausableStorage)233_storage": { + "label": "struct PausableUpgradeable.PausableStorage", + "members": [ + { + "label": "_paused", + "type": "t_bool", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_uint64": { + "label": "uint64", + "numberOfBytes": "8" + }, + "t_contract(IServiceNodeRewards)7888": { + "label": "contract IServiceNodeRewards", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", + "numberOfBytes": "32" + } + }, + "namespaces": { + "erc7201:openzeppelin.storage.Pausable": [ + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol:21", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable2Step": [ + { + "contract": "Ownable2StepUpgradeable", + "label": "_pendingOwner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol:23", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable": [ + { + "contract": "OwnableUpgradeable", + "label": "_owner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:24", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Initializable": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_uint64", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:69", + "offset": 0, + "slot": "0" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:73", + "offset": 8, + "slot": "0" + } + ] + } + } } } } diff --git a/contracts/interfaces/IServiceNodeContribution.sol b/contracts/interfaces/IServiceNodeContribution.sol index a400c88..72515bc 100644 --- a/contracts/interfaces/IServiceNodeContribution.sol +++ b/contracts/interfaces/IServiceNodeContribution.sol @@ -48,7 +48,7 @@ interface IServiceNodeContribution { event UpdateStakerBeneficiary (address indexed staker, address newBeneficiary); event UpdateManualFinalize (bool newValue); event UpdateFee (uint16 newFee); - event UpdatePubkeys (BN256G1.G1Point indexed newBLSPubkey, uint256 indexed newEd25519Pubkey); + event UpdatePubkeys (BN256G1.G1Point newBLSPubkey, uint256 newEd25519Pubkey); event UpdateReservedContributors (IServiceNodeRewards.ReservedContributor[] newReservedContributors); event Reset (); From 706a82f518c2181871b26660267f9ac1624c0a35 Mon Sep 17 00:00:00 2001 From: doylet Date: Tue, 15 Apr 2025 12:08:42 +1000 Subject: [PATCH 5/6] Ensure beneficiary is emitted on initial contribution For external tools tracking the state of the contract, the initial contribution to the contract was not emitting the beneficiary which meant they were unable to rederive the state of the contract from the events alone. --- contracts/ServiceNodeContribution.sol | 8 ++--- .../interfaces/IServiceNodeContribution.sol | 2 +- .../IServiceNodeContributionFactory.sol | 1 - test/unit-js/ServiceNodeContributionTest.js | 32 +++++++++---------- test/unit-js/TokenVestingStaking.js | 2 +- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/contracts/ServiceNodeContribution.sol b/contracts/ServiceNodeContribution.sol index 989948c..a60c5a9 100644 --- a/contracts/ServiceNodeContribution.sol +++ b/contracts/ServiceNodeContribution.sol @@ -155,7 +155,7 @@ contract ServiceNodeContribution is Shared, IServiceNodeContribution { stakingRewardsContract.validateProofOfPossession(newBLSPubkey, newBLSSig, operator, ed25519Pubkey); // NOTE: Update BLS keys - blsPubkey = newBLSPubkey; + blsPubkey = newBLSPubkey; _blsSignature = newBLSSig; // NOTE: Update Ed25519 keys @@ -302,11 +302,11 @@ contract ServiceNodeContribution is Shared, IServiceNodeContribution { } // NOTE: Add the contributor to the contract + address desiredBeneficiary = deriveBeneficiary(caller, beneficiary); if (contributions[caller] == 0) { - address desiredBeneficiary = deriveBeneficiary(caller, beneficiary); _contributorAddresses.push(IServiceNodeRewards.Staker(caller, desiredBeneficiary)); } else { - _updateBeneficiary(caller, beneficiary); + _updateBeneficiary(caller, desiredBeneficiary); } // NOTE: Update the amount contributed and transfer the tokens @@ -333,7 +333,7 @@ contract ServiceNodeContribution is Shared, IServiceNodeContribution { } // NOTE: Transfer funds from sender to contract - emit NewContribution(caller, amount); + emit NewContribution(caller, desiredBeneficiary, amount); SESH.safeTransferFrom(caller, address(this), amount); // NOTE: Auto finalize the node if valid diff --git a/contracts/interfaces/IServiceNodeContribution.sol b/contracts/interfaces/IServiceNodeContribution.sol index 72515bc..6b5a6ce 100644 --- a/contracts/interfaces/IServiceNodeContribution.sol +++ b/contracts/interfaces/IServiceNodeContribution.sol @@ -41,7 +41,7 @@ interface IServiceNodeContribution { ////////////////////////////////////////////////////////////// event Finalized (); - event NewContribution (address indexed contributor, uint256 amount); + event NewContribution (address indexed contributor, address beneficiary, uint256 amount); event OpenForPublicContribution (); event Filled (); event WithdrawContribution (address indexed contributor, uint256 amount); diff --git a/contracts/interfaces/IServiceNodeContributionFactory.sol b/contracts/interfaces/IServiceNodeContributionFactory.sol index c1a4a24..431f47c 100644 --- a/contracts/interfaces/IServiceNodeContributionFactory.sol +++ b/contracts/interfaces/IServiceNodeContributionFactory.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.26; -import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IServiceNodeRewards.sol"; interface IServiceNodeContributionFactory { diff --git a/test/unit-js/ServiceNodeContributionTest.js b/test/unit-js/ServiceNodeContributionTest.js index 7d13ee6..b3dc998 100644 --- a/test/unit-js/ServiceNodeContributionTest.js +++ b/test/unit-js/ServiceNodeContributionTest.js @@ -330,7 +330,7 @@ describe("ServiceNodeContribution Contract Tests", function () { await seshToken.connect(snOperator).approve(snContributionAddress, minContribution); await expect(snContribution.connect(snOperator).contributeFunds(minContribution, beneficiaryData)) .to.emit(snContribution, "NewContribution") - .withArgs(await snOperator.getAddress(), minContribution); + .withArgs(await snOperator.getAddress(), await snOperator.getAddress(), minContribution); await expect(await snContribution.operatorContribution()) .to.equal(minContribution); @@ -384,7 +384,7 @@ describe("ServiceNodeContribution Contract Tests", function () { await expect(snContribution.connect(snOperator) .contributeFunds(minContribution, beneficiaryData)).to .emit(snContribution, "NewContribution") - .withArgs(await snOperator.getAddress(), minContribution); + .withArgs(await snOperator.getAddress(), await snOperator.getAddress(), minContribution); }); it("Should be able to contribute funds as a contributor", async function () { @@ -395,7 +395,7 @@ describe("ServiceNodeContribution Contract Tests", function () { await seshToken.connect(contributor).approve(snContribution, minContribution); await expect(snContribution.connect(contributor).contributeFunds(minContribution, beneficiaryData)) .to.emit(snContribution, "NewContribution") - .withArgs(await contributor.getAddress(), minContribution); + .withArgs(await contributor.getAddress(), await contributor.getAddress(), minContribution); await expect(await snContribution.operatorContribution()) .to.equal(previousContribution); await expect(await snContribution.totalContribution()) @@ -412,7 +412,7 @@ describe("ServiceNodeContribution Contract Tests", function () { await seshToken.connect(snOperator).approve(snContribution, topup); await expect(snContribution.connect(snOperator).contributeFunds(topup, beneficiaryData)) .to.emit(snContribution, "NewContribution") - .withArgs(await snOperator.getAddress(), topup); + .withArgs(await snOperator.getAddress(), await snOperator.getAddress(), topup); await expect(await snContribution.operatorContribution()) .to.equal(currTotal + topup); await expect(await snContribution.totalContribution()) @@ -439,7 +439,7 @@ describe("ServiceNodeContribution Contract Tests", function () { await expect(snContribution.connect(contributor1) .contributeFunds(minContribution1, beneficiaryData)).to .emit(snContribution, "NewContribution") - .withArgs(await contributor1.getAddress(), minContribution1); + .withArgs(await contributor1.getAddress(), await contributor1.getAddress(), minContribution1); // NOTE: Contributor 2 w/ minContribution() const minContribution2 = await snContribution.minimumContribution(); @@ -450,7 +450,7 @@ describe("ServiceNodeContribution Contract Tests", function () { await expect(snContribution.connect(contributor2) .contributeFunds(minContribution2, beneficiaryData)).to .emit(snContribution, "NewContribution") - .withArgs(await contributor2.getAddress(), minContribution2); + .withArgs(await contributor2.getAddress(), await contributor2.getAddress(), minContribution2); // NOTE: Check contribution values expect(await snContribution.operatorContribution()).to @@ -473,7 +473,7 @@ describe("ServiceNodeContribution Contract Tests", function () { await seshToken.connect(contributor1).approve(snContribution, topup1); await expect(snContribution.connect(contributor1).contributeFunds(topup1, beneficiaryData)) .to.emit(snContribution, "NewContribution") - .withArgs(await contributor1.getAddress(), topup1); + .withArgs(await contributor1.getAddress(), await contributor1.getAddress(), topup1); const minContribution2 = await snContribution.minimumContribution(); const topup2 = BigInt(13_000000000); @@ -482,7 +482,7 @@ describe("ServiceNodeContribution Contract Tests", function () { await seshToken.connect(contributor2).approve(snContribution, topup2); await expect(snContribution.connect(contributor2).contributeFunds(topup2, beneficiaryData)) .to.emit(snContribution, "NewContribution") - .withArgs(await contributor2.getAddress(), topup2); + .withArgs(await contributor2.getAddress(), await contributor2.getAddress(), topup2); await expect(await snContribution.operatorContribution()) .to.equal(initialOperatorContrib); @@ -534,7 +534,7 @@ describe("ServiceNodeContribution Contract Tests", function () { await expect(snContribution.connect(contributor1) .contributeFunds(minContribution1, beneficiaryData)).to .emit(snContribution, "NewContribution") - .withArgs(await contributor1.getAddress(), minContribution1); + .withArgs(await contributor1.getAddress(), await contributor1.getAddress(), minContribution1); // NOTE: Contributor 2 w/ minContribution() const minContribution2 = await snContribution.minimumContribution(); @@ -545,7 +545,7 @@ describe("ServiceNodeContribution Contract Tests", function () { await expect(snContribution.connect(contributor2) .contributeFunds(minContribution2, beneficiaryData)).to .emit(snContribution, "NewContribution") - .withArgs(await contributor2.getAddress(), minContribution2); + .withArgs(await contributor2.getAddress(), await contributor2.getAddress(), minContribution2); // NOTE: Check contribution values expect(await snContribution.operatorContribution()).to @@ -620,12 +620,12 @@ describe("ServiceNodeContribution Contract Tests", function () { .contributeFunds(minContribution, beneficiaryData)).to .emit(snContribution, "NewContribution") .emit(snContribution, "Finalized") - .withArgs(await signer.getAddress(), minContribution); + .withArgs(await signer.getAddress(), await signer.getAddress(), minContribution); } else { await expect(snContribution.connect(signer) .contributeFunds(minContribution, beneficiaryData)).to .emit(snContribution, "NewContribution") - .withArgs(await signer.getAddress(), minContribution); + .withArgs(await signer.getAddress(), await signer.getAddress(), minContribution); } } } @@ -644,7 +644,7 @@ describe("ServiceNodeContribution Contract Tests", function () { await expect(await snContribution.connect(contributor).contributeFunds(minContribution, beneficiaryData)) .to.emit(snContribution, "NewContribution") - .withArgs(await contributor.getAddress(), minContribution); + .withArgs(await contributor.getAddress(), await contributor.getAddress(), minContribution); await expect(snContribution.finalize()).to.be.reverted; @@ -1128,7 +1128,7 @@ describe("ServiceNodeContribution Contract Tests", function () { await seshToken.connect(reservedContributor1).approve(snContribution.getAddress(), contribution1); await expect(snContribution.connect(reservedContributor1).contributeFunds(contribution1, beneficiaryData)) .to.emit(snContribution, "NewContribution") - .withArgs(reservedContributor1.address, contribution1); + .withArgs(reservedContributor1.address, reservedContributor1.address, contribution1); // NOTE: Check contribution is registered const contribution = await snContribution.contributions(reservedContributor1.address); @@ -1176,7 +1176,7 @@ describe("ServiceNodeContribution Contract Tests", function () { await expect(snContribution.connect(reservedContributor1).contributeFunds(contribution1 + 1, beneficiaryData)) .to.emit(snContribution, "NewContribution") - .withArgs(reservedContributor1.address, contribution1 + 1); + .withArgs(reservedContributor1.address, reservedContributor1.address, contribution1 + 1); const contribution = await snContribution.contributions(reservedContributor1.address); expect(contribution).to.equal(contribution1 + 1); @@ -1219,7 +1219,7 @@ describe("ServiceNodeContribution Contract Tests", function () { await seshToken.connect(reservedContributor2).approve(snContribution.getAddress(), contribution2); await expect(snContribution.connect(reservedContributor2).contributeFunds(contribution2, beneficiaryData)) .to.emit(snContribution, "NewContribution") - .withArgs(reservedContributor2.address, contribution2); + .withArgs(reservedContributor2.address, reservedContributor2.address, contribution2); // NOTE: Check contract reservation data before we withdraw await expect(await snContribution.getReserved()).to.deep.equal( diff --git a/test/unit-js/TokenVestingStaking.js b/test/unit-js/TokenVestingStaking.js index 321be69..4f85613 100644 --- a/test/unit-js/TokenVestingStaking.js +++ b/test/unit-js/TokenVestingStaking.js @@ -269,7 +269,7 @@ describe("TokenVestingStaking Contract Tests", function () { contribAmount, /*snContribBenficiary*/ beneficiary)) .to.emit(snContribContract, "NewContribution") - .withArgs(await vestingContract.getAddress(), contribAmount); + .withArgs(await vestingContract.getAddress(), beneficiary.address, contribAmount); const contractBalance = await mockERC20.balanceOf(snContribContract.getAddress()); expect(contractBalance).to.equal(revokerContribAmount + contribAmount); From 4cbf9bb2e11b5714a64a12efbdd1933a675dd4b1 Mon Sep 17 00:00:00 2001 From: doylet Date: Tue, 15 Apr 2025 14:06:50 +1000 Subject: [PATCH 6/6] Upgrade metadata for emitting beneficiary on new contributiong --- .openzeppelin/unknown-421614.json | 170 +++++++++++++++++++++++++++++- 1 file changed, 168 insertions(+), 2 deletions(-) diff --git a/.openzeppelin/unknown-421614.json b/.openzeppelin/unknown-421614.json index 27e793f..7f5faf0 100644 --- a/.openzeppelin/unknown-421614.json +++ b/.openzeppelin/unknown-421614.json @@ -84,6 +84,21 @@ "address": "0x90DCb4635D8Df6EeAD86763c64A96d88D06B172f", "txHash": "0x75715e19c560efca4efd5addde8a772e3be68fd80485ddd8535db7403d0227b5", "kind": "transparent" + }, + { + "address": "0xa81a11771B1dD57c2db8b3d2E35af46b35BB0F85", + "txHash": "0x7e8d7f0071e713bed506a60d0226faef6b0dfc7ffa2b6b2320c27450f6925d06", + "kind": "transparent" + }, + { + "address": "0x0005C35433bF677d3501b73A33cB42A481C6C2a3", + "txHash": "0x2edae77e8c25bbbf9e78e4b27717143545b7750cc0f5268e20e33ee18035dd96", + "kind": "transparent" + }, + { + "address": "0xbb2d761a010906F2E98F4e0A8A1FeeDb41E28cec", + "txHash": "0x510024a6528d72e35b1346aee01ff56be33bd0b42eaf1cbbd32d4f1d05aa45ac", + "kind": "transparent" } ], "impls": { @@ -10982,7 +10997,158 @@ "label": "stakingRewardsContract", "offset": 0, "slot": "0", - "type": "t_contract(IServiceNodeRewards)7888", + "type": "t_contract(IServiceNodeRewards)11689", + "contract": "ServiceNodeContributionFactory", + "src": "contracts/ServiceNodeContributionFactory.sol:11" + }, + { + "label": "deployedContracts", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)", + "contract": "ServiceNodeContributionFactory", + "src": "contracts/ServiceNodeContributionFactory.sol:15" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_struct(InitializableStorage)141_storage": { + "label": "struct Initializable.InitializableStorage", + "members": [ + { + "label": "_initialized", + "type": "t_uint64", + "offset": 0, + "slot": "0" + }, + { + "label": "_initializing", + "type": "t_bool", + "offset": 8, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(Ownable2StepStorage)13_storage": { + "label": "struct Ownable2StepUpgradeable.Ownable2StepStorage", + "members": [ + { + "label": "_pendingOwner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(OwnableStorage)74_storage": { + "label": "struct OwnableUpgradeable.OwnableStorage", + "members": [ + { + "label": "_owner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(PausableStorage)444_storage": { + "label": "struct PausableUpgradeable.PausableStorage", + "members": [ + { + "label": "_paused", + "type": "t_bool", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_uint64": { + "label": "uint64", + "numberOfBytes": "8" + }, + "t_contract(IServiceNodeRewards)11689": { + "label": "contract IServiceNodeRewards", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", + "numberOfBytes": "32" + } + }, + "namespaces": { + "erc7201:openzeppelin.storage.Pausable": [ + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol:21", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable2Step": [ + { + "contract": "Ownable2StepUpgradeable", + "label": "_pendingOwner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol:23", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable": [ + { + "contract": "OwnableUpgradeable", + "label": "_owner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:24", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Initializable": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_uint64", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:69", + "offset": 0, + "slot": "0" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:73", + "offset": 8, + "slot": "0" + } + ] + } + } + }, + "7cf75f6dbd51f2e294ffda9428d3306dfefb0dc6ff13694ae77b0d174a6675ec": { + "address": "0x46B10A20E30913B75B15Da4DC18c8d31C69E9b41", + "txHash": "0x600d36d47b44183013d7359c089a208c44844e5be56ff36107b5a29bd5332761", + "layout": { + "solcVersion": "0.8.26", + "storage": [ + { + "label": "stakingRewardsContract", + "offset": 0, + "slot": "0", + "type": "t_contract(IServiceNodeRewards)7890", "contract": "ServiceNodeContributionFactory", "src": "contracts/ServiceNodeContributionFactory.sol:11" }, @@ -11062,7 +11228,7 @@ "label": "uint64", "numberOfBytes": "8" }, - "t_contract(IServiceNodeRewards)7888": { + "t_contract(IServiceNodeRewards)7890": { "label": "contract IServiceNodeRewards", "numberOfBytes": "20" },