Skip to content
Merged
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
4 changes: 4 additions & 0 deletions contracts/contracts/IdentityVerificationHubImplV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ contract IdentityVerificationHubImplV2 is ImplRoot {
/// @dev Ensures that the user context data hash matches the user identifier in the proof.
error InvalidUserIdentifierInProof();

/// @notice Thrown when the verification config is not set.
/// @dev Ensures that the verification config is set before performing verification.
error ConfigNotSet();

// ====================================================
// Constructor
// ====================================================
Expand Down
336 changes: 212 additions & 124 deletions contracts/contracts/example/Airdrop.sol

Large diffs are not rendered by default.

92 changes: 46 additions & 46 deletions contracts/contracts/example/HappyBirthday.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// // SPDX-License-Identifier: MIT
// pragma solidity 0.8.28;
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

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

import {ISelfVerificationRoot} from "../interfaces/ISelfVerificationRoot.sol";
import {AttestationId} from "../constants/AttestationId.sol";
Expand All @@ -29,8 +29,8 @@ contract SelfHappyBirthday is SelfVerificationRoot, Ownable {
// Storage Variables
// ====================================================

// /// @notice USDC token contract
// IERC20 public immutable usdc;
/// @notice USDC token contract
IERC20 public immutable usdc;

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

// /// @notice Default: 1 day window around birthday
// uint256 public claimableWindow = 1 days;
/// @notice Default: 1 day window around birthday
uint256 public claimableWindow = 1 days;

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

// // ====================================================
// // Events
// // ====================================================
// ====================================================
// Events
// ====================================================

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

// // ====================================================
// // Errors
// // ====================================================
// ====================================================
// Errors
// ====================================================

// error NotWithinBirthdayWindow();
// error AlreadyClaimed();
error NotWithinBirthdayWindow();
error AlreadyClaimed();

/**
* @notice Initializes the HappyBirthday V2 contract
Expand All @@ -77,9 +77,9 @@ contract SelfHappyBirthday is SelfVerificationRoot, Ownable {
usdc = IERC20(token);
}

// // ====================================================
// // External/Public Functions
// // ====================================================
// ====================================================
// External/Public Functions
// ====================================================

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

// /**
// * @notice Sets the claimable window around birthdays
// * @param newWindow The new claimable window in seconds
// */
// function setClaimableWindow(uint256 newWindow) external onlyOwner {
// uint256 oldWindow = claimableWindow;
// claimableWindow = newWindow;
// emit ClaimableWindowUpdated(oldWindow, newWindow);
// }
/**
* @notice Sets the claimable window around birthdays
* @param newWindow The new claimable window in seconds
*/
function setClaimableWindow(uint256 newWindow) external onlyOwner {
uint256 oldWindow = claimableWindow;
claimableWindow = newWindow;
emit ClaimableWindowUpdated(oldWindow, newWindow);
}

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

// // ====================================================
// // Override Functions from SelfVerificationRoot
// // ====================================================
// ====================================================
// Override Functions from SelfVerificationRoot
// ====================================================

/**
* @notice Hook called after successful verification
Expand Down Expand Up @@ -163,9 +163,9 @@ contract SelfHappyBirthday is SelfVerificationRoot, Ownable {
}
}

// // ====================================================
// // Internal Functions
// // ====================================================
// ====================================================
// Internal Functions
// ====================================================

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

// uint256 currentTime = block.timestamp;
// uint256 timeDifference;
uint256 currentTime = block.timestamp;
uint256 timeDifference;

// if (currentTime > dobInThisYearTimestamp) {
// timeDifference = currentTime - dobInThisYearTimestamp;
// } else {
// timeDifference = dobInThisYearTimestamp - currentTime;
// }
if (currentTime > dobInThisYearTimestamp) {
timeDifference = currentTime - dobInThisYearTimestamp;
} else {
timeDifference = dobInThisYearTimestamp - currentTime;
}

// return timeDifference <= claimableWindow;
// }
// }
return timeDifference <= claimableWindow;
}
}
219 changes: 0 additions & 219 deletions contracts/contracts/example/SelfPassportERC721.sol

This file was deleted.

Loading
Loading