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

663 lines
27 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 { ERC20Tornado, ERC20TornadoInterface } from "../ERC20Tornado";
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",
},
{
internalType: "address",
name: "_token",
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: true,
inputs: [],
name: "token",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
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 =
"0x6080604052600380546001600160401b03191690553480156200002157600080fd5b5060405162001cef38038062001cef833981810160405260a08110156200004757600080fd5b50805160208201516040830151606084015160809094015192939192909190848484848163ffffffff8116620000af5760405162461bcd60e51b815260040180806020018281038252602781526020018062001c666027913960400191505060405180910390fd5b60208163ffffffff1610620000f65760405162461bcd60e51b815260040180806020018281038252602281526020018062001cad6022913960400191505060405180910390fd5b6000805463ffffffff191663ffffffff83161781556002805460018181019092557f2fe54c60d3acabf3343a35b6eba15db4821b340f76e741e2249685ed4899af6c60008051602062001c25833981519152909101819055815480830183559282905260008051602062001ccf8339815191529092018290555b60005463ffffffff9081169082161015620001e4576200019a82806001600160e01b036200029416565b60028054600181810190925560008051602062001c258339815191520182905580548082018255600082905260008051602062001ccf833981519152018290559092500162000170565b50620001fa81806001600160e01b036200029416565b6004555050600160685582620002425760405162461bcd60e51b815260040180806020018281038252602581526020018062001c006025913960400191505060405180910390fd5b606c80546001600160a01b039586166001600160a01b031991821617909155606d80549286169282169290921790915560699290925550606e8054939092169216919091179055506200048192505050565b600060008051602062001c8d8339815191528310620002fa576040805162461bcd60e51b815260206004820181905260248201527f5f6c6566742073686f756c6420626520696e7369646520746865206669656c64604482015290519081900360640190fd5b60008051602062001c8d8339815191528210620003495760405162461bcd60e51b815260040180806020018281038252602181526020018062001c456021913960400191505060405180910390fd5b6040805163f47d33b560e01b81526004810185905260006024820181905282518693919273__Hasher________________________________9263f47d33b592604480840193829003018186803b158015620003a457600080fd5b505af4158015620003b9573d6000803e3d6000fd5b505050506040513d6040811015620003d057600080fd5b508051602090910151909250905060008051602062001c8d833981519152848308915073__Hasher________________________________63f47d33b583836040518363ffffffff1660e01b81526004018083815260200182815260200192505050604080518083038186803b1580156200044a57600080fd5b505af41580156200045f573d6000803e3d6000fd5b505050506040513d60408110156200047657600080fd5b505195945050505050565b61176f80620004916000396000f3fe60806040526004361061014b5760003560e01c806397fc007c116100b6578063e5285dcc1161006f578063e5285dcc14610514578063e82955881461053e578063ec73295914610568578063f178e47c1461057d578063fc0c546a146105a7578063fc7e9c6f146105bc5761014b565b806397fc007c146103a55780639fa12d0b146103d8578063b214faa5146104a3578063ba70f757146104c0578063c2b40ae4146104d5578063cd87a3b4146104ff5761014b565b80634ecf518b116101085780634ecf518b146102e4578063570ca735146103125780636d9833e314610327578063839df945146103515780638bca6d161461037b57806390eeb02b146103905761014b565b806306394c9b1461015057806317cc915c1461018557806321a0adb6146101c35780632b7ac3f31461025c57806338bf282e1461028d578063414a37ba146102cf575b600080fd5b34801561015c57600080fd5b506101836004803603602081101561017357600080fd5b50356001600160a01b03166105d1565b005b34801561019157600080fd5b506101af600480360360208110156101a857600080fd5b503561063c565b604080519115158252519081900360200190f35b610183600480360360e08110156101d957600080fd5b810190602081018135600160201b8111156101f357600080fd5b82018360208201111561020557600080fd5b803590602001918460018302840111600160201b8311171561022657600080fd5b91935091508035906020810135906001600160a01b03604082013581169160608101359091169060808101359060a00135610651565b34801561026857600080fd5b50610271610992565b604080516001600160a01b039092168252519081900360200190f35b34801561029957600080fd5b506102bd600480360360408110156102b057600080fd5b50803590602001356109a1565b60408051918252519081900360200190f35b3480156102db57600080fd5b506102bd610b82565b3480156102f057600080fd5b506102f9610b94565b6040805163ffffffff9092168252519081900360200190f35b34801561031e57600080fd5b50610271610ba0565b34801561033357600080fd5b506101af6004803603602081101561034a57600080fd5b5035610baf565b34801561035d57600080fd5b506101af60048036036020811015
type ERC20TornadoConstructorParams =
| [linkLibraryAddresses: ERC20TornadoLibraryAddresses, signer?: Signer]
| ConstructorParameters<typeof ContractFactory>;
const isSuperArgs = (
xs: ERC20TornadoConstructorParams
): 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 ERC20Tornado__factory extends ContractFactory {
constructor(...args: ERC20TornadoConstructorParams) {
if (isSuperArgs(args)) {
super(...args);
} else {
const [linkLibraryAddresses, signer] = args;
super(
_abi,
ERC20Tornado__factory.linkBytecode(linkLibraryAddresses),
signer
);
}
this.contractName = "ERC20Tornado";
}
static linkBytecode(
linkLibraryAddresses: ERC20TornadoLibraryAddresses
): 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>,
_token: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ERC20Tornado> {
return super.deploy(
_verifier,
_denomination,
_merkleTreeHeight,
_operator,
_token,
overrides || {}
) as Promise<ERC20Tornado>;
}
override getDeployTransaction(
_verifier: PromiseOrValue<string>,
_denomination: PromiseOrValue<BigNumberish>,
_merkleTreeHeight: PromiseOrValue<BigNumberish>,
_operator: PromiseOrValue<string>,
_token: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): TransactionRequest {
return super.getDeployTransaction(
_verifier,
_denomination,
_merkleTreeHeight,
_operator,
_token,
overrides || {}
);
}
override attach(address: string): ERC20Tornado {
return super.attach(address) as ERC20Tornado;
}
override connect(signer: Signer): ERC20Tornado__factory {
return super.connect(signer) as ERC20Tornado__factory;
}
static readonly contractName: "ERC20Tornado";
public readonly contractName: "ERC20Tornado";
static readonly bytecode = _bytecode;
static readonly abi = _abi;
static createInterface(): ERC20TornadoInterface {
return new utils.Interface(_abi) as ERC20TornadoInterface;
}
static connect(
address: string,
signerOrProvider: Signer | Provider
): ERC20Tornado {
return new Contract(address, _abi, signerOrProvider) as ERC20Tornado;
}
}
export interface ERC20TornadoLibraryAddresses {
["__Hasher________________________________"]: string;
}