Monorepository has been setup

Signed-off-by: T-Hax <>
This commit is contained in:
T-Hax 2023-05-02 22:19:28 +00:00
parent f88fc5c812
commit 9419f0673c
345 changed files with 988845 additions and 537 deletions

View file

@ -0,0 +1,321 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
BaseContract,
BigNumber,
BigNumberish,
BytesLike,
CallOverrides,
ContractTransaction,
Overrides,
PopulatedTransaction,
Signer,
utils
} from 'ethers'
import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi'
import type { Listener, Provider } from '@ethersproject/providers'
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from './common'
export interface ERC20Interface extends utils.Interface {
functions: {
'totalSupply()': FunctionFragment
'_totalSupply()': FunctionFragment
'balanceOf(address)': FunctionFragment
'transfer(address,uint256)': FunctionFragment
'allowance(address,address)': FunctionFragment
'transferFrom(address,address,uint256)': FunctionFragment
'approve(address,uint256)': FunctionFragment
'nonces(address)': FunctionFragment
}
getFunction(
nameOrSignatureOrTopic:
| 'totalSupply'
| '_totalSupply'
| 'balanceOf'
| 'transfer'
| 'allowance'
| 'transferFrom'
| 'approve'
| 'nonces'
): FunctionFragment
encodeFunctionData(functionFragment: 'totalSupply', values?: undefined): string
encodeFunctionData(functionFragment: '_totalSupply', values?: undefined): string
encodeFunctionData(functionFragment: 'balanceOf', values: [PromiseOrValue<string>]): string
encodeFunctionData(
functionFragment: 'transfer',
values: [PromiseOrValue<string>, PromiseOrValue<BigNumberish>]
): string
encodeFunctionData(
functionFragment: 'allowance',
values: [PromiseOrValue<string>, PromiseOrValue<string>]
): string
encodeFunctionData(
functionFragment: 'transferFrom',
values: [PromiseOrValue<string>, PromiseOrValue<string>, PromiseOrValue<BigNumberish>]
): string
encodeFunctionData(
functionFragment: 'approve',
values: [PromiseOrValue<string>, PromiseOrValue<BigNumberish>]
): string
encodeFunctionData(functionFragment: 'nonces', values: [PromiseOrValue<string>]): string
decodeFunctionResult(functionFragment: 'totalSupply', data: BytesLike): Result
decodeFunctionResult(functionFragment: '_totalSupply', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'balanceOf', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'transfer', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'allowance', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'transferFrom', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'approve', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'nonces', data: BytesLike): Result
events: {
'Approval(address,address,uint256)': EventFragment
'Transfer(address,address,uint256)': EventFragment
}
getEvent(nameOrSignatureOrTopic: 'Approval'): EventFragment
getEvent(nameOrSignatureOrTopic: 'Transfer'): EventFragment
}
export interface ApprovalEventObject {
owner: string
spender: string
value: BigNumber
}
export type ApprovalEvent = TypedEvent<[string, string, BigNumber], ApprovalEventObject>
export type ApprovalEventFilter = TypedEventFilter<ApprovalEvent>
export interface TransferEventObject {
from: string
to: string
value: BigNumber
}
export type TransferEvent = TypedEvent<[string, string, BigNumber], TransferEventObject>
export type TransferEventFilter = TypedEventFilter<TransferEvent>
export interface ERC20 extends BaseContract {
contractName: 'ERC20'
connect(signerOrProvider: Signer | Provider | string): this
attach(addressOrName: string): this
deployed(): Promise<this>
interface: ERC20Interface
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TEvent>>
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>
listeners(eventName?: string): Array<Listener>
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this
removeAllListeners(eventName?: string): this
off: OnEvent<this>
on: OnEvent<this>
once: OnEvent<this>
removeListener: OnEvent<this>
functions: {
totalSupply(overrides?: CallOverrides): Promise<[BigNumber]>
_totalSupply(overrides?: CallOverrides): Promise<[BigNumber]>
balanceOf(who: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[BigNumber]>
transfer(
to: PromiseOrValue<string>,
value: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
allowance(
owner: PromiseOrValue<string>,
spender: PromiseOrValue<string>,
overrides?: CallOverrides
): Promise<[BigNumber]>
transferFrom(
from: PromiseOrValue<string>,
to: PromiseOrValue<string>,
value: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
approve(
spender: PromiseOrValue<string>,
value: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
nonces(owner: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[BigNumber]>
}
totalSupply(overrides?: CallOverrides): Promise<BigNumber>
_totalSupply(overrides?: CallOverrides): Promise<BigNumber>
balanceOf(who: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
transfer(
to: PromiseOrValue<string>,
value: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
allowance(
owner: PromiseOrValue<string>,
spender: PromiseOrValue<string>,
overrides?: CallOverrides
): Promise<BigNumber>
transferFrom(
from: PromiseOrValue<string>,
to: PromiseOrValue<string>,
value: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
approve(
spender: PromiseOrValue<string>,
value: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
nonces(owner: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
callStatic: {
totalSupply(overrides?: CallOverrides): Promise<BigNumber>
_totalSupply(overrides?: CallOverrides): Promise<BigNumber>
balanceOf(who: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
transfer(
to: PromiseOrValue<string>,
value: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<void>
allowance(
owner: PromiseOrValue<string>,
spender: PromiseOrValue<string>,
overrides?: CallOverrides
): Promise<BigNumber>
transferFrom(
from: PromiseOrValue<string>,
to: PromiseOrValue<string>,
value: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<void>
approve(
spender: PromiseOrValue<string>,
value: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<void>
nonces(owner: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
}
filters: {
'Approval(address,address,uint256)'(
owner?: PromiseOrValue<string> | null,
spender?: PromiseOrValue<string> | null,
value?: null
): ApprovalEventFilter
Approval(
owner?: PromiseOrValue<string> | null,
spender?: PromiseOrValue<string> | null,
value?: null
): ApprovalEventFilter
'Transfer(address,address,uint256)'(
from?: PromiseOrValue<string> | null,
to?: PromiseOrValue<string> | null,
value?: null
): TransferEventFilter
Transfer(
from?: PromiseOrValue<string> | null,
to?: PromiseOrValue<string> | null,
value?: null
): TransferEventFilter
}
estimateGas: {
totalSupply(overrides?: CallOverrides): Promise<BigNumber>
_totalSupply(overrides?: CallOverrides): Promise<BigNumber>
balanceOf(who: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
transfer(
to: PromiseOrValue<string>,
value: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
allowance(
owner: PromiseOrValue<string>,
spender: PromiseOrValue<string>,
overrides?: CallOverrides
): Promise<BigNumber>
transferFrom(
from: PromiseOrValue<string>,
to: PromiseOrValue<string>,
value: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
approve(
spender: PromiseOrValue<string>,
value: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
nonces(owner: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
}
populateTransaction: {
totalSupply(overrides?: CallOverrides): Promise<PopulatedTransaction>
_totalSupply(overrides?: CallOverrides): Promise<PopulatedTransaction>
balanceOf(who: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>
transfer(
to: PromiseOrValue<string>,
value: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
allowance(
owner: PromiseOrValue<string>,
spender: PromiseOrValue<string>,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
transferFrom(
from: PromiseOrValue<string>,
to: PromiseOrValue<string>,
value: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
approve(
spender: PromiseOrValue<string>,
value: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
nonces(owner: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>
}
}

View file

@ -0,0 +1,704 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
BaseContract,
BigNumber,
BigNumberish,
BytesLike,
CallOverrides,
ContractTransaction,
Overrides,
PopulatedTransaction,
Signer,
utils
} from 'ethers'
import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi'
import type { Listener, Provider } from '@ethersproject/providers'
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from './common'
export interface ERC20MockInterface extends utils.Interface {
functions: {
'addMinter(address)': FunctionFragment
'allowance(address,address)': FunctionFragment
'approve(address,uint256)': FunctionFragment
'balanceOf(address)': FunctionFragment
'decimals()': FunctionFragment
'decreaseAllowance(address,uint256)': FunctionFragment
'increaseAllowance(address,uint256)': FunctionFragment
'isMinter(address)': FunctionFragment
'mint(address,uint256)': FunctionFragment
'name()': FunctionFragment
'renounceMinter()': FunctionFragment
'symbol()': FunctionFragment
'totalSupply()': FunctionFragment
'transfer(address,uint256)': FunctionFragment
'transferFrom(address,address,uint256)': FunctionFragment
}
getFunction(
nameOrSignatureOrTopic:
| 'addMinter'
| 'allowance'
| 'approve'
| 'balanceOf'
| 'decimals'
| 'decreaseAllowance'
| 'increaseAllowance'
| 'isMinter'
| 'mint'
| 'name'
| 'renounceMinter'
| 'symbol'
| 'totalSupply'
| 'transfer'
| 'transferFrom'
): FunctionFragment
encodeFunctionData(functionFragment: 'addMinter', values: [PromiseOrValue<string>]): string
encodeFunctionData(
functionFragment: 'allowance',
values: [PromiseOrValue<string>, PromiseOrValue<string>]
): string
encodeFunctionData(
functionFragment: 'approve',
values: [PromiseOrValue<string>, PromiseOrValue<BigNumberish>]
): string
encodeFunctionData(functionFragment: 'balanceOf', values: [PromiseOrValue<string>]): string
encodeFunctionData(functionFragment: 'decimals', values?: undefined): string
encodeFunctionData(
functionFragment: 'decreaseAllowance',
values: [PromiseOrValue<string>, PromiseOrValue<BigNumberish>]
): string
encodeFunctionData(
functionFragment: 'increaseAllowance',
values: [PromiseOrValue<string>, PromiseOrValue<BigNumberish>]
): string
encodeFunctionData(functionFragment: 'isMinter', values: [PromiseOrValue<string>]): string
encodeFunctionData(
functionFragment: 'mint',
values: [PromiseOrValue<string>, PromiseOrValue<BigNumberish>]
): string
encodeFunctionData(functionFragment: 'name', values?: undefined): string
encodeFunctionData(functionFragment: 'renounceMinter', values?: undefined): string
encodeFunctionData(functionFragment: 'symbol', values?: undefined): string
encodeFunctionData(functionFragment: 'totalSupply', values?: undefined): string
encodeFunctionData(
functionFragment: 'transfer',
values: [PromiseOrValue<string>, PromiseOrValue<BigNumberish>]
): string
encodeFunctionData(
functionFragment: 'transferFrom',
values: [PromiseOrValue<string>, PromiseOrValue<string>, PromiseOrValue<BigNumberish>]
): string
decodeFunctionResult(functionFragment: 'addMinter', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'allowance', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'approve', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'balanceOf', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'decimals', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'decreaseAllowance', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'increaseAllowance', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'isMinter', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'mint', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'name', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'renounceMinter', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'symbol', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'totalSupply', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'transfer', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'transferFrom', data: BytesLike): Result
events: {
'Approval(address,address,uint256)': EventFragment
'MinterAdded(address)': EventFragment
'MinterRemoved(address)': EventFragment
'Transfer(address,address,uint256)': EventFragment
}
getEvent(nameOrSignatureOrTopic: 'Approval'): EventFragment
getEvent(nameOrSignatureOrTopic: 'MinterAdded'): EventFragment
getEvent(nameOrSignatureOrTopic: 'MinterRemoved'): EventFragment
getEvent(nameOrSignatureOrTopic: 'Transfer'): EventFragment
}
export interface ApprovalEventObject {
owner: string
spender: string
value: BigNumber
}
export type ApprovalEvent = TypedEvent<[string, string, BigNumber], ApprovalEventObject>
export type ApprovalEventFilter = TypedEventFilter<ApprovalEvent>
export interface MinterAddedEventObject {
account: string
}
export type MinterAddedEvent = TypedEvent<[string], MinterAddedEventObject>
export type MinterAddedEventFilter = TypedEventFilter<MinterAddedEvent>
export interface MinterRemovedEventObject {
account: string
}
export type MinterRemovedEvent = TypedEvent<[string], MinterRemovedEventObject>
export type MinterRemovedEventFilter = TypedEventFilter<MinterRemovedEvent>
export interface TransferEventObject {
from: string
to: string
value: BigNumber
}
export type TransferEvent = TypedEvent<[string, string, BigNumber], TransferEventObject>
export type TransferEventFilter = TypedEventFilter<TransferEvent>
export interface ERC20Mock extends BaseContract {
contractName: 'ERC20Mock'
connect(signerOrProvider: Signer | Provider | string): this
attach(addressOrName: string): this
deployed(): Promise<this>
interface: ERC20MockInterface
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TEvent>>
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>
listeners(eventName?: string): Array<Listener>
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this
removeAllListeners(eventName?: string): this
off: OnEvent<this>
on: OnEvent<this>
once: OnEvent<this>
removeListener: OnEvent<this>
functions: {
addMinter(
account: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
/**
* See {IERC20-allowance}.
*/
allowance(
owner: PromiseOrValue<string>,
spender: PromiseOrValue<string>,
overrides?: CallOverrides
): Promise<[BigNumber]>
/**
* See {IERC20-approve}. * Requirements: * - `spender` cannot be the zero address.
*/
approve(
spender: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
/**
* See {IERC20-balanceOf}.
*/
balanceOf(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[BigNumber]>
/**
* Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). * Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. * NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
*/
decimals(overrides?: CallOverrides): Promise<[number]>
/**
* Atomically decreases the allowance granted to `spender` by the caller. * This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. * Emits an {Approval} event indicating the updated allowance. * Requirements: * - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.
*/
decreaseAllowance(
spender: PromiseOrValue<string>,
subtractedValue: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
/**
* Atomically increases the allowance granted to `spender` by the caller. * This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. * Emits an {Approval} event indicating the updated allowance. * Requirements: * - `spender` cannot be the zero address.
*/
increaseAllowance(
spender: PromiseOrValue<string>,
addedValue: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
isMinter(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[boolean]>
/**
* See {ERC20-_mint}. * Requirements: * - the caller must have the {MinterRole}.
*/
mint(
account: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
/**
* Returns the name of the token.
*/
name(overrides?: CallOverrides): Promise<[string]>
renounceMinter(overrides?: Overrides & { from?: PromiseOrValue<string> }): Promise<ContractTransaction>
/**
* Returns the symbol of the token, usually a shorter version of the name.
*/
symbol(overrides?: CallOverrides): Promise<[string]>
/**
* See {IERC20-totalSupply}.
*/
totalSupply(overrides?: CallOverrides): Promise<[BigNumber]>
/**
* See {IERC20-transfer}. * Requirements: * - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`.
*/
transfer(
recipient: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
/**
* See {IERC20-transferFrom}. * Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; * Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for `sender`'s tokens of at least `amount`.
*/
transferFrom(
sender: PromiseOrValue<string>,
recipient: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
}
addMinter(
account: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
/**
* See {IERC20-allowance}.
*/
allowance(
owner: PromiseOrValue<string>,
spender: PromiseOrValue<string>,
overrides?: CallOverrides
): Promise<BigNumber>
/**
* See {IERC20-approve}. * Requirements: * - `spender` cannot be the zero address.
*/
approve(
spender: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
/**
* See {IERC20-balanceOf}.
*/
balanceOf(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
/**
* Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). * Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. * NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
*/
decimals(overrides?: CallOverrides): Promise<number>
/**
* Atomically decreases the allowance granted to `spender` by the caller. * This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. * Emits an {Approval} event indicating the updated allowance. * Requirements: * - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.
*/
decreaseAllowance(
spender: PromiseOrValue<string>,
subtractedValue: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
/**
* Atomically increases the allowance granted to `spender` by the caller. * This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. * Emits an {Approval} event indicating the updated allowance. * Requirements: * - `spender` cannot be the zero address.
*/
increaseAllowance(
spender: PromiseOrValue<string>,
addedValue: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
isMinter(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<boolean>
/**
* See {ERC20-_mint}. * Requirements: * - the caller must have the {MinterRole}.
*/
mint(
account: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
/**
* Returns the name of the token.
*/
name(overrides?: CallOverrides): Promise<string>
renounceMinter(overrides?: Overrides & { from?: PromiseOrValue<string> }): Promise<ContractTransaction>
/**
* Returns the symbol of the token, usually a shorter version of the name.
*/
symbol(overrides?: CallOverrides): Promise<string>
/**
* See {IERC20-totalSupply}.
*/
totalSupply(overrides?: CallOverrides): Promise<BigNumber>
/**
* See {IERC20-transfer}. * Requirements: * - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`.
*/
transfer(
recipient: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
/**
* See {IERC20-transferFrom}. * Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; * Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for `sender`'s tokens of at least `amount`.
*/
transferFrom(
sender: PromiseOrValue<string>,
recipient: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
callStatic: {
addMinter(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>
/**
* See {IERC20-allowance}.
*/
allowance(
owner: PromiseOrValue<string>,
spender: PromiseOrValue<string>,
overrides?: CallOverrides
): Promise<BigNumber>
/**
* See {IERC20-approve}. * Requirements: * - `spender` cannot be the zero address.
*/
approve(
spender: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<boolean>
/**
* See {IERC20-balanceOf}.
*/
balanceOf(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
/**
* Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). * Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. * NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
*/
decimals(overrides?: CallOverrides): Promise<number>
/**
* Atomically decreases the allowance granted to `spender` by the caller. * This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. * Emits an {Approval} event indicating the updated allowance. * Requirements: * - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.
*/
decreaseAllowance(
spender: PromiseOrValue<string>,
subtractedValue: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<boolean>
/**
* Atomically increases the allowance granted to `spender` by the caller. * This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. * Emits an {Approval} event indicating the updated allowance. * Requirements: * - `spender` cannot be the zero address.
*/
increaseAllowance(
spender: PromiseOrValue<string>,
addedValue: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<boolean>
isMinter(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<boolean>
/**
* See {ERC20-_mint}. * Requirements: * - the caller must have the {MinterRole}.
*/
mint(
account: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<boolean>
/**
* Returns the name of the token.
*/
name(overrides?: CallOverrides): Promise<string>
renounceMinter(overrides?: CallOverrides): Promise<void>
/**
* Returns the symbol of the token, usually a shorter version of the name.
*/
symbol(overrides?: CallOverrides): Promise<string>
/**
* See {IERC20-totalSupply}.
*/
totalSupply(overrides?: CallOverrides): Promise<BigNumber>
/**
* See {IERC20-transfer}. * Requirements: * - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`.
*/
transfer(
recipient: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<boolean>
/**
* See {IERC20-transferFrom}. * Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; * Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for `sender`'s tokens of at least `amount`.
*/
transferFrom(
sender: PromiseOrValue<string>,
recipient: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<boolean>
}
filters: {
'Approval(address,address,uint256)'(
owner?: PromiseOrValue<string> | null,
spender?: PromiseOrValue<string> | null,
value?: null
): ApprovalEventFilter
Approval(
owner?: PromiseOrValue<string> | null,
spender?: PromiseOrValue<string> | null,
value?: null
): ApprovalEventFilter
'MinterAdded(address)'(account?: PromiseOrValue<string> | null): MinterAddedEventFilter
MinterAdded(account?: PromiseOrValue<string> | null): MinterAddedEventFilter
'MinterRemoved(address)'(account?: PromiseOrValue<string> | null): MinterRemovedEventFilter
MinterRemoved(account?: PromiseOrValue<string> | null): MinterRemovedEventFilter
'Transfer(address,address,uint256)'(
from?: PromiseOrValue<string> | null,
to?: PromiseOrValue<string> | null,
value?: null
): TransferEventFilter
Transfer(
from?: PromiseOrValue<string> | null,
to?: PromiseOrValue<string> | null,
value?: null
): TransferEventFilter
}
estimateGas: {
addMinter(
account: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
/**
* See {IERC20-allowance}.
*/
allowance(
owner: PromiseOrValue<string>,
spender: PromiseOrValue<string>,
overrides?: CallOverrides
): Promise<BigNumber>
/**
* See {IERC20-approve}. * Requirements: * - `spender` cannot be the zero address.
*/
approve(
spender: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
/**
* See {IERC20-balanceOf}.
*/
balanceOf(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
/**
* Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). * Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. * NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
*/
decimals(overrides?: CallOverrides): Promise<BigNumber>
/**
* Atomically decreases the allowance granted to `spender` by the caller. * This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. * Emits an {Approval} event indicating the updated allowance. * Requirements: * - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.
*/
decreaseAllowance(
spender: PromiseOrValue<string>,
subtractedValue: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
/**
* Atomically increases the allowance granted to `spender` by the caller. * This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. * Emits an {Approval} event indicating the updated allowance. * Requirements: * - `spender` cannot be the zero address.
*/
increaseAllowance(
spender: PromiseOrValue<string>,
addedValue: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
isMinter(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
/**
* See {ERC20-_mint}. * Requirements: * - the caller must have the {MinterRole}.
*/
mint(
account: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
/**
* Returns the name of the token.
*/
name(overrides?: CallOverrides): Promise<BigNumber>
renounceMinter(overrides?: Overrides & { from?: PromiseOrValue<string> }): Promise<BigNumber>
/**
* Returns the symbol of the token, usually a shorter version of the name.
*/
symbol(overrides?: CallOverrides): Promise<BigNumber>
/**
* See {IERC20-totalSupply}.
*/
totalSupply(overrides?: CallOverrides): Promise<BigNumber>
/**
* See {IERC20-transfer}. * Requirements: * - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`.
*/
transfer(
recipient: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
/**
* See {IERC20-transferFrom}. * Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; * Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for `sender`'s tokens of at least `amount`.
*/
transferFrom(
sender: PromiseOrValue<string>,
recipient: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
}
populateTransaction: {
addMinter(
account: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
/**
* See {IERC20-allowance}.
*/
allowance(
owner: PromiseOrValue<string>,
spender: PromiseOrValue<string>,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
/**
* See {IERC20-approve}. * Requirements: * - `spender` cannot be the zero address.
*/
approve(
spender: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
/**
* See {IERC20-balanceOf}.
*/
balanceOf(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). * Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. * NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
*/
decimals(overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* Atomically decreases the allowance granted to `spender` by the caller. * This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. * Emits an {Approval} event indicating the updated allowance. * Requirements: * - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.
*/
decreaseAllowance(
spender: PromiseOrValue<string>,
subtractedValue: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
/**
* Atomically increases the allowance granted to `spender` by the caller. * This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. * Emits an {Approval} event indicating the updated allowance. * Requirements: * - `spender` cannot be the zero address.
*/
increaseAllowance(
spender: PromiseOrValue<string>,
addedValue: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
isMinter(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* See {ERC20-_mint}. * Requirements: * - the caller must have the {MinterRole}.
*/
mint(
account: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
/**
* Returns the name of the token.
*/
name(overrides?: CallOverrides): Promise<PopulatedTransaction>
renounceMinter(overrides?: Overrides & { from?: PromiseOrValue<string> }): Promise<PopulatedTransaction>
/**
* Returns the symbol of the token, usually a shorter version of the name.
*/
symbol(overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* See {IERC20-totalSupply}.
*/
totalSupply(overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* See {IERC20-transfer}. * Requirements: * - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`.
*/
transfer(
recipient: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
/**
* See {IERC20-transferFrom}. * Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; * Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for `sender`'s tokens of at least `amount`.
*/
transferFrom(
sender: PromiseOrValue<string>,
recipient: PromiseOrValue<string>,
amount: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
}
}

View file

@ -0,0 +1,719 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
BaseContract,
BigNumber,
BigNumberish,
BytesLike,
CallOverrides,
ContractTransaction,
Overrides,
PayableOverrides,
PopulatedTransaction,
Signer,
utils
} from 'ethers'
import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi'
import type { Listener, Provider } from '@ethersproject/providers'
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from './common'
export interface ERC20TornadoInterface extends utils.Interface {
functions: {
'FIELD_SIZE()': FunctionFragment
'ROOT_HISTORY_SIZE()': FunctionFragment
'ZERO_VALUE()': FunctionFragment
'changeOperator(address)': FunctionFragment
'commitments(bytes32)': FunctionFragment
'currentRootIndex()': FunctionFragment
'denomination()': FunctionFragment
'deposit(bytes32)': FunctionFragment
'filledSubtrees(uint256)': FunctionFragment
'getLastRoot()': FunctionFragment
'hashLeftRight(bytes32,bytes32)': FunctionFragment
'isKnownRoot(bytes32)': FunctionFragment
'isSpent(bytes32)': FunctionFragment
'isSpentArray(bytes32[])': FunctionFragment
'levels()': FunctionFragment
'nextIndex()': FunctionFragment
'nullifierHashes(bytes32)': FunctionFragment
'operator()': FunctionFragment
'roots(uint256)': FunctionFragment
'token()': FunctionFragment
'updateVerifier(address)': FunctionFragment
'verifier()': FunctionFragment
'withdraw(bytes,bytes32,bytes32,address,address,uint256,uint256)': FunctionFragment
'zeros(uint256)': FunctionFragment
}
getFunction(
nameOrSignatureOrTopic:
| 'FIELD_SIZE'
| 'ROOT_HISTORY_SIZE'
| 'ZERO_VALUE'
| 'changeOperator'
| 'commitments'
| 'currentRootIndex'
| 'denomination'
| 'deposit'
| 'filledSubtrees'
| 'getLastRoot'
| 'hashLeftRight'
| 'isKnownRoot'
| 'isSpent'
| 'isSpentArray'
| 'levels'
| 'nextIndex'
| 'nullifierHashes'
| 'operator'
| 'roots'
| 'token'
| 'updateVerifier'
| 'verifier'
| 'withdraw'
| 'zeros'
): FunctionFragment
encodeFunctionData(functionFragment: 'FIELD_SIZE', values?: undefined): string
encodeFunctionData(functionFragment: 'ROOT_HISTORY_SIZE', values?: undefined): string
encodeFunctionData(functionFragment: 'ZERO_VALUE', values?: undefined): string
encodeFunctionData(functionFragment: 'changeOperator', values: [PromiseOrValue<string>]): string
encodeFunctionData(functionFragment: 'commitments', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(functionFragment: 'currentRootIndex', values?: undefined): string
encodeFunctionData(functionFragment: 'denomination', values?: undefined): string
encodeFunctionData(functionFragment: 'deposit', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(functionFragment: 'filledSubtrees', values: [PromiseOrValue<BigNumberish>]): string
encodeFunctionData(functionFragment: 'getLastRoot', values?: undefined): string
encodeFunctionData(
functionFragment: 'hashLeftRight',
values: [PromiseOrValue<BytesLike>, PromiseOrValue<BytesLike>]
): string
encodeFunctionData(functionFragment: 'isKnownRoot', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(functionFragment: 'isSpent', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(functionFragment: 'isSpentArray', values: [PromiseOrValue<BytesLike>[]]): string
encodeFunctionData(functionFragment: 'levels', values?: undefined): string
encodeFunctionData(functionFragment: 'nextIndex', values?: undefined): string
encodeFunctionData(functionFragment: 'nullifierHashes', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(functionFragment: 'operator', values?: undefined): string
encodeFunctionData(functionFragment: 'roots', values: [PromiseOrValue<BigNumberish>]): string
encodeFunctionData(functionFragment: 'token', values?: undefined): string
encodeFunctionData(functionFragment: 'updateVerifier', values: [PromiseOrValue<string>]): string
encodeFunctionData(functionFragment: 'verifier', values?: undefined): string
encodeFunctionData(
functionFragment: 'withdraw',
values: [
PromiseOrValue<BytesLike>,
PromiseOrValue<BytesLike>,
PromiseOrValue<BytesLike>,
PromiseOrValue<string>,
PromiseOrValue<string>,
PromiseOrValue<BigNumberish>,
PromiseOrValue<BigNumberish>
]
): string
encodeFunctionData(functionFragment: 'zeros', values: [PromiseOrValue<BigNumberish>]): string
decodeFunctionResult(functionFragment: 'FIELD_SIZE', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'ROOT_HISTORY_SIZE', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'ZERO_VALUE', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'changeOperator', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'commitments', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'currentRootIndex', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'denomination', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'deposit', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'filledSubtrees', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getLastRoot', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'hashLeftRight', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'isKnownRoot', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'isSpent', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'isSpentArray', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'levels', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'nextIndex', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'nullifierHashes', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'operator', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'roots', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'token', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'updateVerifier', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'verifier', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'withdraw', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'zeros', data: BytesLike): Result
events: {
'Deposit(bytes32,uint32,uint256)': EventFragment
'Withdrawal(address,bytes32,address,uint256)': EventFragment
}
getEvent(nameOrSignatureOrTopic: 'Deposit'): EventFragment
getEvent(nameOrSignatureOrTopic: 'Withdrawal'): EventFragment
}
export interface DepositEventObject {
commitment: string
leafIndex: number
timestamp: BigNumber
}
export type DepositEvent = TypedEvent<[string, number, BigNumber], DepositEventObject>
export type DepositEventFilter = TypedEventFilter<DepositEvent>
export interface WithdrawalEventObject {
to: string
nullifierHash: string
relayer: string
fee: BigNumber
}
export type WithdrawalEvent = TypedEvent<[string, string, string, BigNumber], WithdrawalEventObject>
export type WithdrawalEventFilter = TypedEventFilter<WithdrawalEvent>
export interface ERC20Tornado extends BaseContract {
contractName: 'ERC20Tornado'
connect(signerOrProvider: Signer | Provider | string): this
attach(addressOrName: string): this
deployed(): Promise<this>
interface: ERC20TornadoInterface
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TEvent>>
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>
listeners(eventName?: string): Array<Listener>
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this
removeAllListeners(eventName?: string): this
off: OnEvent<this>
on: OnEvent<this>
once: OnEvent<this>
removeListener: OnEvent<this>
functions: {
FIELD_SIZE(overrides?: CallOverrides): Promise<[BigNumber]>
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<[number]>
ZERO_VALUE(overrides?: CallOverrides): Promise<[BigNumber]>
/**
* operator can change his address
*/
changeOperator(
_newOperator: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
commitments(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<[boolean]>
currentRootIndex(overrides?: CallOverrides): Promise<[number]>
denomination(overrides?: CallOverrides): Promise<[BigNumber]>
/**
* Deposit funds into the contract. The caller must send (for ETH) or approve (for ERC20) value equal to or `denomination` of this instance.
* @param _commitment the note commitment, which is PedersenHash(nullifier + secret)
*/
deposit(
_commitment: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
filledSubtrees(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[string]>
/**
* Returns the last root
*/
getLastRoot(overrides?: CallOverrides): Promise<[string]>
/**
* Hash 2 tree leaves, returns MiMC(_left, _right)
*/
hashLeftRight(
_left: PromiseOrValue<BytesLike>,
_right: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<[string]>
/**
* Whether the root is present in the root history
*/
isKnownRoot(_root: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<[boolean]>
/**
* whether a note is already spent
*/
isSpent(_nullifierHash: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<[boolean]>
/**
* whether an array of notes is already spent
*/
isSpentArray(
_nullifierHashes: PromiseOrValue<BytesLike>[],
overrides?: CallOverrides
): Promise<[boolean[]] & { spent: boolean[] }>
levels(overrides?: CallOverrides): Promise<[number]>
nextIndex(overrides?: CallOverrides): Promise<[number]>
nullifierHashes(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<[boolean]>
operator(overrides?: CallOverrides): Promise<[string]>
roots(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[string]>
token(overrides?: CallOverrides): Promise<[string]>
/**
* allow operator to update SNARK verification keys. This is needed to update keys after the final trusted setup ceremony is held. After that operator rights are supposed to be transferred to zero address
*/
updateVerifier(
_newVerifier: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
verifier(overrides?: CallOverrides): Promise<[string]>
/**
* Withdraw a deposit from the contract. `proof` is a zkSNARK proof data, and input is an array of circuit public inputs `input` array consists of: - merkle root of all deposits in the contract - hash of unique deposit nullifier to prevent double spends - the recipient of funds - optional fee that goes to the transaction sender (usually a relay)
*/
withdraw(
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
zeros(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[string]>
}
FIELD_SIZE(overrides?: CallOverrides): Promise<BigNumber>
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<number>
ZERO_VALUE(overrides?: CallOverrides): Promise<BigNumber>
/**
* operator can change his address
*/
changeOperator(
_newOperator: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
commitments(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
currentRootIndex(overrides?: CallOverrides): Promise<number>
denomination(overrides?: CallOverrides): Promise<BigNumber>
/**
* Deposit funds into the contract. The caller must send (for ETH) or approve (for ERC20) value equal to or `denomination` of this instance.
* @param _commitment the note commitment, which is PedersenHash(nullifier + secret)
*/
deposit(
_commitment: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
filledSubtrees(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
/**
* Returns the last root
*/
getLastRoot(overrides?: CallOverrides): Promise<string>
/**
* Hash 2 tree leaves, returns MiMC(_left, _right)
*/
hashLeftRight(
_left: PromiseOrValue<BytesLike>,
_right: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<string>
/**
* Whether the root is present in the root history
*/
isKnownRoot(_root: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
/**
* whether a note is already spent
*/
isSpent(_nullifierHash: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
/**
* whether an array of notes is already spent
*/
isSpentArray(_nullifierHashes: PromiseOrValue<BytesLike>[], overrides?: CallOverrides): Promise<boolean[]>
levels(overrides?: CallOverrides): Promise<number>
nextIndex(overrides?: CallOverrides): Promise<number>
nullifierHashes(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
operator(overrides?: CallOverrides): Promise<string>
roots(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
token(overrides?: CallOverrides): Promise<string>
/**
* allow operator to update SNARK verification keys. This is needed to update keys after the final trusted setup ceremony is held. After that operator rights are supposed to be transferred to zero address
*/
updateVerifier(
_newVerifier: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
verifier(overrides?: CallOverrides): Promise<string>
/**
* Withdraw a deposit from the contract. `proof` is a zkSNARK proof data, and input is an array of circuit public inputs `input` array consists of: - merkle root of all deposits in the contract - hash of unique deposit nullifier to prevent double spends - the recipient of funds - optional fee that goes to the transaction sender (usually a relay)
*/
withdraw(
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
zeros(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
callStatic: {
FIELD_SIZE(overrides?: CallOverrides): Promise<BigNumber>
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<number>
ZERO_VALUE(overrides?: CallOverrides): Promise<BigNumber>
/**
* operator can change his address
*/
changeOperator(_newOperator: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>
commitments(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
currentRootIndex(overrides?: CallOverrides): Promise<number>
denomination(overrides?: CallOverrides): Promise<BigNumber>
/**
* Deposit funds into the contract. The caller must send (for ETH) or approve (for ERC20) value equal to or `denomination` of this instance.
* @param _commitment the note commitment, which is PedersenHash(nullifier + secret)
*/
deposit(_commitment: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<void>
filledSubtrees(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
/**
* Returns the last root
*/
getLastRoot(overrides?: CallOverrides): Promise<string>
/**
* Hash 2 tree leaves, returns MiMC(_left, _right)
*/
hashLeftRight(
_left: PromiseOrValue<BytesLike>,
_right: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<string>
/**
* Whether the root is present in the root history
*/
isKnownRoot(_root: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
/**
* whether a note is already spent
*/
isSpent(_nullifierHash: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
/**
* whether an array of notes is already spent
*/
isSpentArray(_nullifierHashes: PromiseOrValue<BytesLike>[], overrides?: CallOverrides): Promise<boolean[]>
levels(overrides?: CallOverrides): Promise<number>
nextIndex(overrides?: CallOverrides): Promise<number>
nullifierHashes(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
operator(overrides?: CallOverrides): Promise<string>
roots(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
token(overrides?: CallOverrides): Promise<string>
/**
* allow operator to update SNARK verification keys. This is needed to update keys after the final trusted setup ceremony is held. After that operator rights are supposed to be transferred to zero address
*/
updateVerifier(_newVerifier: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>
verifier(overrides?: CallOverrides): Promise<string>
/**
* Withdraw a deposit from the contract. `proof` is a zkSNARK proof data, and input is an array of circuit public inputs `input` array consists of: - merkle root of all deposits in the contract - hash of unique deposit nullifier to prevent double spends - the recipient of funds - optional fee that goes to the transaction sender (usually a relay)
*/
withdraw(
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<void>
zeros(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
}
filters: {
'Deposit(bytes32,uint32,uint256)'(
commitment?: PromiseOrValue<BytesLike> | null,
leafIndex?: null,
timestamp?: null
): DepositEventFilter
Deposit(
commitment?: PromiseOrValue<BytesLike> | null,
leafIndex?: null,
timestamp?: null
): DepositEventFilter
'Withdrawal(address,bytes32,address,uint256)'(
to?: null,
nullifierHash?: null,
relayer?: PromiseOrValue<string> | null,
fee?: null
): WithdrawalEventFilter
Withdrawal(
to?: null,
nullifierHash?: null,
relayer?: PromiseOrValue<string> | null,
fee?: null
): WithdrawalEventFilter
}
estimateGas: {
FIELD_SIZE(overrides?: CallOverrides): Promise<BigNumber>
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<BigNumber>
ZERO_VALUE(overrides?: CallOverrides): Promise<BigNumber>
/**
* operator can change his address
*/
changeOperator(
_newOperator: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
commitments(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<BigNumber>
currentRootIndex(overrides?: CallOverrides): Promise<BigNumber>
denomination(overrides?: CallOverrides): Promise<BigNumber>
/**
* Deposit funds into the contract. The caller must send (for ETH) or approve (for ERC20) value equal to or `denomination` of this instance.
* @param _commitment the note commitment, which is PedersenHash(nullifier + secret)
*/
deposit(
_commitment: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
filledSubtrees(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>
/**
* Returns the last root
*/
getLastRoot(overrides?: CallOverrides): Promise<BigNumber>
/**
* Hash 2 tree leaves, returns MiMC(_left, _right)
*/
hashLeftRight(
_left: PromiseOrValue<BytesLike>,
_right: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<BigNumber>
/**
* Whether the root is present in the root history
*/
isKnownRoot(_root: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<BigNumber>
/**
* whether a note is already spent
*/
isSpent(_nullifierHash: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<BigNumber>
/**
* whether an array of notes is already spent
*/
isSpentArray(_nullifierHashes: PromiseOrValue<BytesLike>[], overrides?: CallOverrides): Promise<BigNumber>
levels(overrides?: CallOverrides): Promise<BigNumber>
nextIndex(overrides?: CallOverrides): Promise<BigNumber>
nullifierHashes(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<BigNumber>
operator(overrides?: CallOverrides): Promise<BigNumber>
roots(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>
token(overrides?: CallOverrides): Promise<BigNumber>
/**
* allow operator to update SNARK verification keys. This is needed to update keys after the final trusted setup ceremony is held. After that operator rights are supposed to be transferred to zero address
*/
updateVerifier(
_newVerifier: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
verifier(overrides?: CallOverrides): Promise<BigNumber>
/**
* Withdraw a deposit from the contract. `proof` is a zkSNARK proof data, and input is an array of circuit public inputs `input` array consists of: - merkle root of all deposits in the contract - hash of unique deposit nullifier to prevent double spends - the recipient of funds - optional fee that goes to the transaction sender (usually a relay)
*/
withdraw(
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
zeros(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>
}
populateTransaction: {
FIELD_SIZE(overrides?: CallOverrides): Promise<PopulatedTransaction>
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<PopulatedTransaction>
ZERO_VALUE(overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* operator can change his address
*/
changeOperator(
_newOperator: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
commitments(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<PopulatedTransaction>
currentRootIndex(overrides?: CallOverrides): Promise<PopulatedTransaction>
denomination(overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* Deposit funds into the contract. The caller must send (for ETH) or approve (for ERC20) value equal to or `denomination` of this instance.
* @param _commitment the note commitment, which is PedersenHash(nullifier + secret)
*/
deposit(
_commitment: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
filledSubtrees(
arg0: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
/**
* Returns the last root
*/
getLastRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* Hash 2 tree leaves, returns MiMC(_left, _right)
*/
hashLeftRight(
_left: PromiseOrValue<BytesLike>,
_right: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
/**
* Whether the root is present in the root history
*/
isKnownRoot(_root: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* whether a note is already spent
*/
isSpent(
_nullifierHash: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
/**
* whether an array of notes is already spent
*/
isSpentArray(
_nullifierHashes: PromiseOrValue<BytesLike>[],
overrides?: CallOverrides
): Promise<PopulatedTransaction>
levels(overrides?: CallOverrides): Promise<PopulatedTransaction>
nextIndex(overrides?: CallOverrides): Promise<PopulatedTransaction>
nullifierHashes(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<PopulatedTransaction>
operator(overrides?: CallOverrides): Promise<PopulatedTransaction>
roots(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<PopulatedTransaction>
token(overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* allow operator to update SNARK verification keys. This is needed to update keys after the final trusted setup ceremony is held. After that operator rights are supposed to be transferred to zero address
*/
updateVerifier(
_newVerifier: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
verifier(overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* Withdraw a deposit from the contract. `proof` is a zkSNARK proof data, and input is an array of circuit public inputs `input` array consists of: - merkle root of all deposits in the contract - hash of unique deposit nullifier to prevent double spends - the recipient of funds - optional fee that goes to the transaction sender (usually a relay)
*/
withdraw(
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
zeros(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<PopulatedTransaction>
}
}

View file

@ -0,0 +1,705 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
BaseContract,
BigNumber,
BigNumberish,
BytesLike,
CallOverrides,
ContractTransaction,
Overrides,
PayableOverrides,
PopulatedTransaction,
Signer,
utils
} from 'ethers'
import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi'
import type { Listener, Provider } from '@ethersproject/providers'
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from './common'
export interface ETHTornadoInterface extends utils.Interface {
functions: {
'FIELD_SIZE()': FunctionFragment
'ROOT_HISTORY_SIZE()': FunctionFragment
'ZERO_VALUE()': FunctionFragment
'changeOperator(address)': FunctionFragment
'commitments(bytes32)': FunctionFragment
'currentRootIndex()': FunctionFragment
'denomination()': FunctionFragment
'deposit(bytes32)': FunctionFragment
'filledSubtrees(uint256)': FunctionFragment
'getLastRoot()': FunctionFragment
'hashLeftRight(bytes32,bytes32)': FunctionFragment
'isKnownRoot(bytes32)': FunctionFragment
'isSpent(bytes32)': FunctionFragment
'isSpentArray(bytes32[])': FunctionFragment
'levels()': FunctionFragment
'nextIndex()': FunctionFragment
'nullifierHashes(bytes32)': FunctionFragment
'operator()': FunctionFragment
'roots(uint256)': FunctionFragment
'updateVerifier(address)': FunctionFragment
'verifier()': FunctionFragment
'withdraw(bytes,bytes32,bytes32,address,address,uint256,uint256)': FunctionFragment
'zeros(uint256)': FunctionFragment
}
getFunction(
nameOrSignatureOrTopic:
| 'FIELD_SIZE'
| 'ROOT_HISTORY_SIZE'
| 'ZERO_VALUE'
| 'changeOperator'
| 'commitments'
| 'currentRootIndex'
| 'denomination'
| 'deposit'
| 'filledSubtrees'
| 'getLastRoot'
| 'hashLeftRight'
| 'isKnownRoot'
| 'isSpent'
| 'isSpentArray'
| 'levels'
| 'nextIndex'
| 'nullifierHashes'
| 'operator'
| 'roots'
| 'updateVerifier'
| 'verifier'
| 'withdraw'
| 'zeros'
): FunctionFragment
encodeFunctionData(functionFragment: 'FIELD_SIZE', values?: undefined): string
encodeFunctionData(functionFragment: 'ROOT_HISTORY_SIZE', values?: undefined): string
encodeFunctionData(functionFragment: 'ZERO_VALUE', values?: undefined): string
encodeFunctionData(functionFragment: 'changeOperator', values: [PromiseOrValue<string>]): string
encodeFunctionData(functionFragment: 'commitments', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(functionFragment: 'currentRootIndex', values?: undefined): string
encodeFunctionData(functionFragment: 'denomination', values?: undefined): string
encodeFunctionData(functionFragment: 'deposit', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(functionFragment: 'filledSubtrees', values: [PromiseOrValue<BigNumberish>]): string
encodeFunctionData(functionFragment: 'getLastRoot', values?: undefined): string
encodeFunctionData(
functionFragment: 'hashLeftRight',
values: [PromiseOrValue<BytesLike>, PromiseOrValue<BytesLike>]
): string
encodeFunctionData(functionFragment: 'isKnownRoot', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(functionFragment: 'isSpent', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(functionFragment: 'isSpentArray', values: [PromiseOrValue<BytesLike>[]]): string
encodeFunctionData(functionFragment: 'levels', values?: undefined): string
encodeFunctionData(functionFragment: 'nextIndex', values?: undefined): string
encodeFunctionData(functionFragment: 'nullifierHashes', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(functionFragment: 'operator', values?: undefined): string
encodeFunctionData(functionFragment: 'roots', values: [PromiseOrValue<BigNumberish>]): string
encodeFunctionData(functionFragment: 'updateVerifier', values: [PromiseOrValue<string>]): string
encodeFunctionData(functionFragment: 'verifier', values?: undefined): string
encodeFunctionData(
functionFragment: 'withdraw',
values: [
PromiseOrValue<BytesLike>,
PromiseOrValue<BytesLike>,
PromiseOrValue<BytesLike>,
PromiseOrValue<string>,
PromiseOrValue<string>,
PromiseOrValue<BigNumberish>,
PromiseOrValue<BigNumberish>
]
): string
encodeFunctionData(functionFragment: 'zeros', values: [PromiseOrValue<BigNumberish>]): string
decodeFunctionResult(functionFragment: 'FIELD_SIZE', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'ROOT_HISTORY_SIZE', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'ZERO_VALUE', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'changeOperator', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'commitments', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'currentRootIndex', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'denomination', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'deposit', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'filledSubtrees', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getLastRoot', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'hashLeftRight', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'isKnownRoot', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'isSpent', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'isSpentArray', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'levels', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'nextIndex', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'nullifierHashes', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'operator', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'roots', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'updateVerifier', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'verifier', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'withdraw', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'zeros', data: BytesLike): Result
events: {
'Deposit(bytes32,uint32,uint256)': EventFragment
'Withdrawal(address,bytes32,address,uint256)': EventFragment
}
getEvent(nameOrSignatureOrTopic: 'Deposit'): EventFragment
getEvent(nameOrSignatureOrTopic: 'Withdrawal'): EventFragment
}
export interface DepositEventObject {
commitment: string
leafIndex: number
timestamp: BigNumber
}
export type DepositEvent = TypedEvent<[string, number, BigNumber], DepositEventObject>
export type DepositEventFilter = TypedEventFilter<DepositEvent>
export interface WithdrawalEventObject {
to: string
nullifierHash: string
relayer: string
fee: BigNumber
}
export type WithdrawalEvent = TypedEvent<[string, string, string, BigNumber], WithdrawalEventObject>
export type WithdrawalEventFilter = TypedEventFilter<WithdrawalEvent>
export interface ETHTornado extends BaseContract {
contractName: 'ETHTornado'
connect(signerOrProvider: Signer | Provider | string): this
attach(addressOrName: string): this
deployed(): Promise<this>
interface: ETHTornadoInterface
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TEvent>>
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>
listeners(eventName?: string): Array<Listener>
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this
removeAllListeners(eventName?: string): this
off: OnEvent<this>
on: OnEvent<this>
once: OnEvent<this>
removeListener: OnEvent<this>
functions: {
FIELD_SIZE(overrides?: CallOverrides): Promise<[BigNumber]>
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<[number]>
ZERO_VALUE(overrides?: CallOverrides): Promise<[BigNumber]>
/**
* operator can change his address
*/
changeOperator(
_newOperator: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
commitments(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<[boolean]>
currentRootIndex(overrides?: CallOverrides): Promise<[number]>
denomination(overrides?: CallOverrides): Promise<[BigNumber]>
/**
* Deposit funds into the contract. The caller must send (for ETH) or approve (for ERC20) value equal to or `denomination` of this instance.
* @param _commitment the note commitment, which is PedersenHash(nullifier + secret)
*/
deposit(
_commitment: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
filledSubtrees(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[string]>
/**
* Returns the last root
*/
getLastRoot(overrides?: CallOverrides): Promise<[string]>
/**
* Hash 2 tree leaves, returns MiMC(_left, _right)
*/
hashLeftRight(
_left: PromiseOrValue<BytesLike>,
_right: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<[string]>
/**
* Whether the root is present in the root history
*/
isKnownRoot(_root: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<[boolean]>
/**
* whether a note is already spent
*/
isSpent(_nullifierHash: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<[boolean]>
/**
* whether an array of notes is already spent
*/
isSpentArray(
_nullifierHashes: PromiseOrValue<BytesLike>[],
overrides?: CallOverrides
): Promise<[boolean[]] & { spent: boolean[] }>
levels(overrides?: CallOverrides): Promise<[number]>
nextIndex(overrides?: CallOverrides): Promise<[number]>
nullifierHashes(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<[boolean]>
operator(overrides?: CallOverrides): Promise<[string]>
roots(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[string]>
/**
* allow operator to update SNARK verification keys. This is needed to update keys after the final trusted setup ceremony is held. After that operator rights are supposed to be transferred to zero address
*/
updateVerifier(
_newVerifier: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
verifier(overrides?: CallOverrides): Promise<[string]>
/**
* Withdraw a deposit from the contract. `proof` is a zkSNARK proof data, and input is an array of circuit public inputs `input` array consists of: - merkle root of all deposits in the contract - hash of unique deposit nullifier to prevent double spends - the recipient of funds - optional fee that goes to the transaction sender (usually a relay)
*/
withdraw(
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
zeros(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[string]>
}
FIELD_SIZE(overrides?: CallOverrides): Promise<BigNumber>
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<number>
ZERO_VALUE(overrides?: CallOverrides): Promise<BigNumber>
/**
* operator can change his address
*/
changeOperator(
_newOperator: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
commitments(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
currentRootIndex(overrides?: CallOverrides): Promise<number>
denomination(overrides?: CallOverrides): Promise<BigNumber>
/**
* Deposit funds into the contract. The caller must send (for ETH) or approve (for ERC20) value equal to or `denomination` of this instance.
* @param _commitment the note commitment, which is PedersenHash(nullifier + secret)
*/
deposit(
_commitment: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
filledSubtrees(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
/**
* Returns the last root
*/
getLastRoot(overrides?: CallOverrides): Promise<string>
/**
* Hash 2 tree leaves, returns MiMC(_left, _right)
*/
hashLeftRight(
_left: PromiseOrValue<BytesLike>,
_right: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<string>
/**
* Whether the root is present in the root history
*/
isKnownRoot(_root: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
/**
* whether a note is already spent
*/
isSpent(_nullifierHash: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
/**
* whether an array of notes is already spent
*/
isSpentArray(_nullifierHashes: PromiseOrValue<BytesLike>[], overrides?: CallOverrides): Promise<boolean[]>
levels(overrides?: CallOverrides): Promise<number>
nextIndex(overrides?: CallOverrides): Promise<number>
nullifierHashes(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
operator(overrides?: CallOverrides): Promise<string>
roots(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
/**
* allow operator to update SNARK verification keys. This is needed to update keys after the final trusted setup ceremony is held. After that operator rights are supposed to be transferred to zero address
*/
updateVerifier(
_newVerifier: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
verifier(overrides?: CallOverrides): Promise<string>
/**
* Withdraw a deposit from the contract. `proof` is a zkSNARK proof data, and input is an array of circuit public inputs `input` array consists of: - merkle root of all deposits in the contract - hash of unique deposit nullifier to prevent double spends - the recipient of funds - optional fee that goes to the transaction sender (usually a relay)
*/
withdraw(
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
zeros(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
callStatic: {
FIELD_SIZE(overrides?: CallOverrides): Promise<BigNumber>
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<number>
ZERO_VALUE(overrides?: CallOverrides): Promise<BigNumber>
/**
* operator can change his address
*/
changeOperator(_newOperator: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>
commitments(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
currentRootIndex(overrides?: CallOverrides): Promise<number>
denomination(overrides?: CallOverrides): Promise<BigNumber>
/**
* Deposit funds into the contract. The caller must send (for ETH) or approve (for ERC20) value equal to or `denomination` of this instance.
* @param _commitment the note commitment, which is PedersenHash(nullifier + secret)
*/
deposit(_commitment: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<void>
filledSubtrees(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
/**
* Returns the last root
*/
getLastRoot(overrides?: CallOverrides): Promise<string>
/**
* Hash 2 tree leaves, returns MiMC(_left, _right)
*/
hashLeftRight(
_left: PromiseOrValue<BytesLike>,
_right: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<string>
/**
* Whether the root is present in the root history
*/
isKnownRoot(_root: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
/**
* whether a note is already spent
*/
isSpent(_nullifierHash: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
/**
* whether an array of notes is already spent
*/
isSpentArray(_nullifierHashes: PromiseOrValue<BytesLike>[], overrides?: CallOverrides): Promise<boolean[]>
levels(overrides?: CallOverrides): Promise<number>
nextIndex(overrides?: CallOverrides): Promise<number>
nullifierHashes(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
operator(overrides?: CallOverrides): Promise<string>
roots(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
/**
* allow operator to update SNARK verification keys. This is needed to update keys after the final trusted setup ceremony is held. After that operator rights are supposed to be transferred to zero address
*/
updateVerifier(_newVerifier: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>
verifier(overrides?: CallOverrides): Promise<string>
/**
* Withdraw a deposit from the contract. `proof` is a zkSNARK proof data, and input is an array of circuit public inputs `input` array consists of: - merkle root of all deposits in the contract - hash of unique deposit nullifier to prevent double spends - the recipient of funds - optional fee that goes to the transaction sender (usually a relay)
*/
withdraw(
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<void>
zeros(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
}
filters: {
'Deposit(bytes32,uint32,uint256)'(
commitment?: PromiseOrValue<BytesLike> | null,
leafIndex?: null,
timestamp?: null
): DepositEventFilter
Deposit(
commitment?: PromiseOrValue<BytesLike> | null,
leafIndex?: null,
timestamp?: null
): DepositEventFilter
'Withdrawal(address,bytes32,address,uint256)'(
to?: null,
nullifierHash?: null,
relayer?: PromiseOrValue<string> | null,
fee?: null
): WithdrawalEventFilter
Withdrawal(
to?: null,
nullifierHash?: null,
relayer?: PromiseOrValue<string> | null,
fee?: null
): WithdrawalEventFilter
}
estimateGas: {
FIELD_SIZE(overrides?: CallOverrides): Promise<BigNumber>
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<BigNumber>
ZERO_VALUE(overrides?: CallOverrides): Promise<BigNumber>
/**
* operator can change his address
*/
changeOperator(
_newOperator: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
commitments(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<BigNumber>
currentRootIndex(overrides?: CallOverrides): Promise<BigNumber>
denomination(overrides?: CallOverrides): Promise<BigNumber>
/**
* Deposit funds into the contract. The caller must send (for ETH) or approve (for ERC20) value equal to or `denomination` of this instance.
* @param _commitment the note commitment, which is PedersenHash(nullifier + secret)
*/
deposit(
_commitment: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
filledSubtrees(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>
/**
* Returns the last root
*/
getLastRoot(overrides?: CallOverrides): Promise<BigNumber>
/**
* Hash 2 tree leaves, returns MiMC(_left, _right)
*/
hashLeftRight(
_left: PromiseOrValue<BytesLike>,
_right: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<BigNumber>
/**
* Whether the root is present in the root history
*/
isKnownRoot(_root: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<BigNumber>
/**
* whether a note is already spent
*/
isSpent(_nullifierHash: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<BigNumber>
/**
* whether an array of notes is already spent
*/
isSpentArray(_nullifierHashes: PromiseOrValue<BytesLike>[], overrides?: CallOverrides): Promise<BigNumber>
levels(overrides?: CallOverrides): Promise<BigNumber>
nextIndex(overrides?: CallOverrides): Promise<BigNumber>
nullifierHashes(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<BigNumber>
operator(overrides?: CallOverrides): Promise<BigNumber>
roots(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>
/**
* allow operator to update SNARK verification keys. This is needed to update keys after the final trusted setup ceremony is held. After that operator rights are supposed to be transferred to zero address
*/
updateVerifier(
_newVerifier: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
verifier(overrides?: CallOverrides): Promise<BigNumber>
/**
* Withdraw a deposit from the contract. `proof` is a zkSNARK proof data, and input is an array of circuit public inputs `input` array consists of: - merkle root of all deposits in the contract - hash of unique deposit nullifier to prevent double spends - the recipient of funds - optional fee that goes to the transaction sender (usually a relay)
*/
withdraw(
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
zeros(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>
}
populateTransaction: {
FIELD_SIZE(overrides?: CallOverrides): Promise<PopulatedTransaction>
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<PopulatedTransaction>
ZERO_VALUE(overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* operator can change his address
*/
changeOperator(
_newOperator: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
commitments(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<PopulatedTransaction>
currentRootIndex(overrides?: CallOverrides): Promise<PopulatedTransaction>
denomination(overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* Deposit funds into the contract. The caller must send (for ETH) or approve (for ERC20) value equal to or `denomination` of this instance.
* @param _commitment the note commitment, which is PedersenHash(nullifier + secret)
*/
deposit(
_commitment: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
filledSubtrees(
arg0: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
/**
* Returns the last root
*/
getLastRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* Hash 2 tree leaves, returns MiMC(_left, _right)
*/
hashLeftRight(
_left: PromiseOrValue<BytesLike>,
_right: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
/**
* Whether the root is present in the root history
*/
isKnownRoot(_root: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* whether a note is already spent
*/
isSpent(
_nullifierHash: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
/**
* whether an array of notes is already spent
*/
isSpentArray(
_nullifierHashes: PromiseOrValue<BytesLike>[],
overrides?: CallOverrides
): Promise<PopulatedTransaction>
levels(overrides?: CallOverrides): Promise<PopulatedTransaction>
nextIndex(overrides?: CallOverrides): Promise<PopulatedTransaction>
nullifierHashes(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<PopulatedTransaction>
operator(overrides?: CallOverrides): Promise<PopulatedTransaction>
roots(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* allow operator to update SNARK verification keys. This is needed to update keys after the final trusted setup ceremony is held. After that operator rights are supposed to be transferred to zero address
*/
updateVerifier(
_newVerifier: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
verifier(overrides?: CallOverrides): Promise<PopulatedTransaction>
/**
* Withdraw a deposit from the contract. `proof` is a zkSNARK proof data, and input is an array of circuit public inputs `input` array consists of: - merkle root of all deposits in the contract - hash of unique deposit nullifier to prevent double spends - the recipient of funds - optional fee that goes to the transaction sender (usually a relay)
*/
withdraw(
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
zeros(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<PopulatedTransaction>
}
}

View file

@ -0,0 +1,465 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
BaseContract,
BigNumber,
BigNumberish,
BytesLike,
CallOverrides,
ContractTransaction,
PayableOverrides,
PopulatedTransaction,
Signer,
utils
} from 'ethers'
import type { FunctionFragment, Result } from '@ethersproject/abi'
import type { Listener, Provider } from '@ethersproject/providers'
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from './common'
export declare namespace Multicall3 {
export type CallStruct = {
target: PromiseOrValue<string>
callData: PromiseOrValue<BytesLike>
}
export type CallStructOutput = [string, string] & {
target: string
callData: string
}
export type Call3Struct = {
target: PromiseOrValue<string>
allowFailure: PromiseOrValue<boolean>
callData: PromiseOrValue<BytesLike>
}
export type Call3StructOutput = [string, boolean, string] & {
target: string
allowFailure: boolean
callData: string
}
export type ResultStruct = {
success: PromiseOrValue<boolean>
returnData: PromiseOrValue<BytesLike>
}
export type ResultStructOutput = [boolean, string] & {
success: boolean
returnData: string
}
export type Call3ValueStruct = {
target: PromiseOrValue<string>
allowFailure: PromiseOrValue<boolean>
value: PromiseOrValue<BigNumberish>
callData: PromiseOrValue<BytesLike>
}
export type Call3ValueStructOutput = [string, boolean, BigNumber, string] & {
target: string
allowFailure: boolean
value: BigNumber
callData: string
}
}
export interface Multicall3ContractInterface extends utils.Interface {
functions: {
'aggregate((address,bytes)[])': FunctionFragment
'aggregate3((address,bool,bytes)[])': FunctionFragment
'aggregate3Value((address,bool,uint256,bytes)[])': FunctionFragment
'blockAndAggregate((address,bytes)[])': FunctionFragment
'getBasefee()': FunctionFragment
'getBlockHash(uint256)': FunctionFragment
'getBlockNumber()': FunctionFragment
'getChainId()': FunctionFragment
'getCurrentBlockCoinbase()': FunctionFragment
'getCurrentBlockDifficulty()': FunctionFragment
'getCurrentBlockGasLimit()': FunctionFragment
'getCurrentBlockTimestamp()': FunctionFragment
'getEthBalance(address)': FunctionFragment
'getLastBlockHash()': FunctionFragment
'tryAggregate(bool,(address,bytes)[])': FunctionFragment
'tryBlockAndAggregate(bool,(address,bytes)[])': FunctionFragment
}
getFunction(
nameOrSignatureOrTopic:
| 'aggregate'
| 'aggregate3'
| 'aggregate3Value'
| 'blockAndAggregate'
| 'getBasefee'
| 'getBlockHash'
| 'getBlockNumber'
| 'getChainId'
| 'getCurrentBlockCoinbase'
| 'getCurrentBlockDifficulty'
| 'getCurrentBlockGasLimit'
| 'getCurrentBlockTimestamp'
| 'getEthBalance'
| 'getLastBlockHash'
| 'tryAggregate'
| 'tryBlockAndAggregate'
): FunctionFragment
encodeFunctionData(functionFragment: 'aggregate', values: [Multicall3.CallStruct[]]): string
encodeFunctionData(functionFragment: 'aggregate3', values: [Multicall3.Call3Struct[]]): string
encodeFunctionData(functionFragment: 'aggregate3Value', values: [Multicall3.Call3ValueStruct[]]): string
encodeFunctionData(functionFragment: 'blockAndAggregate', values: [Multicall3.CallStruct[]]): string
encodeFunctionData(functionFragment: 'getBasefee', values?: undefined): string
encodeFunctionData(functionFragment: 'getBlockHash', values: [PromiseOrValue<BigNumberish>]): string
encodeFunctionData(functionFragment: 'getBlockNumber', values?: undefined): string
encodeFunctionData(functionFragment: 'getChainId', values?: undefined): string
encodeFunctionData(functionFragment: 'getCurrentBlockCoinbase', values?: undefined): string
encodeFunctionData(functionFragment: 'getCurrentBlockDifficulty', values?: undefined): string
encodeFunctionData(functionFragment: 'getCurrentBlockGasLimit', values?: undefined): string
encodeFunctionData(functionFragment: 'getCurrentBlockTimestamp', values?: undefined): string
encodeFunctionData(functionFragment: 'getEthBalance', values: [PromiseOrValue<string>]): string
encodeFunctionData(functionFragment: 'getLastBlockHash', values?: undefined): string
encodeFunctionData(
functionFragment: 'tryAggregate',
values: [PromiseOrValue<boolean>, Multicall3.CallStruct[]]
): string
encodeFunctionData(
functionFragment: 'tryBlockAndAggregate',
values: [PromiseOrValue<boolean>, Multicall3.CallStruct[]]
): string
decodeFunctionResult(functionFragment: 'aggregate', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'aggregate3', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'aggregate3Value', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'blockAndAggregate', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getBasefee', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getBlockHash', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getBlockNumber', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getChainId', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getCurrentBlockCoinbase', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getCurrentBlockDifficulty', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getCurrentBlockGasLimit', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getCurrentBlockTimestamp', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getEthBalance', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getLastBlockHash', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'tryAggregate', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'tryBlockAndAggregate', data: BytesLike): Result
events: {}
}
export interface Multicall3Contract extends BaseContract {
contractName: 'Multicall3Contract'
connect(signerOrProvider: Signer | Provider | string): this
attach(addressOrName: string): this
deployed(): Promise<this>
interface: Multicall3ContractInterface
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TEvent>>
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>
listeners(eventName?: string): Array<Listener>
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this
removeAllListeners(eventName?: string): this
off: OnEvent<this>
on: OnEvent<this>
once: OnEvent<this>
removeListener: OnEvent<this>
functions: {
aggregate(
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
aggregate3(
calls: Multicall3.Call3Struct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
aggregate3Value(
calls: Multicall3.Call3ValueStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
blockAndAggregate(
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
getBasefee(overrides?: CallOverrides): Promise<[BigNumber] & { basefee: BigNumber }>
getBlockHash(
blockNumber: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<[string] & { blockHash: string }>
getBlockNumber(overrides?: CallOverrides): Promise<[BigNumber] & { blockNumber: BigNumber }>
getChainId(overrides?: CallOverrides): Promise<[BigNumber] & { chainid: BigNumber }>
getCurrentBlockCoinbase(overrides?: CallOverrides): Promise<[string] & { coinbase: string }>
getCurrentBlockDifficulty(overrides?: CallOverrides): Promise<[BigNumber] & { difficulty: BigNumber }>
getCurrentBlockGasLimit(overrides?: CallOverrides): Promise<[BigNumber] & { gaslimit: BigNumber }>
getCurrentBlockTimestamp(overrides?: CallOverrides): Promise<[BigNumber] & { timestamp: BigNumber }>
getEthBalance(
addr: PromiseOrValue<string>,
overrides?: CallOverrides
): Promise<[BigNumber] & { balance: BigNumber }>
getLastBlockHash(overrides?: CallOverrides): Promise<[string] & { blockHash: string }>
tryAggregate(
requireSuccess: PromiseOrValue<boolean>,
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
tryBlockAndAggregate(
requireSuccess: PromiseOrValue<boolean>,
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
}
aggregate(
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
aggregate3(
calls: Multicall3.Call3Struct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
aggregate3Value(
calls: Multicall3.Call3ValueStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
blockAndAggregate(
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
getBasefee(overrides?: CallOverrides): Promise<BigNumber>
getBlockHash(blockNumber: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
getBlockNumber(overrides?: CallOverrides): Promise<BigNumber>
getChainId(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockCoinbase(overrides?: CallOverrides): Promise<string>
getCurrentBlockDifficulty(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockGasLimit(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockTimestamp(overrides?: CallOverrides): Promise<BigNumber>
getEthBalance(addr: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
getLastBlockHash(overrides?: CallOverrides): Promise<string>
tryAggregate(
requireSuccess: PromiseOrValue<boolean>,
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
tryBlockAndAggregate(
requireSuccess: PromiseOrValue<boolean>,
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
callStatic: {
aggregate(
calls: Multicall3.CallStruct[],
overrides?: CallOverrides
): Promise<[BigNumber, string[]] & { blockNumber: BigNumber; returnData: string[] }>
aggregate3(
calls: Multicall3.Call3Struct[],
overrides?: CallOverrides
): Promise<Multicall3.ResultStructOutput[]>
aggregate3Value(
calls: Multicall3.Call3ValueStruct[],
overrides?: CallOverrides
): Promise<Multicall3.ResultStructOutput[]>
blockAndAggregate(
calls: Multicall3.CallStruct[],
overrides?: CallOverrides
): Promise<
[BigNumber, string, Multicall3.ResultStructOutput[]] & {
blockNumber: BigNumber
blockHash: string
returnData: Multicall3.ResultStructOutput[]
}
>
getBasefee(overrides?: CallOverrides): Promise<BigNumber>
getBlockHash(blockNumber: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
getBlockNumber(overrides?: CallOverrides): Promise<BigNumber>
getChainId(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockCoinbase(overrides?: CallOverrides): Promise<string>
getCurrentBlockDifficulty(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockGasLimit(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockTimestamp(overrides?: CallOverrides): Promise<BigNumber>
getEthBalance(addr: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
getLastBlockHash(overrides?: CallOverrides): Promise<string>
tryAggregate(
requireSuccess: PromiseOrValue<boolean>,
calls: Multicall3.CallStruct[],
overrides?: CallOverrides
): Promise<Multicall3.ResultStructOutput[]>
tryBlockAndAggregate(
requireSuccess: PromiseOrValue<boolean>,
calls: Multicall3.CallStruct[],
overrides?: CallOverrides
): Promise<
[BigNumber, string, Multicall3.ResultStructOutput[]] & {
blockNumber: BigNumber
blockHash: string
returnData: Multicall3.ResultStructOutput[]
}
>
}
filters: {}
estimateGas: {
aggregate(
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
aggregate3(
calls: Multicall3.Call3Struct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
aggregate3Value(
calls: Multicall3.Call3ValueStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
blockAndAggregate(
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
getBasefee(overrides?: CallOverrides): Promise<BigNumber>
getBlockHash(blockNumber: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>
getBlockNumber(overrides?: CallOverrides): Promise<BigNumber>
getChainId(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockCoinbase(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockDifficulty(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockGasLimit(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockTimestamp(overrides?: CallOverrides): Promise<BigNumber>
getEthBalance(addr: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
getLastBlockHash(overrides?: CallOverrides): Promise<BigNumber>
tryAggregate(
requireSuccess: PromiseOrValue<boolean>,
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
tryBlockAndAggregate(
requireSuccess: PromiseOrValue<boolean>,
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
}
populateTransaction: {
aggregate(
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
aggregate3(
calls: Multicall3.Call3Struct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
aggregate3Value(
calls: Multicall3.Call3ValueStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
blockAndAggregate(
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
getBasefee(overrides?: CallOverrides): Promise<PopulatedTransaction>
getBlockHash(
blockNumber: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
getBlockNumber(overrides?: CallOverrides): Promise<PopulatedTransaction>
getChainId(overrides?: CallOverrides): Promise<PopulatedTransaction>
getCurrentBlockCoinbase(overrides?: CallOverrides): Promise<PopulatedTransaction>
getCurrentBlockDifficulty(overrides?: CallOverrides): Promise<PopulatedTransaction>
getCurrentBlockGasLimit(overrides?: CallOverrides): Promise<PopulatedTransaction>
getCurrentBlockTimestamp(overrides?: CallOverrides): Promise<PopulatedTransaction>
getEthBalance(addr: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>
getLastBlockHash(overrides?: CallOverrides): Promise<PopulatedTransaction>
tryAggregate(
requireSuccess: PromiseOrValue<boolean>,
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
tryBlockAndAggregate(
requireSuccess: PromiseOrValue<boolean>,
calls: Multicall3.CallStruct[],
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
}
}

View file

@ -0,0 +1,214 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
BaseContract,
BigNumber,
BigNumberish,
BytesLike,
CallOverrides,
ContractTransaction,
Overrides,
PopulatedTransaction,
Signer,
utils
} from 'ethers'
import type { FunctionFragment, Result } from '@ethersproject/abi'
import type { Listener, Provider } from '@ethersproject/providers'
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from './common'
export declare namespace Multicall {
export type CallStruct = {
target: PromiseOrValue<string>
callData: PromiseOrValue<BytesLike>
}
export type CallStructOutput = [string, string] & {
target: string
callData: string
}
}
export interface MulticallContractInterface extends utils.Interface {
functions: {
'aggregate((address,bytes)[])': FunctionFragment
'getBlockHash(uint256)': FunctionFragment
'getCurrentBlockCoinbase()': FunctionFragment
'getCurrentBlockDifficulty()': FunctionFragment
'getCurrentBlockGasLimit()': FunctionFragment
'getCurrentBlockTimestamp()': FunctionFragment
'getEthBalance(address)': FunctionFragment
'getLastBlockHash()': FunctionFragment
}
getFunction(
nameOrSignatureOrTopic:
| 'aggregate'
| 'getBlockHash'
| 'getCurrentBlockCoinbase'
| 'getCurrentBlockDifficulty'
| 'getCurrentBlockGasLimit'
| 'getCurrentBlockTimestamp'
| 'getEthBalance'
| 'getLastBlockHash'
): FunctionFragment
encodeFunctionData(functionFragment: 'aggregate', values: [Multicall.CallStruct[]]): string
encodeFunctionData(functionFragment: 'getBlockHash', values: [PromiseOrValue<BigNumberish>]): string
encodeFunctionData(functionFragment: 'getCurrentBlockCoinbase', values?: undefined): string
encodeFunctionData(functionFragment: 'getCurrentBlockDifficulty', values?: undefined): string
encodeFunctionData(functionFragment: 'getCurrentBlockGasLimit', values?: undefined): string
encodeFunctionData(functionFragment: 'getCurrentBlockTimestamp', values?: undefined): string
encodeFunctionData(functionFragment: 'getEthBalance', values: [PromiseOrValue<string>]): string
encodeFunctionData(functionFragment: 'getLastBlockHash', values?: undefined): string
decodeFunctionResult(functionFragment: 'aggregate', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getBlockHash', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getCurrentBlockCoinbase', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getCurrentBlockDifficulty', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getCurrentBlockGasLimit', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getCurrentBlockTimestamp', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getEthBalance', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getLastBlockHash', data: BytesLike): Result
events: {}
}
export interface MulticallContract extends BaseContract {
contractName: 'MulticallContract'
connect(signerOrProvider: Signer | Provider | string): this
attach(addressOrName: string): this
deployed(): Promise<this>
interface: MulticallContractInterface
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TEvent>>
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>
listeners(eventName?: string): Array<Listener>
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this
removeAllListeners(eventName?: string): this
off: OnEvent<this>
on: OnEvent<this>
once: OnEvent<this>
removeListener: OnEvent<this>
functions: {
aggregate(
calls: Multicall.CallStruct[],
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
getBlockHash(
blockNumber: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<[string] & { blockHash: string }>
getCurrentBlockCoinbase(overrides?: CallOverrides): Promise<[string] & { coinbase: string }>
getCurrentBlockDifficulty(overrides?: CallOverrides): Promise<[BigNumber] & { difficulty: BigNumber }>
getCurrentBlockGasLimit(overrides?: CallOverrides): Promise<[BigNumber] & { gaslimit: BigNumber }>
getCurrentBlockTimestamp(overrides?: CallOverrides): Promise<[BigNumber] & { timestamp: BigNumber }>
getEthBalance(
addr: PromiseOrValue<string>,
overrides?: CallOverrides
): Promise<[BigNumber] & { balance: BigNumber }>
getLastBlockHash(overrides?: CallOverrides): Promise<[string] & { blockHash: string }>
}
aggregate(
calls: Multicall.CallStruct[],
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
getBlockHash(blockNumber: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
getCurrentBlockCoinbase(overrides?: CallOverrides): Promise<string>
getCurrentBlockDifficulty(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockGasLimit(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockTimestamp(overrides?: CallOverrides): Promise<BigNumber>
getEthBalance(addr: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
getLastBlockHash(overrides?: CallOverrides): Promise<string>
callStatic: {
aggregate(
calls: Multicall.CallStruct[],
overrides?: CallOverrides
): Promise<[BigNumber, string[]] & { blockNumber: BigNumber; returnData: string[] }>
getBlockHash(blockNumber: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
getCurrentBlockCoinbase(overrides?: CallOverrides): Promise<string>
getCurrentBlockDifficulty(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockGasLimit(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockTimestamp(overrides?: CallOverrides): Promise<BigNumber>
getEthBalance(addr: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
getLastBlockHash(overrides?: CallOverrides): Promise<string>
}
filters: {}
estimateGas: {
aggregate(
calls: Multicall.CallStruct[],
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
getBlockHash(blockNumber: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockCoinbase(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockDifficulty(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockGasLimit(overrides?: CallOverrides): Promise<BigNumber>
getCurrentBlockTimestamp(overrides?: CallOverrides): Promise<BigNumber>
getEthBalance(addr: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
getLastBlockHash(overrides?: CallOverrides): Promise<BigNumber>
}
populateTransaction: {
aggregate(
calls: Multicall.CallStruct[],
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
getBlockHash(
blockNumber: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
getCurrentBlockCoinbase(overrides?: CallOverrides): Promise<PopulatedTransaction>
getCurrentBlockDifficulty(overrides?: CallOverrides): Promise<PopulatedTransaction>
getCurrentBlockGasLimit(overrides?: CallOverrides): Promise<PopulatedTransaction>
getCurrentBlockTimestamp(overrides?: CallOverrides): Promise<PopulatedTransaction>
getEthBalance(addr: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>
getLastBlockHash(overrides?: CallOverrides): Promise<PopulatedTransaction>
}
}

View file

@ -0,0 +1,565 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
BaseContract,
BigNumber,
BigNumberish,
BytesLike,
CallOverrides,
ContractTransaction,
Overrides,
PayableOverrides,
PopulatedTransaction,
Signer,
utils
} from 'ethers'
import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi'
import type { Listener, Provider } from '@ethersproject/providers'
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from './common'
export interface TornadoInstanceInterface extends utils.Interface {
functions: {
'changeOperator(address)': FunctionFragment
'nullifierHashes(bytes32)': FunctionFragment
'withdraw(bytes,bytes32,bytes32,address,address,uint256,uint256)': FunctionFragment
'verifier()': FunctionFragment
'hashLeftRight(bytes32,bytes32)': FunctionFragment
'FIELD_SIZE()': FunctionFragment
'levels()': FunctionFragment
'operator()': FunctionFragment
'isKnownRoot(bytes32)': FunctionFragment
'commitments(bytes32)': FunctionFragment
'denomination()': FunctionFragment
'currentRootIndex()': FunctionFragment
'updateVerifier(address)': FunctionFragment
'isSpentArray(bytes32[])': FunctionFragment
'deposit(bytes32)': FunctionFragment
'getLastRoot()': FunctionFragment
'roots(uint256)': FunctionFragment
'ROOT_HISTORY_SIZE()': FunctionFragment
'isSpent(bytes32)': FunctionFragment
'zeros(uint256)': FunctionFragment
'ZERO_VALUE()': FunctionFragment
'filledSubtrees(uint256)': FunctionFragment
'nextIndex()': FunctionFragment
}
getFunction(
nameOrSignatureOrTopic:
| 'changeOperator'
| 'nullifierHashes'
| 'withdraw'
| 'verifier'
| 'hashLeftRight'
| 'FIELD_SIZE'
| 'levels'
| 'operator'
| 'isKnownRoot'
| 'commitments'
| 'denomination'
| 'currentRootIndex'
| 'updateVerifier'
| 'isSpentArray'
| 'deposit'
| 'getLastRoot'
| 'roots'
| 'ROOT_HISTORY_SIZE'
| 'isSpent'
| 'zeros'
| 'ZERO_VALUE'
| 'filledSubtrees'
| 'nextIndex'
): FunctionFragment
encodeFunctionData(functionFragment: 'changeOperator', values: [PromiseOrValue<string>]): string
encodeFunctionData(functionFragment: 'nullifierHashes', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(
functionFragment: 'withdraw',
values: [
PromiseOrValue<BytesLike>,
PromiseOrValue<BytesLike>,
PromiseOrValue<BytesLike>,
PromiseOrValue<string>,
PromiseOrValue<string>,
PromiseOrValue<BigNumberish>,
PromiseOrValue<BigNumberish>
]
): string
encodeFunctionData(functionFragment: 'verifier', values?: undefined): string
encodeFunctionData(
functionFragment: 'hashLeftRight',
values: [PromiseOrValue<BytesLike>, PromiseOrValue<BytesLike>]
): string
encodeFunctionData(functionFragment: 'FIELD_SIZE', values?: undefined): string
encodeFunctionData(functionFragment: 'levels', values?: undefined): string
encodeFunctionData(functionFragment: 'operator', values?: undefined): string
encodeFunctionData(functionFragment: 'isKnownRoot', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(functionFragment: 'commitments', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(functionFragment: 'denomination', values?: undefined): string
encodeFunctionData(functionFragment: 'currentRootIndex', values?: undefined): string
encodeFunctionData(functionFragment: 'updateVerifier', values: [PromiseOrValue<string>]): string
encodeFunctionData(functionFragment: 'isSpentArray', values: [PromiseOrValue<BytesLike>[]]): string
encodeFunctionData(functionFragment: 'deposit', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(functionFragment: 'getLastRoot', values?: undefined): string
encodeFunctionData(functionFragment: 'roots', values: [PromiseOrValue<BigNumberish>]): string
encodeFunctionData(functionFragment: 'ROOT_HISTORY_SIZE', values?: undefined): string
encodeFunctionData(functionFragment: 'isSpent', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(functionFragment: 'zeros', values: [PromiseOrValue<BigNumberish>]): string
encodeFunctionData(functionFragment: 'ZERO_VALUE', values?: undefined): string
encodeFunctionData(functionFragment: 'filledSubtrees', values: [PromiseOrValue<BigNumberish>]): string
encodeFunctionData(functionFragment: 'nextIndex', values?: undefined): string
decodeFunctionResult(functionFragment: 'changeOperator', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'nullifierHashes', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'withdraw', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'verifier', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'hashLeftRight', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'FIELD_SIZE', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'levels', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'operator', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'isKnownRoot', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'commitments', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'denomination', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'currentRootIndex', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'updateVerifier', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'isSpentArray', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'deposit', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'getLastRoot', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'roots', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'ROOT_HISTORY_SIZE', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'isSpent', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'zeros', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'ZERO_VALUE', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'filledSubtrees', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'nextIndex', data: BytesLike): Result
events: {
'Deposit(bytes32,uint32,uint256)': EventFragment
'Withdrawal(address,bytes32,address,uint256)': EventFragment
}
getEvent(nameOrSignatureOrTopic: 'Deposit'): EventFragment
getEvent(nameOrSignatureOrTopic: 'Withdrawal'): EventFragment
}
export interface DepositEventObject {
commitment: string
leafIndex: number
timestamp: BigNumber
}
export type DepositEvent = TypedEvent<[string, number, BigNumber], DepositEventObject>
export type DepositEventFilter = TypedEventFilter<DepositEvent>
export interface WithdrawalEventObject {
to: string
nullifierHash: string
relayer: string
fee: BigNumber
}
export type WithdrawalEvent = TypedEvent<[string, string, string, BigNumber], WithdrawalEventObject>
export type WithdrawalEventFilter = TypedEventFilter<WithdrawalEvent>
export interface TornadoInstance extends BaseContract {
contractName: 'TornadoInstance'
connect(signerOrProvider: Signer | Provider | string): this
attach(addressOrName: string): this
deployed(): Promise<this>
interface: TornadoInstanceInterface
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TEvent>>
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>
listeners(eventName?: string): Array<Listener>
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this
removeAllListeners(eventName?: string): this
off: OnEvent<this>
on: OnEvent<this>
once: OnEvent<this>
removeListener: OnEvent<this>
functions: {
changeOperator(
_newOperator: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
nullifierHashes(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<[boolean]>
withdraw(
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
verifier(overrides?: CallOverrides): Promise<[string]>
hashLeftRight(
_left: PromiseOrValue<BytesLike>,
_right: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<[string]>
FIELD_SIZE(overrides?: CallOverrides): Promise<[BigNumber]>
levels(overrides?: CallOverrides): Promise<[number]>
operator(overrides?: CallOverrides): Promise<[string]>
isKnownRoot(_root: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<[boolean]>
commitments(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<[boolean]>
denomination(overrides?: CallOverrides): Promise<[BigNumber]>
currentRootIndex(overrides?: CallOverrides): Promise<[number]>
updateVerifier(
_newVerifier: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
isSpentArray(
_nullifierHashes: PromiseOrValue<BytesLike>[],
overrides?: CallOverrides
): Promise<[boolean[]] & { spent: boolean[] }>
deposit(
_commitment: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
getLastRoot(overrides?: CallOverrides): Promise<[string]>
roots(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[string]>
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<[number]>
isSpent(_nullifierHash: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<[boolean]>
zeros(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[string]>
ZERO_VALUE(overrides?: CallOverrides): Promise<[BigNumber]>
filledSubtrees(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[string]>
nextIndex(overrides?: CallOverrides): Promise<[number]>
}
changeOperator(
_newOperator: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
nullifierHashes(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
withdraw(
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
verifier(overrides?: CallOverrides): Promise<string>
hashLeftRight(
_left: PromiseOrValue<BytesLike>,
_right: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<string>
FIELD_SIZE(overrides?: CallOverrides): Promise<BigNumber>
levels(overrides?: CallOverrides): Promise<number>
operator(overrides?: CallOverrides): Promise<string>
isKnownRoot(_root: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
commitments(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
denomination(overrides?: CallOverrides): Promise<BigNumber>
currentRootIndex(overrides?: CallOverrides): Promise<number>
updateVerifier(
_newVerifier: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
isSpentArray(_nullifierHashes: PromiseOrValue<BytesLike>[], overrides?: CallOverrides): Promise<boolean[]>
deposit(
_commitment: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
getLastRoot(overrides?: CallOverrides): Promise<string>
roots(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<number>
isSpent(_nullifierHash: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
zeros(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
ZERO_VALUE(overrides?: CallOverrides): Promise<BigNumber>
filledSubtrees(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
nextIndex(overrides?: CallOverrides): Promise<number>
callStatic: {
changeOperator(_newOperator: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>
nullifierHashes(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
withdraw(
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<void>
verifier(overrides?: CallOverrides): Promise<string>
hashLeftRight(
_left: PromiseOrValue<BytesLike>,
_right: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<string>
FIELD_SIZE(overrides?: CallOverrides): Promise<BigNumber>
levels(overrides?: CallOverrides): Promise<number>
operator(overrides?: CallOverrides): Promise<string>
isKnownRoot(_root: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
commitments(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
denomination(overrides?: CallOverrides): Promise<BigNumber>
currentRootIndex(overrides?: CallOverrides): Promise<number>
updateVerifier(_newVerifier: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>
isSpentArray(_nullifierHashes: PromiseOrValue<BytesLike>[], overrides?: CallOverrides): Promise<boolean[]>
deposit(_commitment: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<void>
getLastRoot(overrides?: CallOverrides): Promise<string>
roots(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<number>
isSpent(_nullifierHash: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<boolean>
zeros(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
ZERO_VALUE(overrides?: CallOverrides): Promise<BigNumber>
filledSubtrees(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<string>
nextIndex(overrides?: CallOverrides): Promise<number>
}
filters: {
'Deposit(bytes32,uint32,uint256)'(
commitment?: PromiseOrValue<BytesLike> | null,
leafIndex?: null,
timestamp?: null
): DepositEventFilter
Deposit(
commitment?: PromiseOrValue<BytesLike> | null,
leafIndex?: null,
timestamp?: null
): DepositEventFilter
'Withdrawal(address,bytes32,address,uint256)'(
to?: null,
nullifierHash?: null,
relayer?: PromiseOrValue<string> | null,
fee?: null
): WithdrawalEventFilter
Withdrawal(
to?: null,
nullifierHash?: null,
relayer?: PromiseOrValue<string> | null,
fee?: null
): WithdrawalEventFilter
}
estimateGas: {
changeOperator(
_newOperator: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
nullifierHashes(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<BigNumber>
withdraw(
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
verifier(overrides?: CallOverrides): Promise<BigNumber>
hashLeftRight(
_left: PromiseOrValue<BytesLike>,
_right: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<BigNumber>
FIELD_SIZE(overrides?: CallOverrides): Promise<BigNumber>
levels(overrides?: CallOverrides): Promise<BigNumber>
operator(overrides?: CallOverrides): Promise<BigNumber>
isKnownRoot(_root: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<BigNumber>
commitments(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<BigNumber>
denomination(overrides?: CallOverrides): Promise<BigNumber>
currentRootIndex(overrides?: CallOverrides): Promise<BigNumber>
updateVerifier(
_newVerifier: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
isSpentArray(_nullifierHashes: PromiseOrValue<BytesLike>[], overrides?: CallOverrides): Promise<BigNumber>
deposit(
_commitment: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
getLastRoot(overrides?: CallOverrides): Promise<BigNumber>
roots(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<BigNumber>
isSpent(_nullifierHash: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<BigNumber>
zeros(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>
ZERO_VALUE(overrides?: CallOverrides): Promise<BigNumber>
filledSubtrees(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>
nextIndex(overrides?: CallOverrides): Promise<BigNumber>
}
populateTransaction: {
changeOperator(
_newOperator: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
nullifierHashes(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<PopulatedTransaction>
withdraw(
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
verifier(overrides?: CallOverrides): Promise<PopulatedTransaction>
hashLeftRight(
_left: PromiseOrValue<BytesLike>,
_right: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
FIELD_SIZE(overrides?: CallOverrides): Promise<PopulatedTransaction>
levels(overrides?: CallOverrides): Promise<PopulatedTransaction>
operator(overrides?: CallOverrides): Promise<PopulatedTransaction>
isKnownRoot(_root: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<PopulatedTransaction>
commitments(arg0: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<PopulatedTransaction>
denomination(overrides?: CallOverrides): Promise<PopulatedTransaction>
currentRootIndex(overrides?: CallOverrides): Promise<PopulatedTransaction>
updateVerifier(
_newVerifier: PromiseOrValue<string>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
isSpentArray(
_nullifierHashes: PromiseOrValue<BytesLike>[],
overrides?: CallOverrides
): Promise<PopulatedTransaction>
deposit(
_commitment: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
getLastRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>
roots(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<PopulatedTransaction>
ROOT_HISTORY_SIZE(overrides?: CallOverrides): Promise<PopulatedTransaction>
isSpent(
_nullifierHash: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
zeros(arg0: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<PopulatedTransaction>
ZERO_VALUE(overrides?: CallOverrides): Promise<PopulatedTransaction>
filledSubtrees(
arg0: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<PopulatedTransaction>
nextIndex(overrides?: CallOverrides): Promise<PopulatedTransaction>
}
}

View file

@ -0,0 +1,358 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
BaseContract,
BigNumber,
BigNumberish,
BytesLike,
CallOverrides,
ContractTransaction,
Overrides,
PayableOverrides,
PopulatedTransaction,
Signer,
utils
} from 'ethers'
import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi'
import type { Listener, Provider } from '@ethersproject/providers'
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from './common'
export interface TornadoProxyInterface extends utils.Interface {
functions: {
'bulkResolve(bytes32[])': FunctionFragment
'governance()': FunctionFragment
'instances(address)': FunctionFragment
'resolve(bytes32)': FunctionFragment
'tornadoTrees()': FunctionFragment
'deposit(address,bytes32,bytes)': FunctionFragment
'updateInstance(address,bool)': FunctionFragment
'withdraw(address,bytes,bytes32,bytes32,address,address,uint256,uint256)': FunctionFragment
'rescueTokens(address,address,uint256)': FunctionFragment
}
getFunction(
nameOrSignatureOrTopic:
| 'bulkResolve'
| 'governance'
| 'instances'
| 'resolve'
| 'tornadoTrees'
| 'deposit'
| 'updateInstance'
| 'withdraw'
| 'rescueTokens'
): FunctionFragment
encodeFunctionData(functionFragment: 'bulkResolve', values: [PromiseOrValue<BytesLike>[]]): string
encodeFunctionData(functionFragment: 'governance', values?: undefined): string
encodeFunctionData(functionFragment: 'instances', values: [PromiseOrValue<string>]): string
encodeFunctionData(functionFragment: 'resolve', values: [PromiseOrValue<BytesLike>]): string
encodeFunctionData(functionFragment: 'tornadoTrees', values?: undefined): string
encodeFunctionData(
functionFragment: 'deposit',
values: [PromiseOrValue<string>, PromiseOrValue<BytesLike>, PromiseOrValue<BytesLike>]
): string
encodeFunctionData(
functionFragment: 'updateInstance',
values: [PromiseOrValue<string>, PromiseOrValue<boolean>]
): string
encodeFunctionData(
functionFragment: 'withdraw',
values: [
PromiseOrValue<string>,
PromiseOrValue<BytesLike>,
PromiseOrValue<BytesLike>,
PromiseOrValue<BytesLike>,
PromiseOrValue<string>,
PromiseOrValue<string>,
PromiseOrValue<BigNumberish>,
PromiseOrValue<BigNumberish>
]
): string
encodeFunctionData(
functionFragment: 'rescueTokens',
values: [PromiseOrValue<string>, PromiseOrValue<string>, PromiseOrValue<BigNumberish>]
): string
decodeFunctionResult(functionFragment: 'bulkResolve', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'governance', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'instances', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'resolve', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'tornadoTrees', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'deposit', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'updateInstance', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'withdraw', data: BytesLike): Result
decodeFunctionResult(functionFragment: 'rescueTokens', data: BytesLike): Result
events: {
'EncryptedNote(address,bytes)': EventFragment
}
getEvent(nameOrSignatureOrTopic: 'EncryptedNote'): EventFragment
}
export interface EncryptedNoteEventObject {
sender: string
encryptedNote: string
}
export type EncryptedNoteEvent = TypedEvent<[string, string], EncryptedNoteEventObject>
export type EncryptedNoteEventFilter = TypedEventFilter<EncryptedNoteEvent>
export interface TornadoProxy extends BaseContract {
contractName: 'TornadoProxy'
connect(signerOrProvider: Signer | Provider | string): this
attach(addressOrName: string): this
deployed(): Promise<this>
interface: TornadoProxyInterface
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TEvent>>
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>
listeners(eventName?: string): Array<Listener>
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this
removeAllListeners(eventName?: string): this
off: OnEvent<this>
on: OnEvent<this>
once: OnEvent<this>
removeListener: OnEvent<this>
functions: {
bulkResolve(
domains: PromiseOrValue<BytesLike>[],
overrides?: CallOverrides
): Promise<[string[]] & { result: string[] }>
governance(overrides?: CallOverrides): Promise<[string]>
instances(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[boolean]>
resolve(node: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<[string]>
tornadoTrees(overrides?: CallOverrides): Promise<[string]>
deposit(
_tornado: PromiseOrValue<string>,
_commitment: PromiseOrValue<BytesLike>,
_encryptedNote: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
updateInstance(
_instance: PromiseOrValue<string>,
_update: PromiseOrValue<boolean>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
withdraw(
_tornado: PromiseOrValue<string>,
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
rescueTokens(
_token: PromiseOrValue<string>,
_to: PromiseOrValue<string>,
_balance: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
}
bulkResolve(domains: PromiseOrValue<BytesLike>[], overrides?: CallOverrides): Promise<string[]>
governance(overrides?: CallOverrides): Promise<string>
instances(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<boolean>
resolve(node: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<string>
tornadoTrees(overrides?: CallOverrides): Promise<string>
deposit(
_tornado: PromiseOrValue<string>,
_commitment: PromiseOrValue<BytesLike>,
_encryptedNote: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
updateInstance(
_instance: PromiseOrValue<string>,
_update: PromiseOrValue<boolean>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
withdraw(
_tornado: PromiseOrValue<string>,
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
rescueTokens(
_token: PromiseOrValue<string>,
_to: PromiseOrValue<string>,
_balance: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<ContractTransaction>
callStatic: {
bulkResolve(domains: PromiseOrValue<BytesLike>[], overrides?: CallOverrides): Promise<string[]>
governance(overrides?: CallOverrides): Promise<string>
instances(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<boolean>
resolve(node: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<string>
tornadoTrees(overrides?: CallOverrides): Promise<string>
deposit(
_tornado: PromiseOrValue<string>,
_commitment: PromiseOrValue<BytesLike>,
_encryptedNote: PromiseOrValue<BytesLike>,
overrides?: CallOverrides
): Promise<void>
updateInstance(
_instance: PromiseOrValue<string>,
_update: PromiseOrValue<boolean>,
overrides?: CallOverrides
): Promise<void>
withdraw(
_tornado: PromiseOrValue<string>,
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<void>
rescueTokens(
_token: PromiseOrValue<string>,
_to: PromiseOrValue<string>,
_balance: PromiseOrValue<BigNumberish>,
overrides?: CallOverrides
): Promise<void>
}
filters: {
'EncryptedNote(address,bytes)'(
sender?: PromiseOrValue<string> | null,
encryptedNote?: null
): EncryptedNoteEventFilter
EncryptedNote(sender?: PromiseOrValue<string> | null, encryptedNote?: null): EncryptedNoteEventFilter
}
estimateGas: {
bulkResolve(domains: PromiseOrValue<BytesLike>[], overrides?: CallOverrides): Promise<BigNumber>
governance(overrides?: CallOverrides): Promise<BigNumber>
instances(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>
resolve(node: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<BigNumber>
tornadoTrees(overrides?: CallOverrides): Promise<BigNumber>
deposit(
_tornado: PromiseOrValue<string>,
_commitment: PromiseOrValue<BytesLike>,
_encryptedNote: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
updateInstance(
_instance: PromiseOrValue<string>,
_update: PromiseOrValue<boolean>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
withdraw(
_tornado: PromiseOrValue<string>,
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
rescueTokens(
_token: PromiseOrValue<string>,
_to: PromiseOrValue<string>,
_balance: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>
}
populateTransaction: {
bulkResolve(
domains: PromiseOrValue<BytesLike>[],
overrides?: CallOverrides
): Promise<PopulatedTransaction>
governance(overrides?: CallOverrides): Promise<PopulatedTransaction>
instances(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>
resolve(node: PromiseOrValue<BytesLike>, overrides?: CallOverrides): Promise<PopulatedTransaction>
tornadoTrees(overrides?: CallOverrides): Promise<PopulatedTransaction>
deposit(
_tornado: PromiseOrValue<string>,
_commitment: PromiseOrValue<BytesLike>,
_encryptedNote: PromiseOrValue<BytesLike>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
updateInstance(
_instance: PromiseOrValue<string>,
_update: PromiseOrValue<boolean>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
withdraw(
_tornado: PromiseOrValue<string>,
_proof: PromiseOrValue<BytesLike>,
_root: PromiseOrValue<BytesLike>,
_nullifierHash: PromiseOrValue<BytesLike>,
_recipient: PromiseOrValue<string>,
_relayer: PromiseOrValue<string>,
_fee: PromiseOrValue<BigNumberish>,
_refund: PromiseOrValue<BigNumberish>,
overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
rescueTokens(
_token: PromiseOrValue<string>,
_to: PromiseOrValue<string>,
_balance: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<PopulatedTransaction>
}
}

View file

@ -0,0 +1,32 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type { Listener } from '@ethersproject/providers'
import type { Event, EventFilter } from 'ethers'
export interface TypedEvent<TArgsArray extends Array<any> = any, TArgsObject = any> extends Event {
args: TArgsArray & TArgsObject
}
export interface TypedEventFilter<_TEvent extends TypedEvent> extends EventFilter {}
export interface TypedListener<TEvent extends TypedEvent> {
(...listenerArg: [...__TypechainArgsArray<TEvent>, TEvent]): void
}
type __TypechainArgsArray<T> = T extends TypedEvent<infer U> ? U : never
export interface OnEvent<TRes> {
<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>, listener: TypedListener<TEvent>): TRes
(eventName: string, listener: Listener): TRes
}
export type MinEthersFactory<C, ARGS> = {
deploy(...a: ARGS[]): Promise<C>
}
export type GetContractTypeFromFactory<F> = F extends MinEthersFactory<infer C, any> ? C : never
export type GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any> ? Parameters<F['deploy']> : never
export type PromiseOrValue<T> = T | Promise<T>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,231 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, Signer, utils } from 'ethers'
import type { Provider } from '@ethersproject/providers'
import type { ERC20, ERC20Interface } from '../ERC20'
const _abi = [
{
constant: true,
inputs: [],
name: 'totalSupply',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: '_totalSupply',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [
{
internalType: 'address',
name: 'who',
type: 'address'
}
],
name: 'balanceOf',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
internalType: 'address',
name: 'to',
type: 'address'
},
{
internalType: 'uint256',
name: 'value',
type: 'uint256'
}
],
name: 'transfer',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'owner',
type: 'address'
},
{
indexed: true,
internalType: 'address',
name: 'spender',
type: 'address'
},
{
indexed: false,
internalType: 'uint256',
name: 'value',
type: 'uint256'
}
],
name: 'Approval',
type: 'event'
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'from',
type: 'address'
},
{
indexed: true,
internalType: 'address',
name: 'to',
type: 'address'
},
{
indexed: false,
internalType: 'uint256',
name: 'value',
type: 'uint256'
}
],
name: 'Transfer',
type: 'event'
},
{
constant: true,
inputs: [
{
internalType: 'address',
name: 'owner',
type: 'address'
},
{
internalType: 'address',
name: 'spender',
type: 'address'
}
],
name: 'allowance',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
internalType: 'address',
name: 'from',
type: 'address'
},
{
internalType: 'address',
name: 'to',
type: 'address'
},
{
internalType: 'uint256',
name: 'value',
type: 'uint256'
}
],
name: 'transferFrom',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: false,
inputs: [
{
internalType: 'address',
name: 'spender',
type: 'address'
},
{
internalType: 'uint256',
name: 'value',
type: 'uint256'
}
],
name: 'approve',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
inputs: [
{
internalType: 'address',
name: 'owner',
type: 'address'
}
],
name: 'nonces',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256'
}
],
stateMutability: 'view',
type: 'function'
}
] as const
export class ERC20__factory {
static readonly abi = _abi
static createInterface(): ERC20Interface {
return new utils.Interface(_abi) as ERC20Interface
}
static connect(address: string, signerOrProvider: Signer | Provider): ERC20 {
return new Contract(address, _abi, signerOrProvider) as ERC20
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,458 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, Signer, utils } from 'ethers'
import type { Provider } from '@ethersproject/providers'
import type { Multicall3Contract, Multicall3ContractInterface } from '../Multicall3Contract'
const _abi = [
{
inputs: [
{
components: [
{
internalType: 'address',
name: 'target',
type: 'address'
},
{
internalType: 'bytes',
name: 'callData',
type: 'bytes'
}
],
internalType: 'struct Multicall3.Call[]',
name: 'calls',
type: 'tuple[]'
}
],
name: 'aggregate',
outputs: [
{
internalType: 'uint256',
name: 'blockNumber',
type: 'uint256'
},
{
internalType: 'bytes[]',
name: 'returnData',
type: 'bytes[]'
}
],
stateMutability: 'payable',
type: 'function'
},
{
inputs: [
{
components: [
{
internalType: 'address',
name: 'target',
type: 'address'
},
{
internalType: 'bool',
name: 'allowFailure',
type: 'bool'
},
{
internalType: 'bytes',
name: 'callData',
type: 'bytes'
}
],
internalType: 'struct Multicall3.Call3[]',
name: 'calls',
type: 'tuple[]'
}
],
name: 'aggregate3',
outputs: [
{
components: [
{
internalType: 'bool',
name: 'success',
type: 'bool'
},
{
internalType: 'bytes',
name: 'returnData',
type: 'bytes'
}
],
internalType: 'struct Multicall3.Result[]',
name: 'returnData',
type: 'tuple[]'
}
],
stateMutability: 'payable',
type: 'function'
},
{
inputs: [
{
components: [
{
internalType: 'address',
name: 'target',
type: 'address'
},
{
internalType: 'bool',
name: 'allowFailure',
type: 'bool'
},
{
internalType: 'uint256',
name: 'value',
type: 'uint256'
},
{
internalType: 'bytes',
name: 'callData',
type: 'bytes'
}
],
internalType: 'struct Multicall3.Call3Value[]',
name: 'calls',
type: 'tuple[]'
}
],
name: 'aggregate3Value',
outputs: [
{
components: [
{
internalType: 'bool',
name: 'success',
type: 'bool'
},
{
internalType: 'bytes',
name: 'returnData',
type: 'bytes'
}
],
internalType: 'struct Multicall3.Result[]',
name: 'returnData',
type: 'tuple[]'
}
],
stateMutability: 'payable',
type: 'function'
},
{
inputs: [
{
components: [
{
internalType: 'address',
name: 'target',
type: 'address'
},
{
internalType: 'bytes',
name: 'callData',
type: 'bytes'
}
],
internalType: 'struct Multicall3.Call[]',
name: 'calls',
type: 'tuple[]'
}
],
name: 'blockAndAggregate',
outputs: [
{
internalType: 'uint256',
name: 'blockNumber',
type: 'uint256'
},
{
internalType: 'bytes32',
name: 'blockHash',
type: 'bytes32'
},
{
components: [
{
internalType: 'bool',
name: 'success',
type: 'bool'
},
{
internalType: 'bytes',
name: 'returnData',
type: 'bytes'
}
],
internalType: 'struct Multicall3.Result[]',
name: 'returnData',
type: 'tuple[]'
}
],
stateMutability: 'payable',
type: 'function'
},
{
inputs: [],
name: 'getBasefee',
outputs: [
{
internalType: 'uint256',
name: 'basefee',
type: 'uint256'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [
{
internalType: 'uint256',
name: 'blockNumber',
type: 'uint256'
}
],
name: 'getBlockHash',
outputs: [
{
internalType: 'bytes32',
name: 'blockHash',
type: 'bytes32'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [],
name: 'getBlockNumber',
outputs: [
{
internalType: 'uint256',
name: 'blockNumber',
type: 'uint256'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [],
name: 'getChainId',
outputs: [
{
internalType: 'uint256',
name: 'chainid',
type: 'uint256'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [],
name: 'getCurrentBlockCoinbase',
outputs: [
{
internalType: 'address',
name: 'coinbase',
type: 'address'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [],
name: 'getCurrentBlockDifficulty',
outputs: [
{
internalType: 'uint256',
name: 'difficulty',
type: 'uint256'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [],
name: 'getCurrentBlockGasLimit',
outputs: [
{
internalType: 'uint256',
name: 'gaslimit',
type: 'uint256'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [],
name: 'getCurrentBlockTimestamp',
outputs: [
{
internalType: 'uint256',
name: 'timestamp',
type: 'uint256'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [
{
internalType: 'address',
name: 'addr',
type: 'address'
}
],
name: 'getEthBalance',
outputs: [
{
internalType: 'uint256',
name: 'balance',
type: 'uint256'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [],
name: 'getLastBlockHash',
outputs: [
{
internalType: 'bytes32',
name: 'blockHash',
type: 'bytes32'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [
{
internalType: 'bool',
name: 'requireSuccess',
type: 'bool'
},
{
components: [
{
internalType: 'address',
name: 'target',
type: 'address'
},
{
internalType: 'bytes',
name: 'callData',
type: 'bytes'
}
],
internalType: 'struct Multicall3.Call[]',
name: 'calls',
type: 'tuple[]'
}
],
name: 'tryAggregate',
outputs: [
{
components: [
{
internalType: 'bool',
name: 'success',
type: 'bool'
},
{
internalType: 'bytes',
name: 'returnData',
type: 'bytes'
}
],
internalType: 'struct Multicall3.Result[]',
name: 'returnData',
type: 'tuple[]'
}
],
stateMutability: 'payable',
type: 'function'
},
{
inputs: [
{
internalType: 'bool',
name: 'requireSuccess',
type: 'bool'
},
{
components: [
{
internalType: 'address',
name: 'target',
type: 'address'
},
{
internalType: 'bytes',
name: 'callData',
type: 'bytes'
}
],
internalType: 'struct Multicall3.Call[]',
name: 'calls',
type: 'tuple[]'
}
],
name: 'tryBlockAndAggregate',
outputs: [
{
internalType: 'uint256',
name: 'blockNumber',
type: 'uint256'
},
{
internalType: 'bytes32',
name: 'blockHash',
type: 'bytes32'
},
{
components: [
{
internalType: 'bool',
name: 'success',
type: 'bool'
},
{
internalType: 'bytes',
name: 'returnData',
type: 'bytes'
}
],
internalType: 'struct Multicall3.Result[]',
name: 'returnData',
type: 'tuple[]'
}
],
stateMutability: 'payable',
type: 'function'
}
] as const
export class Multicall3Contract__factory {
static readonly abi = _abi
static createInterface(): Multicall3ContractInterface {
return new utils.Interface(_abi) as Multicall3ContractInterface
}
static connect(address: string, signerOrProvider: Signer | Provider): Multicall3Contract {
return new Contract(address, _abi, signerOrProvider) as Multicall3Contract
}
}

View file

@ -0,0 +1,159 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, Signer, utils } from 'ethers'
import type { Provider } from '@ethersproject/providers'
import type { MulticallContract, MulticallContractInterface } from '../MulticallContract'
const _abi = [
{
inputs: [
{
components: [
{
internalType: 'address',
name: 'target',
type: 'address'
},
{
internalType: 'bytes',
name: 'callData',
type: 'bytes'
}
],
internalType: 'struct Multicall.Call[]',
name: 'calls',
type: 'tuple[]'
}
],
name: 'aggregate',
outputs: [
{
internalType: 'uint256',
name: 'blockNumber',
type: 'uint256'
},
{
internalType: 'bytes[]',
name: 'returnData',
type: 'bytes[]'
}
],
stateMutability: 'nonpayable',
type: 'function'
},
{
inputs: [
{
internalType: 'uint256',
name: 'blockNumber',
type: 'uint256'
}
],
name: 'getBlockHash',
outputs: [
{
internalType: 'bytes32',
name: 'blockHash',
type: 'bytes32'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [],
name: 'getCurrentBlockCoinbase',
outputs: [
{
internalType: 'address',
name: 'coinbase',
type: 'address'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [],
name: 'getCurrentBlockDifficulty',
outputs: [
{
internalType: 'uint256',
name: 'difficulty',
type: 'uint256'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [],
name: 'getCurrentBlockGasLimit',
outputs: [
{
internalType: 'uint256',
name: 'gaslimit',
type: 'uint256'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [],
name: 'getCurrentBlockTimestamp',
outputs: [
{
internalType: 'uint256',
name: 'timestamp',
type: 'uint256'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [
{
internalType: 'address',
name: 'addr',
type: 'address'
}
],
name: 'getEthBalance',
outputs: [
{
internalType: 'uint256',
name: 'balance',
type: 'uint256'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [],
name: 'getLastBlockHash',
outputs: [
{
internalType: 'bytes32',
name: 'blockHash',
type: 'bytes32'
}
],
stateMutability: 'view',
type: 'function'
}
] as const
export class MulticallContract__factory {
static readonly abi = _abi
static createInterface(): MulticallContractInterface {
return new utils.Interface(_abi) as MulticallContractInterface
}
static connect(address: string, signerOrProvider: Signer | Provider): MulticallContract {
return new Contract(address, _abi, signerOrProvider) as MulticallContract
}
}

View file

@ -0,0 +1,537 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, Signer, utils } from 'ethers'
import type { Provider } from '@ethersproject/providers'
import type { TornadoInstance, TornadoInstanceInterface } from '../TornadoInstance'
const _abi = [
{
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: 'nullifierHashes',
outputs: [
{
internalType: 'bool',
name: '',
type: 'bool'
}
],
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: [],
name: 'verifier',
outputs: [
{
internalType: 'contract IVerifier',
name: '',
type: 'address'
}
],
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: [],
name: 'FIELD_SIZE',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256'
}
],
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: 'operator',
outputs: [
{
internalType: 'address',
name: '',
type: 'address'
}
],
payable: false,
stateMutability: 'view',
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: '',
type: 'bytes32'
}
],
name: 'commitments',
outputs: [
{
internalType: 'bool',
name: '',
type: 'bool'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'denomination',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'currentRootIndex',
outputs: [
{
internalType: 'uint32',
name: '',
type: 'uint32'
}
],
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: [
{
internalType: 'bytes32[]',
name: '_nullifierHashes',
type: 'bytes32[]'
}
],
name: 'isSpentArray',
outputs: [
{
internalType: 'bool[]',
name: 'spent',
type: 'bool[]'
}
],
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: [],
name: 'getLastRoot',
outputs: [
{
internalType: 'bytes32',
name: '',
type: 'bytes32'
}
],
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: 'ROOT_HISTORY_SIZE',
outputs: [
{
internalType: 'uint32',
name: '',
type: 'uint32'
}
],
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: 'uint256',
name: '',
type: 'uint256'
}
],
name: 'zeros',
outputs: [
{
internalType: 'bytes32',
name: '',
type: 'bytes32'
}
],
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: 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: 'nextIndex',
outputs: [
{
internalType: 'uint32',
name: '',
type: 'uint32'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
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'
}
] as const
export class TornadoInstance__factory {
static readonly abi = _abi
static createInterface(): TornadoInstanceInterface {
return new utils.Interface(_abi) as TornadoInstanceInterface
}
static connect(address: string, signerOrProvider: Signer | Provider): TornadoInstance {
return new Contract(address, _abi, signerOrProvider) as TornadoInstance
}
}

View file

@ -0,0 +1,255 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, Signer, utils } from 'ethers'
import type { Provider } from '@ethersproject/providers'
import type { TornadoProxy, TornadoProxyInterface } from '../TornadoProxy'
const _abi = [
{
inputs: [
{
internalType: 'bytes32',
name: '_tornadoTrees',
type: 'bytes32'
},
{
internalType: 'bytes32',
name: '_governance',
type: 'bytes32'
},
{
internalType: 'bytes32[]',
name: '_instances',
type: 'bytes32[]'
}
],
stateMutability: 'nonpayable',
type: 'constructor'
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'sender',
type: 'address'
},
{
indexed: false,
internalType: 'bytes',
name: 'encryptedNote',
type: 'bytes'
}
],
name: 'EncryptedNote',
type: 'event'
},
{
inputs: [
{
internalType: 'bytes32[]',
name: 'domains',
type: 'bytes32[]'
}
],
name: 'bulkResolve',
outputs: [
{
internalType: 'address[]',
name: 'result',
type: 'address[]'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [],
name: 'governance',
outputs: [
{
internalType: 'address',
name: '',
type: 'address'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [
{
internalType: 'contract ITornadoInstance',
name: '',
type: 'address'
}
],
name: 'instances',
outputs: [
{
internalType: 'bool',
name: '',
type: 'bool'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [
{
internalType: 'bytes32',
name: 'node',
type: 'bytes32'
}
],
name: 'resolve',
outputs: [
{
internalType: 'address',
name: '',
type: 'address'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [],
name: 'tornadoTrees',
outputs: [
{
internalType: 'contract ITornadoTrees',
name: '',
type: 'address'
}
],
stateMutability: 'view',
type: 'function'
},
{
inputs: [
{
internalType: 'contract ITornadoInstance',
name: '_tornado',
type: 'address'
},
{
internalType: 'bytes32',
name: '_commitment',
type: 'bytes32'
},
{
internalType: 'bytes',
name: '_encryptedNote',
type: 'bytes'
}
],
name: 'deposit',
outputs: [],
stateMutability: 'payable',
type: 'function'
},
{
inputs: [
{
internalType: 'contract ITornadoInstance',
name: '_instance',
type: 'address'
},
{
internalType: 'bool',
name: '_update',
type: 'bool'
}
],
name: 'updateInstance',
outputs: [],
stateMutability: 'nonpayable',
type: 'function'
},
{
inputs: [
{
internalType: 'contract ITornadoInstance',
name: '_tornado',
type: 'address'
},
{
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: [],
stateMutability: 'payable',
type: 'function'
},
{
inputs: [
{
internalType: 'contract IERC20',
name: '_token',
type: 'address'
},
{
internalType: 'address payable',
name: '_to',
type: 'address'
},
{
internalType: 'uint256',
name: '_balance',
type: 'uint256'
}
],
name: 'rescueTokens',
outputs: [],
stateMutability: 'nonpayable',
type: 'function'
}
] as const
export class TornadoProxy__factory {
static readonly abi = _abi
static createInterface(): TornadoProxyInterface {
return new utils.Interface(_abi) as TornadoProxyInterface
}
static connect(address: string, signerOrProvider: Signer | Provider): TornadoProxy {
return new Contract(address, _abi, signerOrProvider) as TornadoProxy
}
}

View file

@ -0,0 +1,11 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
export { ERC20__factory } from './ERC20__factory'
export { ERC20Mock__factory } from './ERC20Mock__factory'
export { ERC20Tornado__factory } from './ERC20Tornado__factory'
export { ETHTornado__factory } from './ETHTornado__factory'
export { Multicall3Contract__factory } from './Multicall3Contract__factory'
export { MulticallContract__factory } from './MulticallContract__factory'
export { TornadoInstance__factory } from './TornadoInstance__factory'
export { TornadoProxy__factory } from './TornadoProxy__factory'

View file

@ -0,0 +1,20 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
export type { ERC20 } from './ERC20'
export type { ERC20Mock } from './ERC20Mock'
export type { ERC20Tornado } from './ERC20Tornado'
export type { ETHTornado } from './ETHTornado'
export type { Multicall3Contract } from './Multicall3Contract'
export type { MulticallContract } from './MulticallContract'
export type { TornadoInstance } from './TornadoInstance'
export type { TornadoProxy } from './TornadoProxy'
export * as factories from './factories'
export { ERC20__factory } from './factories/ERC20__factory'
export { ERC20Mock__factory } from './factories/ERC20Mock__factory'
export { ERC20Tornado__factory } from './factories/ERC20Tornado__factory'
export { ETHTornado__factory } from './factories/ETHTornado__factory'
export { Multicall3Contract__factory } from './factories/Multicall3Contract__factory'
export { MulticallContract__factory } from './factories/MulticallContract__factory'
export { TornadoInstance__factory } from './factories/TornadoInstance__factory'
export { TornadoProxy__factory } from './factories/TornadoProxy__factory'

View file

@ -0,0 +1,708 @@
// ts-essentials
import { DeepRequired, MarkOptional } from 'ts-essentials'
// Local types
import { TornadoInstance, TornadoProxy } from './deth'
// Monorepo
import { RelayerProperties as RelayerDataProperties } from '@tornado/sdk-data'
import { ZKDepositData, InputFor } from '@tornado/sdk-crypto'
// External imports
import { TransactionRequest } from '@ethersproject/abstract-provider'
import { BigNumber, providers } from 'ethers'
import { parseUnits } from 'ethers/lib/utils'
import { bigInt } from 'snarkjs'
// @ts-ignore
import { parseIndexableString } from 'pouchdb-collate'
// Local imports
import { Primitives } from '@tornado/sdk-crypto'
import { ErrorUtils, ObjectUtils, AsyncUtils } from '@tornado/sdk-utils'
import { Docs, Cache, Keys, Constants, Onchain } from '@tornado/sdk-data'
import { Contracts, Chain, Synchronizer, Options as ChainOptions } from '@tornado/sdk-chain'
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DECLARATIONS (MUST BE INLINED) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export namespace Options {
export namespace Core {
export interface Deposit {
depositsPerInstance?: Array<number>
doNotPopulate?: boolean
backup?: {
invoices?: boolean
notes?: boolean
}
}
export type Invoice = Deposit
export interface BuildDepositProof {
gasPrice?: BigNumber
gasPriceCushion?: BigNumber
tokenDecimals?: number
ethPurchaseAmounts?: Array<BigNumber>
checkNotesSpent?: boolean
checkKnownRoot?: boolean
merkleTreeHeight?: number
}
}
export type Sync = ChainOptions.Sync
}
export namespace Transactions {
export interface Deposit {
request: TransactionRequest
invoice?: string
note?: string
}
export type Invoice = Deposit
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ FOR SYNCHRONIZATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function tornadoSyncErrorHandler(
err: Error,
numResolvedPromises: number,
callbackIndex: number,
orderIndex: number,
...args: any[]
): void {
err = ErrorUtils.ensureError<Error>(err)
if (err.message.match('context deadline exceeded'))
console.error(
ErrorUtils.getError(
`Context deadline exceeded, stop if more promises do not resolve. Resolved: ${numResolvedPromises}`
)
)
else if (err.message.match('Invalid JSON RPC'))
console.error(
ErrorUtils.getError(`Endpoint returned invalid value (we might be rate limited), retrying.`)
)
else {
err.message += `\nCallback args supplied: [${args.join(', ')}]\n`
throw err
}
}
export class DepositCache extends Cache.Syncable<Docs.Deposit> {
buildDoc(response: any): Docs.Deposit {
return new Docs.Deposit(response)
}
getErrorHandlers(): Array<AsyncUtils.ErrorHandler> {
return [tornadoSyncErrorHandler]
}
getCallbacks(instance: TornadoInstance): Array<AsyncUtils.Callback> {
return [
(fromBlock: number, toBlock: number) => {
return instance.queryFilter(instance.filters.Deposit(null, null, null), fromBlock, toBlock)
}
]
}
}
export class WithdrawalCache extends Cache.Syncable<Docs.Withdrawal> {
buildDoc(response: any): Docs.Withdrawal {
return new Docs.Withdrawal(response)
}
getErrorHandlers(): Array<AsyncUtils.ErrorHandler> {
return [tornadoSyncErrorHandler]
}
getCallbacks(instance: TornadoInstance): Array<AsyncUtils.Callback> {
return [
(fromBlock: number, toBlock: number) => {
return instance.queryFilter(instance.filters.Withdrawal(null, null, null, null), fromBlock, toBlock)
}
]
}
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CORE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
type Provider = providers.Provider
type BackupDepositDoc = {
network: string
denomination: string
token: string
invoice?: string
note?: string
}
type RelayerProperties = MarkOptional<
Pick<RelayerDataProperties, 'address' | 'serviceFeePercent' | 'prices'>,
'serviceFeePercent' | 'prices'
>
export class Core extends Synchronizer {
chain: Chain
caches: Map<string, Cache.Base<Docs.Base>>
instances: Map<string, TornadoInstance>
constructor(provider: providers.Provider) {
super()
this.chain = new Chain(provider)
this.caches = new Map<string, Cache.Syncable<Docs.Base>>()
this.instances = new Map<string, TornadoInstance>()
}
connect(provider: Provider): void {
this.chain.provider = provider
}
async getInstances(
keys: Array<{ token: string; denomination: number | string }>
): Promise<Array<TornadoInstance>> {
const chainId = await this.chain.getChainId()
return Promise.all(
keys.map((key) =>
Contracts.getInstance(String(chainId), key.token, String(key.denomination), this.chain.provider)
)
)
}
async getInstance(token: string, denomination: number | string): Promise<TornadoInstance> {
const chainId = String(await this.chain.getChainId())
token = token.toLowerCase()
denomination = String(denomination)
if (this.instances.has(chainId + token + denomination))
return this.instances.get(chainId + token + denomination)!
else return Contracts.getInstance(chainId, token, denomination, this.chain.provider)
}
async getProxy(): Promise<TornadoProxy> {
const chainId = await this.chain.getChainId()
return Contracts.getProxy(String(chainId), this.chain.provider)
}
async buildDepositProof(
instance: TornadoInstance,
relayerProperties: RelayerProperties,
recipientAddress: string,
zkDepositsData: ZKDepositData,
options?: Options.Core.BuildDepositProof
): Promise<Array<string>> {
return (
await this.buildDepositProofs(
instance,
relayerProperties,
[recipientAddress],
[zkDepositsData],
options
)
)[0]
}
/**
* @param instance This is the Tornado Instance which will be withdrawn from.
* @param relayerProperties The properties of the relayer that is going to be used for the withdrawals. If the service fee is 0, it is assumed that there is no relayer, but that a manual wallet withdraw is being made. These properties are included in the ZK proof.
* @param recipientAddresses The recipient addresses which should receive the withdrawals, in order.
* @param zkDepositsData These represent the public and private values, reconstructed from the deposit note, generated during the building of deposit transactions, used for building the proof of knowledge statement for withdrawal, for each withdrawal (in this context).
* @param options Numerous options which most importantly allow a user to specify whether he is buying ETH, whether to check proof data validity and finally to modulate the gas prices which will be used to calculate the gas fees paid to the relayer.
* @returns The proofs for which the user should then decide whether to use a relayer (recommended, but decide carefully which one) or use his own wallet (if needed).
*/
async buildDepositProofs(
instance: TornadoInstance,
relayerProperties: RelayerProperties,
recipientAddresses: Array<string>,
zkDepositsData: Array<ZKDepositData>,
options?: Options.Core.BuildDepositProof
): Promise<Array<Array<string>>> {
// Extract commitments and nullifier hashes
const hexCommitments: string[] = []
const hexNullifierHashes: string[] = []
const purchaseAmounts =
options?.ethPurchaseAmounts ?? new Array(zkDepositsData.length).fill(BigNumber.from(0))
if (zkDepositsData.length !== recipientAddresses.length)
throw ErrorUtils.getError(
'Core.buildDepositProofs: the number of recipients must equal the length of zkDepositsData.'
)
if (zkDepositsData.length !== purchaseAmounts.length)
throw ErrorUtils.getError(
'Core.buildDepositProofs: if purchase amounts is specified, it must equal the length of zkDepositsData.'
)
zkDepositsData.forEach((deposit) => {
hexCommitments.push(deposit.hexCommitment)
hexNullifierHashes.push(deposit.hexNullifierHash)
})
// Determine cache name
const lookupKeys = await Onchain.getInstanceLookupKeys(instance.address)
const name = 'Deposits' + (lookupKeys.network + lookupKeys.token + lookupKeys.denomination).toUpperCase()
// Find all leaves & indices by reading from cache
const [leaves, leafIndices] = await this._findLeavesAndIndices(name, hexCommitments)
const invalidCommitments: string[] = []
this.emit(
'debug',
`\nFound leaves and indices, num leaves: ${leaves.length}, indices: [${leafIndices.join(', ')}]`
)
// Determine whether we will be checking whether notes are spent
const checkSpent = options?.checkNotesSpent !== false
const spentNotes: string[] = []
this.emit('debug', `\nCheck spent notes? => ${checkSpent}`)
// If yes, immediately check it with the supplied Tornado Instance
const checkSpentArray = checkSpent ? await instance.isSpentArray(hexNullifierHashes) : undefined
if (checkSpent) this.emit('debug', `\nSpent array: [${checkSpentArray?.join(', ')}]`)
// Check whether a commitment has not been found in all deposits, meaning that it is invalid
// Also add the invalid commitments. We can do leafIndices[i] because the matched one are concatenated
// at the start
for (let i = 0, len = zkDepositsData.length; i < len; i++) {
if (!leafIndices[i]) invalidCommitments.push(hexCommitments[i])
if (checkSpent && checkSpentArray![i]) spentNotes.push(hexNullifierHashes[i])
}
// If something is wrong, throw
const commitmentsAreInvalid = invalidCommitments.length !== 0
const notesAreSpent = spentNotes.length !== 0
if (commitmentsAreInvalid || notesAreSpent)
throw ErrorUtils.getError(
`Core.buildDepositProofs: ` +
(commitmentsAreInvalid
? `following commitments are invalid:\n\n${invalidCommitments.join('\n')}\n\n`
: '') +
(notesAreSpent
? `${
commitmentsAreInvalid ? 'and ' : ''
}following notes are already spent or invalid:\n\n${spentNotes.join('\n')}\n\n`
: '')
)
// Otherwise, build the merkle tree from the leaves
const merkleTree = Primitives.buildMerkleTree({
height: options?.merkleTreeHeight ?? Constants.MERKLE_TREE_HEIGHT,
leaves: leaves
})
const root: string = BigNumber.from(merkleTree.root()).toHexString()
const checkKnownRoot: boolean = options?.checkKnownRoot ?? true
this.emit('debug', `\nMerkle root: ${root}, check known? => ${checkKnownRoot}`)
// Check whether the root is valid
if (checkKnownRoot && !(await instance.isKnownRoot(root)))
throw ErrorUtils.getError(
'Core.buildDepositProofs: the merkle tree created is not valid, something went wrong with syncing.'
)
// Rest of note invariant arguments
const inputsForProofs: InputFor.ZKProof[] = []
const gasPrice = options?.gasPrice ?? (await this.chain.getGasPrice())
const gasPriceCushion = options?.gasPrice ?? gasPrice.mul(10).div(100)
// In reality, if a manual withdraw is made, we don't differentiate it from a relayer withdraw
// Since it is only serviceFee 0 AND without a token price, the function will not buy more tokens
const serviceFeePercent = relayerProperties.serviceFeePercent ?? 0
const tokenPrice = relayerProperties.prices?.get(lookupKeys.token)
const decimals = BigNumber.from(10).pow(
options?.tokenDecimals ?? (await Onchain.getTokenDecimals(lookupKeys.network, lookupKeys.token))
)
const toWithdraw = BigNumber.from(+lookupKeys.denomination * 10 ** lookupKeys.denomination.length)
.mul(decimals)
.div(10 ** lookupKeys.denomination.length)
const native = lookupKeys.token == (await this.chain.getChainSymbol())
if (!tokenPrice && !native)
throw ErrorUtils.getError(
'Core.buildDepositProofs: a token price MUST be supplied if the token withdrawn is not native.'
)
this.emit(
'debug',
`\nProof building, invariant data: [${[
gasPrice.toString(),
gasPriceCushion.toString(),
serviceFeePercent,
tokenPrice,
decimals.toString(),
toWithdraw.toString()
].join(', ')}]\n`
)
// Compute proofs
for (let i = 0, len = zkDepositsData.length; i < len; i++) {
inputsForProofs.push({
public: {
root: root,
tree: merkleTree,
leafIndex: leafIndices[i],
hexNullifierHash: zkDepositsData[i].hexNullifierHash,
recipientAddress: recipientAddresses[i],
relayerAddress: relayerProperties.address,
fee: this._calcWithdrawalFee(
toWithdraw,
decimals,
gasPrice,
gasPriceCushion,
serviceFeePercent,
purchaseAmounts[i],
// This is our flag whether it's a token or not
native ? undefined : tokenPrice
),
// @ts-expect-error
refund: purchaseAmounts[i] ? bigInt(purchaseAmounts[i].toString()) : bigInt(0)
},
private: {
nullifier: zkDepositsData[i].nullifier,
secret: zkDepositsData[i].secret
}
})
}
return await Primitives.calcDepositProofs(inputsForProofs)
}
private _calcWithdrawalFee(
toWithdraw: BigNumber,
decimals: BigNumber,
gasPrice: BigNumber,
gasPriceCushion: BigNumber,
relayerServiceFee: number,
ethBought: BigNumber,
tokenPriceInEth?: BigNumber
): typeof bigInt {
const factor = 10 ** String(relayerServiceFee).length
const baseRelayerFee = toWithdraw.mul(BigNumber.from(relayerServiceFee * factor)).div(factor)
const txCost = gasPrice.add(gasPriceCushion).mul(5e5)
if (tokenPriceInEth) {
// @ts-expect-error
return bigInt(txCost.add(ethBought).mul(decimals).div(tokenPriceInEth).add(baseRelayerFee).toString())
}
// @ts-expect-error
else return bigInt(txCost.add(baseRelayerFee).toString())
}
/**
* @param instanceName The name of the instance as created in `_sync` function.
* @param commitments The commitments for which the leaf index values are to be noted down extra.
* @returns The result of concatenating the array of leaf indices found by matching them with the provided commitment values, followed by the array of all leaf indices, including all of the formerly mentioned values given that they are valid. Values which have not been matched, meaning probably invalid values, will be `0`.
*/
private async _findLeavesAndIndices(
instanceName: string,
commitments: Array<string>
): Promise<[Array<string>, Array<number>]> {
const indices = new Array<number>(commitments.length).fill(0)
const leaves: Array<string> = []
const cache = this.loadCache<Cache.Base<Docs.Deposit>>(instanceName)
const docs = await cache.db.allDocs()
// If no docs in cache throw and stop
if (docs.total_rows === 0) {
await cache.clear()
throw ErrorUtils.getError(
`Core.buildMerkleTree: events for instance ${instanceName} have not been synchronized.`
)
}
// Otherwise start looking for commitment leaf indices and also pick up all other leafs on the way
for (const row of docs.rows) {
const [, leafIndex, loadedCommitment] = parseIndexableString(row.id)
const index = commitments.findIndex((commitment) => commitment === loadedCommitment)
// If some commitment is found then add the leaf index and remove that commitment
if (index !== -1) {
indices[index] = leafIndex
commitments.splice(index, 1)
}
// In any case push every leaf
leaves.push(BigNumber.from(loadedCommitment).toString())
}
// Concat matched and all leaf indices
return [leaves, indices]
}
async loadNotes(
indexes?: Array<number>,
keys?: Partial<Keys.InstanceLookup>
): Promise<Array<ZKDepositData>> {
const rows = await Cache.loadContents<Docs.Note>('DepositNotes')
let docs: Array<Docs.Note | undefined> = []
let notes: Array<string> = []
if (indexes)
for (let i = 0, len = rows.length; i < len; i++) {
const [index, , ,] = parseIndexableString(rows[i].id)[0]
if (0 < indexes.findIndex(index)) docs.push(rows[i].doc)
}
else docs = rows.map((row) => row.doc)
if (keys)
docs.forEach((doc) => {
const idNetworkMatches = doc && (keys.network ? keys.network === doc?.network : true)
const andTokenSymbolMatches = idNetworkMatches && (keys.token ? keys.token === doc?.token : true)
const lastlyDenominationMatches =
andTokenSymbolMatches && (keys.denomination ? keys.denomination === doc?.denomination : true)
if (lastlyDenominationMatches && doc?.note) notes.push(doc.note)
})
else notes = docs.filter((doc) => ObjectUtils.exists(doc?.note)).map((doc) => doc!.note)
return this.parseNotes(notes)
}
parseNotes(notes: Array<string>): Array<ZKDepositData> {
return notes.map((note) => Primitives.parseNote(note))
}
parseNote(note: string): ZKDepositData {
return this.parseNotes([note])[0]
}
async createInvoice(
instance: TornadoInstance,
options?: Omit<Options.Core.Invoice, 'depositsPerInstance'>
): Promise<Transactions.Invoice> {
let opts: Options.Core.Invoice = options ?? {}
opts.depositsPerInstance = [1]
return (await this.createInvoices([instance], options))[0]
}
async createInvoices(
instances: Array<TornadoInstance>,
options?: Options.Core.Invoice
): Promise<Array<Transactions.Invoice>> {
if (!options) options = {}
if (!options.backup) options.backup = {}
options.backup.invoices = options.backup.invoices ?? true
options.backup.notes = options.backup.notes ?? true
options.doNotPopulate = options.doNotPopulate ?? true
return this.buildDepositTransactions(instances, options)
}
async buildDepositTransaction(
instance: TornadoInstance,
options?: Options.Core.Deposit
): Promise<Transactions.Deposit> {
let opts: Options.Core.Deposit = options ?? {}
opts.depositsPerInstance = [1]
return (await this.buildDepositTransactions([instance], opts))[0]
}
async buildDepositTransactions(
instances: Array<TornadoInstance>,
options?: Options.Core.Deposit
): Promise<Array<Transactions.Deposit>> {
const depositsPerInstance = options?.depositsPerInstance ?? new Array<number>(instances.length).fill(1)
const doNotPopulate = options?.doNotPopulate ?? false
const backupNotes = options?.backup?.notes ?? true
const backupInvoices = options?.backup?.invoices ?? false
if (depositsPerInstance.length != instances.length)
throw ErrorUtils.getError(
'Core.buildDepositTx: number of deposit amount elements must equal the number of instances!'
)
const notesToBackup: Array<BackupDepositDoc> = []
const invoicesToBackup: Array<BackupDepositDoc> = []
const txs: Array<Transactions.Deposit> = []
const chainId = await this.chain.getChainId()
const proxy: TornadoProxy = await Contracts.getProxy(String(chainId), this.chain.provider)
for (let i = 0, nInstances = instances.length; i < nInstances; i++) {
const lookupKeys = await Onchain.getInstanceLookupKeys(instances[i].address)
const pathstring = lookupKeys.network + lookupKeys.token + lookupKeys.denomination
for (let d = 0, nDeposits = depositsPerInstance[i]; d < nDeposits; d++) {
const deposit = Primitives.createDeposit()
const note = Primitives.createNote(deposit.preimage)
if (backupNotes)
notesToBackup.push({
network: lookupKeys.network,
denomination: lookupKeys.denomination,
token: lookupKeys.token,
note: note
})
if (backupInvoices)
invoicesToBackup.push({
network: lookupKeys.network,
denomination: lookupKeys.denomination,
token: lookupKeys.token,
invoice: deposit.hexCommitment
})
if (!doNotPopulate) {
txs.push({
request: {
to: proxy.address,
data: proxy.interface.encodeFunctionData('deposit', [
instances[i].address,
deposit.hexCommitment,
[]
]),
value: lookupKeys.token == 'eth' ? parseUnits(lookupKeys.denomination) : BigNumber.from(0)
},
note: pathstring + '_' + note,
invoice: pathstring + '_' + deposit.hexCommitment
})
} else
txs.push({
request: {},
note: pathstring + '_' + note,
invoice: pathstring + '_' + deposit.hexCommitment
})
}
}
if (backupNotes)
await this._backupDepositData(this.loadCache<Cache.Base<Docs.Note>>('DepositNotes'), notesToBackup)
if (backupInvoices)
await this._backupDepositData(
this.loadCache<Cache.Base<Docs.Invoice>>('DepositInvoices'),
invoicesToBackup
)
return txs
}
private async _backupDepositData<T extends Docs.Note | Docs.Invoice>(
cache: Cache.Base<T>,
backupData: Array<BackupDepositDoc>
): Promise<void> {
let id = +(await cache.db.info()).update_seq
await cache.db
.bulkDocs(
backupData.map((entry) => {
if (entry.note)
return new Docs.Note(++id, entry.network, entry.token, entry.denomination, entry.note)
else if (entry.invoice)
return new Docs.Invoice(++id, entry.network, entry.token, entry.denomination, entry.invoice)
}) as Array<T>
)
.catch((err) => {
throw ErrorUtils.ensureError(err)
})
// TODO: Decide whether to close caches by default or not
//await cache.close().catch((err) => {
// throw ErrorUtils.ensureError(err)
//})
}
loadDepositCache(name: string, options?: Options.Sync): DepositCache {
if (!this.caches.has(name)) {
this.caches.set(
name,
new DepositCache(
name,
options ? { adapter: options?.cacheAdapter, persistent: options?.persistentCache } : undefined
)
)
}
return this.caches.get(name) as DepositCache
}
loadWithdrawalCache(name: string, options?: Options.Sync): WithdrawalCache {
if (!this.caches.has(name)) {
this.caches.set(
name,
new WithdrawalCache(
name,
options ? { adapter: options?.cacheAdapter, persistent: options?.persistentCache } : undefined
)
)
}
return this.caches.get(name) as WithdrawalCache
}
loadCache<C extends Cache.Base<Docs.Base>>(name: string, options?: Options.Sync): C {
if (!this.caches.has(name)) {
this.caches.set(
name,
new Cache.Base(
name,
options ? { adapter: options?.cacheAdapter, persistent: options?.persistentCache } : undefined
)
)
}
return this.caches.get(name) as C
}
async syncDeposits(instance: TornadoInstance, options?: Options.Sync): Promise<void> {
const lookupKeys = await Onchain.getInstanceLookupKeys(instance.address)
const pathstring = lookupKeys.network + lookupKeys.token + lookupKeys.denomination
options = options ?? {}
options.startBlock = await Onchain.getInstanceDeployBlockNum(
lookupKeys.network,
lookupKeys.token,
lookupKeys.denomination
)
const populatedOptions = await this._populateSyncOptions(options)
const cache = this.loadDepositCache('Deposits' + pathstring.toUpperCase(), populatedOptions)
await this.sync(instance.filters.Deposit(null, null, null), instance, cache, populatedOptions)
if (!this.instances.has(pathstring)) this.instances.set(pathstring, instance)
if (!this.caches.has(cache.name)) this.caches.set(cache.name, cache)
}
async syncWithdrawals(instance: TornadoInstance, options?: Options.Sync): Promise<void> {
const lookupKeys = await Onchain.getInstanceLookupKeys(instance.address)
const pathstring = lookupKeys.network + lookupKeys.token + lookupKeys.denomination
options = options ?? {}
options.startBlock = await Onchain.getInstanceDeployBlockNum(
lookupKeys.network,
lookupKeys.token,
lookupKeys.denomination
)
const populatedOptions = await this._populateSyncOptions(options)
const cache = this.loadWithdrawalCache('Withdrawals' + pathstring.toUpperCase(), populatedOptions)
await this.sync(instance.filters.Withdrawal(null, null, null), instance, cache, populatedOptions)
if (!this.instances.has(pathstring)) this.instances.set(pathstring, instance)
if (!this.caches.has(cache.name)) this.caches.set(cache.name, cache)
}
protected async _populateSyncOptions(options: Options.Sync): Promise<DeepRequired<Options.Sync>> {
if (!options.startBlock) throw ErrorUtils.getError('Core._populateSyncOptions: startBlock not set.')
options.targetBlock = options.targetBlock ?? (await this.chain.latestBlockNum())
options.blockDivisor = options.blockDivisor ?? 40
options.blockDelta = Math.floor((options.targetBlock - options.startBlock) / options.blockDivisor)
options.concurrencyLimit = options.concurrencyLimit ?? 8
options.msTimeout = options.msTimeout ?? 200 // 5 requests per second
options.persistentCache = options.persistentCache ?? true
options.cacheAdapter = options.cacheAdapter ?? 'leveldb'
options.listenForEvents = options.listenForEvents ?? false
return options as DeepRequired<Options.Sync>
}
}