Skip to content

Commit

Permalink
feat(nfts): tbz s1 claim production deployments (#18224)
Browse files Browse the repository at this point in the history
Co-authored-by: Korbinian <KorbinianK@users.noreply.github.com>
  • Loading branch information
bearni95 and KorbinianK authored Oct 10, 2024
1 parent 7129702 commit 543385a
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 12 deletions.
10 changes: 9 additions & 1 deletion packages/nfts/contracts/trailblazers-airdrop/ERC20Airdrop.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ contract ERC20Airdrop is MerkleClaimable, ReentrancyGuardUpgradeable, PausableUp

/// @notice Event emitted when the blacklist is updated.
event BlacklistUpdated(address _blacklist);
/// @notice Errors

/// @notice Errors
error ADDRESS_BLACKLISTED();

uint256[48] private __gap;
Expand Down Expand Up @@ -94,6 +94,14 @@ contract ERC20Airdrop is MerkleClaimable, ReentrancyGuardUpgradeable, PausableUp
_token.transfer(owner(), _token.balanceOf(address(this)));
}

/// @notice Update blacklist contract
/// @param _blacklist The new blacklist contract address
/// @dev Only the owner can execute this function
function updateBlacklist(address _blacklist) external onlyOwner {
blacklist = IMinimalBlacklist(_blacklist);
emit BlacklistUpdated(_blacklist);
}

/// @notice Internal method to authorize an upgrade
function _authorizeUpgrade(address) internal virtual override onlyOwner { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,15 @@ abstract contract MerkleClaimable is
emit ConfigChanged(_claimStart, _claimEnd, _merkleRoot);
}

/// @notice Check if a claim has been made
/// @param user Address of the user
/// @param amount Amount of tokens claimed
/// @return Whether the claim has been made
function hasClaimed(address user, uint256 amount) external view returns (bool) {
bytes32 hash = keccak256(abi.encode("CLAIM_TAIKO_AIRDROP", (abi.encode(user, amount))));
return isClaimed[hash];
}

/// @notice Internal method to authorize an upgrade
function _authorizeUpgrade(address) internal virtual override onlyOwner { }
}
4 changes: 2 additions & 2 deletions packages/nfts/deployments/trailblazers-airdrop/hekla.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"ERC20Airdrop": "0x42DB7bE491a8933FaADbca4891dA2632D45e5CfC",
"MerkleRoot": "0xea5b2299e76b4860965e9059388d021145269c96b816b07a808ff391cd80753e"
"ERC20Airdrop": "0xdeC2662Dff4eAB8b94B5257D637204d18D95cb74",
"MerkleRoot": "0xbe8ec647626f95185f551887b3eee43ea9e8965c7baf558a9f8cb22b020597f0"
}
4 changes: 4 additions & 0 deletions packages/nfts/deployments/trailblazers-airdrop/mainnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"ERC20Airdrop": "0x290265ACd21816EE414E64eEC77dd490d8dd9f51",
"MerkleRoot": "0xc7f7e6bb3d1bb31b0ef5e2e34383c12ec9ef8a301ffde9771bd9de7554c70b1d"
}
3 changes: 2 additions & 1 deletion packages/nfts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"kbw:upgradeV2:mainnet": "forge clean && pnpm compile && forge script script/party-ticket/sol/UpgradeV2.s.sol --rpc-url https://rpc.mainnet.taiko.xyz --broadcast",
"pfp:deploy:hekla": "forge clean && pnpm compile && forge script script/profile/Deploy.s.sol --rpc-url https://rpc.hekla.taiko.xyz --broadcast --gas-estimate-multiplier 200",
"pfp:deploy:mainnet": "forge clean && pnpm compile && forge script script/profile/Deploy.s.sol --rpc-url https://rpc.mainnet.taiko.xyz --broadcast --gas-estimate-multiplier 200",
"tbz:airdrop:hekla": "forge clean && pnpm compile && forge script script/trailblazers-airdrop/Deploy.s.sol --rpc-url https://rpc.hekla.taiko.xyz --broadcast --gas-estimate-multiplier 200"
"tbz:airdrop:hekla": "forge clean && pnpm compile && forge script script/trailblazers-airdrop/Deploy.s.sol --rpc-url https://rpc.hekla.taiko.xyz --broadcast --gas-estimate-multiplier 200",
"tbz:airdrop:mainnet": "forge clean && pnpm compile && forge script script/trailblazers-airdrop/Deploy.s.sol --rpc-url https://rpc.mainnet.taiko.xyz --broadcast --gas-estimate-multiplier 100"
},
"devDependencies": {
"@types/node": "^20.11.30",
Expand Down
14 changes: 7 additions & 7 deletions packages/nfts/script/trailblazers-airdrop/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,21 @@ contract DeployScript is Script {
address public deployerAddress;

// only used for production
IMinimalBlacklist blacklist = IMinimalBlacklist(0xe61E9034b5633977eC98E302b33e321e8140F105);
IMinimalBlacklist blacklist = IMinimalBlacklist(0xfA5EA6f9A13532cd64e805996a941F101CCaAc9a);

ERC20Airdrop public airdrop;
uint256 constant TOTAL_AVAILABLE_FUNDS = 1000 ether;

uint256 constant CLAIM_AMOUNT = 10 ether;

// hekla test root
bytes32 public merkleRoot = 0xea5b2299e76b4860965e9059388d021145269c96b816b07a808ff391cd80753e;
bytes32 public merkleRoot = 0xbe8ec647626f95185f551887b3eee43ea9e8965c7baf558a9f8cb22b020597f0;

// rewards token
ERC20Upgradeable public erc20;
ERC20Upgradeable public erc20 = ERC20Upgradeable(0xA9d23408b9bA935c230493c40C73824Df71A0975);
ERC20Mock public mockERC20;
// start and end times for the claim
uint64 constant CLAIM_DURATION = 1 days;
uint64 public CLAIM_START = uint64(block.timestamp);
uint64 constant CLAIM_DURATION = 30 days;
// uint64 public CLAIM_START = uint64(block.timestamp);
uint64 public CLAIM_START = 1_728_683_700; // 2024-06-10 23:55:00 UTC
uint64 public CLAIM_END = CLAIM_START + CLAIM_DURATION;

function setUp() public {
Expand Down Expand Up @@ -81,6 +80,7 @@ contract DeployScript is Script {
if (block.chainid != 167_000) {
mockERC20.mint(address(airdrop), TOTAL_AVAILABLE_FUNDS);
}
console.log("ERC20 Token:", address(erc20));

console.log("Deployed ERC20Airdrop to:", address(airdrop));

Expand Down
12 changes: 11 additions & 1 deletion packages/nfts/test/trailblazers-airdrop/ERC20Airdrop.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ contract ERC20AirdropTest is Test {
airdrop = ERC20Airdrop(proxy);

// fund the airdrop contract
erc20.mint(address(airdrop), TOTAL_AVAILABLE_FUNDS);
erc20.mint(owner, TOTAL_AVAILABLE_FUNDS);
erc20.transfer(address(airdrop), TOTAL_AVAILABLE_FUNDS);

vm.stopBroadcast();
}
Expand Down Expand Up @@ -138,4 +139,13 @@ contract ERC20AirdropTest is Test {
vm.expectRevert();
airdrop.claim(user, CLAIM_AMOUNT, proof);
}

function test_transferOwnership() public {
assertEq(airdrop.owner(), owner);
vm.prank(owner);
airdrop.transferOwnership(minters[0]);
vm.prank(minters[0]);
airdrop.acceptOwnership();
assertEq(airdrop.owner(), minters[0]);
}
}

0 comments on commit 543385a

Please sign in to comment.