2023-07-28 15:11:38 +03:00
|
|
|
import fs from "fs";
|
|
|
|
import path from "path";
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
import { hash } from "@ensdomains/eth-ens-namehash";
|
|
|
|
import { keccak_256 } from "js-sha3";
|
|
|
|
import { DeclCalculator } from "./utils";
|
|
|
|
|
|
|
|
const rootTornadoDomain = "tornadocash.eth";
|
|
|
|
const stakingDomain = "staking-rewards.contract.tornadocash.eth";
|
2023-08-30 22:15:12 +03:00
|
|
|
const governanceImplDomain = "governance-impl.contract.tornadocash.eth";
|
2023-07-28 15:11:38 +03:00
|
|
|
const novaUIDomain = "nova.tornadocash.eth";
|
|
|
|
const docsDomain = "docs.tornadocash.eth";
|
|
|
|
const relayersUIDomain = "relayers-network.tornadocash.eth";
|
|
|
|
const tornadoContractDomain = "contract.tornadocash.eth";
|
|
|
|
|
|
|
|
const rootTornadoENSNode = hash(rootTornadoDomain);
|
|
|
|
const tornadoContractENSNode = hash(tornadoContractDomain);
|
|
|
|
const stakingRewardsENSNode = hash(stakingDomain);
|
2023-08-30 22:15:12 +03:00
|
|
|
const governanceImplENSNode = hash(governanceImplDomain);
|
2023-07-28 15:11:38 +03:00
|
|
|
const novaENSNode = hash(novaUIDomain);
|
|
|
|
const docsENSNode = hash(docsDomain);
|
|
|
|
const relayersUIENSNode = hash(relayersUIDomain);
|
|
|
|
|
|
|
|
const getLabelhashFromDomain = (ensDomain: string) => "0x" + keccak_256(ensDomain.split(".")[0]);
|
|
|
|
const tornadoContractENSLabelhash = getLabelhashFromDomain(tornadoContractDomain);
|
|
|
|
const stakingRewardsENSLabelhash = getLabelhashFromDomain(stakingDomain);
|
2023-08-30 22:15:12 +03:00
|
|
|
const governanceImplENSLabelhash = getLabelhashFromDomain(governanceImplDomain);
|
2023-07-28 15:11:38 +03:00
|
|
|
|
|
|
|
const { calculateDecl } = new DeclCalculator("bytes32");
|
|
|
|
const solidityCode =
|
|
|
|
calculateDecl({ rootTornadoENSNode }) +
|
|
|
|
calculateDecl({ tornadoContractENSNode }) +
|
|
|
|
calculateDecl({ stakingRewardsENSNode }) +
|
2023-08-30 22:15:12 +03:00
|
|
|
calculateDecl({ governanceImplENSNode }) +
|
2023-07-28 15:11:38 +03:00
|
|
|
calculateDecl({ novaENSNode }) +
|
|
|
|
calculateDecl({ docsENSNode }) +
|
|
|
|
calculateDecl({ relayersUIENSNode }) +
|
|
|
|
"\n" +
|
|
|
|
calculateDecl({ tornadoContractENSLabelhash }) +
|
2023-08-30 22:15:12 +03:00
|
|
|
calculateDecl({ stakingRewardsENSLabelhash }) +
|
|
|
|
calculateDecl({ governanceImplENSLabelhash });
|
2023-07-28 15:11:38 +03:00
|
|
|
|
|
|
|
fs.writeFileSync(path.join("data", "ensNodesDeclarations.txt"), solidityCode);
|