Skip to content

Commit 02a0ee3

Browse files
authored
Hotfix contract compile error (#660)
* Fix previous rebase error * Refactor deployment module for Identity Verification Hub V2.
1 parent 0468719 commit 02a0ee3

File tree

8 files changed

+311
-467
lines changed

8 files changed

+311
-467
lines changed

contracts/contracts/IdentityVerificationHubImplV2.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ contract IdentityVerificationHubImplV2 is ImplRoot {
161161
/// @dev Ensures that the user context data hash matches the user identifier in the proof.
162162
error InvalidUserIdentifierInProof();
163163

164+
/// @notice Thrown when the verification config is not set.
165+
/// @dev Ensures that the verification config is set before performing verification.
166+
error ConfigNotSet();
167+
164168
// ====================================================
165169
// Constructor
166170
// ====================================================

contracts/contracts/example/Airdrop.sol

Lines changed: 212 additions & 124 deletions
Large diffs are not rendered by default.

contracts/contracts/example/HappyBirthday.sol

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// // SPDX-License-Identifier: MIT
2-
// pragma solidity 0.8.28;
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.28;
33

4-
// import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
5-
// import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
4+
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
5+
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
66

77
import {ISelfVerificationRoot} from "../interfaces/ISelfVerificationRoot.sol";
88
import {AttestationId} from "../constants/AttestationId.sol";
@@ -29,8 +29,8 @@ contract SelfHappyBirthday is SelfVerificationRoot, Ownable {
2929
// Storage Variables
3030
// ====================================================
3131

32-
// /// @notice USDC token contract
33-
// IERC20 public immutable usdc;
32+
/// @notice USDC token contract
33+
IERC20 public immutable usdc;
3434

3535
/// @notice Default: 50 dollar (6 decimals for USDC)
3636
uint256 public claimableAmount = 50e6;
@@ -41,27 +41,27 @@ contract SelfHappyBirthday is SelfVerificationRoot, Ownable {
4141
/// @notice Bonus multiplier for E-Passport card users (in basis points)
4242
uint256 public passportBonusMultiplier = 100; // 100% = 50% bonus
4343

44-
// /// @notice Default: 1 day window around birthday
45-
// uint256 public claimableWindow = 1 days;
44+
/// @notice Default: 1 day window around birthday
45+
uint256 public claimableWindow = 1 days;
4646

47-
// /// @notice Tracks users who have claimed to prevent double claims
48-
// mapping(uint256 nullifier => bool hasClaimed) public hasClaimed;
47+
/// @notice Tracks users who have claimed to prevent double claims
48+
mapping(uint256 nullifier => bool hasClaimed) public hasClaimed;
4949

50-
// // ====================================================
51-
// // Events
52-
// // ====================================================
50+
// ====================================================
51+
// Events
52+
// ====================================================
5353

5454
event USDCClaimed(address indexed claimer, uint256 amount, bytes32 attestationId);
5555
event ClaimableAmountUpdated(uint256 oldAmount, uint256 newAmount);
5656
event ClaimableWindowUpdated(uint256 oldWindow, uint256 newWindow);
5757
event EuidBonusMultiplierUpdated(uint256 oldMultiplier, uint256 newMultiplier);
5858

59-
// // ====================================================
60-
// // Errors
61-
// // ====================================================
59+
// ====================================================
60+
// Errors
61+
// ====================================================
6262

63-
// error NotWithinBirthdayWindow();
64-
// error AlreadyClaimed();
63+
error NotWithinBirthdayWindow();
64+
error AlreadyClaimed();
6565

6666
/**
6767
* @notice Initializes the HappyBirthday V2 contract
@@ -77,9 +77,9 @@ contract SelfHappyBirthday is SelfVerificationRoot, Ownable {
7777
usdc = IERC20(token);
7878
}
7979

80-
// // ====================================================
81-
// // External/Public Functions
82-
// // ====================================================
80+
// ====================================================
81+
// External/Public Functions
82+
// ====================================================
8383

8484
/**
8585
* @notice Sets the claimable USDC amount
@@ -91,15 +91,15 @@ contract SelfHappyBirthday is SelfVerificationRoot, Ownable {
9191
emit ClaimableAmountUpdated(oldAmount, newAmount);
9292
}
9393

94-
// /**
95-
// * @notice Sets the claimable window around birthdays
96-
// * @param newWindow The new claimable window in seconds
97-
// */
98-
// function setClaimableWindow(uint256 newWindow) external onlyOwner {
99-
// uint256 oldWindow = claimableWindow;
100-
// claimableWindow = newWindow;
101-
// emit ClaimableWindowUpdated(oldWindow, newWindow);
102-
// }
94+
/**
95+
* @notice Sets the claimable window around birthdays
96+
* @param newWindow The new claimable window in seconds
97+
*/
98+
function setClaimableWindow(uint256 newWindow) external onlyOwner {
99+
uint256 oldWindow = claimableWindow;
100+
claimableWindow = newWindow;
101+
emit ClaimableWindowUpdated(oldWindow, newWindow);
102+
}
103103

104104
/**
105105
* @notice Sets the EUID bonus multiplier for EUID card users
@@ -120,9 +120,9 @@ contract SelfHappyBirthday is SelfVerificationRoot, Ownable {
120120
usdc.safeTransfer(to, amount);
121121
}
122122

123-
// // ====================================================
124-
// // Override Functions from SelfVerificationRoot
125-
// // ====================================================
123+
// ====================================================
124+
// Override Functions from SelfVerificationRoot
125+
// ====================================================
126126

127127
/**
128128
* @notice Hook called after successful verification
@@ -163,9 +163,9 @@ contract SelfHappyBirthday is SelfVerificationRoot, Ownable {
163163
}
164164
}
165165

166-
// // ====================================================
167-
// // Internal Functions
168-
// // ====================================================
166+
// ====================================================
167+
// Internal Functions
168+
// ====================================================
169169

170170
/**
171171
* @notice Checks if the current date is within the user's birthday window
@@ -186,15 +186,15 @@ contract SelfHappyBirthday is SelfVerificationRoot, Ownable {
186186
string memory dobInThisYear = string(abi.encodePacked("25", month, day));
187187
uint256 dobInThisYearTimestamp = Formatter.dateToUnixTimestamp(dobInThisYear);
188188

189-
// uint256 currentTime = block.timestamp;
190-
// uint256 timeDifference;
189+
uint256 currentTime = block.timestamp;
190+
uint256 timeDifference;
191191

192-
// if (currentTime > dobInThisYearTimestamp) {
193-
// timeDifference = currentTime - dobInThisYearTimestamp;
194-
// } else {
195-
// timeDifference = dobInThisYearTimestamp - currentTime;
196-
// }
192+
if (currentTime > dobInThisYearTimestamp) {
193+
timeDifference = currentTime - dobInThisYearTimestamp;
194+
} else {
195+
timeDifference = dobInThisYearTimestamp - currentTime;
196+
}
197197

198-
// return timeDifference <= claimableWindow;
199-
// }
200-
// }
198+
return timeDifference <= claimableWindow;
199+
}
200+
}

contracts/contracts/example/SelfPassportERC721.sol

Lines changed: 0 additions & 219 deletions
This file was deleted.

0 commit comments

Comments
 (0)