Add scripts to calculate all new ENS nodes and IPFS hashes
This commit is contained in:
parent
eaeb72357d
commit
b569bd3f77
4
.gitignore
vendored
4
.gitignore
vendored
@ -22,4 +22,6 @@ package-lock.json
|
|||||||
yarn.lock
|
yarn.lock
|
||||||
|
|
||||||
# VScode files
|
# VScode files
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
|
test.ts
|
2
.nvmrc
2
.nvmrc
@ -1 +1 @@
|
|||||||
v20.3.0
|
v16.20.2
|
@ -1,15 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "proposal-27",
|
"name": "proposal-30",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"repository": "https://git.tornado.ws/Theo/proposal-27-update-ipfs",
|
"repository": "https://git.tornado.ws/Theo/proposal-30-decentralize-sources",
|
||||||
"author": "Theo",
|
"author": "Theo",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
"private": false,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"calculateENS": "npx ts-node scripts/calculateENSNodes.ts",
|
"calculateENS": "npx ts-node scripts/calculateENSNodes.ts",
|
||||||
"calculateIpfsV1Cids": "npx ts-node scripts/calculateIpfsV1Cids",
|
"calculateIpfsV1Cids": "npx ts-node scripts/calculateIpfsV1Cids",
|
||||||
"calculateIPFS": "npx ts-node scripts/calculateIPFSContenthashes",
|
"calculateIpfs": "npx ts-node scripts/calculateIPFSContenthashes",
|
||||||
"init": "cd lib && git clone --recurse-submodules https://github.com/foundry-rs/forge-std",
|
"init": "cd lib && git clone --recurse-submodules https://github.com/foundry-rs/forge-std",
|
||||||
|
"test:calculateENS": "npx ts-node scripts/test/calculateENSNodes.ts",
|
||||||
"test:windows": ".\\.env.bat && forge test",
|
"test:windows": ".\\.env.bat && forge test",
|
||||||
"test:linux": ". .env && forge test",
|
"test:linux": ". .env && forge test",
|
||||||
"test:gas:windows": ".\\.env.bat && forge test --gas-report",
|
"test:gas:windows": ".\\.env.bat && forge test --gas-report",
|
||||||
|
@ -5,40 +5,31 @@ import path from "path";
|
|||||||
import { hash } from "@ensdomains/eth-ens-namehash";
|
import { hash } from "@ensdomains/eth-ens-namehash";
|
||||||
import { keccak_256 } from "js-sha3";
|
import { keccak_256 } from "js-sha3";
|
||||||
import { DeclCalculator } from "./utils";
|
import { DeclCalculator } from "./utils";
|
||||||
|
import { ensDomains } from "./constants";
|
||||||
const rootTornadoDomain = "tornadocash.eth";
|
|
||||||
const stakingDomain = "staking-rewards.contract.tornadocash.eth";
|
|
||||||
const governanceImplDomain = "governance-impl.contract.tornadocash.eth";
|
|
||||||
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);
|
|
||||||
const governanceImplENSNode = hash(governanceImplDomain);
|
|
||||||
const novaENSNode = hash(novaUIDomain);
|
|
||||||
const docsENSNode = hash(docsDomain);
|
|
||||||
const relayersUIENSNode = hash(relayersUIDomain);
|
|
||||||
|
|
||||||
const getLabelhashFromDomain = (ensDomain: string) => "0x" + keccak_256(ensDomain.split(".")[0]);
|
const getLabelhashFromDomain = (ensDomain: string) => "0x" + keccak_256(ensDomain.split(".")[0]);
|
||||||
const tornadoContractENSLabelhash = getLabelhashFromDomain(tornadoContractDomain);
|
|
||||||
const stakingRewardsENSLabelhash = getLabelhashFromDomain(stakingDomain);
|
|
||||||
const governanceImplENSLabelhash = getLabelhashFromDomain(governanceImplDomain);
|
|
||||||
|
|
||||||
const { calculateDecl } = new DeclCalculator("bytes32");
|
const solidityInContractPadding = " ".repeat(4);
|
||||||
|
const { calculateDecl: calculateNodeDecl } = new DeclCalculator(
|
||||||
|
"bytes32 internal constant",
|
||||||
|
solidityInContractPadding,
|
||||||
|
hash,
|
||||||
|
(name: string) => name + "Node"
|
||||||
|
);
|
||||||
|
const { calculateDecl: calculateLabelDecl } = new DeclCalculator(
|
||||||
|
"bytes32 internal constant",
|
||||||
|
solidityInContractPadding,
|
||||||
|
getLabelhashFromDomain,
|
||||||
|
(name: string) => name + "Labelhash"
|
||||||
|
);
|
||||||
|
|
||||||
const solidityCode =
|
const solidityCode =
|
||||||
calculateDecl({ rootTornadoENSNode }) +
|
Object.entries(ensDomains)
|
||||||
calculateDecl({ tornadoContractENSNode }) +
|
.map((e) => calculateNodeDecl(e))
|
||||||
calculateDecl({ stakingRewardsENSNode }) +
|
.join("") +
|
||||||
calculateDecl({ governanceImplENSNode }) +
|
|
||||||
calculateDecl({ novaENSNode }) +
|
|
||||||
calculateDecl({ docsENSNode }) +
|
|
||||||
calculateDecl({ relayersUIENSNode }) +
|
|
||||||
"\n" +
|
"\n" +
|
||||||
calculateDecl({ tornadoContractENSLabelhash }) +
|
Object.entries(ensDomains)
|
||||||
calculateDecl({ stakingRewardsENSLabelhash }) +
|
.map((e) => calculateLabelDecl(e))
|
||||||
calculateDecl({ governanceImplENSLabelhash });
|
.join("");
|
||||||
|
|
||||||
fs.writeFileSync(path.join("data", "ensNodesDeclarations.txt"), solidityCode);
|
fs.writeFileSync(path.join("data", "ensNodesDeclarations.txt"), solidityCode);
|
||||||
|
@ -4,21 +4,20 @@ import fs from "fs";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
import { DeclCalculator } from "./utils";
|
import { DeclCalculator } from "./utils";
|
||||||
import { classicUiIpfsCid, novaUiIpfsCid, relayersUiIpfsCid, docsIpfsCid } from "./constants";
|
import { ipfsCids } from "./constants";
|
||||||
|
|
||||||
const contentHashToBytesMemory = (hash: string) => `hex"${hash}"`;
|
const contentHashToBytesMemory = (hash: string) => `hex"${hash}"`;
|
||||||
|
const ipfsCidToBytesMemory = (cid: string) => contentHashToBytesMemory(contentHash.fromIpfs(cid));
|
||||||
const classicUiIPFSContenthash = contentHash.fromIpfs(classicUiIpfsCid);
|
|
||||||
const novaUiIPFSContenthash = contentHash.fromIpfs(novaUiIpfsCid);
|
|
||||||
const relayersUiIPFSContenthash = contentHash.fromIpfs(relayersUiIpfsCid);
|
|
||||||
const docsIPFSContenthash = contentHash.fromIpfs(docsIpfsCid);
|
|
||||||
|
|
||||||
const solidityDoublePadding = " ".repeat(8);
|
const solidityDoublePadding = " ".repeat(8);
|
||||||
const { calculateDecl } = new DeclCalculator("bytes memory", solidityDoublePadding, contentHashToBytesMemory);
|
const { calculateDecl: calculateContenthashDecl } = new DeclCalculator(
|
||||||
const solidityCode =
|
"bytes memory",
|
||||||
calculateDecl({ classicUiIPFSContenthash }) +
|
solidityDoublePadding,
|
||||||
calculateDecl({ novaUiIPFSContenthash }) +
|
ipfsCidToBytesMemory,
|
||||||
calculateDecl({ relayersUiIPFSContenthash }) +
|
(name: string) => name + "Contenthash"
|
||||||
calculateDecl({ docsIPFSContenthash });
|
);
|
||||||
|
const solidityCode = Object.entries(ipfsCids)
|
||||||
|
.map((e) => calculateContenthashDecl(e))
|
||||||
|
.join("");
|
||||||
|
|
||||||
fs.writeFileSync(path.join("data", "ensDomainsIPFSContenthashes.txt"), solidityCode);
|
fs.writeFileSync(path.join("data", "ensDomainsIPFSContenthashes.txt"), solidityCode);
|
||||||
|
@ -3,15 +3,13 @@ import path from "path";
|
|||||||
import CID from "cids";
|
import CID from "cids";
|
||||||
|
|
||||||
import { DeclCalculator } from "./utils";
|
import { DeclCalculator } from "./utils";
|
||||||
import { classicUiIpfsCid, novaUiIpfsCid, relayersUiIpfsCid, docsIpfsCid } from "./constants";
|
import { ipfsCids } from "./constants";
|
||||||
|
|
||||||
const convertCIDToV1 = (cidV0: string) => `"${new CID(cidV0).toV1().toString()}"`;
|
const convertCIDToV1 = (cidV0: string) => `"${new CID(cidV0).toV1().toString()}"`;
|
||||||
|
|
||||||
const { calculateDecl } = new DeclCalculator("const", "", convertCIDToV1);
|
const { calculateDecl } = new DeclCalculator("const", "", convertCIDToV1, (name: string) => name + "IpfsCid");
|
||||||
const typescriptCode =
|
const typescriptCode = Object.entries(ipfsCids)
|
||||||
calculateDecl({ classicUiIpfsCid }) +
|
.map((e) => calculateDecl(e))
|
||||||
calculateDecl({ novaUiIpfsCid }) +
|
.join("");
|
||||||
calculateDecl({ relayersUiIpfsCid }) +
|
|
||||||
calculateDecl({ docsIpfsCid });
|
|
||||||
|
|
||||||
fs.writeFileSync(path.join(".", "data", "ipfsV1CIDs.txt"), typescriptCode);
|
fs.writeFileSync(path.join(".", "data", "ipfsV1CIDs.txt"), typescriptCode);
|
||||||
|
@ -1,4 +1,63 @@
|
|||||||
export const classicUiIpfsCid = "QmSQxyjNpGAMXYBNjkuZAjuAg5JCg1RYoe663XovNQicua";
|
const rootTornadoDomain = "tornadocash.eth";
|
||||||
export const novaUiIpfsCid = "QmVS4SPsH44oJPCffUZZUGTXqCpSx3eK8UJ8YmZsSDygop";
|
const sourcesDomain = "sources." + rootTornadoDomain;
|
||||||
export const relayersUiIpfsCid = "QmSUG2SNSPc6UUc6tgTZJWQKExhUGqjxHQPcJNZuU5FcxW";
|
const minifiedSourcesDomain = "minified." + sourcesDomain;
|
||||||
export const docsIpfsCid = "QmQPThvEBTCBFLPp16TeHxWGk7oYKth3AGdvYdiw6TyfKV";
|
const packagesDomain = "packages." + sourcesDomain;
|
||||||
|
|
||||||
|
export const ensDomains = {
|
||||||
|
rootTornadoDomain,
|
||||||
|
sourcesDomain,
|
||||||
|
minifiedSourcesDomain,
|
||||||
|
packagesDomain,
|
||||||
|
downloadScriptSourceDomain: "download." + sourcesDomain,
|
||||||
|
classicUISourceDomain: "classic-ui." + sourcesDomain,
|
||||||
|
novaUISourceDomain: "nova." + sourcesDomain,
|
||||||
|
docsSourceDomain: "docs." + sourcesDomain,
|
||||||
|
relayersUISourceDomain: "relayers-ui." + sourcesDomain,
|
||||||
|
tornTokenSourceDomain: "torn-token." + sourcesDomain,
|
||||||
|
classicRelayerSoftwareSourceDomain: "classic-relayer." + sourcesDomain,
|
||||||
|
novaRelayerSoftwareSourceDomain: "nova-relayer." + sourcesDomain,
|
||||||
|
tornadoCliSourceDomain: "cli." + sourcesDomain,
|
||||||
|
infoPageSourceDomain: "info-page." + sourcesDomain,
|
||||||
|
classicUIMinifiedDomain: "classic-ui." + minifiedSourcesDomain,
|
||||||
|
novaMinifiedDomain: "nova." + minifiedSourcesDomain,
|
||||||
|
tornadoCliMinifiedDomain: "cli." + minifiedSourcesDomain,
|
||||||
|
websnarkPackageDomain: "websnark." + packagesDomain,
|
||||||
|
circomlibPackageDomain: "circomlib." + packagesDomain,
|
||||||
|
snarkjsPackageDomain: "snarkjs." + packagesDomain,
|
||||||
|
tornadoOraclesPackageDomain: "oracles." + packagesDomain,
|
||||||
|
gasPriceOraclePackageDomain: "gas-price-oracle." + packagesDomain,
|
||||||
|
tornadoConfigPackageDomain: "config." + packagesDomain,
|
||||||
|
anonymityMiningPackageDomain: "anonymity-mining." + packagesDomain,
|
||||||
|
tornadoTreesPackageDomain: "trees." + packagesDomain,
|
||||||
|
fixedMerkleTreePackageDomain: "fixed-merkle-tree." + packagesDomain,
|
||||||
|
txManagerPackageDomain: "tx-manager." + packagesDomain,
|
||||||
|
merkleRootUpdaterPackageDomain: "merkle-root-updater." + packagesDomain,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const ipfsCids = {
|
||||||
|
downloadInstructionsHtml: "QmX2RqM2g98EM1C7UWx2uW7Cz9ALQSCRkogDxEJDZbNH15",
|
||||||
|
downloadScriptSource: "QmXrkrmZYvVCBtsZYdpsyhRcfNERYnrcTmjgLfgwWEn2XE",
|
||||||
|
classicUiSource: "QmacsxDCzyUCsmG6W5Nz5arHPjNms5Bwc7QqfYM6utASWj",
|
||||||
|
classicRelayerSource: "QmUTA3MABmeNU9RvJK1cQ7L28KRLFVA8ebaq7gotQXAKrg",
|
||||||
|
novaRelayerSource: "QmbsX9ScTxZ5Tqy1a8ecdQNacStiCDwFufUyCJ5HXrgMSj",
|
||||||
|
relayersUiSource: "QmT5vRziiwZKDZUkDX4BqxKvXmcz3W2tLtGkE9VrtdCQuu",
|
||||||
|
novaUiSource: "QmaYVcnwab7eR8JStD11JwXUkiCLfBvth2eByMBSxWhfVP",
|
||||||
|
docsSource: "QmZC7e8KqB7fdyRFj3iu45i3sTABVsYVnmMzZ1bsn1VpMn",
|
||||||
|
tornadoCliSource: "Qmc1XYtApEGsJpMfSjTAYQoYHakNyJcfJUtRFC3FBLD1AD",
|
||||||
|
infoPageSource: "QmQwNEb8SdFkiPDMAk3ncktqbZCTGknVN3sH33LAMSaADB",
|
||||||
|
classicUiMinified: "QmQGsukwaYhkKJ1bHW3rZJTc83Rh7xFogMMu8GMDRcbAt8",
|
||||||
|
novaUiMinified: "QmecystQd1aGDfWp93EndSpU8gGGYXgyAhfFEKXsZfPA2m",
|
||||||
|
tornadoCliMinified: "QmUFAL29scANSqvrVTejoRrpMzKpJJE6j4BKrKGyKNM5XH",
|
||||||
|
tornTokenSource: "QmfRtPH3gRwTbbNEAfkvVNeGauBAcFHBzuET7JfmKvfFr1",
|
||||||
|
merkleRootUpdaterPackage: "QmTVin6iNu5Mp6YPo3jTpCNKdE5JdvM4r4tqXZJtac2UQ4",
|
||||||
|
gasPriceOraclePackage: "QmW8zZ1Dv32j9HpjP3aExNJvxcshYoGTsjQaX8VZzRTXxx",
|
||||||
|
tornadoOraclesPackage: "QmYUM1Kx6ju5ZBu6TDdRfZZjG64fCNbyKxWySMsLprPQGY",
|
||||||
|
snarkjsPackage: "QmdoqswophQXo5JrQQnbpWS5562eizT8vAK8XQDsHyKLs5",
|
||||||
|
websnarkPackage: "QmRqZ55oP7Vyq39cJrqLSAhiLEbhCLm6QTJKghhHHogKmQ",
|
||||||
|
circomlibPackage: "QmVDdK5YowqaMuQuAPwW2Hq4GSSNebVBfd3qsKUhvQZxVv",
|
||||||
|
txManagerPackage: "QmYNvuaKH47QJuFairApChBvoRtbezvnWU12tPs8cHUZzA",
|
||||||
|
fixedMerkleTreePackage: "QmUtj3m6y5sEw4Y7V7PnAS7pKp9gbJGJ2eGAMWnwXAPRP9",
|
||||||
|
tornadoTreesPackage: "QmanV67Tzu7jLdeVXStjJ7iVVYMPAvnHhmxwsCSXALAtGK",
|
||||||
|
anonymityMiningPackage: "QmTfy4wGgYMKczEjtKNRZTEpnzfYyqtPhbc3fzJqwPSpzF",
|
||||||
|
tornadoConfigPackage: "QmRPK6AqffoB721RfaWtRr1GjdpVN7x4g8ZcG27RqvLweR",
|
||||||
|
};
|
||||||
|
71
scripts/test/calculateENSNodes.ts
Normal file
71
scripts/test/calculateENSNodes.ts
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
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";
|
||||||
|
|
||||||
|
// Different domain for Goerli testing
|
||||||
|
const rootTornadoDomain = "tornadotest.eth";
|
||||||
|
const sourcesDomain = "sources." + rootTornadoDomain;
|
||||||
|
const minifiedSourcesDomain = "minified." + sourcesDomain;
|
||||||
|
const packagesDomain = "packages." + sourcesDomain;
|
||||||
|
|
||||||
|
export const ensDomains = {
|
||||||
|
rootTornadoDomain,
|
||||||
|
sourcesDomain,
|
||||||
|
minifiedSourcesDomain,
|
||||||
|
packagesDomain,
|
||||||
|
downloadScriptSourceDomain: "download." + sourcesDomain,
|
||||||
|
classicUISourceDomain: "classic-ui." + sourcesDomain,
|
||||||
|
novaUISourceDomain: "nova." + sourcesDomain,
|
||||||
|
docsSourceDomain: "docs." + sourcesDomain,
|
||||||
|
relayersUISourceDomain: "relayers-ui." + sourcesDomain,
|
||||||
|
tornTokenSourceDomain: "torn-token." + sourcesDomain,
|
||||||
|
classicRelayerSoftwareSourceDomain: "classic-relayer." + sourcesDomain,
|
||||||
|
novaRelayerSoftwareSourceDomain: "nova-relayer." + sourcesDomain,
|
||||||
|
tornadoCliSourceDomain: "cli." + sourcesDomain,
|
||||||
|
infoPageSourceDomain: "info-page." + sourcesDomain,
|
||||||
|
classicUIMinifiedDomain: "classic-ui." + minifiedSourcesDomain,
|
||||||
|
novaMinifiedDomain: "nova." + minifiedSourcesDomain,
|
||||||
|
tornadoCliMinifiedDomain: "cli." + minifiedSourcesDomain,
|
||||||
|
websnarkPackageDomain: "websnark." + packagesDomain,
|
||||||
|
circomlibPackageDomain: "circomlib." + packagesDomain,
|
||||||
|
snarkjsPackageDomain: "snarkjs." + packagesDomain,
|
||||||
|
tornadoOraclesPackageDomain: "oracles." + packagesDomain,
|
||||||
|
gasPriceOraclePackageDomain: "gas-price-oracle." + packagesDomain,
|
||||||
|
tornadoConfigPackageDomain: "config." + packagesDomain,
|
||||||
|
anonymityMiningPackageDomain: "anonymity-mining." + packagesDomain,
|
||||||
|
tornadoTreesPackageDomain: "trees." + packagesDomain,
|
||||||
|
fixedMerkleTreePackageDomain: "fixed-merkle-tree." + packagesDomain,
|
||||||
|
txManagerPackageDomain: "tx-manager." + packagesDomain,
|
||||||
|
merkleRootUpdaterPackageDomain: "merkle-root-updater." + packagesDomain,
|
||||||
|
};
|
||||||
|
|
||||||
|
const getLabelhashFromDomain = (ensDomain: string) => "0x" + keccak_256(ensDomain.split(".")[0]);
|
||||||
|
|
||||||
|
const solidityInContractPadding = " ".repeat(4);
|
||||||
|
const { calculateDecl: calculateNodeDecl } = new DeclCalculator(
|
||||||
|
"bytes32 internal constant",
|
||||||
|
solidityInContractPadding,
|
||||||
|
hash,
|
||||||
|
(name: string) => name + "Node"
|
||||||
|
);
|
||||||
|
const { calculateDecl: calculateLabelDecl } = new DeclCalculator(
|
||||||
|
"bytes32 internal constant",
|
||||||
|
solidityInContractPadding,
|
||||||
|
getLabelhashFromDomain,
|
||||||
|
(name: string) => name + "Labelhash"
|
||||||
|
);
|
||||||
|
|
||||||
|
const solidityCode =
|
||||||
|
Object.entries(ensDomains)
|
||||||
|
.map((e) => calculateNodeDecl(e))
|
||||||
|
.join("") +
|
||||||
|
"\n" +
|
||||||
|
Object.entries(ensDomains)
|
||||||
|
.map((e) => calculateLabelDecl(e))
|
||||||
|
.join("");
|
||||||
|
|
||||||
|
fs.writeFileSync(path.join("data", "test", "ensNodesDeclarations.txt"), solidityCode);
|
@ -1,33 +1,30 @@
|
|||||||
type NodeVarObject = { [key: string]: string };
|
type NodeVarObject = { [key: string]: string };
|
||||||
|
type NodeVarArray = [string, string];
|
||||||
|
|
||||||
const solidityCodePadding = " ".repeat(8);
|
const solidityCodePadding = " ".repeat(8);
|
||||||
const pad = (decl: string, padding: string = solidityCodePadding) => padding + decl + "\n";
|
const pad = (decl: string, padding: string = solidityCodePadding) => padding + decl + "\n";
|
||||||
|
|
||||||
class DeclCalculator {
|
class DeclCalculator {
|
||||||
declType!: string;
|
|
||||||
padding!: string;
|
|
||||||
transformator!: Function;
|
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
declType: string,
|
private declType: string,
|
||||||
padding: string = solidityCodePadding,
|
private padding: string = solidityCodePadding,
|
||||||
transformator: Function = (
|
private transformator: Function = (
|
||||||
|
() => (x: any) =>
|
||||||
|
x
|
||||||
|
)(),
|
||||||
|
private variableNameChanger: Function = (
|
||||||
() => (x: any) =>
|
() => (x: any) =>
|
||||||
x
|
x
|
||||||
)()
|
)()
|
||||||
) {
|
) {}
|
||||||
this.declType = declType;
|
|
||||||
this.padding = padding;
|
|
||||||
this.transformator = transformator;
|
|
||||||
}
|
|
||||||
|
|
||||||
private displayVariableName(varObj: NodeVarObject) {
|
private displayVariableName(varObj: NodeVarObject) {
|
||||||
return Object.keys(varObj)[0];
|
return Object.keys(varObj)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public calculateDecl = (varObj: NodeVarObject, type: string = "bytes32") => {
|
public calculateDecl = (varInfo: NodeVarObject | NodeVarArray, type: string = "bytes32") => {
|
||||||
const solidityVariableName = this.displayVariableName(varObj);
|
const solidityVariableName = this.variableNameChanger(Array.isArray(varInfo) ? varInfo[0] : this.displayVariableName(varInfo));
|
||||||
const solidityVariableValue = this.transformator(Object.values(varObj)[0]);
|
const solidityVariableValue = this.transformator(Array.isArray(varInfo) ? varInfo[1] : Object.values(varInfo)[0]);
|
||||||
const solidityDeclaration = `${this.declType || type} ${solidityVariableName} = ${solidityVariableValue};`;
|
const solidityDeclaration = `${this.declType || type} ${solidityVariableName} = ${solidityVariableValue};`;
|
||||||
|
|
||||||
return pad(solidityDeclaration, this.padding);
|
return pad(solidityDeclaration, this.padding);
|
||||||
|
Loading…
Reference in New Issue
Block a user