Skip to content

Commit

Permalink
feat(taikoon): devnet deployment (#16937)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Wang <[email protected]>
Co-authored-by: bearni95 <[email protected]>
  • Loading branch information
3 people authored May 15, 2024
1 parent 3740dc0 commit 387ffb1
Show file tree
Hide file tree
Showing 13 changed files with 203 additions and 21 deletions.
1 change: 1 addition & 0 deletions packages/taikoon-ui/src/generated/abi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ export const taikoonTokenAbi = [
export const taikoonTokenAddress = {
17000: '0xfDbaA6d6c382A2555856bFaB315D5E6F3CDA1393',
31337: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512',
167001: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512',
} as const;

/**
Expand Down
73 changes: 73 additions & 0 deletions packages/taikoon-ui/src/generated/whitelist/devnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"format": "standard-v1",
"tree": [
"0x1c71ed62062e13d65812291988bfef0460682d875100761c58592d17c18555a9",
"0x8bb46b909451ba8922cd72ca90e4afce2c7ffdccf14d3ade6fc98efccfe64ec2",
"0x2ab871cb5e296646403f25784cfeb5dfbf75d5636a5712436cbaff8e1a1ceca1",
"0x352d7e8aaa905d0ad60f23d4f1fe8623eeb226ab9176237ec2999824a5b42a8a",
"0xce952912fdfb7274edac76d5aad2b651d8cf9b7f80ecafce517cf92b8cd9d546",
"0xd240494c00293ec17300c655e0c65b6086b9bc7c1952f40981ba763b419fd457",
"0x6c6c6e5a37e025eb0424ef0310815cafdd25bb9db7c7e9b38fe895a7c0c284a2",
"0xf312d570abc8cd8e0a9125e24d3226d09cc52a06299ee24dd29bae06d286d5f4",
"0xc5214eda5aa1a2b4b374c4174c0bb2e19919fa0926785c366db4a7518683b2b1",
"0xdd5c4aa8136160e7f06dcae4fc2a53f2e61cc44f298cc8752e04419704fc566f",
"0xfa31eb8d65ff2307b7026df667a06a19aade0151ed701ed2307295ae4fa48364",
"0xd564c879701263dc95ed8b12a3ccc0068725c20abe9b3f974d37039d3502004a",
"0xd2ba18d108a6f870072af3fcac999272d9f05eae84b5b3c9d90caa5eae14b690",
"0xcfa52795847379e100e5fe363a62abec587da5ae587614c82afb0af917d037c6",
"0xb389f4bc7aeae1095ce783a124301833696089020a9fac46d22d49d63172c2e4",
"0xaef7908975d3b9b86b11945a9988e60f10766d68b86477c34d7ed55b500c70fc",
"0xae323cc40a61b10949149004b5400452f33014003b414e93c2ecc7b0a945e356",
"0xa0af2dd081de8fe969bfc780d7dd36be3c6c9e5ddae779a9a8b8b79f31c7e070",
"0x6a9ce9822687cfc256f353882a96be5fe95f4de311b84f737ad8a5e184a0dd4f",
"0x2f62398f45c265d27e2e1e1735584f35c729b0bf3e0aad336410144e43b83d43",
"0x216e60a5ff1ea005e332f4ff55613abd29e314ea5de98b3c27162aad1428f5f4"
],
"values": [
{
"value": ["0x8f63e3cD0D14cAef993E59B4e01e3D404cF3c1B7", "17"],
"treeIndex": 15
},
{
"value": ["0x2E2989015f5818A256EB967940454EfE8a0B4b5d", "17"],
"treeIndex": 12
},
{
"value": ["0x927a146e18294efb36edCacC99D9aCEA6aB16b95", "17"],
"treeIndex": 19
},
{
"value": ["0x4757D97449acA795510b9f3152C6a9019A3545c3", "17"],
"treeIndex": 16
},
{
"value": ["0x424bFb32f78731252a6BCeDc828E38e2701DAAEf", "17"],
"treeIndex": 17
},
{
"value": ["0xC66fAdfFeb6DA3b9A7FA3C71130F881e3a9B13fb", "17"],
"treeIndex": 14
},
{
"value": ["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "100"],
"treeIndex": 20
},
{
"value": ["0x70997970C51812dc3A010C7d01b50e0d17dc79C8", "100"],
"treeIndex": 18
},
{
"value": ["0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC", "100"],
"treeIndex": 10
},
{
"value": ["0x90F79bf6EB2c4f870365E785982E1f101E93b906", "100"],
"treeIndex": 13
},
{
"value": ["0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65", "100"],
"treeIndex": 11
}
],
"leafEncoding": ["address", "uint256"]
}
49 changes: 49 additions & 0 deletions packages/taikoon-ui/src/generated/whitelist/sepolia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"format": "standard-v1",
"tree": [
"0xfe88200f6947dda783685a2bc8674a8031e567d50124442e11f5c1d5eeb9b35c",
"0x83d2f7c232fa35fa49ae22a8ac0fc3807a4a92985d15d7bd80fd70c3814433fa",
"0xc48ce10aa650635c08faee559c631a73bec56b63d123b56122b99c3d374f2ea2",
"0x87dc7098eb08dde5bcbaf2c84933d88d8c0da3347852680ed5c519e011044bd3",
"0x9e06f6ded3211a567693d1e38b6832104d9ee9e0ddf049a90e4fe757d805bb5a",
"0x8cd1271c0950fb0eb32fc0d76dfd741f3d20eda2992bf36b3403039073bb6af3",
"0xee3d903875927a1fd767e1fc8b850a5840596a21a00df4c2bec30a8f5d58d16d",
"0xafc473ef5147f5d39d32d4e4b466f4beea4e859f397980156d0470bb80900373",
"0xaf53707ab893501840153fc5f05a3a24c7d185d8bcfcc44ece20f8bd2f012339",
"0x921a6e0470293d600eead14aeb046dad51a5620ee1eb5e72b95112dbbe9b245a",
"0x7358742a31cea3f1d62dc77c7d63389fbd8a194073ad04ea25e4aa0071c7b4f3",
"0x59949ceb40f5400653526e3e5a0de863a6c4f49a029f189f770ecccbdb192fe9",
"0x456e44977c40b6df1bcb531feb67a5857454ad14ef1a4c2dd80834d19b339d0a"
],
"values": [
{
"value": ["0x8f63e3cD0D14cAef993E59B4e01e3D404cF3c1B7", "10"],
"treeIndex": 10
},
{
"value": ["0x2E2989015f5818A256EB967940454EfE8a0B4b5d", "10"],
"treeIndex": 6
},
{
"value": ["0x927a146e18294efb36edCacC99D9aCEA6aB16b95", "10"],
"treeIndex": 12
},
{
"value": ["0x4757D97449acA795510b9f3152C6a9019A3545c3", "10"],
"treeIndex": 7
},
{
"value": ["0x424bFb32f78731252a6BCeDc828E38e2701DAAEf", "10"],
"treeIndex": 8
},
{
"value": ["0xC66fAdfFeb6DA3b9A7FA3C71130F881e3a9B13fb", "10"],
"treeIndex": 9
},
{
"value": ["0x25e282A9176568b9da58b14FcE3A91Ed99aa0fe6", "12"],
"treeIndex": 11
}
],
"leafEncoding": ["address", "uint256"]
}
30 changes: 30 additions & 0 deletions packages/taikoon-ui/src/lib/chain/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,36 @@ const chainConfigs: ChainConfigMap = {
icon: '/chains/ethereum.svg',
type: 'L1' as LayerType, // Add the missing 'type' property with the value of 'LayerType'
},
'11155111': {
name: 'Sepolia',
rpcUrls: {
default: {
http: ['https://rpc2.sepolia.org'],
},
},
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
icon: '/chains/ethereum.svg',
type: 'L1' as LayerType, // Add the missing 'type' property with the value of 'LayerType'
},
'167001': {
name: 'Devnet',
rpcUrls: {
default: {
http: ['https://rpc.internal.taiko.xyz'],
},
},
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
icon: '/chains/ethereum.svg',
type: 'L1' as LayerType, // Add the missing 'type' property with the value of 'LayerType'
},
};

function mapChainConfigToChain(chainId: string, chainConfig: ChainConfig): Chain {
Expand Down
9 changes: 6 additions & 3 deletions packages/taikoon-ui/src/lib/wagmi/publicClient.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { createPublicClient, http } from 'viem';
import { hardhat } from 'viem/chains';

import { chainIdToChain } from '$lib/chain/chains';

const devnet = chainIdToChain(167001);

export default async function publicClient() {
const client = createPublicClient({
chain: hardhat,
transport: http('http://localhost:8545'),
chain: devnet,
transport: http('https://rpc.internal.taiko.xyz'),
});

return client;
Expand Down
6 changes: 5 additions & 1 deletion packages/taikoon-ui/src/lib/whitelist/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { hardhat, holesky } from '@wagmi/core/chains';
import { hardhat, holesky, sepolia } from '@wagmi/core/chains';

import { default as DevnetWhitelist } from '../../generated/whitelist/devnet.json';
import { default as HardhatWhitelist } from '../../generated/whitelist/hardhat.json';
import { default as HoleskyWhitelist } from '../../generated/whitelist/holesky.json';
import { default as SepoliaWhitelist } from '../../generated/whitelist/sepolia.json';

export const whitelist: Record<number, any> = {
[hardhat.id]: HardhatWhitelist,
[holesky.id]: HoleskyWhitelist,
[sepolia.id]: SepoliaWhitelist,
[167001]: DevnetWhitelist,
};
10 changes: 6 additions & 4 deletions packages/taikoon-ui/src/wagmi.config.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import { injected, walletConnect } from '@wagmi/connectors';
import { createConfig, http, reconnect } from '@wagmi/core';
import { hardhat, holesky } from '@wagmi/core/chains';
import { hardhat, holesky, sepolia } from '@wagmi/core/chains';

import { PUBLIC_WALLETCONNECT_PROJECT_ID } from '$env/static/public';

const projectId = PUBLIC_WALLETCONNECT_PROJECT_ID;

import { chainIdToChain } from '$lib/chain/chains';

const devnet = chainIdToChain(167001);
const baseConfig = {
chains: [hardhat, holesky],
chains: [hardhat, holesky, sepolia, devnet],
projectId,
metadata: {},
batch: {
multicall: false,
},
transports: {
[hardhat.id]: http('http://localhost:8545'),
//[holesky.id]: http('https://1rpc.io/holesky'),
[holesky.id]: http('https://ethereum-holesky.blockpi.network/v1/rpc/public'),
//[holesky.id]: http('https://l1rpc.hekla.taiko.xyz/'),
[devnet.id]: http('https://rpc.internal.taiko.xyz'),
},
} as const;

Expand Down
3 changes: 3 additions & 0 deletions packages/taikoon-ui/wagmi.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineConfig } from '@wagmi/cli'
import type { Abi, Address } from 'abitype'
import { existsSync, mkdirSync,readFileSync, writeFileSync } from 'fs'

import * as DevnetDeployment from '../taikoon/deployments/devnet.json'
import * as HoleskyDeployment from '../taikoon/deployments/holesky.json'
import * as LocalhostDeployment from '../taikoon/deployments/localhost.json'
import TaikoonToken from '../taikoon/out/TaikoonToken.sol/TaikoonToken.json'
Expand Down Expand Up @@ -31,6 +32,7 @@ function generateWhitelistJson() {

generateNetworkWhitelist("hardhat");
generateNetworkWhitelist("holesky");
generateNetworkWhitelist('devnet')
}

generateWhitelistJson();
Expand All @@ -43,6 +45,7 @@ export default defineConfig({
address: {
31337: LocalhostDeployment.TaikoonToken as Address,
17000: HoleskyDeployment.TaikoonToken as Address,
167001: DevnetDeployment.TaikoonToken as Address,
},
abi: TaikoonToken.abi as Abi,
}
Expand Down
12 changes: 12 additions & 0 deletions packages/taikoon/data/whitelist/devnet.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
freeMints,address
17,0x8f63e3cD0D14cAef993E59B4e01e3D404cF3c1B7
17,0x2E2989015f5818A256EB967940454EfE8a0B4b5d
17,0x927a146e18294efb36edCacC99D9aCEA6aB16b95
17,0x4757D97449acA795510b9f3152C6a9019A3545c3
17,0x424bFb32f78731252a6BCeDc828E38e2701DAAEf
17,0xC66fAdfFeb6DA3b9A7FA3C71130F881e3a9B13fb
100,0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
100,0x70997970C51812dc3A010C7d01b50e0d17dc79C8
100,0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC
100,0x90F79bf6EB2c4f870365E785982E1f101E93b906
100,0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65
1 change: 1 addition & 0 deletions packages/taikoon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"merkle": "node script/js/generate-merkle-tree.js",
"deploy:localhost": "forge clean && pnpm compile && forge script script/sol/Deploy.s.sol --rpc-url http://localhost:8545 --broadcast",
"deploy:holesky": "forge clean && pnpm compile && forge script script/sol/Deploy.s.sol --rpc-url https://l1rpc.hekla.taiko.xyz/ --broadcast --gas-estimate-multiplier 200",
"deploy:devnet": "forge clean && pnpm compile && forge script script/sol/Deploy.s.sol --rpc-url https://rpc.internal.taiko.xyz --broadcast --gas-estimate-multiplier 200",
"deploy:ipfs": "rm -rf data/metadata/* && node script/js/resize-images.js && node script/js/add-images-ipfs.js && echo 'IPFS Base URI:' && ipfs add -r ./data/metadata/ && echo 'Update your .env file with the new IPFS URI'"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/taikoon/script/js/generate-merkle-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ async function main(network) {
}, null, 2)
)

console.log('Merkle Root:', tree.root)
console.log(`Merkle Root for network ${network}`, tree.root)
}

main('hardhat')
main('holesky')
main('devnet')
24 changes: 15 additions & 9 deletions packages/taikoon/script/sol/MerkleMinters.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@ contract MerkleMintersScript is Script {

TaikoonToken token;

// bytes32[] public leaves;

// bytes32[] public holeskyLeaves;

bytes32 public holeskyRoot;

bytes32 public localhostRoot;
bytes32 public devnetRoot;

string public hardhatTreeJson;
string public holeskyTreeJson;
string public devnetTreeJson;

function setUp() public {
utils = new UtilsScript();
Expand All @@ -45,21 +42,24 @@ contract MerkleMintersScript is Script {
address tokenAddress = abi.decode(addressRaw, (address));
token = TaikoonToken(tokenAddress);

// load hardhat's tree and root
hardhatTreeJson =
vm.readFile(string.concat(vm.projectRoot(), "/data/whitelist/hardhat.json"));
//bytes memory treeRaw = hardhatTreeJson.parseRaw('.tree');
// leaves = abi.decode(treeRaw, (bytes32[]));

bytes memory rootRaw = hardhatTreeJson.parseRaw(".root");
localhostRoot = abi.decode(rootRaw, (bytes32));

// load holesky's tree and root
holeskyTreeJson =
vm.readFile(string.concat(vm.projectRoot(), "/data/whitelist/holesky.json"));

// treeRaw = holeskyTreeJson.parseRaw('.tree');
// holeskyLeaves = abi.decode(treeRaw, (bytes32[]));
rootRaw = holeskyTreeJson.parseRaw(".root");
holeskyRoot = abi.decode(rootRaw, (bytes32));

// load devnet's tree and root
devnetTreeJson = vm.readFile(string.concat(vm.projectRoot(), "/data/whitelist/devnet.json"));
rootRaw = devnetTreeJson.parseRaw(".root");
devnetRoot = abi.decode(rootRaw, (bytes32));
}

function getMerkleRoot() public view returns (bytes32) {
Expand All @@ -68,6 +68,8 @@ contract MerkleMintersScript is Script {
return localhostRoot;
} else if (chainId == 17_000) {
return holeskyRoot;
} else if (chainId == 167_001) {
return devnetRoot;
} else {
revert("Unsupported chainId");
}
Expand All @@ -87,6 +89,10 @@ contract MerkleMintersScript is Script {
// holesky
bytes memory treeRaw = holeskyTreeJson.parseRaw(".tree");
leaves = abi.decode(treeRaw, (bytes32[]));
} else if (chainId == 167_001) {
// devnet
bytes memory treeRaw = devnetTreeJson.parseRaw(".tree");
leaves = abi.decode(treeRaw, (bytes32[]));
} else {
revert("Unsupported chainId");
}
Expand Down
3 changes: 0 additions & 3 deletions packages/taikoon/script/sol/Utils.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ contract UtilsScript is Script {
} else if (chainId == 167_001) {
lowercaseNetworkKey = "devnet";
uppercaseNetworkKey = "DEVNET";
} else if (chainId == 11_155_111) {
lowercaseNetworkKey = "sepolia";
uppercaseNetworkKey = "SEPOLIA";
} else if (chainId == 167_008) {
lowercaseNetworkKey = "katla";
uppercaseNetworkKey = "KATLA";
Expand Down

0 comments on commit 387ffb1

Please sign in to comment.