Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nfts): tbz s2 claim deployment #18600

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
4 changes: 4 additions & 0 deletions packages/nfts/deployments/trailblazers-airdrop/s2/hekla.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"ERC20Airdrop": "0xd32365f71Ea0CEb3Bb51Ec095D669eB64a9640F3",
"MerkleRoot": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"ERC20Airdrop": "0x95345D5A092623D79a56a016001f7878FA9Da3Ef",
"MerkleRoot": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
4 changes: 3 additions & 1 deletion packages/nfts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
"tbz:upgradeV3:hekla": "forge clean && pnpm compile && forge script script/trailblazers-badges/sol/UpgradeV3.s.sol --rpc-url https://rpc.hekla.taiko.xyz --broadcast --gas-estimate-multiplier 200",
"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-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"
},
"devDependencies": {
"@types/node": "^20.11.30",
Expand Down
91 changes: 91 additions & 0 deletions packages/nfts/script/trailblazers-airdrop/DeployS2.s.sol
Original file line number Diff line number Diff line change
@@ -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();
}
}
6 changes: 6 additions & 0 deletions packages/nfts/script/trailblazers-airdrop/Utils.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down