diff --git a/abis/proxyLightABI.json b/abis/proxyLightABI.json new file mode 100644 index 0000000..eea628c --- /dev/null +++ b/abis/proxyLightABI.json @@ -0,0 +1,105 @@ +[ + { + "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": "bytes[]", + "name": "_encryptedNotes", + "type": "bytes[]" + } + ], + "name": "backupNotes", + "outputs": [], + "stateMutability": "nonpayable", + "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": "_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" + } +] diff --git a/contracts/MiningAbi.ts b/contracts/MiningAbi.ts index 129bf01..b4b67db 100644 --- a/contracts/MiningAbi.ts +++ b/contracts/MiningAbi.ts @@ -173,6 +173,8 @@ export declare namespace Miner { } export interface MiningAbiInterface extends utils.Interface { + contractName: "MiningAbi"; + functions: { "ACCOUNT_ROOT_HISTORY_SIZE()": FunctionFragment; "accountCount()": FunctionFragment; @@ -540,6 +542,8 @@ export type WithdrawalDataEvent = TypedEvent< export type WithdrawalDataEventFilter = TypedEventFilter; export interface MiningAbi extends BaseContract { + contractName: "MiningAbi"; + connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; diff --git a/contracts/MulticallAbi.ts b/contracts/MulticallAbi.ts index 74e73c1..0a6f585 100644 --- a/contracts/MulticallAbi.ts +++ b/contracts/MulticallAbi.ts @@ -9,15 +9,15 @@ import type { PopulatedTransaction, Signer, utils, -} from 'ethers'; -import type { FunctionFragment, Result } from '@ethersproject/abi'; -import type { Listener, Provider } from '@ethersproject/providers'; +} from "ethers"; +import type { FunctionFragment, Result } from "@ethersproject/abi"; +import type { Listener, Provider } from "@ethersproject/providers"; import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, -} from './common'; +} from "./common"; export declare namespace MultiCall { export type CallStruct = { to: string; data: BytesLike }; @@ -29,27 +29,29 @@ export declare namespace MultiCall { } export interface MulticallAbiInterface extends utils.Interface { + contractName: "MulticallAbi"; + functions: { - 'multicall((address,bytes)[])': FunctionFragment; + "multicall((address,bytes)[])": FunctionFragment; }; - getFunction(nameOrSignatureOrTopic: 'multicall'): FunctionFragment; + getFunction(nameOrSignatureOrTopic: "multicall"): FunctionFragment; encodeFunctionData( - functionFragment: 'multicall', - values: [MultiCall.CallStruct[]], + functionFragment: "multicall", + values: [MultiCall.CallStruct[]] ): string; - decodeFunctionResult(functionFragment: 'multicall', data: BytesLike): Result; + decodeFunctionResult(functionFragment: "multicall", data: BytesLike): Result; events: {}; } export interface MulticallAbi extends BaseContract { + contractName: "MulticallAbi"; + connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; interface: MulticallAbiInterface; @@ -57,21 +59,17 @@ export interface MulticallAbi extends BaseContract { queryFilter( event: TypedEventFilter, fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, + toBlock?: string | number | undefined ): Promise>; listeners( - eventFilter?: TypedEventFilter, + eventFilter?: TypedEventFilter ): Array>; - listeners(eventName?: string): Array; - removeAllListeners( - eventFilter: TypedEventFilter, + eventFilter: TypedEventFilter ): this; - removeAllListeners(eventName?: string): this; - off: OnEvent; on: OnEvent; once: OnEvent; @@ -80,20 +78,24 @@ export interface MulticallAbi extends BaseContract { functions: { multicall( calls: MultiCall.CallStruct[], - overrides?: CallOverrides, - ): Promise<[string[], boolean[]] & { results: string[]; success: boolean[] }>; + overrides?: CallOverrides + ): Promise< + [string[], boolean[]] & { results: string[]; success: boolean[] } + >; }; multicall( calls: MultiCall.CallStruct[], - overrides?: CallOverrides, + overrides?: CallOverrides ): Promise<[string[], boolean[]] & { results: string[]; success: boolean[] }>; callStatic: { multicall( calls: MultiCall.CallStruct[], - overrides?: CallOverrides, - ): Promise<[string[], boolean[]] & { results: string[]; success: boolean[] }>; + overrides?: CallOverrides + ): Promise< + [string[], boolean[]] & { results: string[]; success: boolean[] } + >; }; filters: {}; @@ -101,14 +103,14 @@ export interface MulticallAbi extends BaseContract { estimateGas: { multicall( calls: MultiCall.CallStruct[], - overrides?: CallOverrides, + overrides?: CallOverrides ): Promise; }; populateTransaction: { multicall( calls: MultiCall.CallStruct[], - overrides?: CallOverrides, + overrides?: CallOverrides ): Promise; }; } diff --git a/contracts/OffchainOracleAbi.ts b/contracts/OffchainOracleAbi.ts index bb59111..46673a5 100644 --- a/contracts/OffchainOracleAbi.ts +++ b/contracts/OffchainOracleAbi.ts @@ -27,6 +27,8 @@ import type { } from "./common"; export interface OffchainOracleAbiInterface extends utils.Interface { + contractName: "OffchainOracleAbi"; + functions: { "addConnector(address)": FunctionFragment; "addOracle(address,uint8)": FunctionFragment; @@ -64,56 +66,44 @@ export interface OffchainOracleAbiInterface extends utils.Interface { functionFragment: "addConnector", values: [string] ): string; - encodeFunctionData( functionFragment: "addOracle", values: [string, BigNumberish] ): string; - encodeFunctionData( functionFragment: "connectors", values?: undefined ): string; - encodeFunctionData( functionFragment: "getRate", values: [string, string, boolean] ): string; - encodeFunctionData( functionFragment: "getRateToEth", values: [string, boolean] ): string; - encodeFunctionData( functionFragment: "multiWrapper", values?: undefined ): string; - encodeFunctionData(functionFragment: "oracles", values?: undefined): string; - encodeFunctionData(functionFragment: "owner", values?: undefined): string; - encodeFunctionData( functionFragment: "removeConnector", values: [string] ): string; - encodeFunctionData( functionFragment: "removeOracle", values: [string, BigNumberish] ): string; - encodeFunctionData( functionFragment: "renounceOwnership", values?: undefined ): string; - encodeFunctionData( functionFragment: "setMultiWrapper", values: [string] ): string; - encodeFunctionData( functionFragment: "transferOwnership", values: [string] @@ -123,47 +113,35 @@ export interface OffchainOracleAbiInterface extends utils.Interface { functionFragment: "addConnector", data: BytesLike ): Result; - decodeFunctionResult(functionFragment: "addOracle", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "connectors", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "getRate", data: BytesLike): Result; - decodeFunctionResult( functionFragment: "getRateToEth", data: BytesLike ): Result; - decodeFunctionResult( functionFragment: "multiWrapper", data: BytesLike ): Result; - decodeFunctionResult(functionFragment: "oracles", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; - decodeFunctionResult( functionFragment: "removeConnector", data: BytesLike ): Result; - decodeFunctionResult( functionFragment: "removeOracle", data: BytesLike ): Result; - decodeFunctionResult( functionFragment: "renounceOwnership", data: BytesLike ): Result; - decodeFunctionResult( functionFragment: "setMultiWrapper", data: BytesLike ): Result; - decodeFunctionResult( functionFragment: "transferOwnership", data: BytesLike @@ -179,33 +157,30 @@ export interface OffchainOracleAbiInterface extends utils.Interface { }; getEvent(nameOrSignatureOrTopic: "ConnectorAdded"): EventFragment; - getEvent(nameOrSignatureOrTopic: "ConnectorRemoved"): EventFragment; - getEvent(nameOrSignatureOrTopic: "MultiWrapperUpdated"): EventFragment; - getEvent(nameOrSignatureOrTopic: "OracleAdded"): EventFragment; - getEvent(nameOrSignatureOrTopic: "OracleRemoved"): EventFragment; - getEvent(nameOrSignatureOrTopic: "OwnershipTransferred"): EventFragment; } export interface ConnectorAddedEventObject { connector: string; } - -export type ConnectorAddedEvent = TypedEvent<[string], - ConnectorAddedEventObject>; +export type ConnectorAddedEvent = TypedEvent< + [string], + ConnectorAddedEventObject +>; export type ConnectorAddedEventFilter = TypedEventFilter; export interface ConnectorRemovedEventObject { connector: string; } - -export type ConnectorRemovedEvent = TypedEvent<[string], - ConnectorRemovedEventObject>; +export type ConnectorRemovedEvent = TypedEvent< + [string], + ConnectorRemovedEventObject +>; export type ConnectorRemovedEventFilter = TypedEventFilter; @@ -213,9 +188,10 @@ export type ConnectorRemovedEventFilter = export interface MultiWrapperUpdatedEventObject { multiWrapper: string; } - -export type MultiWrapperUpdatedEvent = TypedEvent<[string], - MultiWrapperUpdatedEventObject>; +export type MultiWrapperUpdatedEvent = TypedEvent< + [string], + MultiWrapperUpdatedEventObject +>; export type MultiWrapperUpdatedEventFilter = TypedEventFilter; @@ -224,9 +200,10 @@ export interface OracleAddedEventObject { oracle: string; oracleType: number; } - -export type OracleAddedEvent = TypedEvent<[string, number], - OracleAddedEventObject>; +export type OracleAddedEvent = TypedEvent< + [string, number], + OracleAddedEventObject +>; export type OracleAddedEventFilter = TypedEventFilter; @@ -234,9 +211,10 @@ export interface OracleRemovedEventObject { oracle: string; oracleType: number; } - -export type OracleRemovedEvent = TypedEvent<[string, number], - OracleRemovedEventObject>; +export type OracleRemovedEvent = TypedEvent< + [string, number], + OracleRemovedEventObject +>; export type OracleRemovedEventFilter = TypedEventFilter; @@ -244,18 +222,19 @@ export interface OwnershipTransferredEventObject { previousOwner: string; newOwner: string; } - -export type OwnershipTransferredEvent = TypedEvent<[string, string], - OwnershipTransferredEventObject>; +export type OwnershipTransferredEvent = TypedEvent< + [string, string], + OwnershipTransferredEventObject +>; export type OwnershipTransferredEventFilter = TypedEventFilter; export interface OffchainOracleAbi extends BaseContract { + contractName: "OffchainOracleAbi"; + connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; interface: OffchainOracleAbiInterface; @@ -269,15 +248,11 @@ export interface OffchainOracleAbi extends BaseContract { listeners( eventFilter?: TypedEventFilter ): Array>; - listeners(eventName?: string): Array; - removeAllListeners( eventFilter: TypedEventFilter ): this; - removeAllListeners(eventName?: string): this; - off: OnEvent; on: OnEvent; once: OnEvent; @@ -316,7 +291,9 @@ export interface OffchainOracleAbi extends BaseContract { oracles( overrides?: CallOverrides - ): Promise<[string[], number[]] & { allOracles: string[]; oracleTypes: number[] }>; + ): Promise< + [string[], number[]] & { allOracles: string[]; oracleTypes: number[] } + >; owner(overrides?: CallOverrides): Promise<[string]>; @@ -376,7 +353,9 @@ export interface OffchainOracleAbi extends BaseContract { oracles( overrides?: CallOverrides - ): Promise<[string[], number[]] & { allOracles: string[]; oracleTypes: number[] }>; + ): Promise< + [string[], number[]] & { allOracles: string[]; oracleTypes: number[] } + >; owner(overrides?: CallOverrides): Promise; @@ -433,7 +412,9 @@ export interface OffchainOracleAbi extends BaseContract { oracles( overrides?: CallOverrides - ): Promise<[string[], number[]] & { allOracles: string[]; oracleTypes: number[] }>; + ): Promise< + [string[], number[]] & { allOracles: string[]; oracleTypes: number[] } + >; owner(overrides?: CallOverrides): Promise; diff --git a/contracts/TornadoABI.ts b/contracts/TornadoABI.ts index 76b8f4a..7afe41a 100644 --- a/contracts/TornadoABI.ts +++ b/contracts/TornadoABI.ts @@ -28,6 +28,8 @@ import type { } from "./common"; export interface TornadoABIInterface extends utils.Interface { + contractName: "TornadoABI"; + functions: { "changeOperator(address)": FunctionFragment; "nullifierHashes(bytes32)": FunctionFragment; @@ -243,6 +245,8 @@ export type WithdrawalEvent = TypedEvent< export type WithdrawalEventFilter = TypedEventFilter; export interface TornadoABI extends BaseContract { + contractName: "TornadoABI"; + connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; diff --git a/contracts/TornadoProxyABI.ts b/contracts/TornadoProxyABI.ts index f7e87e7..f5edca3 100644 --- a/contracts/TornadoProxyABI.ts +++ b/contracts/TornadoProxyABI.ts @@ -24,6 +24,8 @@ import type { } from "./common"; export interface TornadoProxyABIInterface extends utils.Interface { + contractName: "TornadoProxyABI"; + functions: { "governance()": FunctionFragment; "instances(address)": FunctionFragment; @@ -95,6 +97,8 @@ export interface TornadoProxyABIInterface extends utils.Interface { } export interface TornadoProxyABI extends BaseContract { + contractName: "TornadoProxyABI"; + connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; diff --git a/contracts/factories/MulticallAbi__factory.ts b/contracts/factories/MulticallAbi__factory.ts index 318f2bb..788746a 100644 --- a/contracts/factories/MulticallAbi__factory.ts +++ b/contracts/factories/MulticallAbi__factory.ts @@ -2,9 +2,9 @@ /* tslint:disable */ /* eslint-disable */ -import { Contract, Signer, utils } from 'ethers'; -import type { Provider } from '@ethersproject/providers'; -import type { MulticallAbi, MulticallAbiInterface } from '../MulticallAbi'; +import { Contract, Signer, utils } from "ethers"; +import type { Provider } from "@ethersproject/providers"; +import type { MulticallAbi, MulticallAbiInterface } from "../MulticallAbi"; const _abi = [ { @@ -12,49 +12,47 @@ const _abi = [ { components: [ { - internalType: 'address', - name: 'to', - type: 'address', + internalType: "address", + name: "to", + type: "address", }, { - internalType: 'bytes', - name: 'data', - type: 'bytes', + internalType: "bytes", + name: "data", + type: "bytes", }, ], - internalType: 'struct MultiCall.Call[]', - name: 'calls', - type: 'tuple[]', + internalType: "struct MultiCall.Call[]", + name: "calls", + type: "tuple[]", }, ], - name: 'multicall', + name: "multicall", outputs: [ { - internalType: 'bytes[]', - name: 'results', - type: 'bytes[]', + internalType: "bytes[]", + name: "results", + type: "bytes[]", }, { - internalType: 'bool[]', - name: 'success', - type: 'bool[]', + internalType: "bool[]", + name: "success", + type: "bool[]", }, ], - stateMutability: 'view', - type: 'function', + stateMutability: "view", + type: "function", }, ]; export class MulticallAbi__factory { static readonly abi = _abi; - static createInterface(): MulticallAbiInterface { return new utils.Interface(_abi) as MulticallAbiInterface; } - static connect( address: string, - signerOrProvider: Signer | Provider, + signerOrProvider: Signer | Provider ): MulticallAbi { return new Contract(address, _abi, signerOrProvider) as MulticallAbi; } diff --git a/contracts/factories/index.ts b/contracts/factories/index.ts index 3e7dbd3..d932b5e 100644 --- a/contracts/factories/index.ts +++ b/contracts/factories/index.ts @@ -1,10 +1,11 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -export { AggregatorAbi__factory } from './AggregatorAbi__factory'; -export { MulticallAbi__factory } from './MulticallAbi__factory'; -export { OffchainOracleAbi__factory } from './OffchainOracleAbi__factory'; -export { MiningAbi__factory } from './MiningAbi__factory'; -export { SwapAbi__factory } from './SwapAbi__factory'; -export { TornadoABI__factory } from './TornadoABI__factory'; -export { TornadoProxyABI__factory } from './TornadoProxyABI__factory'; +export { AggregatorAbi__factory } from "./AggregatorAbi__factory"; +export { MulticallAbi__factory } from "./MulticallAbi__factory"; +export { OffchainOracleAbi__factory } from "./OffchainOracleAbi__factory"; +export { MiningAbi__factory } from "./MiningAbi__factory"; +export { ProxyLightABI__factory } from "./ProxyLightABI__factory"; +export { SwapAbi__factory } from "./SwapAbi__factory"; +export { TornadoABI__factory } from "./TornadoABI__factory"; +export { TornadoProxyABI__factory } from "./TornadoProxyABI__factory"; diff --git a/contracts/index.ts b/contracts/index.ts index c019d30..fbb2853 100644 --- a/contracts/index.ts +++ b/contracts/index.ts @@ -1,18 +1,20 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -export type { AggregatorAbi } from './AggregatorAbi'; -export type { MulticallAbi } from './MulticallAbi'; -export type { OffchainOracleAbi } from './OffchainOracleAbi'; -export type { MiningAbi } from './MiningAbi'; -export type { SwapAbi } from './SwapAbi'; -export type { TornadoABI } from './TornadoABI'; -export type { TornadoProxyABI } from './TornadoProxyABI'; -export * as factories from './factories'; -export { AggregatorAbi__factory } from './factories/AggregatorAbi__factory'; -export { MiningAbi__factory } from './factories/MiningAbi__factory'; -export { MulticallAbi__factory } from './factories/MulticallAbi__factory'; -export { OffchainOracleAbi__factory } from './factories/OffchainOracleAbi__factory'; -export { SwapAbi__factory } from './factories/SwapAbi__factory'; -export { TornadoABI__factory } from './factories/TornadoABI__factory'; -export { TornadoProxyABI__factory } from './factories/TornadoProxyABI__factory'; +export type { AggregatorAbi } from "./AggregatorAbi"; +export type { MulticallAbi } from "./MulticallAbi"; +export type { OffchainOracleAbi } from "./OffchainOracleAbi"; +export type { MiningAbi } from "./MiningAbi"; +export type { ProxyLightABI } from "./ProxyLightABI"; +export type { SwapAbi } from "./SwapAbi"; +export type { TornadoABI } from "./TornadoABI"; +export type { TornadoProxyABI } from "./TornadoProxyABI"; +export * as factories from "./factories"; +export { AggregatorAbi__factory } from "./factories/AggregatorAbi__factory"; +export { MiningAbi__factory } from "./factories/MiningAbi__factory"; +export { MulticallAbi__factory } from "./factories/MulticallAbi__factory"; +export { OffchainOracleAbi__factory } from "./factories/OffchainOracleAbi__factory"; +export { ProxyLightABI__factory } from "./factories/ProxyLightABI__factory"; +export { SwapAbi__factory } from "./factories/SwapAbi__factory"; +export { TornadoABI__factory } from "./factories/TornadoABI__factory"; +export { TornadoProxyABI__factory } from "./factories/TornadoProxyABI__factory"; diff --git a/src/modules/contracts.ts b/src/modules/contracts.ts index af0b8a5..40dc995 100644 --- a/src/modules/contracts.ts +++ b/src/modules/contracts.ts @@ -1,29 +1,23 @@ import { AggregatorAbi__factory, - MiningAbi__factory, MulticallAbi__factory, - OffchainOracleAbi__factory, + OffchainOracleAbi__factory, ProxyLightABI__factory, TornadoProxyABI__factory, } from '../../contracts'; import { providers } from 'ethers'; -import { - aggregatorAddress, - httpRpcUrl, - multiCallAddress, - netId, - offchainOracleAddress, - tornadoMiningAddress, - tornadoProxyAddress, -} from '../config'; +import { aggregatorAddress, httpRpcUrl, multiCallAddress, netId, offchainOracleAddress } from '../config'; +import { configService } from '../services'; export function getProvider() { return new providers.StaticJsonRpcProvider(httpRpcUrl, netId); } export const getTornadoProxyContract = () => { - return TornadoProxyABI__factory.connect(tornadoProxyAddress, getProvider()); + return TornadoProxyABI__factory.connect(configService.proxyAddress, getProvider()); +}; +export const getTornadoProxyLightContract = () => { + return ProxyLightABI__factory.connect(configService.proxyAddress, getProvider()); }; - export const getAggregatorContract = () => { return AggregatorAbi__factory.connect(aggregatorAddress, getProvider()); }; @@ -35,6 +29,3 @@ export const getOffchainOracleContract = () => { export const getMultiCallContract = () => { return MulticallAbi__factory.connect(multiCallAddress, getProvider()); }; -export const getTornadoMiningContract = () => { - return MiningAbi__factory.connect(tornadoMiningAddress, getProvider()); -};