Skip to content

Commit

Permalink
add max claims
Browse files Browse the repository at this point in the history
  • Loading branch information
elshan-eth committed Feb 21, 2024
1 parent 56ce65c commit fc6d88f
Show file tree
Hide file tree
Showing 3 changed files with 267 additions and 17 deletions.
7 changes: 7 additions & 0 deletions contracts/contracts/DevRewardDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ contract DevRewardDistributor {

uint256 public immutable lockupPeriod;

uint256 public immutable maxClaims;

uint256 public immutable totalClaims;

uint256 private _totalSupply;

/**
Expand Down Expand Up @@ -196,6 +200,8 @@ contract DevRewardDistributor {
) external whenClaimingIs(true) {
require(!isClaimed(userId), "Tokens already claimed");

require(totalClaims < maxClaims, "All tokens are claimed");

bytes32 leaf = keccak256(abi.encodePacked(userId, temporaryAddress));

require(MerkleProof.verify(merkleProof, merkleRoot, leaf), "Valid proof required");
Expand All @@ -210,6 +216,7 @@ contract DevRewardDistributor {
uint256 amount = currentReward();
lockedBalances[msg.sender] = LockedBalance({amount: amount, unlockTime: block.timestamp + lockupPeriod});
_totalSupply += amount;
totalClaims++;

emit Transfer(address(0x00), msg.sender, amount);
emit Claimed(userId, msg.sender, amount, leaf);
Expand Down
50 changes: 33 additions & 17 deletions contracts/deployments/sepolia/DevRewardDistributor.json

Large diffs are not rendered by default.

Loading

0 comments on commit fc6d88f

Please sign in to comment.