@@ -37,6 +37,9 @@ contract Oracle is IOracle, Ownable2StepUpgradeable, UUPSUpgradeable {
3737 // oracle node allow list
3838 mapping (address => bool ) public nodeAllowList;
3939
40+ // snapshot allow list
41+ mapping (address => bool ) public snapshotAllowList;
42+
4043 // address status map, key: voter address value: block height
4144 mapping (address => uint256 ) public voterAddressToBlockHeight;
4245
@@ -67,6 +70,9 @@ contract Oracle is IOracle, Ownable2StepUpgradeable, UUPSUpgradeable {
6770 // github account list
6871 mapping (string => bool ) public githubAccountList;
6972
73+ // date to cid
74+ mapping (string => string ) public dateToCid;
75+
7076 /**
7177 * @dev Modifier that allows a function to be called only by addresses in the node allow list.
7278 */
@@ -77,6 +83,13 @@ contract Oracle is IOracle, Ownable2StepUpgradeable, UUPSUpgradeable {
7783 _;
7884 }
7985
86+ modifier onlyInSnapshotAllowList (){
87+ if (! snapshotAllowList[msg .sender ]) {
88+ revert PermissionError ("Not in snapshot allow list error. " );
89+ }
90+ _;
91+ }
92+
8093 /**
8194 * @dev Modifier that ensures the provided address is non-zero.
8295 * @param addr The address to check.
@@ -258,6 +271,15 @@ contract Oracle is IOracle, Ownable2StepUpgradeable, UUPSUpgradeable {
258271 nodeAllowList[nodeAddress] = allow;
259272 }
260273
274+ /**
275+ * @notice Updates the snapshot allow list by adding or removing a snapshot address.
276+ * @param snapshotAddress Address of the snapshot to be added or removed.
277+ * @param allow Boolean indicating whether to allow (true) or disallow (false) the snapshot address.
278+ */
279+ function updateSnapshotAllowList (address snapshotAddress , bool allow ) external override onlyOwner nonZeroAddress (snapshotAddress) {
280+ snapshotAllowList[snapshotAddress] = allow;
281+ }
282+
261283 /**
262284 * @notice Retrieves the list of voter addresses.
263285 * @return An array containing the addresses of all voters.
@@ -275,6 +297,16 @@ contract Oracle is IOracle, Ownable2StepUpgradeable, UUPSUpgradeable {
275297 return voterToInfo[voter];
276298 }
277299
300+ /**
301+ * @notice Adds a snapshot for a specific date with its associated IPFS CID.
302+ * @param date The date associated with the snapshot.
303+ * @param cid The IPFS CID corresponding to the snapshot.
304+ * @dev Only addresses in the snapshot allow list can call this function.
305+ */
306+ function addSnapshot (string calldata date , string calldata cid ) external override onlyInSnapshotAllowList {
307+ dateToCid[date] = cid;
308+ }
309+
278310 /**
279311 * @notice Updates the miner IDs associated with a voter based on their actor IDs.
280312 * @param voterAddress The address of the voter.
0 commit comments