fix: update onchain tree contract

This commit is contained in:
nikdementev 2021-09-28 13:37:28 +03:00
parent dd24249359
commit 3afefc3c7d
No known key found for this signature in database
GPG Key ID: 769B05D57CF16FE2
6 changed files with 570 additions and 132 deletions

View File

@ -10,6 +10,16 @@
"internalType": "contract IVerifier",
"name": "_verifier16",
"type": "address"
},
{
"internalType": "uint32",
"name": "_levels",
"type": "uint32"
},
{
"internalType": "address",
"name": "_hasher",
"type": "address"
}
],
"stateMutability": "nonpayable",
@ -130,6 +140,32 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "ROOT_HISTORY_SIZE",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "ZERO_VALUE",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
@ -156,20 +192,39 @@
},
{
"inputs": [],
"name": "currentCommitmentIndex",
"name": "currentRootIndex",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "filledSubtrees",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "currentRoot",
"name": "getLastRoot",
"outputs": [
{
"internalType": "bytes32",
@ -184,15 +239,65 @@
"inputs": [
{
"internalType": "bytes32",
"name": "_currentRoot",
"name": "_left",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "_right",
"type": "bytes32"
}
],
"name": "hashLeftRight",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "hasher",
"outputs": [
{
"internalType": "contract IHasher",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "_root",
"type": "bytes32"
}
],
"name": "isKnownRoot",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
@ -212,6 +317,32 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "levels",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "nextIndex",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
@ -287,11 +418,6 @@
"name": "root",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "newRoot",
"type": "bytes32"
},
{
"internalType": "bytes32[]",
"name": "inputNullifiers",
@ -302,11 +428,6 @@
"name": "outputCommitments",
"type": "bytes32[2]"
},
{
"internalType": "uint256",
"name": "outPathIndices",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "publicAmount",
@ -365,6 +486,25 @@
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "roots",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
@ -379,11 +519,6 @@
"name": "root",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "newRoot",
"type": "bytes32"
},
{
"internalType": "bytes32[]",
"name": "inputNullifiers",
@ -394,11 +529,6 @@
"name": "outputCommitments",
"type": "bytes32[2]"
},
{
"internalType": "uint256",
"name": "outPathIndices",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "publicAmount",
@ -497,11 +627,6 @@
"name": "root",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "newRoot",
"type": "bytes32"
},
{
"internalType": "bytes32[]",
"name": "inputNullifiers",
@ -512,11 +637,6 @@
"name": "outputCommitments",
"type": "bytes32[2]"
},
{
"internalType": "uint256",
"name": "outPathIndices",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "publicAmount",
@ -543,5 +663,24 @@
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "i",
"type": "uint256"
}
],
"name": "zeros",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "pure",
"type": "function"
}
]

View File

@ -25,18 +25,28 @@ interface TornadoPoolInterface extends ethers.utils.Interface {
"FIELD_SIZE()": FunctionFragment;
"MAX_EXT_AMOUNT()": FunctionFragment;
"MAX_FEE()": FunctionFragment;
"ROOT_HISTORY_SIZE()": FunctionFragment;
"ZERO_VALUE()": FunctionFragment;
"calculatePublicAmount(int256,uint256)": FunctionFragment;
"currentCommitmentIndex()": FunctionFragment;
"currentRoot()": FunctionFragment;
"initialize(bytes32)": FunctionFragment;
"currentRootIndex()": FunctionFragment;
"filledSubtrees(uint256)": FunctionFragment;
"getLastRoot()": FunctionFragment;
"hashLeftRight(bytes32,bytes32)": FunctionFragment;
"hasher()": FunctionFragment;
"initialize()": FunctionFragment;
"isKnownRoot(bytes32)": FunctionFragment;
"isSpent(bytes32)": FunctionFragment;
"levels()": FunctionFragment;
"nextIndex()": FunctionFragment;
"nullifierHashes(bytes32)": FunctionFragment;
"register(tuple)": FunctionFragment;
"registerAndTransact(tuple,tuple,tuple)": FunctionFragment;
"roots(uint256)": FunctionFragment;
"transaction(tuple,tuple)": FunctionFragment;
"verifier16()": FunctionFragment;
"verifier2()": FunctionFragment;
"verifyProof(tuple)": FunctionFragment;
"zeros(uint256)": FunctionFragment;
};
encodeFunctionData(
@ -48,23 +58,46 @@ interface TornadoPoolInterface extends ethers.utils.Interface {
values?: undefined
): string;
encodeFunctionData(functionFragment: "MAX_FEE", values?: undefined): string;
encodeFunctionData(
functionFragment: "ROOT_HISTORY_SIZE",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "ZERO_VALUE",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "calculatePublicAmount",
values: [BigNumberish, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "currentCommitmentIndex",
functionFragment: "currentRootIndex",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "currentRoot",
functionFragment: "filledSubtrees",
values: [BigNumberish]
): string;
encodeFunctionData(
functionFragment: "getLastRoot",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "hashLeftRight",
values: [BytesLike, BytesLike]
): string;
encodeFunctionData(functionFragment: "hasher", values?: undefined): string;
encodeFunctionData(
functionFragment: "initialize",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "isKnownRoot",
values: [BytesLike]
): string;
encodeFunctionData(functionFragment: "isSpent", values: [BytesLike]): string;
encodeFunctionData(functionFragment: "levels", values?: undefined): string;
encodeFunctionData(functionFragment: "nextIndex", values?: undefined): string;
encodeFunctionData(
functionFragment: "nullifierHashes",
values: [BytesLike]
@ -80,10 +113,8 @@ interface TornadoPoolInterface extends ethers.utils.Interface {
{
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
@ -97,16 +128,15 @@ interface TornadoPoolInterface extends ethers.utils.Interface {
}
]
): string;
encodeFunctionData(functionFragment: "roots", values: [BigNumberish]): string;
encodeFunctionData(
functionFragment: "transaction",
values: [
{
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
@ -131,15 +161,14 @@ interface TornadoPoolInterface extends ethers.utils.Interface {
{
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
}
]
): string;
encodeFunctionData(functionFragment: "zeros", values: [BigNumberish]): string;
decodeFunctionResult(functionFragment: "FIELD_SIZE", data: BytesLike): Result;
decodeFunctionResult(
@ -147,20 +176,40 @@ interface TornadoPoolInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "MAX_FEE", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "ROOT_HISTORY_SIZE",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "ZERO_VALUE", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "calculatePublicAmount",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "currentCommitmentIndex",
functionFragment: "currentRootIndex",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "currentRoot",
functionFragment: "filledSubtrees",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "getLastRoot",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "hashLeftRight",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "hasher", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "initialize", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "isKnownRoot",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "isSpent", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "levels", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "nextIndex", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "nullifierHashes",
data: BytesLike
@ -170,6 +219,7 @@ interface TornadoPoolInterface extends ethers.utils.Interface {
functionFragment: "registerAndTransact",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "roots", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "transaction",
data: BytesLike
@ -180,6 +230,7 @@ interface TornadoPoolInterface extends ethers.utils.Interface {
functionFragment: "verifyProof",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "zeros", data: BytesLike): Result;
events: {
"EncryptedAccount(address,bytes)": EventFragment;
@ -244,26 +295,51 @@ export class TornadoPool extends BaseContract {
MAX_FEE(overrides?: CallOverrides): Promise<[BigNumber]>;
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<[number]>;
ZERO_VALUE(overrides?: CallOverrides): Promise<[BigNumber]>;
calculatePublicAmount(
_extAmount: BigNumberish,
_fee: BigNumberish,
overrides?: CallOverrides
): Promise<[BigNumber]>;
currentCommitmentIndex(overrides?: CallOverrides): Promise<[BigNumber]>;
currentRootIndex(overrides?: CallOverrides): Promise<[number]>;
currentRoot(overrides?: CallOverrides): Promise<[string]>;
filledSubtrees(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<[string]>;
getLastRoot(overrides?: CallOverrides): Promise<[string]>;
hashLeftRight(
_left: BytesLike,
_right: BytesLike,
overrides?: CallOverrides
): Promise<[string]>;
hasher(overrides?: CallOverrides): Promise<[string]>;
initialize(
_currentRoot: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
isKnownRoot(
_root: BytesLike,
overrides?: CallOverrides
): Promise<[boolean]>;
isSpent(
_nullifierHash: BytesLike,
overrides?: CallOverrides
): Promise<[boolean]>;
levels(overrides?: CallOverrides): Promise<[number]>;
nextIndex(overrides?: CallOverrides): Promise<[number]>;
nullifierHashes(
arg0: BytesLike,
overrides?: CallOverrides
@ -279,10 +355,8 @@ export class TornadoPool extends BaseContract {
_proofArgs: {
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
@ -297,14 +371,14 @@ export class TornadoPool extends BaseContract {
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
roots(arg0: BigNumberish, overrides?: CallOverrides): Promise<[string]>;
transaction(
_args: {
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
@ -327,15 +401,15 @@ export class TornadoPool extends BaseContract {
_args: {
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
overrides?: CallOverrides
): Promise<[boolean]>;
zeros(i: BigNumberish, overrides?: CallOverrides): Promise<[string]>;
};
FIELD_SIZE(overrides?: CallOverrides): Promise<BigNumber>;
@ -344,26 +418,48 @@ export class TornadoPool extends BaseContract {
MAX_FEE(overrides?: CallOverrides): Promise<BigNumber>;
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<number>;
ZERO_VALUE(overrides?: CallOverrides): Promise<BigNumber>;
calculatePublicAmount(
_extAmount: BigNumberish,
_fee: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
currentCommitmentIndex(overrides?: CallOverrides): Promise<BigNumber>;
currentRootIndex(overrides?: CallOverrides): Promise<number>;
currentRoot(overrides?: CallOverrides): Promise<string>;
filledSubtrees(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<string>;
getLastRoot(overrides?: CallOverrides): Promise<string>;
hashLeftRight(
_left: BytesLike,
_right: BytesLike,
overrides?: CallOverrides
): Promise<string>;
hasher(overrides?: CallOverrides): Promise<string>;
initialize(
_currentRoot: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
isKnownRoot(_root: BytesLike, overrides?: CallOverrides): Promise<boolean>;
isSpent(
_nullifierHash: BytesLike,
overrides?: CallOverrides
): Promise<boolean>;
levels(overrides?: CallOverrides): Promise<number>;
nextIndex(overrides?: CallOverrides): Promise<number>;
nullifierHashes(arg0: BytesLike, overrides?: CallOverrides): Promise<boolean>;
register(
@ -376,10 +472,8 @@ export class TornadoPool extends BaseContract {
_proofArgs: {
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
@ -394,14 +488,14 @@ export class TornadoPool extends BaseContract {
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
roots(arg0: BigNumberish, overrides?: CallOverrides): Promise<string>;
transaction(
_args: {
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
@ -424,16 +518,16 @@ export class TornadoPool extends BaseContract {
_args: {
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
overrides?: CallOverrides
): Promise<boolean>;
zeros(i: BigNumberish, overrides?: CallOverrides): Promise<string>;
callStatic: {
FIELD_SIZE(overrides?: CallOverrides): Promise<BigNumber>;
@ -441,26 +535,46 @@ export class TornadoPool extends BaseContract {
MAX_FEE(overrides?: CallOverrides): Promise<BigNumber>;
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<number>;
ZERO_VALUE(overrides?: CallOverrides): Promise<BigNumber>;
calculatePublicAmount(
_extAmount: BigNumberish,
_fee: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
currentCommitmentIndex(overrides?: CallOverrides): Promise<BigNumber>;
currentRootIndex(overrides?: CallOverrides): Promise<number>;
currentRoot(overrides?: CallOverrides): Promise<string>;
initialize(
_currentRoot: BytesLike,
filledSubtrees(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<void>;
): Promise<string>;
getLastRoot(overrides?: CallOverrides): Promise<string>;
hashLeftRight(
_left: BytesLike,
_right: BytesLike,
overrides?: CallOverrides
): Promise<string>;
hasher(overrides?: CallOverrides): Promise<string>;
initialize(overrides?: CallOverrides): Promise<void>;
isKnownRoot(_root: BytesLike, overrides?: CallOverrides): Promise<boolean>;
isSpent(
_nullifierHash: BytesLike,
overrides?: CallOverrides
): Promise<boolean>;
levels(overrides?: CallOverrides): Promise<number>;
nextIndex(overrides?: CallOverrides): Promise<number>;
nullifierHashes(
arg0: BytesLike,
overrides?: CallOverrides
@ -476,10 +590,8 @@ export class TornadoPool extends BaseContract {
_proofArgs: {
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
@ -494,14 +606,14 @@ export class TornadoPool extends BaseContract {
overrides?: CallOverrides
): Promise<void>;
roots(arg0: BigNumberish, overrides?: CallOverrides): Promise<string>;
transaction(
_args: {
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
@ -524,15 +636,15 @@ export class TornadoPool extends BaseContract {
_args: {
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
overrides?: CallOverrides
): Promise<boolean>;
zeros(i: BigNumberish, overrides?: CallOverrides): Promise<string>;
};
filters: {
@ -567,26 +679,51 @@ export class TornadoPool extends BaseContract {
MAX_FEE(overrides?: CallOverrides): Promise<BigNumber>;
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<BigNumber>;
ZERO_VALUE(overrides?: CallOverrides): Promise<BigNumber>;
calculatePublicAmount(
_extAmount: BigNumberish,
_fee: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
currentCommitmentIndex(overrides?: CallOverrides): Promise<BigNumber>;
currentRootIndex(overrides?: CallOverrides): Promise<BigNumber>;
currentRoot(overrides?: CallOverrides): Promise<BigNumber>;
filledSubtrees(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
getLastRoot(overrides?: CallOverrides): Promise<BigNumber>;
hashLeftRight(
_left: BytesLike,
_right: BytesLike,
overrides?: CallOverrides
): Promise<BigNumber>;
hasher(overrides?: CallOverrides): Promise<BigNumber>;
initialize(
_currentRoot: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
isKnownRoot(
_root: BytesLike,
overrides?: CallOverrides
): Promise<BigNumber>;
isSpent(
_nullifierHash: BytesLike,
overrides?: CallOverrides
): Promise<BigNumber>;
levels(overrides?: CallOverrides): Promise<BigNumber>;
nextIndex(overrides?: CallOverrides): Promise<BigNumber>;
nullifierHashes(
arg0: BytesLike,
overrides?: CallOverrides
@ -602,10 +739,8 @@ export class TornadoPool extends BaseContract {
_proofArgs: {
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
@ -620,14 +755,14 @@ export class TornadoPool extends BaseContract {
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
roots(arg0: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
transaction(
_args: {
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
@ -650,15 +785,15 @@ export class TornadoPool extends BaseContract {
_args: {
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
overrides?: CallOverrides
): Promise<BigNumber>;
zeros(i: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
};
populateTransaction: {
@ -668,28 +803,51 @@ export class TornadoPool extends BaseContract {
MAX_FEE(overrides?: CallOverrides): Promise<PopulatedTransaction>;
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<PopulatedTransaction>;
ZERO_VALUE(overrides?: CallOverrides): Promise<PopulatedTransaction>;
calculatePublicAmount(
_extAmount: BigNumberish,
_fee: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
currentCommitmentIndex(
currentRootIndex(overrides?: CallOverrides): Promise<PopulatedTransaction>;
filledSubtrees(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
currentRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>;
getLastRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>;
hashLeftRight(
_left: BytesLike,
_right: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
hasher(overrides?: CallOverrides): Promise<PopulatedTransaction>;
initialize(
_currentRoot: BytesLike,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
isKnownRoot(
_root: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
isSpent(
_nullifierHash: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
levels(overrides?: CallOverrides): Promise<PopulatedTransaction>;
nextIndex(overrides?: CallOverrides): Promise<PopulatedTransaction>;
nullifierHashes(
arg0: BytesLike,
overrides?: CallOverrides
@ -705,10 +863,8 @@ export class TornadoPool extends BaseContract {
_proofArgs: {
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
@ -723,14 +879,17 @@ export class TornadoPool extends BaseContract {
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
roots(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
transaction(
_args: {
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
@ -753,14 +912,17 @@ export class TornadoPool extends BaseContract {
_args: {
proof: BytesLike;
root: BytesLike;
newRoot: BytesLike;
inputNullifiers: BytesLike[];
outputCommitments: [BytesLike, BytesLike];
outPathIndices: BigNumberish;
publicAmount: BigNumberish;
extDataHash: BytesLike;
},
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
zeros(
i: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
};
}

View File

@ -19,6 +19,16 @@ const _abi = [
name: "_verifier16",
type: "address",
},
{
internalType: "uint32",
name: "_levels",
type: "uint32",
},
{
internalType: "address",
name: "_hasher",
type: "address",
},
],
stateMutability: "nonpayable",
type: "constructor",
@ -138,6 +148,32 @@ const _abi = [
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "ROOT_HISTORY_SIZE",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "ZERO_VALUE",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
@ -164,20 +200,39 @@ const _abi = [
},
{
inputs: [],
name: "currentCommitmentIndex",
name: "currentRootIndex",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "filledSubtrees",
outputs: [
{
internalType: "bytes32",
name: "",
type: "bytes32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "currentRoot",
name: "getLastRoot",
outputs: [
{
internalType: "bytes32",
@ -192,15 +247,65 @@ const _abi = [
inputs: [
{
internalType: "bytes32",
name: "_currentRoot",
name: "_left",
type: "bytes32",
},
{
internalType: "bytes32",
name: "_right",
type: "bytes32",
},
],
name: "hashLeftRight",
outputs: [
{
internalType: "bytes32",
name: "",
type: "bytes32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "hasher",
outputs: [
{
internalType: "contract IHasher",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "initialize",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "bytes32",
name: "_root",
type: "bytes32",
},
],
name: "isKnownRoot",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
@ -220,6 +325,32 @@ const _abi = [
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "levels",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "nextIndex",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
@ -295,11 +426,6 @@ const _abi = [
name: "root",
type: "bytes32",
},
{
internalType: "bytes32",
name: "newRoot",
type: "bytes32",
},
{
internalType: "bytes32[]",
name: "inputNullifiers",
@ -310,11 +436,6 @@ const _abi = [
name: "outputCommitments",
type: "bytes32[2]",
},
{
internalType: "uint256",
name: "outPathIndices",
type: "uint256",
},
{
internalType: "uint256",
name: "publicAmount",
@ -373,6 +494,25 @@ const _abi = [
stateMutability: "payable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "roots",
outputs: [
{
internalType: "bytes32",
name: "",
type: "bytes32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
@ -387,11 +527,6 @@ const _abi = [
name: "root",
type: "bytes32",
},
{
internalType: "bytes32",
name: "newRoot",
type: "bytes32",
},
{
internalType: "bytes32[]",
name: "inputNullifiers",
@ -402,11 +537,6 @@ const _abi = [
name: "outputCommitments",
type: "bytes32[2]",
},
{
internalType: "uint256",
name: "outPathIndices",
type: "uint256",
},
{
internalType: "uint256",
name: "publicAmount",
@ -505,11 +635,6 @@ const _abi = [
name: "root",
type: "bytes32",
},
{
internalType: "bytes32",
name: "newRoot",
type: "bytes32",
},
{
internalType: "bytes32[]",
name: "inputNullifiers",
@ -520,11 +645,6 @@ const _abi = [
name: "outputCommitments",
type: "bytes32[2]",
},
{
internalType: "uint256",
name: "outPathIndices",
type: "uint256",
},
{
internalType: "uint256",
name: "publicAmount",
@ -552,6 +672,25 @@ const _abi = [
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "i",
type: "uint256",
},
],
name: "zeros",
outputs: [
{
internalType: "bytes32",
name: "",
type: "bytes32",
},
],
stateMutability: "pure",
type: "function",
},
];
export class TornadoPool__factory {

View File

@ -2,7 +2,7 @@ import { ChainId } from '@/types';
export const CONTRACT_NETWORKS: { [chainId in ChainId]: string } = {
// [ChainId.MAINNET]: '0x8Bfac9EF3d73cE08C7CEC339C0fE3B2e57814c1E',
[ChainId.GOERLI]: '0x3a4cbAC9C28abb1205B5Ca8AdC54b3306B18eEE7',
[ChainId.GOERLI]: '0xE2D9aF526edeB16a02FBC3B68B0eB9B534f9c114',
[ChainId.OPTIMISM]: '0xcd7318c299A82E887f5180EF865a4c350dFC9fe5',
};

View File

@ -3,11 +3,11 @@ import { ChainId } from '@/types';
const NETWORKS_INFO: { [chainId in ChainId] } = {
[ChainId.MAINNET]: {
gasLimit: BigNumber.from(400000),
gasLimit: BigNumber.from(1000000),
minimumBalance: '0.5',
},
[ChainId.GOERLI]: {
gasLimit: BigNumber.from(400000),
gasLimit: BigNumber.from(1000000),
minimumBalance: '0.5',
},
[ChainId.OPTIMISM]: {

View File

@ -42,8 +42,6 @@ const transactionSchema = {
properties: {
extDataHash: bytes32Type,
inputNullifiers: arrayType,
newRoot: bytes32Type,
outPathIndices: bytes32Type,
outputCommitments: arrayType,
proof: proofType,
publicAmount: bytes32Type,