diff --git a/packages/nfts/deployments/trailblazers-airdrop/s2/hekla.json b/packages/nfts/deployments/trailblazers-airdrop/s2/hekla.json new file mode 100644 index 00000000000..db20ec393cb --- /dev/null +++ b/packages/nfts/deployments/trailblazers-airdrop/s2/hekla.json @@ -0,0 +1,4 @@ +{ + "ERC20Airdrop": "0xd32365f71Ea0CEb3Bb51Ec095D669eB64a9640F3", + "MerkleRoot": "0x0000000000000000000000000000000000000000000000000000000000000000" +} diff --git a/packages/nfts/deployments/trailblazers-airdrop/s2/mainnet.json b/packages/nfts/deployments/trailblazers-airdrop/s2/mainnet.json new file mode 100644 index 00000000000..d4bb9ca0d99 --- /dev/null +++ b/packages/nfts/deployments/trailblazers-airdrop/s2/mainnet.json @@ -0,0 +1,4 @@ +{ + "ERC20Airdrop": "0x95345D5A092623D79a56a016001f7878FA9Da3Ef", + "MerkleRoot": "0x0000000000000000000000000000000000000000000000000000000000000000" +} diff --git a/packages/nfts/package.json b/packages/nfts/package.json index 9203661d0a1..72bd4261542 100644 --- a/packages/nfts/package.json +++ b/packages/nfts/package.json @@ -42,6 +42,8 @@ "tbz:upgradeV3:mainnet": "forge clean && pnpm compile && forge script script/trailblazers-badges/sol/UpgradeV3.s.sol --rpc-url https://rpc.mainnet.taiko.xyz --broadcast --gas-estimate-multiplier 100", "tbz:upgradeV4:mainnet": "forge clean && pnpm compile && forge script script/trailblazers-badges/UpgradeV4.s.sol --rpc-url https://rpc.mainnet.taiko.xyz --broadcast --gas-estimate-multiplier 100", "tbz-s2:upgradeV2:mainnet": "forge clean && pnpm compile && forge script script/trailblazers-season-2/UpgradeV2.s.sol --rpc-url https://rpc.mainnet.taiko.xyz --broadcast --gas-estimate-multiplier 100", + "tbz:airdrop-s2:hekla": "forge clean && pnpm compile && forge script script/trailblazers-airdrop/DeployS2.s.sol --rpc-url https://rpc.hekla.taiko.xyz --broadcast --gas-estimate-multiplier 200", + "tbz:airdrop-s2:mainnet": "forge clean && pnpm compile && forge script script/trailblazers-airdrop/DeployS2.s.sol --rpc-url https://rpc.mainnet.taiko.xyz --broadcast --verify --gas-estimate-multiplier 100", "tbz-s2:upgradeRecruitmentV2:hekla": "forge clean && pnpm compile && forge script script/trailblazers-season-2/RecruitmentUpgradeV2.s.sol --rpc-url https://rpc.hekla.taiko.xyz --broadcast --gas-estimate-multiplier 200", "tbz-s2:upgradeRecruitmentV2:mainnet": "forge clean && pnpm compile && forge script script/trailblazers-season-2/RecruitmentUpgradeV2.s.sol --rpc-url https://rpc.mainnet.taiko.xyz --broadcast --gas-estimate-multiplier 100" }, diff --git a/packages/nfts/script/trailblazers-airdrop/DeployS2.s.sol b/packages/nfts/script/trailblazers-airdrop/DeployS2.s.sol new file mode 100644 index 00000000000..d23df201584 --- /dev/null +++ b/packages/nfts/script/trailblazers-airdrop/DeployS2.s.sol @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.24; + +import { UtilsScript } from "./Utils.s.sol"; +import { Script, console } from "forge-std/src/Script.sol"; +import { Merkle } from "murky/Merkle.sol"; +import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; +import { TrailblazersBadges } from "../../contracts/trailblazers-badges/TrailblazersBadges.sol"; +import { IMinimalBlacklist } from "@taiko/blacklist/IMinimalBlacklist.sol"; +import { ERC20Airdrop } from "../../contracts/trailblazers-airdrop/ERC20Airdrop.sol"; +import { ERC20Mock } from "../../test/util/MockTokens.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; +import { MockBlacklist } from "../../test/util/Blacklist.sol"; + +contract DeployScript is Script { + UtilsScript public utils; + string public jsonLocation; + uint256 public deployerPrivateKey; + address public deployerAddress; + + // only used for production + IMinimalBlacklist blacklist = IMinimalBlacklist(0xfA5EA6f9A13532cd64e805996a941F101CCaAc9a); + + ERC20Airdrop public airdrop; + uint256 constant TOTAL_AVAILABLE_FUNDS = 1000 ether; + + // rewards token + ERC20Upgradeable public erc20 = ERC20Upgradeable(0xA9d23408b9bA935c230493c40C73824Df71A0975); + ERC20Mock public mockERC20; + // start and end times for the claim + uint64 constant CLAIM_DURATION = 30 days; + // Blind deployment + bytes32 public merkleRoot = 0x0; + uint64 public CLAIM_START = 253370764861; // year 9999 + uint64 public CLAIM_END = CLAIM_START + 1; + + function setUp() public { + utils = new UtilsScript(); + utils.setUp(); + + jsonLocation = utils.getS2ContractJsonLocation(); + deployerPrivateKey = utils.getPrivateKey(); + deployerAddress = utils.getAddress(); + + vm.startBroadcast(deployerPrivateKey); + + if (block.chainid != 167_000) { + // not mainnet, create mock contracts + blacklist = new MockBlacklist(); + mockERC20 = new ERC20Mock(); + // mint the necessary funds + erc20 = ERC20Upgradeable(address(mockERC20)); + } + + vm.stopBroadcast(); + } + + function run() public { + string memory jsonRoot = "root"; + + vm.startBroadcast(deployerPrivateKey); + + // deploy token with empty root + address impl = address(new ERC20Airdrop()); + address proxy = address( + new ERC1967Proxy( + impl, + abi.encodeCall( + ERC20Airdrop.init, + (deployerAddress, CLAIM_START, CLAIM_END, merkleRoot, erc20, address(blacklist)) + ) + ) + ); + + airdrop = ERC20Airdrop(proxy); + + // mint the necessary funds on hekla + 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)); + + vm.serializeBytes32(jsonRoot, "MerkleRoot", merkleRoot); + string memory finalJson = vm.serializeAddress(jsonRoot, "ERC20Airdrop", address(airdrop)); + vm.writeJson(finalJson, jsonLocation); + + vm.stopBroadcast(); + } +} diff --git a/packages/nfts/script/trailblazers-airdrop/Utils.s.sol b/packages/nfts/script/trailblazers-airdrop/Utils.s.sol index cb9b6269d5f..58a2f424126 100644 --- a/packages/nfts/script/trailblazers-airdrop/Utils.s.sol +++ b/packages/nfts/script/trailblazers-airdrop/Utils.s.sol @@ -62,6 +62,12 @@ contract UtilsScript is Script { string.concat(root, "/deployments/trailblazers-airdrop/", lowercaseNetworkKey, ".json"); } + function getS2ContractJsonLocation() public view returns (string memory) { + string memory root = vm.projectRoot(); + return + string.concat(root, "/deployments/trailblazers-airdrop/s2/", lowercaseNetworkKey, ".json"); + } + function getBlacklist() public view returns (IMinimalBlacklist blacklistAddress) { if (block.chainid == 167_000) { // mainnet blacklist address