diff --git a/src/abi/TornadoPool.json b/src/abi/TornadoPool.json index 26c5aaa..1b3c911 100644 --- a/src/abi/TornadoPool.json +++ b/src/abi/TornadoPool.json @@ -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" } ] diff --git a/src/artifacts/TornadoPool.d.ts b/src/artifacts/TornadoPool.d.ts index b4be1a3..5fdb738 100644 --- a/src/artifacts/TornadoPool.d.ts +++ b/src/artifacts/TornadoPool.d.ts @@ -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 } ): Promise; + 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 } ): Promise; + 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; @@ -344,26 +418,48 @@ export class TornadoPool extends BaseContract { MAX_FEE(overrides?: CallOverrides): Promise; + ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise; + + ZERO_VALUE(overrides?: CallOverrides): Promise; + calculatePublicAmount( _extAmount: BigNumberish, _fee: BigNumberish, overrides?: CallOverrides ): Promise; - currentCommitmentIndex(overrides?: CallOverrides): Promise; + currentRootIndex(overrides?: CallOverrides): Promise; - currentRoot(overrides?: CallOverrides): Promise; + filledSubtrees( + arg0: BigNumberish, + overrides?: CallOverrides + ): Promise; + + getLastRoot(overrides?: CallOverrides): Promise; + + hashLeftRight( + _left: BytesLike, + _right: BytesLike, + overrides?: CallOverrides + ): Promise; + + hasher(overrides?: CallOverrides): Promise; initialize( - _currentRoot: BytesLike, overrides?: Overrides & { from?: string | Promise } ): Promise; + isKnownRoot(_root: BytesLike, overrides?: CallOverrides): Promise; + isSpent( _nullifierHash: BytesLike, overrides?: CallOverrides ): Promise; + levels(overrides?: CallOverrides): Promise; + + nextIndex(overrides?: CallOverrides): Promise; + nullifierHashes(arg0: BytesLike, overrides?: CallOverrides): Promise; 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 } ): Promise; + roots(arg0: BigNumberish, overrides?: CallOverrides): Promise; + 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; + zeros(i: BigNumberish, overrides?: CallOverrides): Promise; + callStatic: { FIELD_SIZE(overrides?: CallOverrides): Promise; @@ -441,26 +535,46 @@ export class TornadoPool extends BaseContract { MAX_FEE(overrides?: CallOverrides): Promise; + ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise; + + ZERO_VALUE(overrides?: CallOverrides): Promise; + calculatePublicAmount( _extAmount: BigNumberish, _fee: BigNumberish, overrides?: CallOverrides ): Promise; - currentCommitmentIndex(overrides?: CallOverrides): Promise; + currentRootIndex(overrides?: CallOverrides): Promise; - currentRoot(overrides?: CallOverrides): Promise; - - initialize( - _currentRoot: BytesLike, + filledSubtrees( + arg0: BigNumberish, overrides?: CallOverrides - ): Promise; + ): Promise; + + getLastRoot(overrides?: CallOverrides): Promise; + + hashLeftRight( + _left: BytesLike, + _right: BytesLike, + overrides?: CallOverrides + ): Promise; + + hasher(overrides?: CallOverrides): Promise; + + initialize(overrides?: CallOverrides): Promise; + + isKnownRoot(_root: BytesLike, overrides?: CallOverrides): Promise; isSpent( _nullifierHash: BytesLike, overrides?: CallOverrides ): Promise; + levels(overrides?: CallOverrides): Promise; + + nextIndex(overrides?: CallOverrides): Promise; + 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; + roots(arg0: BigNumberish, overrides?: CallOverrides): Promise; + 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; + + zeros(i: BigNumberish, overrides?: CallOverrides): Promise; }; filters: { @@ -567,26 +679,51 @@ export class TornadoPool extends BaseContract { MAX_FEE(overrides?: CallOverrides): Promise; + ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise; + + ZERO_VALUE(overrides?: CallOverrides): Promise; + calculatePublicAmount( _extAmount: BigNumberish, _fee: BigNumberish, overrides?: CallOverrides ): Promise; - currentCommitmentIndex(overrides?: CallOverrides): Promise; + currentRootIndex(overrides?: CallOverrides): Promise; - currentRoot(overrides?: CallOverrides): Promise; + filledSubtrees( + arg0: BigNumberish, + overrides?: CallOverrides + ): Promise; + + getLastRoot(overrides?: CallOverrides): Promise; + + hashLeftRight( + _left: BytesLike, + _right: BytesLike, + overrides?: CallOverrides + ): Promise; + + hasher(overrides?: CallOverrides): Promise; initialize( - _currentRoot: BytesLike, overrides?: Overrides & { from?: string | Promise } ): Promise; + isKnownRoot( + _root: BytesLike, + overrides?: CallOverrides + ): Promise; + isSpent( _nullifierHash: BytesLike, overrides?: CallOverrides ): Promise; + levels(overrides?: CallOverrides): Promise; + + nextIndex(overrides?: CallOverrides): Promise; + 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 } ): Promise; + roots(arg0: BigNumberish, overrides?: CallOverrides): Promise; + 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; + + zeros(i: BigNumberish, overrides?: CallOverrides): Promise; }; populateTransaction: { @@ -668,28 +803,51 @@ export class TornadoPool extends BaseContract { MAX_FEE(overrides?: CallOverrides): Promise; + ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise; + + ZERO_VALUE(overrides?: CallOverrides): Promise; + calculatePublicAmount( _extAmount: BigNumberish, _fee: BigNumberish, overrides?: CallOverrides ): Promise; - currentCommitmentIndex( + currentRootIndex(overrides?: CallOverrides): Promise; + + filledSubtrees( + arg0: BigNumberish, overrides?: CallOverrides ): Promise; - currentRoot(overrides?: CallOverrides): Promise; + getLastRoot(overrides?: CallOverrides): Promise; + + hashLeftRight( + _left: BytesLike, + _right: BytesLike, + overrides?: CallOverrides + ): Promise; + + hasher(overrides?: CallOverrides): Promise; initialize( - _currentRoot: BytesLike, overrides?: Overrides & { from?: string | Promise } ): Promise; + isKnownRoot( + _root: BytesLike, + overrides?: CallOverrides + ): Promise; + isSpent( _nullifierHash: BytesLike, overrides?: CallOverrides ): Promise; + levels(overrides?: CallOverrides): Promise; + + nextIndex(overrides?: CallOverrides): Promise; + 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 } ): Promise; + roots( + arg0: BigNumberish, + overrides?: CallOverrides + ): Promise; + 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; + + zeros( + i: BigNumberish, + overrides?: CallOverrides + ): Promise; }; } diff --git a/src/artifacts/factories/TornadoPool__factory.ts b/src/artifacts/factories/TornadoPool__factory.ts index 274b4c9..a5037de 100644 --- a/src/artifacts/factories/TornadoPool__factory.ts +++ b/src/artifacts/factories/TornadoPool__factory.ts @@ -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 { diff --git a/src/constants/contracts.ts b/src/constants/contracts.ts index fd9b99d..f7b8072 100644 --- a/src/constants/contracts.ts +++ b/src/constants/contracts.ts @@ -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', }; diff --git a/src/constants/variables.ts b/src/constants/variables.ts index 8fbdda9..fae809b 100644 --- a/src/constants/variables.ts +++ b/src/constants/variables.ts @@ -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]: { diff --git a/src/modules/api/api.validator.ts b/src/modules/api/api.validator.ts index fbfe0de..97e3756 100644 --- a/src/modules/api/api.validator.ts +++ b/src/modules/api/api.validator.ts @@ -42,8 +42,6 @@ const transactionSchema = { properties: { extDataHash: bytes32Type, inputNullifiers: arrayType, - newRoot: bytes32Type, - outPathIndices: bytes32Type, outputCommitments: arrayType, proof: proofType, publicAmount: bytes32Type,