sdk-monorepo/test/deth/factories/ETHTornado__factory.ts

639 lines
25 KiB
TypeScript
Raw Normal View History

/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import {
Signer,
utils,
Contract,
ContractFactory,
BigNumberish,
Overrides,
} from "ethers";
import type { Provider, TransactionRequest } from "@ethersproject/providers";
import type { PromiseOrValue } from "../common";
import type { ETHTornado, ETHTornadoInterface } from "../ETHTornado";
const _abi = [
{
inputs: [
{
internalType: "contract IVerifier",
name: "_verifier",
type: "address",
},
{
internalType: "uint256",
name: "_denomination",
type: "uint256",
},
{
internalType: "uint32",
name: "_merkleTreeHeight",
type: "uint32",
},
{
internalType: "address",
name: "_operator",
type: "address",
},
],
payable: false,
stateMutability: "nonpayable",
type: "constructor",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "bytes32",
name: "commitment",
type: "bytes32",
},
{
indexed: false,
internalType: "uint32",
name: "leafIndex",
type: "uint32",
},
{
indexed: false,
internalType: "uint256",
name: "timestamp",
type: "uint256",
},
],
name: "Deposit",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "to",
type: "address",
},
{
indexed: false,
internalType: "bytes32",
name: "nullifierHash",
type: "bytes32",
},
{
indexed: true,
internalType: "address",
name: "relayer",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "fee",
type: "uint256",
},
],
name: "Withdrawal",
type: "event",
},
{
constant: true,
inputs: [],
name: "FIELD_SIZE",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: true,
inputs: [],
name: "ROOT_HISTORY_SIZE",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: true,
inputs: [],
name: "ZERO_VALUE",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: false,
inputs: [
{
internalType: "address",
name: "_newOperator",
type: "address",
},
],
name: "changeOperator",
outputs: [],
payable: false,
stateMutability: "nonpayable",
type: "function",
},
{
constant: true,
inputs: [
{
internalType: "bytes32",
name: "",
type: "bytes32",
},
],
name: "commitments",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: true,
inputs: [],
name: "currentRootIndex",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: true,
inputs: [],
name: "denomination",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: false,
inputs: [
{
internalType: "bytes32",
name: "_commitment",
type: "bytes32",
},
],
name: "deposit",
outputs: [],
payable: true,
stateMutability: "payable",
type: "function",
},
{
constant: true,
inputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "filledSubtrees",
outputs: [
{
internalType: "bytes32",
name: "",
type: "bytes32",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: true,
inputs: [],
name: "getLastRoot",
outputs: [
{
internalType: "bytes32",
name: "",
type: "bytes32",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: true,
inputs: [
{
internalType: "bytes32",
name: "_left",
type: "bytes32",
},
{
internalType: "bytes32",
name: "_right",
type: "bytes32",
},
],
name: "hashLeftRight",
outputs: [
{
internalType: "bytes32",
name: "",
type: "bytes32",
},
],
payable: false,
stateMutability: "pure",
type: "function",
},
{
constant: true,
inputs: [
{
internalType: "bytes32",
name: "_root",
type: "bytes32",
},
],
name: "isKnownRoot",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: true,
inputs: [
{
internalType: "bytes32",
name: "_nullifierHash",
type: "bytes32",
},
],
name: "isSpent",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: true,
inputs: [
{
internalType: "bytes32[]",
name: "_nullifierHashes",
type: "bytes32[]",
},
],
name: "isSpentArray",
outputs: [
{
internalType: "bool[]",
name: "spent",
type: "bool[]",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: true,
inputs: [],
name: "levels",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: true,
inputs: [],
name: "nextIndex",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: true,
inputs: [
{
internalType: "bytes32",
name: "",
type: "bytes32",
},
],
name: "nullifierHashes",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: true,
inputs: [],
name: "operator",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: true,
inputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "roots",
outputs: [
{
internalType: "bytes32",
name: "",
type: "bytes32",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: false,
inputs: [
{
internalType: "address",
name: "_newVerifier",
type: "address",
},
],
name: "updateVerifier",
outputs: [],
payable: false,
stateMutability: "nonpayable",
type: "function",
},
{
constant: true,
inputs: [],
name: "verifier",
outputs: [
{
internalType: "contract IVerifier",
name: "",
type: "address",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: false,
inputs: [
{
internalType: "bytes",
name: "_proof",
type: "bytes",
},
{
internalType: "bytes32",
name: "_root",
type: "bytes32",
},
{
internalType: "bytes32",
name: "_nullifierHash",
type: "bytes32",
},
{
internalType: "address payable",
name: "_recipient",
type: "address",
},
{
internalType: "address payable",
name: "_relayer",
type: "address",
},
{
internalType: "uint256",
name: "_fee",
type: "uint256",
},
{
internalType: "uint256",
name: "_refund",
type: "uint256",
},
],
name: "withdraw",
outputs: [],
payable: true,
stateMutability: "payable",
type: "function",
},
{
constant: true,
inputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "zeros",
outputs: [
{
internalType: "bytes32",
name: "",
type: "bytes32",
},
],
payable: false,
stateMutability: "view",
type: "function",
},
] as const;
const _bytecode =
"0x6080604052600380546001600160401b03191690553480156200002157600080fd5b50604051620019a9380380620019a9833981810160405260808110156200004757600080fd5b5080516020820151604083015160609093015191929091838383838163ffffffff8116620000a75760405162461bcd60e51b8152600401808060200182810382526027815260200180620019206027913960400191505060405180910390fd5b60208163ffffffff1610620000ee5760405162461bcd60e51b8152600401808060200182810382526022815260200180620019676022913960400191505060405180910390fd5b6000805463ffffffff191663ffffffff83161781556002805460018181019092557f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c600080516020620018df8339815191529091018190558154808301835592829052600080516020620019898339815191529092018290555b60005463ffffffff9081169082161015620001dc576200019282806001600160e01b036200027616565b600280546001818101909255600080516020620018df8339815191520182905580548082018255600082905260008051602062001989833981519152018290559092500162000168565b50620001f281806001600160e01b036200027616565b60045550506001606855826200023a5760405162461bcd60e51b8152600401808060200182810382526025815260200180620018ba6025913960400191505060405180910390fd5b606c80546001600160a01b039586166001600160a01b031991821617909155606d80549290951691161790925560695550620004639350505050565b6000600080516020620019478339815191528310620002dc576040805162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c64604482015290519081900360640190fd5b6000805160206200194783398151915282106200032b5760405162461bcd60e51b8152600401808060200182810382526021815260200180620018ff6021913960400191505060405180910390fd5b6040805163f47d33b560e01b81526004810185905260006024820181905282518693919273__Hasher________________________________9263f47d33b592604480840193829003018186803b1580156200038657600080fd5b505af41580156200039b573d6000803e3d6000fd5b505050506040513d6040811015620003b257600080fd5b508051602090910151909250905060008051602062001947833981519152848308915073__Hasher________________________________63f47d33b583836040518363ffffffff1660e01b81526004018083815260200182815260200192505050604080518083038186803b1580156200042c57600080fd5b505af415801562000441573d6000803e3d6000fd5b505050506040513d60408110156200045857600080fd5b505195945050505050565b61144780620004736000396000f3fe6080604052600436106101405760003560e01c806390eeb02b116100b6578063cd87a3b41161006f578063cd87a3b4146104f4578063e5285dcc14610509578063e829558814610533578063ec7329591461055d578063f178e47c14610572578063fc7e9c6f1461059c57610140565b806390eeb02b1461038557806397fc007c1461039a5780639fa12d0b146103cd578063b214faa514610498578063ba70f757146104b5578063c2b40ae4146104ca57610140565b8063414a37ba11610108578063414a37ba146102c45780634ecf518b146102d9578063570ca735146103075780636d9833e31461031c578063839df945146103465780638bca6d161461037057610140565b806306394c9b1461014557806317cc915c1461017a57806321a0adb6146101b85780632b7ac3f31461025157806338bf282e14610282575b600080fd5b34801561015157600080fd5b506101786004803603602081101561016857600080fd5b50356001600160a01b03166105b1565b005b34801561018657600080fd5b506101a46004803603602081101561019d57600080fd5b503561061c565b604080519115158252519081900360200190f35b610178600480360360e08110156101ce57600080fd5b810190602081018135600160201b8111156101e857600080fd5b8201836020820111156101fa57600080fd5b803590602001918460018302840111600160201b8311171561021b57600080fd5b91935091508035906020810135906001600160a01b03604082013581169160608101359091169060808101359060a00135610631565b34801561025d57600080fd5b50610266610972565b604080516001600160a01b039092168252519081900360200190f35b34801561028e57600080fd5b506102b2600480360360408110156102a557600080fd5b5080359060200135610981565b60408051918252519081900360200190f35b3480156102d057600080fd5b506102b2610b62565b3480156102e557600080fd5b506102ee610b74565b6040805163ffffffff9092168252519081900360200190f35b34801561031357600080fd5b50610266610b80565b34801561032857600080fd5b506101a46004803603602081101561033f57600080fd5b5035610b8f565b34801561035257600080fd5b506101a46004803603602081101561036957600080fd5b5035610c02565b34801561037c57600080fd5b506102b2610c17565b34801561
type ETHTornadoConstructorParams =
| [linkLibraryAddresses: ETHTornadoLibraryAddresses, signer?: Signer]
| ConstructorParameters<typeof ContractFactory>;
const isSuperArgs = (
xs: ETHTornadoConstructorParams
): xs is ConstructorParameters<typeof ContractFactory> => {
return (
typeof xs[0] === "string" ||
(Array.isArray as (arg: any) => arg is readonly any[])(xs[0]) ||
"_isInterface" in xs[0]
);
};
export class ETHTornado__factory extends ContractFactory {
constructor(...args: ETHTornadoConstructorParams) {
if (isSuperArgs(args)) {
super(...args);
} else {
const [linkLibraryAddresses, signer] = args;
super(
_abi,
ETHTornado__factory.linkBytecode(linkLibraryAddresses),
signer
);
}
this.contractName = "ETHTornado";
}
static linkBytecode(
linkLibraryAddresses: ETHTornadoLibraryAddresses
): string {
let linkedBytecode = _bytecode;
linkedBytecode = linkedBytecode.replace(
new RegExp("__Hasher________________________________", "g"),
linkLibraryAddresses["__Hasher________________________________"]
.replace(/^0x/, "")
.toLowerCase()
);
return linkedBytecode;
}
override deploy(
_verifier: PromiseOrValue<string>,
_denomination: PromiseOrValue<BigNumberish>,
_merkleTreeHeight: PromiseOrValue<BigNumberish>,
_operator: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ETHTornado> {
return super.deploy(
_verifier,
_denomination,
_merkleTreeHeight,
_operator,
overrides || {}
) as Promise<ETHTornado>;
}
override getDeployTransaction(
_verifier: PromiseOrValue<string>,
_denomination: PromiseOrValue<BigNumberish>,
_merkleTreeHeight: PromiseOrValue<BigNumberish>,
_operator: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): TransactionRequest {
return super.getDeployTransaction(
_verifier,
_denomination,
_merkleTreeHeight,
_operator,
overrides || {}
);
}
override attach(address: string): ETHTornado {
return super.attach(address) as ETHTornado;
}
override connect(signer: Signer): ETHTornado__factory {
return super.connect(signer) as ETHTornado__factory;
}
static readonly contractName: "ETHTornado";
public readonly contractName: "ETHTornado";
static readonly bytecode = _bytecode;
static readonly abi = _abi;
static createInterface(): ETHTornadoInterface {
return new utils.Interface(_abi) as ETHTornadoInterface;
}
static connect(
address: string,
signerOrProvider: Signer | Provider
): ETHTornado {
return new Contract(address, _abi, signerOrProvider) as ETHTornado;
}
}
export interface ETHTornadoLibraryAddresses {
["__Hasher________________________________"]: string;
}