sdk-monorepo/@tornado/sdk-registry/src/deth/factories/ETHTornado__factory.ts

639 lines
25 KiB
TypeScript

/* 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________________________________63f47d33b583836040518363ffffffff1660e01b81526004018083815260200182815260200192505050604080518083038186803b1580156200042c57600080fd5b505af415801562000441573d6000803e3d6000fd5b505050506040513d60408110156200045857600080fd5b505195945050505050565b61144780620004736000396000f3fe6080604052600436106101405760003560e01c806390eeb02b116100b6578063cd87a3b41161006f578063cd87a3b4146104f4578063e5285dcc14610509578063e829558814610533578063ec7329591461055d578063f178e47c14610572578063fc7e9c6f1461059c57610140565b806390eeb02b1461038557806397fc007c1461039a5780639fa12d0b146103cd578063b214faa514610498578063ba70f757146104b5578063c2b40ae4146104ca57610140565b8063414a37ba11610108578063414a37ba146102c45780634ecf518b146102d9578063570ca735146103075780636d9833e31461031c578063839df945146103465780638bca6d161461037057610140565b806306394c9b1461014557806317cc915c1461017a57806321a0adb6146101b85780632b7ac3f31461025157806338bf282e14610282575b600080fd5b34801561015157600080fd5b506101786004803603602081101561016857600080fd5b50356001600160a01b03166105b1565b005b34801561018657600080fd5b506101a46004803603602081101561019d57600080fd5b503561061c565b604080519115158252519081900360200190f35b610178600480360360e08110156101ce57600080fd5b810190602081018135600160201b8111156101e857600080fd5b8201836020820111156101fa57600080fd5b803590602001918460018302840111600160201b8311171561021b57600080fd5b91935091508035906020810135906001600160a01b03604082013581169160608101359091169060808101359060a00135610631565b34801561025d57600080fd5b50610266610972565b604080516001600160a01b039092168252519081900360200190f35b34801561028e57600080fd5b506102b2600480360360408110156102a557600080fd5b5080359060200135610981565b60408051918252519081900360200190f35b3480156102d057600080fd5b506102b2610b62565b3480156102e557600080fd5b506102ee610b74565b6040805163ffffffff9092168252519081900360200190f35b34801561031357600080fd5b50610266610b80565b34801561032857600080fd5b506101a46004803603602081101561033f57600080fd5b5035610b8f565b34801561035257600080fd5b506101a46004803603602081101561036957600080fd5b5035610c02565b34801561037c57600080fd5b506102b2610c17565b34801561039157600080fd5b506102ee610c1d565b3480156103a657600080fd5b50610178600480360360208110156103bd57600080fd5b50356001600160a01b0316610c29565b3480156103d957600080fd5b50610448600480360360208110156103f057600080fd5b810190602081018135600160201b81111561040a57600080fd5b82018360208201111561041c57600080fd5b803590602001918460208302840111600160201b8311171561043d57600080fd5b509092509050610c94565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561048457818101518382015260200161046c565b505050509050019250505060405180910390f35b610178600480360360208110156104ae57600080fd5b5035610d1c565b3480156104c157600080fd5b506102b2610e3d565b3480156104d657600080fd5b506102b2600480360360208110156104ed57600080fd5b5035610e5d565b34801561050057600080fd5b506102ee610e71565b34801561051557600080fd5b506101a46004803603602081101561052c57600080fd5b5035610e76565b34801561053f57600080fd5b506102b26004803603602081101561055657600080fd5b5035610e8b565b34801561056957600080fd5b506102b2610ea9565b34801561057e57600080fd5b506102b26004803603602081101561059557600080fd5b5035610ecd565b3480156105a857600080fd5b506102ee610eda565b606d546001600160a01b031633146105fa5760405162461bcd60e51b81526004018080602001828103825260258152602001806113b96025913960400191505060405180910390fd5b606d80546001600160a01b0319166001600160a01b0392909216919091179055565b606a6020526000908152604090205460ff1681565b6068805460010190819055606954831115610693576040805162461bcd60e51b815260206004820152601a60248201527f4665652065786365656473207472616e736665722076616c7565000000000000604482015290519081900360640190fd5b6000868152606a602052604090205460ff16156106f7576040805162461bcd60e51b815260206004820152601f60248201527f546865206e6f746520686173206265656e20616c7265616479207370656e7400604482015290519081900360640190fd5b61070087610b8f565b610751576040805162461bcd60e51b815260206004820152601c60248201527f43616e6e6f742066696e6420796f7572206d65726b6c6520726f6f7400000000604482015290519081900360640190fd5b606c546040805160c080820183528a8252602082018a90526001600160a01b038981168385015288811660608401526080830188905260a08301879052925163695ef6f960e01b8152929093169263695ef6f9928d928d9290916004810191829160240190849080838360005b838110156107d65781810151838201526020016107be565b505050509050018281038252858582818152602001925080828437600081840152601f19601f820116905080830192505050945050505050602060405180830381600087803b15801561082857600080fd5b505af115801561083c573d6000803e3d6000fd5b505050506040513d602081101561085257600080fd5b505161089e576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b2103bb4ba34323930bb90383937b7b360511b604482015290519081900360640190fd5b6000868152606a60205260409020805460ff191660011790556108c385858585610eed565b604080516001600160a01b038781168252602082018990528183018690529151918616917fe9e508bad6d4c3227e881ca19068f099da81b5164dd6d62b2eaf1e8bc6c349319181900360600190a26068548114610967576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b505050505050505050565b606c546001600160a01b031681565b600060008051602061133083398151915283106109e5576040805162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c64604482015290519081900360640190fd5b6000805160206113308339815191528210610a315760405162461bcd60e51b81526004018080602001828103825260218152602001806112db6021913960400191505060405180910390fd5b6040805163f47d33b560e01b81526004810185905260006024820181905282518693919273__Hasher________________________________9263f47d33b592604480840193829003018186803b158015610a8b57600080fd5b505af4158015610a9f573d6000803e3d6000fd5b505050506040513d6040811015610ab557600080fd5b5080516020909101519092509050600080516020611330833981519152848308915073__Hasher________________________________63f47d33b583836040518363ffffffff1660e01b81526004018083815260200182815260200192505050604080518083038186803b158015610b2d57600080fd5b505af4158015610b41573d6000803e3d6000fd5b505050506040513d6040811015610b5757600080fd5b505195945050505050565b60008051602061133083398151915281565b60005463ffffffff1681565b606d546001600160a01b031681565b600081610b9e57506000610bfd565b60035463ffffffff165b60048163ffffffff1660648110610bbb57fe5b0154831415610bce576001915050610bfd565b63ffffffff8116610bdd575060645b6003546000199091019063ffffffff80831691161415610ba85760009150505b919050565b606b6020526000908152604090205460ff1681565b60695481565b60035463ffffffff1681565b606d546001600160a01b03163314610c725760405162461bcd60e51b81526004018080602001828103825260258152602001806113b96025913960400191505060405180910390fd5b606c80546001600160a01b0319166001600160a01b0392909216919091179055565b604080518281526020808402820101909152606090828015610cc0578160200160208202803883390190505b50905060005b82811015610d1557610ce9848483818110610cdd57fe5b90506020020135610e76565b15610d0d576001828281518110610cfc57fe5b911515602092830291909101909101525b600101610cc6565b5092915050565b60688054600101908190556000828152606b602052604090205460ff1615610d755760405162461bcd60e51b81526004018080602001828103825260218152602001806113506021913960400191505060405180910390fd5b6000610d808361109a565b6000848152606b60205260409020805460ff191660011790559050610da3611231565b6040805163ffffffff83168152426020820152815185927fa945e51eec50ab98c161376f0db4cf2aeba3ec92755fe2fcd388bdbbb80ff196928290030190a2506068548114610e39576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b5050565b60035460009060049063ffffffff1660648110610e5657fe5b0154905090565b60048160648110610e6a57fe5b0154905081565b606481565b6000908152606a602052604090205460ff1690565b60028181548110610e9857fe5b600091825260209091200154905081565b7f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c81565b60018181548110610e9857fe5b600354600160201b900463ffffffff1681565b3415610f2a5760405162461bcd60e51b81526004018080602001828103825260358152602001806113de6035913960400191505060405180910390fd5b8015610f675760405162461bcd60e51b81526004018080602001828103825260348152602001806112fc6034913960400191505060405180910390fd5b6069546040516000916001600160a01b0387169190859003908381818185875af1925050503d8060008114610fb8576040519150601f19603f3d011682016040523d82523d6000602084013e610fbd565b606091505b5050905080610ffd5760405162461bcd60e51b81526004018080602001828103825260258152602001806113716025913960400191505060405180910390fd5b8215611093576040516001600160a01b038516908490600081818185875af1925050503d806000811461104c576040519150601f19603f3d011682016040523d82523d6000602084013e611051565b606091505b505080915050806110935760405162461bcd60e51b81526004018080602001828103825260238152602001806113966023913960400191505060405180910390fd5b5050505050565b60035460008054909163ffffffff600160201b909104811691811660020a168114156110f75760405162461bcd60e51b815260040180806020018281038252602f815260200180611274602f913960400191505060405180910390fd5b6003805463ffffffff600160201b80830482166001019091160267ffffffff000000001990911617905582600080805b60005463ffffffff90811690821610156111cf576001851661118b5783925060028163ffffffff168154811061115957fe5b906000526020600020015491508360018263ffffffff168154811061117a57fe5b6000918252602090912001556111af565b60018163ffffffff168154811061119e57fe5b906000526020600020015492508391505b6111b98383610981565b9350600263ffffffff8616049450600101611127565b5060035460649063ffffffff908116600101166003805463ffffffff19169290910663ffffffff90811692909217908190558491600491166064811061121157fe5b01555050600354600160201b900463ffffffff1660001901949350505050565b60695434146112715760405162461bcd60e51b81526004018080602001828103825260388152602001806112a36038913960400191505060405180910390fd5b56fe4d65726b6c6520747265652069732066756c6c2e204e6f206d6f7265206c656166732063616e206265206164646564506c656173652073656e6420606d697844656e6f6d696e6174696f6e602045544820616c6f6e672077697468207472616e73616374696f6e5f72696768742073686f756c6420626520696e7369646520746865206669656c64526566756e642076616c756520697320737570706f73656420746f206265207a65726f20666f722045544820696e7374616e636530644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000154686520636f6d6d69746d656e7420686173206265656e207375626d69747465647061796d656e7420746f205f726563697069656e7420646964206e6f7420676f20746872757061796d656e7420746f205f72656c6179657220646964206e6f7420676f20746872754f6e6c79206f70657261746f722063616e2063616c6c20746869732066756e6374696f6e2e4d6573736167652076616c756520697320737570706f73656420746f206265207a65726f20666f722045544820696e7374616e6365a265627a7a72315820d15ee2f16c5ac46ac18f5c188efe2bd8dbb37cf2c474ec6b110e395ee7645dfd64736f6c6343000511003264656e6f6d696e6174696f6e2073686f756c642062652067726561746572207468616e2030405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5f72696768742073686f756c6420626520696e7369646520746865206669656c645f747265654c6576656c732073686f756c642062652067726561746572207468616e207a65726f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000015f747265654c6576656c732073686f756c64206265206c657373207468616e203332b10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6";
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;
}