@@ -5,37 +5,26 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
55import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol " ;
66import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol " ;
77import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol " ;
8+ import {IZoraTokenCommunityClaim} from "./IZoraTokenCommunityClaim.sol " ;
89
910/// @title Zora Token Claim
1011/// @notice Contract for distributing tokens to the Zora community
1112/// @dev Allows an admin to set allocations in advance using a storage mapping of addresses to amounts,
1213/// avoiding the blockspace congestion that can occur with merkle proofs during claiming
13- contract ZoraTokenCommunityClaim is EIP712 {
14+ contract ZoraTokenCommunityClaim is IZoraTokenCommunityClaim , EIP712 {
1415 string private constant DOMAIN_NAME = "ZoraTokenCommunityClaim " ;
1516 string private constant DOMAIN_VERSION = "1 " ;
1617
1718 // Type hash for the ClaimWithSignature struct
1819 bytes32 private constant CLAIM_TYPEHASH = keccak256 ("ClaimWithSignature(address user,address claimTo,uint256 deadline) " );
1920
20- address public immutable admin;
21- uint256 public immutable claimStart;
21+ address public immutable override admin;
22+ uint256 public immutable override claimStart;
2223 IERC20 public immutable token;
2324
2425 // Compact allocations stored as uint96 (token count, will be multiplied by 1e18)
2526 mapping (address => uint96 ) private compactAllocations;
26- mapping (address => bool ) public hasClaimed;
27-
28- error OnlyAdmin ();
29- error ClaimNotOpen ();
30- error ClaimOpened ();
31- error ArrayLengthMismatch ();
32- error NoAllocation ();
33- error AlreadyClaimed ();
34- error InvalidSignature ();
35- error SignatureExpired ();
36-
37- event AllocationsSet (bytes32 [] indexed allocations );
38- event Claimed (address indexed account , address indexed claimTo , uint256 amount );
27+ mapping (address => bool ) public override hasClaimed;
3928
4029 constructor (address _admin , uint256 _claimStart , address _token ) EIP712 (DOMAIN_NAME, DOMAIN_VERSION) {
4130 admin = _admin;
@@ -44,14 +33,14 @@ contract ZoraTokenCommunityClaim is EIP712 {
4433 }
4534
4635 // Public view function to get the full allocation amount with 18 decimals
47- function allocations (address user ) public view returns (uint256 ) {
36+ function allocations (address user ) public view override returns (uint256 ) {
4837 return uint256 (compactAllocations[user]);
4938 }
5039
5140 /// @notice Sets allocations using packed data format for gas efficiency
5241 /// @dev Each bytes32 contains an address (160 bits) and allocation (96 bits)
5342 /// @param packedData Array of packed address+allocation data
54- function setAllocations (bytes32 [] calldata packedData ) external {
43+ function setAllocations (bytes32 [] calldata packedData ) external override {
5544 require (msg .sender == admin, OnlyAdmin ());
5645 require (! claimIsOpen (), ClaimOpened ());
5746
@@ -69,11 +58,11 @@ contract ZoraTokenCommunityClaim is EIP712 {
6958 emit AllocationsSet (packedData);
7059 }
7160
72- function claimIsOpen () public view returns (bool ) {
61+ function claimIsOpen () public view override returns (bool ) {
7362 return block .timestamp >= claimStart;
7463 }
7564
76- function claim (address _claimTo ) external {
65+ function claim (address _claimTo ) external override {
7766 _claim (msg .sender , _claimTo);
7867 }
7968
@@ -82,7 +71,7 @@ contract ZoraTokenCommunityClaim is EIP712 {
8271 /// @param _claimTo The address to send the tokens to
8372 /// @param _deadline The deadline for the signature to be valid
8473 /// @param _signature The signature authorizing the claim
85- function claimWithSignature (address _user , address _claimTo , uint256 _deadline , bytes calldata _signature ) external {
74+ function claimWithSignature (address _user , address _claimTo , uint256 _deadline , bytes calldata _signature ) external override {
8675 require (block .timestamp <= _deadline, SignatureExpired ());
8776
8877 // Verify signature
@@ -113,8 +102,8 @@ contract ZoraTokenCommunityClaim is EIP712 {
113102 SafeERC20.safeTransfer (token, _claimTo, amount);
114103 }
115104
116- // Make the domain separator accessible for testing
117- function getDomainSeparator () public view returns (bytes32 ) {
105+ /// @notice Make the domain separator accessible for testing
106+ function getDomainSeparator () public view override returns (bytes32 ) {
118107 return _domainSeparatorV4 ();
119108 }
120109}
0 commit comments