diff --git a/.gitignore b/.gitignore index 8f8d464..9957b15 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ pids *.pid.lock # Directory for instrumented libs generated by jscoverage/JSCover -lib lib-cov # Coverage directory used by tools like istanbul diff --git a/lib/constants.d.ts b/lib/constants.d.ts new file mode 100644 index 0000000..07a8e7d --- /dev/null +++ b/lib/constants.d.ts @@ -0,0 +1,14 @@ +export declare enum ChainId { + MAINNET = 1, + BSC = 56, + XDAI = 100, + POLYGON = 137, + OPTIMISM = 10, + ARBITRUM = 42161, + AVAX = 43114, + SEPOLIA = 11155111 +} +export type ChainIdType = ChainId | number; +export declare const ENS_CHAINS: ChainId[]; +export declare const multiCallAddress = "0xcA11bde05977b3631167028862bE2a173976CA11"; +export declare const POLYGON_GAS_STATION = "https://gasstation.polygon.technology/v2"; diff --git a/lib/constants.js b/lib/constants.js new file mode 100644 index 0000000..4c3d7d4 --- /dev/null +++ b/lib/constants.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.POLYGON_GAS_STATION = exports.multiCallAddress = exports.ENS_CHAINS = exports.ChainId = void 0; +var ChainId; +(function (ChainId) { + ChainId[ChainId["MAINNET"] = 1] = "MAINNET"; + ChainId[ChainId["BSC"] = 56] = "BSC"; + ChainId[ChainId["XDAI"] = 100] = "XDAI"; + ChainId[ChainId["POLYGON"] = 137] = "POLYGON"; + ChainId[ChainId["OPTIMISM"] = 10] = "OPTIMISM"; + ChainId[ChainId["ARBITRUM"] = 42161] = "ARBITRUM"; + ChainId[ChainId["AVAX"] = 43114] = "AVAX"; + ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA"; +})(ChainId || (exports.ChainId = ChainId = {})); +exports.ENS_CHAINS = [ChainId.MAINNET, ChainId.SEPOLIA]; +exports.multiCallAddress = '0xcA11bde05977b3631167028862bE2a173976CA11'; +exports.POLYGON_GAS_STATION = 'https://gasstation.polygon.technology/v2'; +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/constants.js.map b/lib/constants.js.map new file mode 100644 index 0000000..517d8bb --- /dev/null +++ b/lib/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA,IAAY,OASX;AATD,WAAY,OAAO;IACjB,2CAAW,CAAA;IACX,oCAAQ,CAAA;IACR,uCAAU,CAAA;IACV,6CAAa,CAAA;IACb,8CAAa,CAAA;IACb,iDAAgB,CAAA;IAChB,yCAAY,CAAA;IACZ,kDAAkB,CAAA;AACpB,CAAC,EATW,OAAO,uBAAP,OAAO,QASlB;AAIY,QAAA,UAAU,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;AAEhD,QAAA,gBAAgB,GAAG,4CAA4C,CAAC;AAEhE,QAAA,mBAAmB,GAAG,0CAA0C,CAAC"} \ No newline at end of file diff --git a/lib/contracts/GasPriceOracle.d.ts b/lib/contracts/GasPriceOracle.d.ts new file mode 100644 index 0000000..0ff65c8 --- /dev/null +++ b/lib/contracts/GasPriceOracle.d.ts @@ -0,0 +1,101 @@ +import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers"; +import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedListener, TypedContractMethod } from "./common"; +export interface GasPriceOracleInterface extends Interface { + getFunction(nameOrSignature: "GAS_UNIT" | "changeDerivationThresold" | "changeGasUnit" | "changeHeartbeat" | "changeOwnership" | "derivationThresold" | "gasPrice" | "heartbeat" | "maxFeePerGas" | "maxPriorityFeePerGas" | "owner" | "pastGasPrice" | "setGasPrice" | "timestamp"): FunctionFragment; + encodeFunctionData(functionFragment: "GAS_UNIT", values?: undefined): string; + encodeFunctionData(functionFragment: "changeDerivationThresold", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "changeGasUnit", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "changeHeartbeat", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "changeOwnership", values: [AddressLike]): string; + encodeFunctionData(functionFragment: "derivationThresold", values?: undefined): string; + encodeFunctionData(functionFragment: "gasPrice", values?: undefined): string; + encodeFunctionData(functionFragment: "heartbeat", values?: undefined): string; + encodeFunctionData(functionFragment: "maxFeePerGas", values?: undefined): string; + encodeFunctionData(functionFragment: "maxPriorityFeePerGas", values?: undefined): string; + encodeFunctionData(functionFragment: "owner", values?: undefined): string; + encodeFunctionData(functionFragment: "pastGasPrice", values?: undefined): string; + encodeFunctionData(functionFragment: "setGasPrice", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "timestamp", values?: undefined): string; + decodeFunctionResult(functionFragment: "GAS_UNIT", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "changeDerivationThresold", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "changeGasUnit", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "changeHeartbeat", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "changeOwnership", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "derivationThresold", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "gasPrice", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "heartbeat", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "maxFeePerGas", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "maxPriorityFeePerGas", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "pastGasPrice", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setGasPrice", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "timestamp", data: BytesLike): Result; +} +export interface GasPriceOracle extends BaseContract { + connect(runner?: ContractRunner | null): GasPriceOracle; + waitForDeployment(): Promise; + interface: GasPriceOracleInterface; + queryFilter(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; + queryFilter(filter: TypedDeferredTopicFilter, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; + on(event: TCEvent, listener: TypedListener): Promise; + on(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; + once(event: TCEvent, listener: TypedListener): Promise; + once(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; + listeners(event: TCEvent): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners(event?: TCEvent): Promise; + GAS_UNIT: TypedContractMethod<[], [bigint], "view">; + changeDerivationThresold: TypedContractMethod<[ + _derivationThresold: BigNumberish + ], [ + void + ], "nonpayable">; + changeGasUnit: TypedContractMethod<[ + _gasUnit: BigNumberish + ], [ + void + ], "nonpayable">; + changeHeartbeat: TypedContractMethod<[ + _heartbeat: BigNumberish + ], [ + void + ], "nonpayable">; + changeOwnership: TypedContractMethod<[ + _owner: AddressLike + ], [ + void + ], "nonpayable">; + derivationThresold: TypedContractMethod<[], [bigint], "view">; + gasPrice: TypedContractMethod<[], [bigint], "view">; + heartbeat: TypedContractMethod<[], [bigint], "view">; + maxFeePerGas: TypedContractMethod<[], [bigint], "view">; + maxPriorityFeePerGas: TypedContractMethod<[], [bigint], "view">; + owner: TypedContractMethod<[], [string], "view">; + pastGasPrice: TypedContractMethod<[], [bigint], "view">; + setGasPrice: TypedContractMethod<[ + _gasPrice: BigNumberish + ], [ + void + ], "nonpayable">; + timestamp: TypedContractMethod<[], [bigint], "view">; + getFunction(key: string | FunctionFragment): T; + getFunction(nameOrSignature: "GAS_UNIT"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "changeDerivationThresold"): TypedContractMethod<[ + _derivationThresold: BigNumberish + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "changeGasUnit"): TypedContractMethod<[_gasUnit: BigNumberish], [void], "nonpayable">; + getFunction(nameOrSignature: "changeHeartbeat"): TypedContractMethod<[_heartbeat: BigNumberish], [void], "nonpayable">; + getFunction(nameOrSignature: "changeOwnership"): TypedContractMethod<[_owner: AddressLike], [void], "nonpayable">; + getFunction(nameOrSignature: "derivationThresold"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "gasPrice"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "heartbeat"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "maxFeePerGas"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "maxPriorityFeePerGas"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "owner"): TypedContractMethod<[], [string], "view">; + getFunction(nameOrSignature: "pastGasPrice"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "setGasPrice"): TypedContractMethod<[_gasPrice: BigNumberish], [void], "nonpayable">; + getFunction(nameOrSignature: "timestamp"): TypedContractMethod<[], [bigint], "view">; + filters: {}; +} diff --git a/lib/contracts/GasPriceOracle.js b/lib/contracts/GasPriceOracle.js new file mode 100644 index 0000000..8f67172 --- /dev/null +++ b/lib/contracts/GasPriceOracle.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=GasPriceOracle.js.map \ No newline at end of file diff --git a/lib/contracts/GasPriceOracle.js.map b/lib/contracts/GasPriceOracle.js.map new file mode 100644 index 0000000..ccfef05 --- /dev/null +++ b/lib/contracts/GasPriceOracle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GasPriceOracle.js","sourceRoot":"","sources":["../../src/contracts/GasPriceOracle.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib/contracts/Multicall.d.ts b/lib/contracts/Multicall.d.ts new file mode 100644 index 0000000..e1bfd18 --- /dev/null +++ b/lib/contracts/Multicall.d.ts @@ -0,0 +1,228 @@ +import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers"; +import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedListener, TypedContractMethod } from "./common"; +export declare namespace Multicall3 { + type CallStruct = { + target: AddressLike; + callData: BytesLike; + }; + type CallStructOutput = [target: string, callData: string] & { + target: string; + callData: string; + }; + type Call3Struct = { + target: AddressLike; + allowFailure: boolean; + callData: BytesLike; + }; + type Call3StructOutput = [ + target: string, + allowFailure: boolean, + callData: string + ] & { + target: string; + allowFailure: boolean; + callData: string; + }; + type ResultStruct = { + success: boolean; + returnData: BytesLike; + }; + type ResultStructOutput = [success: boolean, returnData: string] & { + success: boolean; + returnData: string; + }; + type Call3ValueStruct = { + target: AddressLike; + allowFailure: boolean; + value: BigNumberish; + callData: BytesLike; + }; + type Call3ValueStructOutput = [ + target: string, + allowFailure: boolean, + value: bigint, + callData: string + ] & { + target: string; + allowFailure: boolean; + value: bigint; + callData: string; + }; +} +export interface MulticallInterface extends Interface { + getFunction(nameOrSignature: "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: [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: [AddressLike]): string; + encodeFunctionData(functionFragment: "getLastBlockHash", values?: undefined): string; + encodeFunctionData(functionFragment: "tryAggregate", values: [boolean, Multicall3.CallStruct[]]): string; + encodeFunctionData(functionFragment: "tryBlockAndAggregate", values: [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; +} +export interface Multicall extends BaseContract { + connect(runner?: ContractRunner | null): Multicall; + waitForDeployment(): Promise; + interface: MulticallInterface; + queryFilter(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; + queryFilter(filter: TypedDeferredTopicFilter, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; + on(event: TCEvent, listener: TypedListener): Promise; + on(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; + once(event: TCEvent, listener: TypedListener): Promise; + once(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; + listeners(event: TCEvent): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners(event?: TCEvent): Promise; + aggregate: TypedContractMethod<[ + calls: Multicall3.CallStruct[] + ], [ + [bigint, string[]] & { + blockNumber: bigint; + returnData: string[]; + } + ], "payable">; + aggregate3: TypedContractMethod<[ + calls: Multicall3.Call3Struct[] + ], [ + Multicall3.ResultStructOutput[] + ], "payable">; + aggregate3Value: TypedContractMethod<[ + calls: Multicall3.Call3ValueStruct[] + ], [ + Multicall3.ResultStructOutput[] + ], "payable">; + blockAndAggregate: TypedContractMethod<[ + calls: Multicall3.CallStruct[] + ], [ + [ + bigint, + string, + Multicall3.ResultStructOutput[] + ] & { + blockNumber: bigint; + blockHash: string; + returnData: Multicall3.ResultStructOutput[]; + } + ], "payable">; + getBasefee: TypedContractMethod<[], [bigint], "view">; + getBlockHash: TypedContractMethod<[ + blockNumber: BigNumberish + ], [ + string + ], "view">; + getBlockNumber: TypedContractMethod<[], [bigint], "view">; + getChainId: TypedContractMethod<[], [bigint], "view">; + getCurrentBlockCoinbase: TypedContractMethod<[], [string], "view">; + getCurrentBlockDifficulty: TypedContractMethod<[], [bigint], "view">; + getCurrentBlockGasLimit: TypedContractMethod<[], [bigint], "view">; + getCurrentBlockTimestamp: TypedContractMethod<[], [bigint], "view">; + getEthBalance: TypedContractMethod<[addr: AddressLike], [bigint], "view">; + getLastBlockHash: TypedContractMethod<[], [string], "view">; + tryAggregate: TypedContractMethod<[ + requireSuccess: boolean, + calls: Multicall3.CallStruct[] + ], [ + Multicall3.ResultStructOutput[] + ], "payable">; + tryBlockAndAggregate: TypedContractMethod<[ + requireSuccess: boolean, + calls: Multicall3.CallStruct[] + ], [ + [ + bigint, + string, + Multicall3.ResultStructOutput[] + ] & { + blockNumber: bigint; + blockHash: string; + returnData: Multicall3.ResultStructOutput[]; + } + ], "payable">; + getFunction(key: string | FunctionFragment): T; + getFunction(nameOrSignature: "aggregate"): TypedContractMethod<[ + calls: Multicall3.CallStruct[] + ], [ + [bigint, string[]] & { + blockNumber: bigint; + returnData: string[]; + } + ], "payable">; + getFunction(nameOrSignature: "aggregate3"): TypedContractMethod<[ + calls: Multicall3.Call3Struct[] + ], [ + Multicall3.ResultStructOutput[] + ], "payable">; + getFunction(nameOrSignature: "aggregate3Value"): TypedContractMethod<[ + calls: Multicall3.Call3ValueStruct[] + ], [ + Multicall3.ResultStructOutput[] + ], "payable">; + getFunction(nameOrSignature: "blockAndAggregate"): TypedContractMethod<[ + calls: Multicall3.CallStruct[] + ], [ + [ + bigint, + string, + Multicall3.ResultStructOutput[] + ] & { + blockNumber: bigint; + blockHash: string; + returnData: Multicall3.ResultStructOutput[]; + } + ], "payable">; + getFunction(nameOrSignature: "getBasefee"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "getBlockHash"): TypedContractMethod<[blockNumber: BigNumberish], [string], "view">; + getFunction(nameOrSignature: "getBlockNumber"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "getChainId"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "getCurrentBlockCoinbase"): TypedContractMethod<[], [string], "view">; + getFunction(nameOrSignature: "getCurrentBlockDifficulty"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "getCurrentBlockGasLimit"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "getCurrentBlockTimestamp"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "getEthBalance"): TypedContractMethod<[addr: AddressLike], [bigint], "view">; + getFunction(nameOrSignature: "getLastBlockHash"): TypedContractMethod<[], [string], "view">; + getFunction(nameOrSignature: "tryAggregate"): TypedContractMethod<[ + requireSuccess: boolean, + calls: Multicall3.CallStruct[] + ], [ + Multicall3.ResultStructOutput[] + ], "payable">; + getFunction(nameOrSignature: "tryBlockAndAggregate"): TypedContractMethod<[ + requireSuccess: boolean, + calls: Multicall3.CallStruct[] + ], [ + [ + bigint, + string, + Multicall3.ResultStructOutput[] + ] & { + blockNumber: bigint; + blockHash: string; + returnData: Multicall3.ResultStructOutput[]; + } + ], "payable">; + filters: {}; +} diff --git a/lib/contracts/Multicall.js b/lib/contracts/Multicall.js new file mode 100644 index 0000000..23aeaeb --- /dev/null +++ b/lib/contracts/Multicall.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Multicall.js.map \ No newline at end of file diff --git a/lib/contracts/Multicall.js.map b/lib/contracts/Multicall.js.map new file mode 100644 index 0000000..3bc5930 --- /dev/null +++ b/lib/contracts/Multicall.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Multicall.js","sourceRoot":"","sources":["../../src/contracts/Multicall.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib/contracts/OffchainOracle.d.ts b/lib/contracts/OffchainOracle.d.ts new file mode 100644 index 0000000..853f317 --- /dev/null +++ b/lib/contracts/OffchainOracle.d.ts @@ -0,0 +1,304 @@ +import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers"; +import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "./common"; +export interface OffchainOracleInterface extends Interface { + getFunction(nameOrSignature: "addConnector" | "addOracle" | "connectors" | "getRate" | "getRateToEth" | "getRateToEthWithCustomConnectors" | "getRateToEthWithThreshold" | "getRateWithCustomConnectors" | "getRateWithThreshold" | "multiWrapper" | "oracles" | "owner" | "removeConnector" | "removeOracle" | "renounceOwnership" | "setMultiWrapper" | "transferOwnership"): FunctionFragment; + getEvent(nameOrSignatureOrTopic: "ConnectorAdded" | "ConnectorRemoved" | "MultiWrapperUpdated" | "OracleAdded" | "OracleRemoved" | "OwnershipTransferred"): EventFragment; + encodeFunctionData(functionFragment: "addConnector", values: [AddressLike]): string; + encodeFunctionData(functionFragment: "addOracle", values: [AddressLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "connectors", values?: undefined): string; + encodeFunctionData(functionFragment: "getRate", values: [AddressLike, AddressLike, boolean]): string; + encodeFunctionData(functionFragment: "getRateToEth", values: [AddressLike, boolean]): string; + encodeFunctionData(functionFragment: "getRateToEthWithCustomConnectors", values: [AddressLike, boolean, AddressLike[], BigNumberish]): string; + encodeFunctionData(functionFragment: "getRateToEthWithThreshold", values: [AddressLike, boolean, BigNumberish]): string; + encodeFunctionData(functionFragment: "getRateWithCustomConnectors", values: [AddressLike, AddressLike, boolean, AddressLike[], BigNumberish]): string; + encodeFunctionData(functionFragment: "getRateWithThreshold", values: [AddressLike, AddressLike, boolean, BigNumberish]): string; + encodeFunctionData(functionFragment: "multiWrapper", values?: undefined): string; + encodeFunctionData(functionFragment: "oracles", values?: undefined): string; + encodeFunctionData(functionFragment: "owner", values?: undefined): string; + encodeFunctionData(functionFragment: "removeConnector", values: [AddressLike]): string; + encodeFunctionData(functionFragment: "removeOracle", values: [AddressLike, BigNumberish]): string; + encodeFunctionData(functionFragment: "renounceOwnership", values?: undefined): string; + encodeFunctionData(functionFragment: "setMultiWrapper", values: [AddressLike]): string; + encodeFunctionData(functionFragment: "transferOwnership", values: [AddressLike]): string; + decodeFunctionResult(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: "getRateToEthWithCustomConnectors", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "getRateToEthWithThreshold", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "getRateWithCustomConnectors", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "getRateWithThreshold", 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): Result; +} +export declare namespace ConnectorAddedEvent { + type InputTuple = [connector: AddressLike]; + type OutputTuple = [connector: string]; + interface OutputObject { + connector: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace ConnectorRemovedEvent { + type InputTuple = [connector: AddressLike]; + type OutputTuple = [connector: string]; + interface OutputObject { + connector: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace MultiWrapperUpdatedEvent { + type InputTuple = [multiWrapper: AddressLike]; + type OutputTuple = [multiWrapper: string]; + interface OutputObject { + multiWrapper: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace OracleAddedEvent { + type InputTuple = [oracle: AddressLike, oracleType: BigNumberish]; + type OutputTuple = [oracle: string, oracleType: bigint]; + interface OutputObject { + oracle: string; + oracleType: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace OracleRemovedEvent { + type InputTuple = [oracle: AddressLike, oracleType: BigNumberish]; + type OutputTuple = [oracle: string, oracleType: bigint]; + interface OutputObject { + oracle: string; + oracleType: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace OwnershipTransferredEvent { + type InputTuple = [previousOwner: AddressLike, newOwner: AddressLike]; + type OutputTuple = [previousOwner: string, newOwner: string]; + interface OutputObject { + previousOwner: string; + newOwner: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export interface OffchainOracle extends BaseContract { + connect(runner?: ContractRunner | null): OffchainOracle; + waitForDeployment(): Promise; + interface: OffchainOracleInterface; + queryFilter(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; + queryFilter(filter: TypedDeferredTopicFilter, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; + on(event: TCEvent, listener: TypedListener): Promise; + on(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; + once(event: TCEvent, listener: TypedListener): Promise; + once(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; + listeners(event: TCEvent): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners(event?: TCEvent): Promise; + addConnector: TypedContractMethod<[ + connector: AddressLike + ], [ + void + ], "nonpayable">; + addOracle: TypedContractMethod<[ + oracle: AddressLike, + oracleKind: BigNumberish + ], [ + void + ], "nonpayable">; + connectors: TypedContractMethod<[], [string[]], "view">; + getRate: TypedContractMethod<[ + srcToken: AddressLike, + dstToken: AddressLike, + useWrappers: boolean + ], [ + bigint + ], "view">; + getRateToEth: TypedContractMethod<[ + srcToken: AddressLike, + useSrcWrappers: boolean + ], [ + bigint + ], "view">; + getRateToEthWithCustomConnectors: TypedContractMethod<[ + srcToken: AddressLike, + useSrcWrappers: boolean, + customConnectors: AddressLike[], + thresholdFilter: BigNumberish + ], [ + bigint + ], "view">; + getRateToEthWithThreshold: TypedContractMethod<[ + srcToken: AddressLike, + useSrcWrappers: boolean, + thresholdFilter: BigNumberish + ], [ + bigint + ], "view">; + getRateWithCustomConnectors: TypedContractMethod<[ + srcToken: AddressLike, + dstToken: AddressLike, + useWrappers: boolean, + customConnectors: AddressLike[], + thresholdFilter: BigNumberish + ], [ + bigint + ], "view">; + getRateWithThreshold: TypedContractMethod<[ + srcToken: AddressLike, + dstToken: AddressLike, + useWrappers: boolean, + thresholdFilter: BigNumberish + ], [ + bigint + ], "view">; + multiWrapper: TypedContractMethod<[], [string], "view">; + oracles: TypedContractMethod<[ + ], [ + [string[], bigint[]] & { + allOracles: string[]; + oracleTypes: bigint[]; + } + ], "view">; + owner: TypedContractMethod<[], [string], "view">; + removeConnector: TypedContractMethod<[ + connector: AddressLike + ], [ + void + ], "nonpayable">; + removeOracle: TypedContractMethod<[ + oracle: AddressLike, + oracleKind: BigNumberish + ], [ + void + ], "nonpayable">; + renounceOwnership: TypedContractMethod<[], [void], "nonpayable">; + setMultiWrapper: TypedContractMethod<[ + _multiWrapper: AddressLike + ], [ + void + ], "nonpayable">; + transferOwnership: TypedContractMethod<[ + newOwner: AddressLike + ], [ + void + ], "nonpayable">; + getFunction(key: string | FunctionFragment): T; + getFunction(nameOrSignature: "addConnector"): TypedContractMethod<[connector: AddressLike], [void], "nonpayable">; + getFunction(nameOrSignature: "addOracle"): TypedContractMethod<[ + oracle: AddressLike, + oracleKind: BigNumberish + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "connectors"): TypedContractMethod<[], [string[]], "view">; + getFunction(nameOrSignature: "getRate"): TypedContractMethod<[ + srcToken: AddressLike, + dstToken: AddressLike, + useWrappers: boolean + ], [ + bigint + ], "view">; + getFunction(nameOrSignature: "getRateToEth"): TypedContractMethod<[ + srcToken: AddressLike, + useSrcWrappers: boolean + ], [ + bigint + ], "view">; + getFunction(nameOrSignature: "getRateToEthWithCustomConnectors"): TypedContractMethod<[ + srcToken: AddressLike, + useSrcWrappers: boolean, + customConnectors: AddressLike[], + thresholdFilter: BigNumberish + ], [ + bigint + ], "view">; + getFunction(nameOrSignature: "getRateToEthWithThreshold"): TypedContractMethod<[ + srcToken: AddressLike, + useSrcWrappers: boolean, + thresholdFilter: BigNumberish + ], [ + bigint + ], "view">; + getFunction(nameOrSignature: "getRateWithCustomConnectors"): TypedContractMethod<[ + srcToken: AddressLike, + dstToken: AddressLike, + useWrappers: boolean, + customConnectors: AddressLike[], + thresholdFilter: BigNumberish + ], [ + bigint + ], "view">; + getFunction(nameOrSignature: "getRateWithThreshold"): TypedContractMethod<[ + srcToken: AddressLike, + dstToken: AddressLike, + useWrappers: boolean, + thresholdFilter: BigNumberish + ], [ + bigint + ], "view">; + getFunction(nameOrSignature: "multiWrapper"): TypedContractMethod<[], [string], "view">; + getFunction(nameOrSignature: "oracles"): TypedContractMethod<[ + ], [ + [string[], bigint[]] & { + allOracles: string[]; + oracleTypes: bigint[]; + } + ], "view">; + getFunction(nameOrSignature: "owner"): TypedContractMethod<[], [string], "view">; + getFunction(nameOrSignature: "removeConnector"): TypedContractMethod<[connector: AddressLike], [void], "nonpayable">; + getFunction(nameOrSignature: "removeOracle"): TypedContractMethod<[ + oracle: AddressLike, + oracleKind: BigNumberish + ], [ + void + ], "nonpayable">; + getFunction(nameOrSignature: "renounceOwnership"): TypedContractMethod<[], [void], "nonpayable">; + getFunction(nameOrSignature: "setMultiWrapper"): TypedContractMethod<[_multiWrapper: AddressLike], [void], "nonpayable">; + getFunction(nameOrSignature: "transferOwnership"): TypedContractMethod<[newOwner: AddressLike], [void], "nonpayable">; + getEvent(key: "ConnectorAdded"): TypedContractEvent; + getEvent(key: "ConnectorRemoved"): TypedContractEvent; + getEvent(key: "MultiWrapperUpdated"): TypedContractEvent; + getEvent(key: "OracleAdded"): TypedContractEvent; + getEvent(key: "OracleRemoved"): TypedContractEvent; + getEvent(key: "OwnershipTransferred"): TypedContractEvent; + filters: { + "ConnectorAdded(address)": TypedContractEvent; + ConnectorAdded: TypedContractEvent; + "ConnectorRemoved(address)": TypedContractEvent; + ConnectorRemoved: TypedContractEvent; + "MultiWrapperUpdated(address)": TypedContractEvent; + MultiWrapperUpdated: TypedContractEvent; + "OracleAdded(address,uint8)": TypedContractEvent; + OracleAdded: TypedContractEvent; + "OracleRemoved(address,uint8)": TypedContractEvent; + OracleRemoved: TypedContractEvent; + "OwnershipTransferred(address,address)": TypedContractEvent; + OwnershipTransferred: TypedContractEvent; + }; +} diff --git a/lib/contracts/OffchainOracle.js b/lib/contracts/OffchainOracle.js new file mode 100644 index 0000000..99222d6 --- /dev/null +++ b/lib/contracts/OffchainOracle.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=OffchainOracle.js.map \ No newline at end of file diff --git a/lib/contracts/OffchainOracle.js.map b/lib/contracts/OffchainOracle.js.map new file mode 100644 index 0000000..2e98495 --- /dev/null +++ b/lib/contracts/OffchainOracle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"OffchainOracle.js","sourceRoot":"","sources":["../../src/contracts/OffchainOracle.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib/contracts/OptimismL1FeeOracle.d.ts b/lib/contracts/OptimismL1FeeOracle.d.ts new file mode 100644 index 0000000..c8bfc30 --- /dev/null +++ b/lib/contracts/OptimismL1FeeOracle.d.ts @@ -0,0 +1,188 @@ +import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers"; +import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "./common"; +export interface OptimismL1FeeOracleInterface extends Interface { + getFunction(nameOrSignature: "decimals" | "gasPrice" | "getL1Fee" | "getL1GasUsed" | "l1BaseFee" | "overhead" | "owner" | "renounceOwnership" | "scalar" | "setDecimals" | "setGasPrice" | "setL1BaseFee" | "setOverhead" | "setScalar" | "transferOwnership"): FunctionFragment; + getEvent(nameOrSignatureOrTopic: "DecimalsUpdated" | "GasPriceUpdated" | "L1BaseFeeUpdated" | "OverheadUpdated" | "OwnershipTransferred" | "ScalarUpdated"): EventFragment; + encodeFunctionData(functionFragment: "decimals", values?: undefined): string; + encodeFunctionData(functionFragment: "gasPrice", values?: undefined): string; + encodeFunctionData(functionFragment: "getL1Fee", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "getL1GasUsed", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "l1BaseFee", values?: undefined): string; + encodeFunctionData(functionFragment: "overhead", values?: undefined): string; + encodeFunctionData(functionFragment: "owner", values?: undefined): string; + encodeFunctionData(functionFragment: "renounceOwnership", values?: undefined): string; + encodeFunctionData(functionFragment: "scalar", values?: undefined): string; + encodeFunctionData(functionFragment: "setDecimals", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "setGasPrice", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "setL1BaseFee", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "setOverhead", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "setScalar", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "transferOwnership", values: [AddressLike]): string; + decodeFunctionResult(functionFragment: "decimals", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "gasPrice", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "getL1Fee", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "getL1GasUsed", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "l1BaseFee", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "overhead", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "renounceOwnership", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "scalar", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setDecimals", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setGasPrice", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setL1BaseFee", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setOverhead", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setScalar", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "transferOwnership", data: BytesLike): Result; +} +export declare namespace DecimalsUpdatedEvent { + type InputTuple = [arg0: BigNumberish]; + type OutputTuple = [arg0: bigint]; + interface OutputObject { + arg0: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace GasPriceUpdatedEvent { + type InputTuple = [arg0: BigNumberish]; + type OutputTuple = [arg0: bigint]; + interface OutputObject { + arg0: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace L1BaseFeeUpdatedEvent { + type InputTuple = [arg0: BigNumberish]; + type OutputTuple = [arg0: bigint]; + interface OutputObject { + arg0: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace OverheadUpdatedEvent { + type InputTuple = [arg0: BigNumberish]; + type OutputTuple = [arg0: bigint]; + interface OutputObject { + arg0: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace OwnershipTransferredEvent { + type InputTuple = [previousOwner: AddressLike, newOwner: AddressLike]; + type OutputTuple = [previousOwner: string, newOwner: string]; + interface OutputObject { + previousOwner: string; + newOwner: string; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export declare namespace ScalarUpdatedEvent { + type InputTuple = [arg0: BigNumberish]; + type OutputTuple = [arg0: bigint]; + interface OutputObject { + arg0: bigint; + } + type Event = TypedContractEvent; + type Filter = TypedDeferredTopicFilter; + type Log = TypedEventLog; + type LogDescription = TypedLogDescription; +} +export interface OptimismL1FeeOracle extends BaseContract { + connect(runner?: ContractRunner | null): OptimismL1FeeOracle; + waitForDeployment(): Promise; + interface: OptimismL1FeeOracleInterface; + queryFilter(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; + queryFilter(filter: TypedDeferredTopicFilter, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise>>; + on(event: TCEvent, listener: TypedListener): Promise; + on(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; + once(event: TCEvent, listener: TypedListener): Promise; + once(filter: TypedDeferredTopicFilter, listener: TypedListener): Promise; + listeners(event: TCEvent): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners(event?: TCEvent): Promise; + decimals: TypedContractMethod<[], [bigint], "view">; + gasPrice: TypedContractMethod<[], [bigint], "view">; + getL1Fee: TypedContractMethod<[_data: BytesLike], [bigint], "view">; + getL1GasUsed: TypedContractMethod<[_data: BytesLike], [bigint], "view">; + l1BaseFee: TypedContractMethod<[], [bigint], "view">; + overhead: TypedContractMethod<[], [bigint], "view">; + owner: TypedContractMethod<[], [string], "view">; + renounceOwnership: TypedContractMethod<[], [void], "nonpayable">; + scalar: TypedContractMethod<[], [bigint], "view">; + setDecimals: TypedContractMethod<[ + _decimals: BigNumberish + ], [ + void + ], "nonpayable">; + setGasPrice: TypedContractMethod<[ + _gasPrice: BigNumberish + ], [ + void + ], "nonpayable">; + setL1BaseFee: TypedContractMethod<[ + _baseFee: BigNumberish + ], [ + void + ], "nonpayable">; + setOverhead: TypedContractMethod<[ + _overhead: BigNumberish + ], [ + void + ], "nonpayable">; + setScalar: TypedContractMethod<[_scalar: BigNumberish], [void], "nonpayable">; + transferOwnership: TypedContractMethod<[ + newOwner: AddressLike + ], [ + void + ], "nonpayable">; + getFunction(key: string | FunctionFragment): T; + getFunction(nameOrSignature: "decimals"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "gasPrice"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "getL1Fee"): TypedContractMethod<[_data: BytesLike], [bigint], "view">; + getFunction(nameOrSignature: "getL1GasUsed"): TypedContractMethod<[_data: BytesLike], [bigint], "view">; + getFunction(nameOrSignature: "l1BaseFee"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "overhead"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "owner"): TypedContractMethod<[], [string], "view">; + getFunction(nameOrSignature: "renounceOwnership"): TypedContractMethod<[], [void], "nonpayable">; + getFunction(nameOrSignature: "scalar"): TypedContractMethod<[], [bigint], "view">; + getFunction(nameOrSignature: "setDecimals"): TypedContractMethod<[_decimals: BigNumberish], [void], "nonpayable">; + getFunction(nameOrSignature: "setGasPrice"): TypedContractMethod<[_gasPrice: BigNumberish], [void], "nonpayable">; + getFunction(nameOrSignature: "setL1BaseFee"): TypedContractMethod<[_baseFee: BigNumberish], [void], "nonpayable">; + getFunction(nameOrSignature: "setOverhead"): TypedContractMethod<[_overhead: BigNumberish], [void], "nonpayable">; + getFunction(nameOrSignature: "setScalar"): TypedContractMethod<[_scalar: BigNumberish], [void], "nonpayable">; + getFunction(nameOrSignature: "transferOwnership"): TypedContractMethod<[newOwner: AddressLike], [void], "nonpayable">; + getEvent(key: "DecimalsUpdated"): TypedContractEvent; + getEvent(key: "GasPriceUpdated"): TypedContractEvent; + getEvent(key: "L1BaseFeeUpdated"): TypedContractEvent; + getEvent(key: "OverheadUpdated"): TypedContractEvent; + getEvent(key: "OwnershipTransferred"): TypedContractEvent; + getEvent(key: "ScalarUpdated"): TypedContractEvent; + filters: { + "DecimalsUpdated(uint256)": TypedContractEvent; + DecimalsUpdated: TypedContractEvent; + "GasPriceUpdated(uint256)": TypedContractEvent; + GasPriceUpdated: TypedContractEvent; + "L1BaseFeeUpdated(uint256)": TypedContractEvent; + L1BaseFeeUpdated: TypedContractEvent; + "OverheadUpdated(uint256)": TypedContractEvent; + OverheadUpdated: TypedContractEvent; + "OwnershipTransferred(address,address)": TypedContractEvent; + OwnershipTransferred: TypedContractEvent; + "ScalarUpdated(uint256)": TypedContractEvent; + ScalarUpdated: TypedContractEvent; + }; +} diff --git a/lib/contracts/OptimismL1FeeOracle.js b/lib/contracts/OptimismL1FeeOracle.js new file mode 100644 index 0000000..9905f1c --- /dev/null +++ b/lib/contracts/OptimismL1FeeOracle.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=OptimismL1FeeOracle.js.map \ No newline at end of file diff --git a/lib/contracts/OptimismL1FeeOracle.js.map b/lib/contracts/OptimismL1FeeOracle.js.map new file mode 100644 index 0000000..de6c182 --- /dev/null +++ b/lib/contracts/OptimismL1FeeOracle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"OptimismL1FeeOracle.js","sourceRoot":"","sources":["../../src/contracts/OptimismL1FeeOracle.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib/contracts/common.d.ts b/lib/contracts/common.d.ts new file mode 100644 index 0000000..d6c302a --- /dev/null +++ b/lib/contracts/common.d.ts @@ -0,0 +1,50 @@ +import type { FunctionFragment, Typed, EventFragment, ContractTransaction, ContractTransactionResponse, DeferredTopicFilter, EventLog, TransactionRequest, LogDescription } from "ethers"; +export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> extends DeferredTopicFilter { +} +export interface TypedContractEvent = any, OutputTuple extends Array = any, OutputObject = any> { + (...args: Partial): TypedDeferredTopicFilter>; + name: string; + fragment: EventFragment; + getFragment(...args: Partial): EventFragment; +} +type __TypechainAOutputTuple = T extends TypedContractEvent ? W : never; +type __TypechainOutputObject = T extends TypedContractEvent ? V : never; +export interface TypedEventLog extends Omit { + args: __TypechainAOutputTuple & __TypechainOutputObject; +} +export interface TypedLogDescription extends Omit { + args: __TypechainAOutputTuple & __TypechainOutputObject; +} +export type TypedListener = (...listenerArg: [ + ...__TypechainAOutputTuple, + TypedEventLog, + ...undefined[] +]) => void; +export type MinEthersFactory = { + deploy(...a: ARGS[]): Promise; +}; +export type GetContractTypeFromFactory = F extends MinEthersFactory ? C : never; +export type GetARGsTypeFromFactory = F extends MinEthersFactory ? Parameters : never; +export type StateMutability = "nonpayable" | "payable" | "view"; +export type BaseOverrides = Omit; +export type NonPayableOverrides = Omit; +export type PayableOverrides = Omit; +export type ViewOverrides = Omit; +export type Overrides = S extends "nonpayable" ? NonPayableOverrides : S extends "payable" ? PayableOverrides : ViewOverrides; +export type PostfixOverrides, S extends StateMutability> = A | [...A, Overrides]; +export type ContractMethodArgs, S extends StateMutability> = PostfixOverrides<{ + [I in keyof A]-?: A[I] | Typed; +}, S>; +export type DefaultReturnType = R extends Array ? R[0] : R; +export interface TypedContractMethod = Array, R = any, S extends StateMutability = "payable"> { + (...args: ContractMethodArgs): S extends "view" ? Promise> : Promise; + name: string; + fragment: FunctionFragment; + getFragment(...args: ContractMethodArgs): FunctionFragment; + populateTransaction(...args: ContractMethodArgs): Promise; + staticCall(...args: ContractMethodArgs): Promise>; + send(...args: ContractMethodArgs): Promise; + estimateGas(...args: ContractMethodArgs): Promise; + staticCallResult(...args: ContractMethodArgs): Promise; +} +export {}; diff --git a/lib/contracts/common.js b/lib/contracts/common.js new file mode 100644 index 0000000..023264f --- /dev/null +++ b/lib/contracts/common.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/lib/contracts/common.js.map b/lib/contracts/common.js.map new file mode 100644 index 0000000..08d7a78 --- /dev/null +++ b/lib/contracts/common.js.map @@ -0,0 +1 @@ +{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/contracts/common.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib/contracts/factories/GasPriceOracle__factory.d.ts b/lib/contracts/factories/GasPriceOracle__factory.d.ts new file mode 100644 index 0000000..8d623de --- /dev/null +++ b/lib/contracts/factories/GasPriceOracle__factory.d.ts @@ -0,0 +1,151 @@ +import { type ContractRunner } from "ethers"; +import type { GasPriceOracle, GasPriceOracleInterface } from "../GasPriceOracle"; +export declare class GasPriceOracle__factory { + static readonly abi: readonly [{ + readonly inputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "constructor"; + }, { + readonly inputs: readonly []; + readonly name: "GAS_UNIT"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint32"; + readonly name: "_derivationThresold"; + readonly type: "uint32"; + }]; + readonly name: "changeDerivationThresold"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint32"; + readonly name: "_gasUnit"; + readonly type: "uint32"; + }]; + readonly name: "changeGasUnit"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint32"; + readonly name: "_heartbeat"; + readonly type: "uint32"; + }]; + readonly name: "changeHeartbeat"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "_owner"; + readonly type: "address"; + }]; + readonly name: "changeOwnership"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "derivationThresold"; + readonly outputs: readonly [{ + readonly internalType: "uint32"; + readonly name: ""; + readonly type: "uint32"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "gasPrice"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "heartbeat"; + readonly outputs: readonly [{ + readonly internalType: "uint32"; + readonly name: ""; + readonly type: "uint32"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "maxFeePerGas"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "maxPriorityFeePerGas"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "owner"; + readonly outputs: readonly [{ + readonly internalType: "address"; + readonly name: ""; + readonly type: "address"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "pastGasPrice"; + readonly outputs: readonly [{ + readonly internalType: "uint32"; + readonly name: ""; + readonly type: "uint32"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint32"; + readonly name: "_gasPrice"; + readonly type: "uint32"; + }]; + readonly name: "setGasPrice"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "timestamp"; + readonly outputs: readonly [{ + readonly internalType: "uint32"; + readonly name: ""; + readonly type: "uint32"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }]; + static createInterface(): GasPriceOracleInterface; + static connect(address: string, runner?: ContractRunner | null): GasPriceOracle; +} diff --git a/lib/contracts/factories/GasPriceOracle__factory.js b/lib/contracts/factories/GasPriceOracle__factory.js new file mode 100644 index 0000000..bcb9bea --- /dev/null +++ b/lib/contracts/factories/GasPriceOracle__factory.js @@ -0,0 +1,207 @@ +"use strict"; +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.GasPriceOracle__factory = void 0; +const ethers_1 = require("ethers"); +const _abi = [ + { + inputs: [], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [], + name: "GAS_UNIT", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "_derivationThresold", + type: "uint32", + }, + ], + name: "changeDerivationThresold", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "_gasUnit", + type: "uint32", + }, + ], + name: "changeGasUnit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "_heartbeat", + type: "uint32", + }, + ], + name: "changeHeartbeat", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_owner", + type: "address", + }, + ], + name: "changeOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "derivationThresold", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gasPrice", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "heartbeat", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxFeePerGas", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxPriorityFeePerGas", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "pastGasPrice", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "_gasPrice", + type: "uint32", + }, + ], + name: "setGasPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "timestamp", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, +]; +class GasPriceOracle__factory { + static createInterface() { + return new ethers_1.Interface(_abi); + } + static connect(address, runner) { + return new ethers_1.Contract(address, _abi, runner); + } +} +exports.GasPriceOracle__factory = GasPriceOracle__factory; +GasPriceOracle__factory.abi = _abi; +//# sourceMappingURL=GasPriceOracle__factory.js.map \ No newline at end of file diff --git a/lib/contracts/factories/GasPriceOracle__factory.js.map b/lib/contracts/factories/GasPriceOracle__factory.js.map new file mode 100644 index 0000000..ed68de7 --- /dev/null +++ b/lib/contracts/factories/GasPriceOracle__factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GasPriceOracle__factory.js","sourceRoot":"","sources":["../../../src/contracts/factories/GasPriceOracle__factory.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;;;AAEpB,mCAAkE;AAMlE,MAAM,IAAI,GAAG;IACX;QACE,MAAM,EAAE,EAAE;QACV,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,aAAa;KACpB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,QAAQ;gBACtB,IAAI,EAAE,qBAAqB;gBAC3B,IAAI,EAAE,QAAQ;aACf;SACF;QACD,IAAI,EAAE,0BAA0B;QAChC,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,QAAQ;gBACtB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;aACf;SAC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Aa,uBAAuB;IAElC,MAAM,CAAC,eAAe;QACpB,OAAO,IAAI,kBAAS,CAAC,IAAI,CAA4B,CAAC;IACxD,CAAC;IACD,MAAM,CAAC,OAAO,CACZ,OAAe,EACf,MAA8B;QAE9B,OAAO,IAAI,iBAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAA8B,CAAC;IAC1E,CAAC;;AAVH,0DAWC;AAViB,2BAAG,GAAG,IAAI,CAAC"} \ No newline at end of file diff --git a/lib/contracts/factories/Multicall__factory.d.ts b/lib/contracts/factories/Multicall__factory.d.ts new file mode 100644 index 0000000..2a1d4a1 --- /dev/null +++ b/lib/contracts/factories/Multicall__factory.d.ts @@ -0,0 +1,338 @@ +import { type ContractRunner } from "ethers"; +import type { Multicall, MulticallInterface } from "../Multicall"; +export declare class Multicall__factory { + static readonly abi: readonly [{ + readonly inputs: readonly [{ + readonly components: readonly [{ + readonly internalType: "address"; + readonly name: "target"; + readonly type: "address"; + }, { + readonly internalType: "bytes"; + readonly name: "callData"; + readonly type: "bytes"; + }]; + readonly internalType: "struct Multicall3.Call[]"; + readonly name: "calls"; + readonly type: "tuple[]"; + }]; + readonly name: "aggregate"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "blockNumber"; + readonly type: "uint256"; + }, { + readonly internalType: "bytes[]"; + readonly name: "returnData"; + readonly type: "bytes[]"; + }]; + readonly stateMutability: "payable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly components: readonly [{ + readonly internalType: "address"; + readonly name: "target"; + readonly type: "address"; + }, { + readonly internalType: "bool"; + readonly name: "allowFailure"; + readonly type: "bool"; + }, { + readonly internalType: "bytes"; + readonly name: "callData"; + readonly type: "bytes"; + }]; + readonly internalType: "struct Multicall3.Call3[]"; + readonly name: "calls"; + readonly type: "tuple[]"; + }]; + readonly name: "aggregate3"; + readonly outputs: readonly [{ + readonly components: readonly [{ + readonly internalType: "bool"; + readonly name: "success"; + readonly type: "bool"; + }, { + readonly internalType: "bytes"; + readonly name: "returnData"; + readonly type: "bytes"; + }]; + readonly internalType: "struct Multicall3.Result[]"; + readonly name: "returnData"; + readonly type: "tuple[]"; + }]; + readonly stateMutability: "payable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly components: readonly [{ + readonly internalType: "address"; + readonly name: "target"; + readonly type: "address"; + }, { + readonly internalType: "bool"; + readonly name: "allowFailure"; + readonly type: "bool"; + }, { + readonly internalType: "uint256"; + readonly name: "value"; + readonly type: "uint256"; + }, { + readonly internalType: "bytes"; + readonly name: "callData"; + readonly type: "bytes"; + }]; + readonly internalType: "struct Multicall3.Call3Value[]"; + readonly name: "calls"; + readonly type: "tuple[]"; + }]; + readonly name: "aggregate3Value"; + readonly outputs: readonly [{ + readonly components: readonly [{ + readonly internalType: "bool"; + readonly name: "success"; + readonly type: "bool"; + }, { + readonly internalType: "bytes"; + readonly name: "returnData"; + readonly type: "bytes"; + }]; + readonly internalType: "struct Multicall3.Result[]"; + readonly name: "returnData"; + readonly type: "tuple[]"; + }]; + readonly stateMutability: "payable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly components: readonly [{ + readonly internalType: "address"; + readonly name: "target"; + readonly type: "address"; + }, { + readonly internalType: "bytes"; + readonly name: "callData"; + readonly type: "bytes"; + }]; + readonly internalType: "struct Multicall3.Call[]"; + readonly name: "calls"; + readonly type: "tuple[]"; + }]; + readonly name: "blockAndAggregate"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "blockNumber"; + readonly type: "uint256"; + }, { + readonly internalType: "bytes32"; + readonly name: "blockHash"; + readonly type: "bytes32"; + }, { + readonly components: readonly [{ + readonly internalType: "bool"; + readonly name: "success"; + readonly type: "bool"; + }, { + readonly internalType: "bytes"; + readonly name: "returnData"; + readonly type: "bytes"; + }]; + readonly internalType: "struct Multicall3.Result[]"; + readonly name: "returnData"; + readonly type: "tuple[]"; + }]; + readonly stateMutability: "payable"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "getBasefee"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "basefee"; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "blockNumber"; + readonly type: "uint256"; + }]; + readonly name: "getBlockHash"; + readonly outputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "blockHash"; + readonly type: "bytes32"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "getBlockNumber"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "blockNumber"; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "getChainId"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "chainid"; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "getCurrentBlockCoinbase"; + readonly outputs: readonly [{ + readonly internalType: "address"; + readonly name: "coinbase"; + readonly type: "address"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "getCurrentBlockDifficulty"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "difficulty"; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "getCurrentBlockGasLimit"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "gaslimit"; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "getCurrentBlockTimestamp"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "timestamp"; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "addr"; + readonly type: "address"; + }]; + readonly name: "getEthBalance"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "balance"; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "getLastBlockHash"; + readonly outputs: readonly [{ + readonly internalType: "bytes32"; + readonly name: "blockHash"; + readonly type: "bytes32"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bool"; + readonly name: "requireSuccess"; + readonly type: "bool"; + }, { + readonly components: readonly [{ + readonly internalType: "address"; + readonly name: "target"; + readonly type: "address"; + }, { + readonly internalType: "bytes"; + readonly name: "callData"; + readonly type: "bytes"; + }]; + readonly internalType: "struct Multicall3.Call[]"; + readonly name: "calls"; + readonly type: "tuple[]"; + }]; + readonly name: "tryAggregate"; + readonly outputs: readonly [{ + readonly components: readonly [{ + readonly internalType: "bool"; + readonly name: "success"; + readonly type: "bool"; + }, { + readonly internalType: "bytes"; + readonly name: "returnData"; + readonly type: "bytes"; + }]; + readonly internalType: "struct Multicall3.Result[]"; + readonly name: "returnData"; + readonly type: "tuple[]"; + }]; + readonly stateMutability: "payable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bool"; + readonly name: "requireSuccess"; + readonly type: "bool"; + }, { + readonly components: readonly [{ + readonly internalType: "address"; + readonly name: "target"; + readonly type: "address"; + }, { + readonly internalType: "bytes"; + readonly name: "callData"; + readonly type: "bytes"; + }]; + readonly internalType: "struct Multicall3.Call[]"; + readonly name: "calls"; + readonly type: "tuple[]"; + }]; + readonly name: "tryBlockAndAggregate"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "blockNumber"; + readonly type: "uint256"; + }, { + readonly internalType: "bytes32"; + readonly name: "blockHash"; + readonly type: "bytes32"; + }, { + readonly components: readonly [{ + readonly internalType: "bool"; + readonly name: "success"; + readonly type: "bool"; + }, { + readonly internalType: "bytes"; + readonly name: "returnData"; + readonly type: "bytes"; + }]; + readonly internalType: "struct Multicall3.Result[]"; + readonly name: "returnData"; + readonly type: "tuple[]"; + }]; + readonly stateMutability: "payable"; + readonly type: "function"; + }]; + static createInterface(): MulticallInterface; + static connect(address: string, runner?: ContractRunner | null): Multicall; +} diff --git a/lib/contracts/factories/Multicall__factory.js b/lib/contracts/factories/Multicall__factory.js new file mode 100644 index 0000000..eb86c71 --- /dev/null +++ b/lib/contracts/factories/Multicall__factory.js @@ -0,0 +1,458 @@ +"use strict"; +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Multicall__factory = void 0; +const ethers_1 = require("ethers"); +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", + }, +]; +class Multicall__factory { + static createInterface() { + return new ethers_1.Interface(_abi); + } + static connect(address, runner) { + return new ethers_1.Contract(address, _abi, runner); + } +} +exports.Multicall__factory = Multicall__factory; +Multicall__factory.abi = _abi; +//# sourceMappingURL=Multicall__factory.js.map \ No newline at end of file diff --git a/lib/contracts/factories/Multicall__factory.js.map b/lib/contracts/factories/Multicall__factory.js.map new file mode 100644 index 0000000..26590d8 --- /dev/null +++ b/lib/contracts/factories/Multicall__factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Multicall__factory.js","sourceRoot":"","sources":["../../../src/contracts/factories/Multicall__factory.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;;;AAEpB,mCAAkE;AAGlE,MAAM,IAAI,GAAG;IACX;QACE,MAAM,EAAE;YACN;gBACE,UAAU,EAAE;oBACV;wBACE,YAAY,EAAE,SAAS;wBACvB,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,SAAS;qBAChB;oBACD;wBACE,YAAY,EAAE,OAAO;wBACrB,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,OAAO;qBACd;iBACF;gBACD,YAAY,EAAE,0BAA0B;gBACxC,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,SAAS;QAC1B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,UAAU,EAAE;oBACV;wBACE,YAAY,EAAE,SAAS;wBACvB,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,SAAS;qBAChB;oBACD;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S;wBACf,IAAI,EAAE,MAAM;qBACb;oBACD;wBACE,YAAY,EAAE,OAAO;wBACrB,IAAI,EAAE,YAAY;wBAClB,IAAI,EAAE,OAAO;qBACd;iBACF;gBACD,YAAY,EAAE,4BAA4B;gBAC1C,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,SAAS;QAC1B,IAAI,EAAE,UAAU;KACjB;CACO,CAAC;AAEX,MAAa,kBAAkB;IAE7B,MAAM,CAAC,eAAe;QACpB,OAAO,IAAI,kBAAS,CAAC,IAAI,CAAuB,CAAC;IACnD,CAAC;IACD,MAAM,CAAC,OAAO,CAAC,OAAe,EAAE,MAA8B;QAC5D,OAAO,IAAI,iBAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAyB,CAAC;IACrE,CAAC;;AAPH,gDAQC;AAPiB,sBAAG,GAAG,IAAI,CAAC"} \ No newline at end of file diff --git a/lib/contracts/factories/OffchainOracle__factory.d.ts b/lib/contracts/factories/OffchainOracle__factory.d.ts new file mode 100644 index 0000000..0ffeac3 --- /dev/null +++ b/lib/contracts/factories/OffchainOracle__factory.d.ts @@ -0,0 +1,404 @@ +import { type ContractRunner } from "ethers"; +import type { OffchainOracle, OffchainOracleInterface } from "../OffchainOracle"; +export declare class OffchainOracle__factory { + static readonly abi: readonly [{ + readonly inputs: readonly [{ + readonly internalType: "contract MultiWrapper"; + readonly name: "_multiWrapper"; + readonly type: "address"; + }, { + readonly internalType: "contract IOracle[]"; + readonly name: "existingOracles"; + readonly type: "address[]"; + }, { + readonly internalType: "enum OffchainOracle.OracleType[]"; + readonly name: "oracleTypes"; + readonly type: "uint8[]"; + }, { + readonly internalType: "contract IERC20[]"; + readonly name: "existingConnectors"; + readonly type: "address[]"; + }, { + readonly internalType: "contract IERC20"; + readonly name: "wBase"; + readonly type: "address"; + }, { + readonly internalType: "address"; + readonly name: "owner"; + readonly type: "address"; + }]; + readonly stateMutability: "nonpayable"; + readonly type: "constructor"; + }, { + readonly inputs: readonly []; + readonly name: "ArraysLengthMismatch"; + readonly type: "error"; + }, { + readonly inputs: readonly []; + readonly name: "ConnectorAlreadyAdded"; + readonly type: "error"; + }, { + readonly inputs: readonly []; + readonly name: "InvalidOracleTokenKind"; + readonly type: "error"; + }, { + readonly inputs: readonly []; + readonly name: "OracleAlreadyAdded"; + readonly type: "error"; + }, { + readonly inputs: readonly []; + readonly name: "SameTokens"; + readonly type: "error"; + }, { + readonly inputs: readonly []; + readonly name: "TooBigThreshold"; + readonly type: "error"; + }, { + readonly inputs: readonly []; + readonly name: "UnknownConnector"; + readonly type: "error"; + }, { + readonly inputs: readonly []; + readonly name: "UnknownOracle"; + readonly type: "error"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: false; + readonly internalType: "contract IERC20"; + readonly name: "connector"; + readonly type: "address"; + }]; + readonly name: "ConnectorAdded"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: false; + readonly internalType: "contract IERC20"; + readonly name: "connector"; + readonly type: "address"; + }]; + readonly name: "ConnectorRemoved"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: false; + readonly internalType: "contract MultiWrapper"; + readonly name: "multiWrapper"; + readonly type: "address"; + }]; + readonly name: "MultiWrapperUpdated"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: false; + readonly internalType: "contract IOracle"; + readonly name: "oracle"; + readonly type: "address"; + }, { + readonly indexed: false; + readonly internalType: "enum OffchainOracle.OracleType"; + readonly name: "oracleType"; + readonly type: "uint8"; + }]; + readonly name: "OracleAdded"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: false; + readonly internalType: "contract IOracle"; + readonly name: "oracle"; + readonly type: "address"; + }, { + readonly indexed: false; + readonly internalType: "enum OffchainOracle.OracleType"; + readonly name: "oracleType"; + readonly type: "uint8"; + }]; + readonly name: "OracleRemoved"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "address"; + readonly name: "previousOwner"; + readonly type: "address"; + }, { + readonly indexed: true; + readonly internalType: "address"; + readonly name: "newOwner"; + readonly type: "address"; + }]; + readonly name: "OwnershipTransferred"; + readonly type: "event"; + }, { + readonly inputs: readonly [{ + readonly internalType: "contract IERC20"; + readonly name: "connector"; + readonly type: "address"; + }]; + readonly name: "addConnector"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "contract IOracle"; + readonly name: "oracle"; + readonly type: "address"; + }, { + readonly internalType: "enum OffchainOracle.OracleType"; + readonly name: "oracleKind"; + readonly type: "uint8"; + }]; + readonly name: "addOracle"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "connectors"; + readonly outputs: readonly [{ + readonly internalType: "contract IERC20[]"; + readonly name: "allConnectors"; + readonly type: "address[]"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "contract IERC20"; + readonly name: "srcToken"; + readonly type: "address"; + }, { + readonly internalType: "contract IERC20"; + readonly name: "dstToken"; + readonly type: "address"; + }, { + readonly internalType: "bool"; + readonly name: "useWrappers"; + readonly type: "bool"; + }]; + readonly name: "getRate"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "weightedRate"; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "contract IERC20"; + readonly name: "srcToken"; + readonly type: "address"; + }, { + readonly internalType: "bool"; + readonly name: "useSrcWrappers"; + readonly type: "bool"; + }]; + readonly name: "getRateToEth"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "weightedRate"; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "contract IERC20"; + readonly name: "srcToken"; + readonly type: "address"; + }, { + readonly internalType: "bool"; + readonly name: "useSrcWrappers"; + readonly type: "bool"; + }, { + readonly internalType: "contract IERC20[]"; + readonly name: "customConnectors"; + readonly type: "address[]"; + }, { + readonly internalType: "uint256"; + readonly name: "thresholdFilter"; + readonly type: "uint256"; + }]; + readonly name: "getRateToEthWithCustomConnectors"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "weightedRate"; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "contract IERC20"; + readonly name: "srcToken"; + readonly type: "address"; + }, { + readonly internalType: "bool"; + readonly name: "useSrcWrappers"; + readonly type: "bool"; + }, { + readonly internalType: "uint256"; + readonly name: "thresholdFilter"; + readonly type: "uint256"; + }]; + readonly name: "getRateToEthWithThreshold"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "weightedRate"; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "contract IERC20"; + readonly name: "srcToken"; + readonly type: "address"; + }, { + readonly internalType: "contract IERC20"; + readonly name: "dstToken"; + readonly type: "address"; + }, { + readonly internalType: "bool"; + readonly name: "useWrappers"; + readonly type: "bool"; + }, { + readonly internalType: "contract IERC20[]"; + readonly name: "customConnectors"; + readonly type: "address[]"; + }, { + readonly internalType: "uint256"; + readonly name: "thresholdFilter"; + readonly type: "uint256"; + }]; + readonly name: "getRateWithCustomConnectors"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "weightedRate"; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "contract IERC20"; + readonly name: "srcToken"; + readonly type: "address"; + }, { + readonly internalType: "contract IERC20"; + readonly name: "dstToken"; + readonly type: "address"; + }, { + readonly internalType: "bool"; + readonly name: "useWrappers"; + readonly type: "bool"; + }, { + readonly internalType: "uint256"; + readonly name: "thresholdFilter"; + readonly type: "uint256"; + }]; + readonly name: "getRateWithThreshold"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "weightedRate"; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "multiWrapper"; + readonly outputs: readonly [{ + readonly internalType: "contract MultiWrapper"; + readonly name: ""; + readonly type: "address"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "oracles"; + readonly outputs: readonly [{ + readonly internalType: "contract IOracle[]"; + readonly name: "allOracles"; + readonly type: "address[]"; + }, { + readonly internalType: "enum OffchainOracle.OracleType[]"; + readonly name: "oracleTypes"; + readonly type: "uint8[]"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "owner"; + readonly outputs: readonly [{ + readonly internalType: "address"; + readonly name: ""; + readonly type: "address"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "contract IERC20"; + readonly name: "connector"; + readonly type: "address"; + }]; + readonly name: "removeConnector"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "contract IOracle"; + readonly name: "oracle"; + readonly type: "address"; + }, { + readonly internalType: "enum OffchainOracle.OracleType"; + readonly name: "oracleKind"; + readonly type: "uint8"; + }]; + readonly name: "removeOracle"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "renounceOwnership"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "contract MultiWrapper"; + readonly name: "_multiWrapper"; + readonly type: "address"; + }]; + readonly name: "setMultiWrapper"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "newOwner"; + readonly type: "address"; + }]; + readonly name: "transferOwnership"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }]; + static createInterface(): OffchainOracleInterface; + static connect(address: string, runner?: ContractRunner | null): OffchainOracle; +} diff --git a/lib/contracts/factories/OffchainOracle__factory.js b/lib/contracts/factories/OffchainOracle__factory.js new file mode 100644 index 0000000..5c3b228 --- /dev/null +++ b/lib/contracts/factories/OffchainOracle__factory.js @@ -0,0 +1,533 @@ +"use strict"; +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.OffchainOracle__factory = void 0; +const ethers_1 = require("ethers"); +const _abi = [ + { + inputs: [ + { + internalType: "contract MultiWrapper", + name: "_multiWrapper", + type: "address", + }, + { + internalType: "contract IOracle[]", + name: "existingOracles", + type: "address[]", + }, + { + internalType: "enum OffchainOracle.OracleType[]", + name: "oracleTypes", + type: "uint8[]", + }, + { + internalType: "contract IERC20[]", + name: "existingConnectors", + type: "address[]", + }, + { + internalType: "contract IERC20", + name: "wBase", + type: "address", + }, + { + internalType: "address", + name: "owner", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [], + name: "ArraysLengthMismatch", + type: "error", + }, + { + inputs: [], + name: "ConnectorAlreadyAdded", + type: "error", + }, + { + inputs: [], + name: "InvalidOracleTokenKind", + type: "error", + }, + { + inputs: [], + name: "OracleAlreadyAdded", + type: "error", + }, + { + inputs: [], + name: "SameTokens", + type: "error", + }, + { + inputs: [], + name: "TooBigThreshold", + type: "error", + }, + { + inputs: [], + name: "UnknownConnector", + type: "error", + }, + { + inputs: [], + name: "UnknownOracle", + type: "error", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "contract IERC20", + name: "connector", + type: "address", + }, + ], + name: "ConnectorAdded", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "contract IERC20", + name: "connector", + type: "address", + }, + ], + name: "ConnectorRemoved", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "contract MultiWrapper", + name: "multiWrapper", + type: "address", + }, + ], + name: "MultiWrapperUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "contract IOracle", + name: "oracle", + type: "address", + }, + { + indexed: false, + internalType: "enum OffchainOracle.OracleType", + name: "oracleType", + type: "uint8", + }, + ], + name: "OracleAdded", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "contract IOracle", + name: "oracle", + type: "address", + }, + { + indexed: false, + internalType: "enum OffchainOracle.OracleType", + name: "oracleType", + type: "uint8", + }, + ], + name: "OracleRemoved", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "connector", + type: "address", + }, + ], + name: "addConnector", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IOracle", + name: "oracle", + type: "address", + }, + { + internalType: "enum OffchainOracle.OracleType", + name: "oracleKind", + type: "uint8", + }, + ], + name: "addOracle", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "connectors", + outputs: [ + { + internalType: "contract IERC20[]", + name: "allConnectors", + type: "address[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address", + }, + { + internalType: "contract IERC20", + name: "dstToken", + type: "address", + }, + { + internalType: "bool", + name: "useWrappers", + type: "bool", + }, + ], + name: "getRate", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address", + }, + { + internalType: "bool", + name: "useSrcWrappers", + type: "bool", + }, + ], + name: "getRateToEth", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address", + }, + { + internalType: "bool", + name: "useSrcWrappers", + type: "bool", + }, + { + internalType: "contract IERC20[]", + name: "customConnectors", + type: "address[]", + }, + { + internalType: "uint256", + name: "thresholdFilter", + type: "uint256", + }, + ], + name: "getRateToEthWithCustomConnectors", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address", + }, + { + internalType: "bool", + name: "useSrcWrappers", + type: "bool", + }, + { + internalType: "uint256", + name: "thresholdFilter", + type: "uint256", + }, + ], + name: "getRateToEthWithThreshold", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address", + }, + { + internalType: "contract IERC20", + name: "dstToken", + type: "address", + }, + { + internalType: "bool", + name: "useWrappers", + type: "bool", + }, + { + internalType: "contract IERC20[]", + name: "customConnectors", + type: "address[]", + }, + { + internalType: "uint256", + name: "thresholdFilter", + type: "uint256", + }, + ], + name: "getRateWithCustomConnectors", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address", + }, + { + internalType: "contract IERC20", + name: "dstToken", + type: "address", + }, + { + internalType: "bool", + name: "useWrappers", + type: "bool", + }, + { + internalType: "uint256", + name: "thresholdFilter", + type: "uint256", + }, + ], + name: "getRateWithThreshold", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "multiWrapper", + outputs: [ + { + internalType: "contract MultiWrapper", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "oracles", + outputs: [ + { + internalType: "contract IOracle[]", + name: "allOracles", + type: "address[]", + }, + { + internalType: "enum OffchainOracle.OracleType[]", + name: "oracleTypes", + type: "uint8[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "connector", + type: "address", + }, + ], + name: "removeConnector", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IOracle", + name: "oracle", + type: "address", + }, + { + internalType: "enum OffchainOracle.OracleType", + name: "oracleKind", + type: "uint8", + }, + ], + name: "removeOracle", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "contract MultiWrapper", + name: "_multiWrapper", + type: "address", + }, + ], + name: "setMultiWrapper", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +]; +class OffchainOracle__factory { + static createInterface() { + return new ethers_1.Interface(_abi); + } + static connect(address, runner) { + return new ethers_1.Contract(address, _abi, runner); + } +} +exports.OffchainOracle__factory = OffchainOracle__factory; +OffchainOracle__factory.abi = _abi; +//# sourceMappingURL=OffchainOracle__factory.js.map \ No newline at end of file diff --git a/lib/contracts/factories/OffchainOracle__factory.js.map b/lib/contracts/factories/OffchainOracle__factory.js.map new file mode 100644 index 0000000..41a22b8 --- /dev/null +++ b/lib/contracts/factories/OffchainOracle__factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"OffchainOracle__factory.js","sourceRoot":"","sources":["../../../src/contracts/factories/OffchainOracle__factory.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;;;AAEpB,mCAAkE;AAMlE,MAAM,IAAI,GAAG;IACX;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,uBAAuB;gBACrC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,YAAY,EAAE,oBAAoB;gBAClC,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE,WAAW;aAClB;YACD;gBACE,YAAY,EAAE,kCAAkC;gBAChD,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,YAAY,EAAE,mBAAmB;gBACjC,IAAI,EAAE,oBAAoB;gBAC1B,IAAI,EAAE,WAAW;aAClB;YACD;gBACE,YAAY,EAAE,iBAAiB;gBAC/B,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,aAAa;KACpB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,sBAAsB;QAC5B,IAAI,EAAE,OAAO;KACd;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,OAAO;KACd;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,OAAO;KACd;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,OAAO;KACd;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,OAAO;KACd;IAC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;gBAChB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;CACO,CAAC;AAEX,MAAa,uBAAuB;IAElC,MAAM,CAAC,eAAe;QACpB,OAAO,IAAI,kBAAS,CAAC,IAAI,CAA4B,CAAC;IACxD,CAAC;IACD,MAAM,CAAC,OAAO,CACZ,OAAe,EACf,MAA8B;QAE9B,OAAO,IAAI,iBAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAA8B,CAAC;IAC1E,CAAC;;AAVH,0DAWC;AAViB,2BAAG,GAAG,IAAI,CAAC"} \ No newline at end of file diff --git a/lib/contracts/factories/OptimismL1FeeOracle__factory.d.ts b/lib/contracts/factories/OptimismL1FeeOracle__factory.d.ts new file mode 100644 index 0000000..41e21f9 --- /dev/null +++ b/lib/contracts/factories/OptimismL1FeeOracle__factory.d.ts @@ -0,0 +1,234 @@ +import { type ContractRunner } from "ethers"; +import type { OptimismL1FeeOracle, OptimismL1FeeOracleInterface } from "../OptimismL1FeeOracle"; +export declare class OptimismL1FeeOracle__factory { + static readonly abi: readonly [{ + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "_owner"; + readonly type: "address"; + }]; + readonly stateMutability: "nonpayable"; + readonly type: "constructor"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: false; + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly name: "DecimalsUpdated"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: false; + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly name: "GasPriceUpdated"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: false; + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly name: "L1BaseFeeUpdated"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: false; + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly name: "OverheadUpdated"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: true; + readonly internalType: "address"; + readonly name: "previousOwner"; + readonly type: "address"; + }, { + readonly indexed: true; + readonly internalType: "address"; + readonly name: "newOwner"; + readonly type: "address"; + }]; + readonly name: "OwnershipTransferred"; + readonly type: "event"; + }, { + readonly anonymous: false; + readonly inputs: readonly [{ + readonly indexed: false; + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly name: "ScalarUpdated"; + readonly type: "event"; + }, { + readonly inputs: readonly []; + readonly name: "decimals"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "gasPrice"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes"; + readonly name: "_data"; + readonly type: "bytes"; + }]; + readonly name: "getL1Fee"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "bytes"; + readonly name: "_data"; + readonly type: "bytes"; + }]; + readonly name: "getL1GasUsed"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "l1BaseFee"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "overhead"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "owner"; + readonly outputs: readonly [{ + readonly internalType: "address"; + readonly name: ""; + readonly type: "address"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "renounceOwnership"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly []; + readonly name: "scalar"; + readonly outputs: readonly [{ + readonly internalType: "uint256"; + readonly name: ""; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "_decimals"; + readonly type: "uint256"; + }]; + readonly name: "setDecimals"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "_gasPrice"; + readonly type: "uint256"; + }]; + readonly name: "setGasPrice"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "_baseFee"; + readonly type: "uint256"; + }]; + readonly name: "setL1BaseFee"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "_overhead"; + readonly type: "uint256"; + }]; + readonly name: "setOverhead"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "uint256"; + readonly name: "_scalar"; + readonly type: "uint256"; + }]; + readonly name: "setScalar"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }, { + readonly inputs: readonly [{ + readonly internalType: "address"; + readonly name: "newOwner"; + readonly type: "address"; + }]; + readonly name: "transferOwnership"; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; + readonly type: "function"; + }]; + static createInterface(): OptimismL1FeeOracleInterface; + static connect(address: string, runner?: ContractRunner | null): OptimismL1FeeOracle; +} diff --git a/lib/contracts/factories/OptimismL1FeeOracle__factory.js b/lib/contracts/factories/OptimismL1FeeOracle__factory.js new file mode 100644 index 0000000..a284bfd --- /dev/null +++ b/lib/contracts/factories/OptimismL1FeeOracle__factory.js @@ -0,0 +1,316 @@ +"use strict"; +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.OptimismL1FeeOracle__factory = void 0; +const ethers_1 = require("ethers"); +const _abi = [ + { + inputs: [ + { + internalType: "address", + name: "_owner", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "DecimalsUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "GasPriceUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "L1BaseFeeUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "OverheadUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "ScalarUpdated", + type: "event", + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gasPrice", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes", + name: "_data", + type: "bytes", + }, + ], + name: "getL1Fee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes", + name: "_data", + type: "bytes", + }, + ], + name: "getL1GasUsed", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "l1BaseFee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "overhead", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "scalar", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_decimals", + type: "uint256", + }, + ], + name: "setDecimals", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_gasPrice", + type: "uint256", + }, + ], + name: "setGasPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_baseFee", + type: "uint256", + }, + ], + name: "setL1BaseFee", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_overhead", + type: "uint256", + }, + ], + name: "setOverhead", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_scalar", + type: "uint256", + }, + ], + name: "setScalar", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +]; +class OptimismL1FeeOracle__factory { + static createInterface() { + return new ethers_1.Interface(_abi); + } + static connect(address, runner) { + return new ethers_1.Contract(address, _abi, runner); + } +} +exports.OptimismL1FeeOracle__factory = OptimismL1FeeOracle__factory; +OptimismL1FeeOracle__factory.abi = _abi; +//# sourceMappingURL=OptimismL1FeeOracle__factory.js.map \ No newline at end of file diff --git a/lib/contracts/factories/OptimismL1FeeOracle__factory.js.map b/lib/contracts/factories/OptimismL1FeeOracle__factory.js.map new file mode 100644 index 0000000..5744824 --- /dev/null +++ b/lib/contracts/factories/OptimismL1FeeOracle__factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"OptimismL1FeeOracle__factory.js","sourceRoot":"","sources":["../../../src/contracts/factories/OptimismL1FeeOracle__factory.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;;;AAEpB,mCAAkE;AAMlE,MAAM,IAAI,GAAG;IACX;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,aAAa;KACpB;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SA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;gBACvB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;CACO,CAAC;AAEX,MAAa,4BAA4B;IAEvC,MAAM,CAAC,eAAe;QACpB,OAAO,IAAI,kBAAS,CAAC,IAAI,CAAiC,CAAC;IAC7D,CAAC;IACD,MAAM,CAAC,OAAO,CACZ,OAAe,EACf,MAA8B;QAE9B,OAAO,IAAI,iBAAQ,CACjB,OAAO,EACP,IAAI,EACJ,MAAM,CAC2B,CAAC;IACtC,CAAC;;AAdH,oEAeC;AAdiB,gCAAG,GAAG,IAAI,CAAC"} \ No newline at end of file diff --git a/lib/contracts/factories/index.d.ts b/lib/contracts/factories/index.d.ts new file mode 100644 index 0000000..def5b8d --- /dev/null +++ b/lib/contracts/factories/index.d.ts @@ -0,0 +1,4 @@ +export { GasPriceOracle__factory } from "./GasPriceOracle__factory"; +export { Multicall__factory } from "./Multicall__factory"; +export { OffchainOracle__factory } from "./OffchainOracle__factory"; +export { OptimismL1FeeOracle__factory } from "./OptimismL1FeeOracle__factory"; diff --git a/lib/contracts/factories/index.js b/lib/contracts/factories/index.js new file mode 100644 index 0000000..060a9e1 --- /dev/null +++ b/lib/contracts/factories/index.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.OptimismL1FeeOracle__factory = exports.OffchainOracle__factory = exports.Multicall__factory = exports.GasPriceOracle__factory = void 0; +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +var GasPriceOracle__factory_1 = require("./GasPriceOracle__factory"); +Object.defineProperty(exports, "GasPriceOracle__factory", { enumerable: true, get: function () { return GasPriceOracle__factory_1.GasPriceOracle__factory; } }); +var Multicall__factory_1 = require("./Multicall__factory"); +Object.defineProperty(exports, "Multicall__factory", { enumerable: true, get: function () { return Multicall__factory_1.Multicall__factory; } }); +var OffchainOracle__factory_1 = require("./OffchainOracle__factory"); +Object.defineProperty(exports, "OffchainOracle__factory", { enumerable: true, get: function () { return OffchainOracle__factory_1.OffchainOracle__factory; } }); +var OptimismL1FeeOracle__factory_1 = require("./OptimismL1FeeOracle__factory"); +Object.defineProperty(exports, "OptimismL1FeeOracle__factory", { enumerable: true, get: function () { return OptimismL1FeeOracle__factory_1.OptimismL1FeeOracle__factory; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/contracts/factories/index.js.map b/lib/contracts/factories/index.js.map new file mode 100644 index 0000000..ddd0c29 --- /dev/null +++ b/lib/contracts/factories/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/contracts/factories/index.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AACpB,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAChC,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAChC,+EAA8E;AAArE,4IAAA,4BAA4B,OAAA"} \ No newline at end of file diff --git a/lib/contracts/index.d.ts b/lib/contracts/index.d.ts new file mode 100644 index 0000000..88ad115 --- /dev/null +++ b/lib/contracts/index.d.ts @@ -0,0 +1,9 @@ +export type { GasPriceOracle } from "./GasPriceOracle"; +export type { Multicall } from "./Multicall"; +export type { OffchainOracle } from "./OffchainOracle"; +export type { OptimismL1FeeOracle } from "./OptimismL1FeeOracle"; +export * as factories from "./factories"; +export { GasPriceOracle__factory } from "./factories/GasPriceOracle__factory"; +export { Multicall__factory } from "./factories/Multicall__factory"; +export { OffchainOracle__factory } from "./factories/OffchainOracle__factory"; +export { OptimismL1FeeOracle__factory } from "./factories/OptimismL1FeeOracle__factory"; diff --git a/lib/contracts/index.js b/lib/contracts/index.js new file mode 100644 index 0000000..2bdf5b5 --- /dev/null +++ b/lib/contracts/index.js @@ -0,0 +1,36 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.OptimismL1FeeOracle__factory = exports.OffchainOracle__factory = exports.Multicall__factory = exports.GasPriceOracle__factory = exports.factories = void 0; +exports.factories = __importStar(require("./factories")); +var GasPriceOracle__factory_1 = require("./factories/GasPriceOracle__factory"); +Object.defineProperty(exports, "GasPriceOracle__factory", { enumerable: true, get: function () { return GasPriceOracle__factory_1.GasPriceOracle__factory; } }); +var Multicall__factory_1 = require("./factories/Multicall__factory"); +Object.defineProperty(exports, "Multicall__factory", { enumerable: true, get: function () { return Multicall__factory_1.Multicall__factory; } }); +var OffchainOracle__factory_1 = require("./factories/OffchainOracle__factory"); +Object.defineProperty(exports, "OffchainOracle__factory", { enumerable: true, get: function () { return OffchainOracle__factory_1.OffchainOracle__factory; } }); +var OptimismL1FeeOracle__factory_1 = require("./factories/OptimismL1FeeOracle__factory"); +Object.defineProperty(exports, "OptimismL1FeeOracle__factory", { enumerable: true, get: function () { return OptimismL1FeeOracle__factory_1.OptimismL1FeeOracle__factory; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/contracts/index.js.map b/lib/contracts/index.js.map new file mode 100644 index 0000000..4372bf9 --- /dev/null +++ b/lib/contracts/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,yDAAyC;AACzC,+EAA8E;AAArE,kIAAA,uBAAuB,OAAA;AAChC,qEAAoE;AAA3D,wHAAA,kBAAkB,OAAA;AAC3B,+EAA8E;AAArE,kIAAA,uBAAuB,OAAA;AAChC,yFAAwF;AAA/E,4IAAA,4BAA4B,OAAA"} \ No newline at end of file diff --git a/lib/esm/constants.js b/lib/esm/constants.js new file mode 100644 index 0000000..afe2655 --- /dev/null +++ b/lib/esm/constants.js @@ -0,0 +1,15 @@ +export var ChainId; +(function (ChainId) { + ChainId[ChainId["MAINNET"] = 1] = "MAINNET"; + ChainId[ChainId["BSC"] = 56] = "BSC"; + ChainId[ChainId["XDAI"] = 100] = "XDAI"; + ChainId[ChainId["POLYGON"] = 137] = "POLYGON"; + ChainId[ChainId["OPTIMISM"] = 10] = "OPTIMISM"; + ChainId[ChainId["ARBITRUM"] = 42161] = "ARBITRUM"; + ChainId[ChainId["AVAX"] = 43114] = "AVAX"; + ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA"; +})(ChainId || (ChainId = {})); +export const ENS_CHAINS = [ChainId.MAINNET, ChainId.SEPOLIA]; +export const multiCallAddress = '0xcA11bde05977b3631167028862bE2a173976CA11'; +export const POLYGON_GAS_STATION = 'https://gasstation.polygon.technology/v2'; +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/esm/constants.js.map b/lib/esm/constants.js.map new file mode 100644 index 0000000..5c14d20 --- /dev/null +++ b/lib/esm/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,OASX;AATD,WAAY,OAAO;IACjB,2CAAW,CAAA;IACX,oCAAQ,CAAA;IACR,uCAAU,CAAA;IACV,6CAAa,CAAA;IACb,8CAAa,CAAA;IACb,iDAAgB,CAAA;IAChB,yCAAY,CAAA;IACZ,kDAAkB,CAAA;AACpB,CAAC,EATW,OAAO,KAAP,OAAO,QASlB;AAID,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,4CAA4C,CAAC;AAE7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,0CAA0C,CAAC"} \ No newline at end of file diff --git a/lib/esm/contracts/GasPriceOracle.js b/lib/esm/contracts/GasPriceOracle.js new file mode 100644 index 0000000..d0c9d48 --- /dev/null +++ b/lib/esm/contracts/GasPriceOracle.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=GasPriceOracle.js.map \ No newline at end of file diff --git a/lib/esm/contracts/GasPriceOracle.js.map b/lib/esm/contracts/GasPriceOracle.js.map new file mode 100644 index 0000000..3f5a36f --- /dev/null +++ b/lib/esm/contracts/GasPriceOracle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GasPriceOracle.js","sourceRoot":"","sources":["../../../src/contracts/GasPriceOracle.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib/esm/contracts/Multicall.js b/lib/esm/contracts/Multicall.js new file mode 100644 index 0000000..3e02184 --- /dev/null +++ b/lib/esm/contracts/Multicall.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=Multicall.js.map \ No newline at end of file diff --git a/lib/esm/contracts/Multicall.js.map b/lib/esm/contracts/Multicall.js.map new file mode 100644 index 0000000..5ab846d --- /dev/null +++ b/lib/esm/contracts/Multicall.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Multicall.js","sourceRoot":"","sources":["../../../src/contracts/Multicall.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib/esm/contracts/OffchainOracle.js b/lib/esm/contracts/OffchainOracle.js new file mode 100644 index 0000000..ef35506 --- /dev/null +++ b/lib/esm/contracts/OffchainOracle.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=OffchainOracle.js.map \ No newline at end of file diff --git a/lib/esm/contracts/OffchainOracle.js.map b/lib/esm/contracts/OffchainOracle.js.map new file mode 100644 index 0000000..75b4315 --- /dev/null +++ b/lib/esm/contracts/OffchainOracle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"OffchainOracle.js","sourceRoot":"","sources":["../../../src/contracts/OffchainOracle.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib/esm/contracts/OptimismL1FeeOracle.js b/lib/esm/contracts/OptimismL1FeeOracle.js new file mode 100644 index 0000000..6174f2b --- /dev/null +++ b/lib/esm/contracts/OptimismL1FeeOracle.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=OptimismL1FeeOracle.js.map \ No newline at end of file diff --git a/lib/esm/contracts/OptimismL1FeeOracle.js.map b/lib/esm/contracts/OptimismL1FeeOracle.js.map new file mode 100644 index 0000000..ed7c2aa --- /dev/null +++ b/lib/esm/contracts/OptimismL1FeeOracle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"OptimismL1FeeOracle.js","sourceRoot":"","sources":["../../../src/contracts/OptimismL1FeeOracle.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib/esm/contracts/common.js b/lib/esm/contracts/common.js new file mode 100644 index 0000000..6b84ded --- /dev/null +++ b/lib/esm/contracts/common.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/lib/esm/contracts/common.js.map b/lib/esm/contracts/common.js.map new file mode 100644 index 0000000..df8c71a --- /dev/null +++ b/lib/esm/contracts/common.js.map @@ -0,0 +1 @@ +{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/contracts/common.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib/esm/contracts/factories/GasPriceOracle__factory.js b/lib/esm/contracts/factories/GasPriceOracle__factory.js new file mode 100644 index 0000000..763857b --- /dev/null +++ b/lib/esm/contracts/factories/GasPriceOracle__factory.js @@ -0,0 +1,203 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { Contract, Interface } from "ethers"; +const _abi = [ + { + inputs: [], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [], + name: "GAS_UNIT", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "_derivationThresold", + type: "uint32", + }, + ], + name: "changeDerivationThresold", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "_gasUnit", + type: "uint32", + }, + ], + name: "changeGasUnit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "_heartbeat", + type: "uint32", + }, + ], + name: "changeHeartbeat", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_owner", + type: "address", + }, + ], + name: "changeOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "derivationThresold", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gasPrice", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "heartbeat", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxFeePerGas", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxPriorityFeePerGas", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "pastGasPrice", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "_gasPrice", + type: "uint32", + }, + ], + name: "setGasPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "timestamp", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, +]; +export class GasPriceOracle__factory { + static createInterface() { + return new Interface(_abi); + } + static connect(address, runner) { + return new Contract(address, _abi, runner); + } +} +GasPriceOracle__factory.abi = _abi; +//# sourceMappingURL=GasPriceOracle__factory.js.map \ No newline at end of file diff --git a/lib/esm/contracts/factories/GasPriceOracle__factory.js.map b/lib/esm/contracts/factories/GasPriceOracle__factory.js.map new file mode 100644 index 0000000..2919ff4 --- /dev/null +++ b/lib/esm/contracts/factories/GasPriceOracle__factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GasPriceOracle__factory.js","sourceRoot":"","sources":["../../../../src/contracts/factories/GasPriceOracle__factory.ts"],"names":[],"mappings":"AAAA,+CAA+C;A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ACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,QAAQ;gBACtB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,QAAQ;aACf;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,QAAQ;gBACtB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;aACf;SACF;QACD,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,QAAQ;gBACtB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,QAAQ;aACf;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;CACO,CAAC;AAEX,MAAM,OAAO,uBAAuB;IAElC,MAAM,CAAC,eAAe;QACpB,OAAO,IAAI,SAAS,CAAC,IAAI,CAA4B,CAAC;IACxD,CAAC;IACD,MAAM,CAAC,OAAO,CACZ,OAAe,EACf,MAA8B;QAE9B,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAA8B,CAAC;IAC1E,CAAC;;AATe,2BAAG,GAAG,IAAI,CAAC"} \ No newline at end of file diff --git a/lib/esm/contracts/factories/Multicall__factory.js b/lib/esm/contracts/factories/Multicall__factory.js new file mode 100644 index 0000000..56cc318 --- /dev/null +++ b/lib/esm/contracts/factories/Multicall__factory.js @@ -0,0 +1,454 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { Contract, Interface } from "ethers"; +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", + }, +]; +export class Multicall__factory { + static createInterface() { + return new Interface(_abi); + } + static connect(address, runner) { + return new Contract(address, _abi, runner); + } +} +Multicall__factory.abi = _abi; +//# sourceMappingURL=Multicall__factory.js.map \ No newline at end of file diff --git a/lib/esm/contracts/factories/Multicall__factory.js.map b/lib/esm/contracts/factories/Multicall__factory.js.map new file mode 100644 index 0000000..0aa0ac3 --- /dev/null +++ b/lib/esm/contracts/factories/Multicall__factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Multicall__factory.js","sourceRoot":"","sources":["../../../../src/contracts/factories/Multicall__factory.ts"],"names":[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AAuB,CAAC;IACnD,CAAC;IACD,MAAM,CAAC,OAAO,CAAC,OAAe,EAAE,MAA8B;QAC5D,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAyB,CAAC;IACrE,CAAC;;AANe,sBAAG,GAAG,IAAI,CAAC"} \ No newline at end of file diff --git a/lib/esm/contracts/factories/OffchainOracle__factory.js b/lib/esm/contracts/factories/OffchainOracle__factory.js new file mode 100644 index 0000000..e77e961 --- /dev/null +++ b/lib/esm/contracts/factories/OffchainOracle__factory.js @@ -0,0 +1,529 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { Contract, Interface } from "ethers"; +const _abi = [ + { + inputs: [ + { + internalType: "contract MultiWrapper", + name: "_multiWrapper", + type: "address", + }, + { + internalType: "contract IOracle[]", + name: "existingOracles", + type: "address[]", + }, + { + internalType: "enum OffchainOracle.OracleType[]", + name: "oracleTypes", + type: "uint8[]", + }, + { + internalType: "contract IERC20[]", + name: "existingConnectors", + type: "address[]", + }, + { + internalType: "contract IERC20", + name: "wBase", + type: "address", + }, + { + internalType: "address", + name: "owner", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [], + name: "ArraysLengthMismatch", + type: "error", + }, + { + inputs: [], + name: "ConnectorAlreadyAdded", + type: "error", + }, + { + inputs: [], + name: "InvalidOracleTokenKind", + type: "error", + }, + { + inputs: [], + name: "OracleAlreadyAdded", + type: "error", + }, + { + inputs: [], + name: "SameTokens", + type: "error", + }, + { + inputs: [], + name: "TooBigThreshold", + type: "error", + }, + { + inputs: [], + name: "UnknownConnector", + type: "error", + }, + { + inputs: [], + name: "UnknownOracle", + type: "error", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "contract IERC20", + name: "connector", + type: "address", + }, + ], + name: "ConnectorAdded", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "contract IERC20", + name: "connector", + type: "address", + }, + ], + name: "ConnectorRemoved", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "contract MultiWrapper", + name: "multiWrapper", + type: "address", + }, + ], + name: "MultiWrapperUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "contract IOracle", + name: "oracle", + type: "address", + }, + { + indexed: false, + internalType: "enum OffchainOracle.OracleType", + name: "oracleType", + type: "uint8", + }, + ], + name: "OracleAdded", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "contract IOracle", + name: "oracle", + type: "address", + }, + { + indexed: false, + internalType: "enum OffchainOracle.OracleType", + name: "oracleType", + type: "uint8", + }, + ], + name: "OracleRemoved", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "connector", + type: "address", + }, + ], + name: "addConnector", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IOracle", + name: "oracle", + type: "address", + }, + { + internalType: "enum OffchainOracle.OracleType", + name: "oracleKind", + type: "uint8", + }, + ], + name: "addOracle", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "connectors", + outputs: [ + { + internalType: "contract IERC20[]", + name: "allConnectors", + type: "address[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address", + }, + { + internalType: "contract IERC20", + name: "dstToken", + type: "address", + }, + { + internalType: "bool", + name: "useWrappers", + type: "bool", + }, + ], + name: "getRate", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address", + }, + { + internalType: "bool", + name: "useSrcWrappers", + type: "bool", + }, + ], + name: "getRateToEth", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address", + }, + { + internalType: "bool", + name: "useSrcWrappers", + type: "bool", + }, + { + internalType: "contract IERC20[]", + name: "customConnectors", + type: "address[]", + }, + { + internalType: "uint256", + name: "thresholdFilter", + type: "uint256", + }, + ], + name: "getRateToEthWithCustomConnectors", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address", + }, + { + internalType: "bool", + name: "useSrcWrappers", + type: "bool", + }, + { + internalType: "uint256", + name: "thresholdFilter", + type: "uint256", + }, + ], + name: "getRateToEthWithThreshold", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address", + }, + { + internalType: "contract IERC20", + name: "dstToken", + type: "address", + }, + { + internalType: "bool", + name: "useWrappers", + type: "bool", + }, + { + internalType: "contract IERC20[]", + name: "customConnectors", + type: "address[]", + }, + { + internalType: "uint256", + name: "thresholdFilter", + type: "uint256", + }, + ], + name: "getRateWithCustomConnectors", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "srcToken", + type: "address", + }, + { + internalType: "contract IERC20", + name: "dstToken", + type: "address", + }, + { + internalType: "bool", + name: "useWrappers", + type: "bool", + }, + { + internalType: "uint256", + name: "thresholdFilter", + type: "uint256", + }, + ], + name: "getRateWithThreshold", + outputs: [ + { + internalType: "uint256", + name: "weightedRate", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "multiWrapper", + outputs: [ + { + internalType: "contract MultiWrapper", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "oracles", + outputs: [ + { + internalType: "contract IOracle[]", + name: "allOracles", + type: "address[]", + }, + { + internalType: "enum OffchainOracle.OracleType[]", + name: "oracleTypes", + type: "uint8[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IERC20", + name: "connector", + type: "address", + }, + ], + name: "removeConnector", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IOracle", + name: "oracle", + type: "address", + }, + { + internalType: "enum OffchainOracle.OracleType", + name: "oracleKind", + type: "uint8", + }, + ], + name: "removeOracle", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "contract MultiWrapper", + name: "_multiWrapper", + type: "address", + }, + ], + name: "setMultiWrapper", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +]; +export class OffchainOracle__factory { + static createInterface() { + return new Interface(_abi); + } + static connect(address, runner) { + return new Contract(address, _abi, runner); + } +} +OffchainOracle__factory.abi = _abi; +//# sourceMappingURL=OffchainOracle__factory.js.map \ No newline at end of file diff --git a/lib/esm/contracts/factories/OffchainOracle__factory.js.map b/lib/esm/contracts/factories/OffchainOracle__factory.js.map new file mode 100644 index 0000000..0f67961 --- /dev/null +++ b/lib/esm/contracts/factories/OffchainOracle__factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"OffchainOracle__factory.js","sourceRoot":"","sources":["../../../../src/contracts/factories/OffchainOracle__factory.ts"],"names":[],"mappings":"AA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AAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;CACO,CAAC;AAEX,MAAM,OAAO,uBAAuB;IAElC,MAAM,CAAC,eAAe;QACpB,OAAO,IAAI,SAAS,CAAC,IAAI,CAA4B,CAAC;IACxD,CAAC;IACD,MAAM,CAAC,OAAO,CACZ,OAAe,EACf,MAA8B;QAE9B,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAA8B,CAAC;IAC1E,CAAC;;AATe,2BAAG,GAAG,IAAI,CAAC"} \ No newline at end of file diff --git a/lib/esm/contracts/factories/OptimismL1FeeOracle__factory.js b/lib/esm/contracts/factories/OptimismL1FeeOracle__factory.js new file mode 100644 index 0000000..53472be --- /dev/null +++ b/lib/esm/contracts/factories/OptimismL1FeeOracle__factory.js @@ -0,0 +1,312 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { Contract, Interface } from "ethers"; +const _abi = [ + { + inputs: [ + { + internalType: "address", + name: "_owner", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "DecimalsUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "GasPriceUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "L1BaseFeeUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "OverheadUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "ScalarUpdated", + type: "event", + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gasPrice", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes", + name: "_data", + type: "bytes", + }, + ], + name: "getL1Fee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes", + name: "_data", + type: "bytes", + }, + ], + name: "getL1GasUsed", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "l1BaseFee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "overhead", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "scalar", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_decimals", + type: "uint256", + }, + ], + name: "setDecimals", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_gasPrice", + type: "uint256", + }, + ], + name: "setGasPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_baseFee", + type: "uint256", + }, + ], + name: "setL1BaseFee", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_overhead", + type: "uint256", + }, + ], + name: "setOverhead", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_scalar", + type: "uint256", + }, + ], + name: "setScalar", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +]; +export class OptimismL1FeeOracle__factory { + static createInterface() { + return new Interface(_abi); + } + static connect(address, runner) { + return new Contract(address, _abi, runner); + } +} +OptimismL1FeeOracle__factory.abi = _abi; +//# sourceMappingURL=OptimismL1FeeOracle__factory.js.map \ No newline at end of file diff --git a/lib/esm/contracts/factories/OptimismL1FeeOracle__factory.js.map b/lib/esm/contracts/factories/OptimismL1FeeOracle__factory.js.map new file mode 100644 index 0000000..74509b7 --- /dev/null +++ b/lib/esm/contracts/factories/OptimismL1FeeOracle__factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"OptimismL1FeeOracle__factory.js","sourceRoot":"","sources":["../../../../src/contracts/factories/OptimismL1FeeOracle__factory.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAuB,MAAM,QAAQ,CAAC;AAMlE,MAAM,IAAI,GAAG;IACX;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,aAAa;KACpB;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IA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AAU;gBAChB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;CACO,CAAC;AAEX,MAAM,OAAO,4BAA4B;IAEvC,MAAM,CAAC,eAAe;QACpB,OAAO,IAAI,SAAS,CAAC,IAAI,CAAiC,CAAC;IAC7D,CAAC;IACD,MAAM,CAAC,OAAO,CACZ,OAAe,EACf,MAA8B;QAE9B,OAAO,IAAI,QAAQ,CACjB,OAAO,EACP,IAAI,EACJ,MAAM,CAC2B,CAAC;IACtC,CAAC;;AAbe,gCAAG,GAAG,IAAI,CAAC"} \ No newline at end of file diff --git a/lib/esm/contracts/factories/index.js b/lib/esm/contracts/factories/index.js new file mode 100644 index 0000000..683dd7c --- /dev/null +++ b/lib/esm/contracts/factories/index.js @@ -0,0 +1,8 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export { GasPriceOracle__factory } from "./GasPriceOracle__factory"; +export { Multicall__factory } from "./Multicall__factory"; +export { OffchainOracle__factory } from "./OffchainOracle__factory"; +export { OptimismL1FeeOracle__factory } from "./OptimismL1FeeOracle__factory"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/esm/contracts/factories/index.js.map b/lib/esm/contracts/factories/index.js.map new file mode 100644 index 0000000..33862c8 --- /dev/null +++ b/lib/esm/contracts/factories/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/contracts/factories/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AACpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC"} \ No newline at end of file diff --git a/lib/esm/contracts/index.js b/lib/esm/contracts/index.js new file mode 100644 index 0000000..78854bc --- /dev/null +++ b/lib/esm/contracts/index.js @@ -0,0 +1,7 @@ +import * as factories_1 from "./factories"; +export { factories_1 as factories }; +export { GasPriceOracle__factory } from "./factories/GasPriceOracle__factory"; +export { Multicall__factory } from "./factories/Multicall__factory"; +export { OffchainOracle__factory } from "./factories/OffchainOracle__factory"; +export { OptimismL1FeeOracle__factory } from "./factories/OptimismL1FeeOracle__factory"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/esm/contracts/index.js.map b/lib/esm/contracts/index.js.map new file mode 100644 index 0000000..340f12c --- /dev/null +++ b/lib/esm/contracts/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/contracts/index.ts"],"names":[],"mappings":"6BAO2B,aAAa;wBAA5B,SAAS;AACrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC"} \ No newline at end of file diff --git a/lib/esm/feeOracle.js b/lib/esm/feeOracle.js new file mode 100644 index 0000000..fc70b78 --- /dev/null +++ b/lib/esm/feeOracle.js @@ -0,0 +1,71 @@ +import { Transaction, parseUnits } from 'ethers'; +import { OptimismL1FeeOracle__factory } from './contracts'; +import { getProvider } from './providers'; +import { convertETHToTokenAmount } from './utils'; +const DUMMY_ADDRESS = '0x1111111111111111111111111111111111111111'; +const DUMMY_NONCE = '0x1111111111111111111111111111111111111111111111111111111111111111'; +const DUMMY_WITHDRAW_DATA = '0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'; +export class TornadoFeeOracle { + constructor(netId, rpcUrl, config) { + const { optimismL1FeeOracleAddress } = config; + if (optimismL1FeeOracleAddress) { + const provider = getProvider(netId, rpcUrl, config); + this.optimismL1FeeOracle = OptimismL1FeeOracle__factory.connect(optimismL1FeeOracleAddress, provider); + } + } + /** + * Calculate L1 fee for op-stack chains + * + * This is required since relayers would pay the full transaction fees for users + */ + fetchL1OptimismFee(tx) { + if (!this.optimismL1FeeOracle) { + return new Promise((resolve) => resolve(BigInt(0))); + } + if (!tx) { + // this tx is only used to simulate bytes size of the encoded tx so has nothing to with the accuracy + // inspired by the old style classic-ui calculation + tx = { + type: 0, + gasLimit: 1000000, + nonce: Number(DUMMY_NONCE), + data: DUMMY_WITHDRAW_DATA, + gasPrice: parseUnits('1', 'gwei'), + from: DUMMY_ADDRESS, + to: DUMMY_ADDRESS, + }; + } + return this.optimismL1FeeOracle.getL1Fee.staticCall(Transaction.from(tx).unsignedSerialized); + } + /** + * We don't need to distinguish default refunds by tokens since most users interact with other defi protocols after withdrawal + * So we default with 1M gas which is enough for two or three swaps + * Using 30 gwei for default but it is recommended to supply cached gasPrice value from the UI + */ + defaultEthRefund(gasPrice, gasLimit) { + return (gasPrice ? BigInt(gasPrice) : parseUnits('30', 'gwei')) * BigInt(gasLimit || 1000000); + } + /** + * Calculates token amount for required ethRefund purchases required to calculate fees + */ + calculateTokenAmount(ethRefund, tokenPriceInEth, tokenDecimals) { + return convertETHToTokenAmount(ethRefund, tokenPriceInEth, tokenDecimals); + } + /** + * Warning: For tokens you need to check if the fees are above denomination + * (Usually happens for small denomination pool or if the gas price is high) + */ + calculateRelayerFee({ gasPrice, gasLimit = 600000, l1Fee = 0, denomination, ethRefund = BigInt(0), tokenPriceInWei, tokenDecimals = 18, relayerFeePercent = 0.33, isEth = true, premiumPercent = 20, }) { + const gasCosts = BigInt(gasPrice) * BigInt(gasLimit) + BigInt(l1Fee); + const relayerFee = (BigInt(denomination) * BigInt(Math.floor(10000 * relayerFeePercent))) / BigInt(10000 * 100); + if (isEth) { + // Add 20% premium + return ((gasCosts + relayerFee) * BigInt(premiumPercent ? 100 + premiumPercent : 100)) / BigInt(100); + } + const feeInEth = gasCosts + BigInt(ethRefund); + return (((convertETHToTokenAmount(feeInEth, tokenPriceInWei, tokenDecimals) + relayerFee) * + BigInt(premiumPercent ? 100 + premiumPercent : 100)) / + BigInt(100)); + } +} +//# sourceMappingURL=feeOracle.js.map \ No newline at end of file diff --git a/lib/esm/feeOracle.js.map b/lib/esm/feeOracle.js.map new file mode 100644 index 0000000..1675fd9 --- /dev/null +++ b/lib/esm/feeOracle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"feeOracle.js","sourceRoot":"","sources":["../../src/feeOracle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEjD,OAAO,EAAuB,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,aAAa,GAAG,4CAA4C,CAAC;AAEnE,MAAM,WAAW,GAAG,oEAAoE,CAAC;AAEzF,MAAM,mBAAmB,GACvB,4kCAA4kC,CAAC;AAe/kC,MAAM,OAAO,gBAAgB;IAG3B,YAAY,KAAkB,EAAE,MAAc,EAAE,MAAqB;QACnE,MAAM,EAAE,0BAA0B,EAAE,GAAG,MAAM,CAAC;QAE9C,IAAI,0BAA0B,EAAE,CAAC;YAC/B,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;YACpD,IAAI,CAAC,mBAAmB,GAAG,4BAA4B,CAAC,OAAO,CAAC,0BAA0B,EAAE,QAAQ,CAAC,CAAC;QACxG,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,kBAAkB,CAAC,EAAoB;QACrC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtD,CAAC;QAED,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,oGAAoG;YACpG,mDAAmD;YACnD,EAAE,GAAG;gBACH,IAAI,EA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KAAK,CAAC,KAAK,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;QAEhH,IAAI,KAAK,EAAE,CAAC;YACV,kBAAkB;YAClB,OAAO,CAAC,CAAC,QAAQ,GAAG,UAAU,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACvG,CAAC;QAED,MAAM,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;QAE9C,OAAO,CACL,CAAC,CAAC,uBAAuB,CAAC,QAAQ,EAAE,eAAe,EAAE,aAAa,CAAC,GAAG,UAAU,CAAC;YAC/E,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACtD,MAAM,CAAC,GAAG,CAAC,CACZ,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/lib/esm/index.js b/lib/esm/index.js new file mode 100644 index 0000000..c6304a2 --- /dev/null +++ b/lib/esm/index.js @@ -0,0 +1,8 @@ +export * from './constants'; +export * from './feeOracle'; +export * from './multicall'; +export * from './providers'; +export * from './tokenPriceOracle'; +export * from './types'; +export * from './utils'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/esm/index.js.map b/lib/esm/index.js.map new file mode 100644 index 0000000..1e8ae91 --- /dev/null +++ b/lib/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"} \ No newline at end of file diff --git a/lib/esm/multicall.js b/lib/esm/multicall.js new file mode 100644 index 0000000..1263b56 --- /dev/null +++ b/lib/esm/multicall.js @@ -0,0 +1,33 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +export function multicall(Multicall, calls) { + return __awaiter(this, void 0, void 0, function* () { + const calldata = calls.map((call) => { + var _a, _b, _c; + const target = (((_a = call.contract) === null || _a === void 0 ? void 0 : _a.target) || call.address); + const callInterface = (((_b = call.contract) === null || _b === void 0 ? void 0 : _b.interface) || call.interface); + return { + target, + callData: callInterface.encodeFunctionData(call.name, call.params), + allowFailure: (_c = call.allowFailure) !== null && _c !== void 0 ? _c : false, + }; + }); + const returnData = yield Multicall.aggregate3.staticCall(calldata); + const res = returnData.map((call, i) => { + var _a; + const callInterface = (((_a = calls[i].contract) === null || _a === void 0 ? void 0 : _a.interface) || calls[i].interface); + const [result, data] = call; + const decodeResult = result && data && data !== '0x' ? callInterface.decodeFunctionResult(calls[i].name, data) : null; + return !decodeResult ? null : decodeResult.length === 1 ? decodeResult[0] : decodeResult; + }); + return res; + }); +} +//# sourceMappingURL=multicall.js.map \ No newline at end of file diff --git a/lib/esm/multicall.js.map b/lib/esm/multicall.js.map new file mode 100644 index 0000000..cc3c455 --- /dev/null +++ b/lib/esm/multicall.js.map @@ -0,0 +1 @@ +{"version":3,"file":"multicall.js","sourceRoot":"","sources":["../../src/multicall.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,UAAgB,SAAS,CAAC,SAAoB,EAAE,KAAc;;QAClE,MAAM,QA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AAC;QAC3F,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;IACb,CAAC;CAAA"} \ No newline at end of file diff --git a/lib/esm/providers.js b/lib/esm/providers.js new file mode 100644 index 0000000..6111146 --- /dev/null +++ b/lib/esm/providers.js @@ -0,0 +1,89 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { JsonRpcProvider, Network, parseUnits, FetchUrlFeeDataNetworkPlugin, EnsPlugin, GasCostPlugin } from 'ethers'; +import { GasPriceOracle__factory, Multicall__factory } from './contracts'; +import { ENS_CHAINS, multiCallAddress, POLYGON_GAS_STATION } from './constants'; +import { multicall } from './multicall'; +import { isNode } from './utils'; +// caching to improve performance +const oracleMapper = new Map(); +const multicallMapper = new Map(); +export function getGasOraclePlugin(networkKey, gasOracleOptions) { + const gasStationApi = (gasOracleOptions === null || gasOracleOptions === void 0 ? void 0 : gasOracleOptions.gasStationApi) || POLYGON_GAS_STATION; + return new FetchUrlFeeDataNetworkPlugin(gasStationApi, (fetchFeeData, provider, request) => __awaiter(this, void 0, void 0, function* () { + if (!oracleMapper.has(networkKey)) { + oracleMapper.set(networkKey, GasPriceOracle__factory.connect(gasOracleOptions === null || gasOracleOptions === void 0 ? void 0 : gasOracleOptions.gasPriceOracle, provider)); + } + if (!multicallMapper.has(networkKey)) { + multicallMapper.set(networkKey, Multicall__factory.connect(multiCallAddress, provider)); + } + const Oracle = oracleMapper.get(networkKey); + const Multicall = multicallMapper.get(networkKey); + const [timestamp, heartbeat, feePerGas, priorityFeePerGas] = yield multicall(Multicall, [ + { + contract: Oracle, + name: 'timestamp', + }, + { + contract: Oracle, + name: 'heartbeat', + }, + { + contract: Oracle, + name: 'maxFeePerGas', + }, + { + contract: Oracle, + name: 'maxPriorityFeePerGas', + }, + ]); + const isOutdated = Number(timestamp) <= Date.now() / 1000 - Number(heartbeat); + if (!isOutdated) { + const maxPriorityFeePerGas = (priorityFeePerGas * BigInt(13)) / BigInt(10); + const maxFeePerGas = feePerGas * BigInt(2) + maxPriorityFeePerGas; + return { + gasPrice: maxFeePerGas, + maxFeePerGas, + maxPriorityFeePerGas, + }; + } + if (isNode) { + // Prevent Cloudflare from blocking our request in node.js + request.setHeader('User-Agent', 'ethers'); + } + const [{ bodyJson: { fast }, }, { gasPrice },] = yield Promise.all([request.send(), fetchFeeData()]); + return { + gasPrice, + maxFeePerGas: parseUnits(`${fast.maxFee}`, 9), + maxPriorityFeePerGas: parseUnits(`${fast.maxPriorityFee}`, 9), + }; + })); +} +export function getProvider(netId, rpcUrl, config) { + const { networkName, gasPriceOracleContract, gasStationApi, pollInterval } = config; + const hasEns = ENS_CHAINS.includes(netId); + const staticNetwork = new Network(networkName, netId); + if (hasEns) { + staticNetwork.attachPlugin(new EnsPlugin(null, Number(netId))); + } + staticNetwork.attachPlugin(new GasCostPlugin()); + if (gasPriceOracleContract) { + staticNetwork.attachPlugin(getGasOraclePlugin(`${netId}_${rpcUrl}`, { + gasPriceOracle: gasPriceOracleContract, + gasStationApi, + })); + } + const provider = new JsonRpcProvider(rpcUrl, staticNetwork, { + staticNetwork, + }); + provider.pollingInterval = pollInterval * 1000; + return provider; +} +//# sourceMappingURL=providers.js.map \ No newline at end of file diff --git a/lib/esm/providers.js.map b/lib/esm/providers.js.map new file mode 100644 index 0000000..48ab2eb --- /dev/null +++ b/lib/esm/providers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../src/providers.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,UAA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AAoB,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;SAC9D,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAkB,EAAE,MAAc,EAAE,MAAqB;IACnF,MAAM,EAAE,WAAW,EAAE,sBAAsB,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IACpF,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE1C,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IACtD,IAAI,MAAM,EAAE,CAAC;QACX,aAAa,CAAC,YAAY,CAAC,IAAI,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,aAAa,CAAC,YAAY,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;IAEhD,IAAI,sBAAsB,EAAE,CAAC;QAC3B,aAAa,CAAC,YAAY,CACxB,kBAAkB,CAAC,GAAG,KAAK,IAAI,MAAM,EAAE,EAAE;YACvC,cAAc,EAAE,sBAAsB;YACtC,aAAa;SACd,CAAC,CACH,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE;QAC1D,aAAa;KACd,CAAC,CAAC;IAEH,QAAQ,CAAC,eAAe,GAAG,YAAY,GAAG,IAAI,CAAC;IAE/C,OAAO,QAAQ,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/lib/esm/tokenPriceOracle.js b/lib/esm/tokenPriceOracle.js new file mode 100644 index 0000000..6684ccd --- /dev/null +++ b/lib/esm/tokenPriceOracle.js @@ -0,0 +1,46 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { parseEther } from 'ethers'; +import { Multicall__factory, OffchainOracle__factory } from './contracts'; +import { multiCallAddress } from './constants'; +import { multicall } from './multicall'; +import { getProvider } from './providers'; +export class TokenPriceOracle { + constructor(netId, rpcUrl, config) { + const { offchainOracleContract } = config; + this.provider = getProvider(netId, rpcUrl, config); + this.multicall = Multicall__factory.connect(multiCallAddress, this.provider); + if (offchainOracleContract) { + this.oracle = OffchainOracle__factory.connect(offchainOracleContract, this.provider); + } + } + fetchPrices(tokens) { + return __awaiter(this, void 0, void 0, function* () { + // setup mock price for testnets + if (!this.oracle) { + return new Promise((resolve) => resolve(tokens.reduce((acc, _, index) => { + acc[tokens[index].symbol] = parseEther('0.0001').toString(); + return acc; + }, {}))); + } + const prices = (yield multicall(this.multicall, tokens.map(({ tokenAddress }) => ({ + contract: this.oracle, + name: 'getRateToEth', + params: [tokenAddress, true], + })))); + return prices.reduce((acc, price, index) => { + const tokenPriceInwei = (price * BigInt(10 ** tokens[index].decimals)) / BigInt(10 ** 18); + acc[tokens[index].symbol] = tokenPriceInwei.toString(); + return acc; + }, {}); + }); + } +} +//# sourceMappingURL=tokenPriceOracle.js.map \ No newline at end of file diff --git a/lib/esm/tokenPriceOracle.js.map b/lib/esm/tokenPriceOracle.js.map new file mode 100644 index 0000000..1a1b2c6 --- /dev/null +++ b/lib/esm/tokenPriceOracle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tokenPriceOracle.js","sourceRoot":"","sources":["../../src/tokenPriceOracle.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAY,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAa,kBAAkB,EAAkB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CAAC;gBAChC,QAAQ,EAAE,IAAI,CAAC,MAAM;gBACrB,IAAI,EAAE,cAAc;gBACpB,MAAM,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC;aAC7B,CAAC,CAAC,CACJ,CAAa,CAAC;YAEf,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;gBACzC,MAAM,eAAe,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;gBAE1F,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC;gBAEvD,OAAO,GAAG,CAAC;YACb,CAAC,EAAE,EAAiB,CAAC,CAAC;QACxB,CAAC;KAAA;CACF"} \ No newline at end of file diff --git a/lib/esm/types.js b/lib/esm/types.js new file mode 100644 index 0000000..718fd38 --- /dev/null +++ b/lib/esm/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/lib/esm/types.js.map b/lib/esm/types.js.map new file mode 100644 index 0000000..7b5fff8 --- /dev/null +++ b/lib/esm/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib/esm/utils.js b/lib/esm/utils.js new file mode 100644 index 0000000..0d94a97 --- /dev/null +++ b/lib/esm/utils.js @@ -0,0 +1,17 @@ +export const isNode = !(process.browser +// prettier-ignore +// @ts-ignore +) && typeof globalThis.window === 'undefined'; +export function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} +/** + * Example: + * + * amountInWei (0.1 ETH) * tokenDecimals (18) * tokenPriceInWei (0.0008) = 125 TOKEN + */ +export function convertETHToTokenAmount(amountInWei, tokenPriceInWei, tokenDecimals = 18) { + const tokenDecimalsMultiplier = BigInt(10 ** Number(tokenDecimals)); + return (BigInt(amountInWei) * tokenDecimalsMultiplier) / BigInt(tokenPriceInWei); +} +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/lib/esm/utils.js.map b/lib/esm/utils.js.map new file mode 100644 index 0000000..0d68578 --- /dev/null +++ b/lib/esm/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,MAAM,GACjB,CAAC,CAEG,OAGD,CAAC,OAAO;AACT,kBAAkB;AAClB,aAAa;CACd,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,WAAW,CAAC;AAEhD,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAAyB,EACzB,eAA6B,EAC7B,gBAAwB,EAAE;IAE1B,MAAM,uBAAuB,GAAG,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,uBAAuB,CAAC,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AACnF,CAAC"} \ No newline at end of file diff --git a/lib/feeOracle.d.ts b/lib/feeOracle.d.ts new file mode 100644 index 0000000..da8cdf4 --- /dev/null +++ b/lib/feeOracle.d.ts @@ -0,0 +1,41 @@ +import type { BigNumberish, TransactionLike } from 'ethers'; +import { OptimismL1FeeOracle } from './contracts'; +import { ChainIdType } from './constants'; +import { networkConfig } from './types'; +export interface RelayerFeeParams { + gasPrice: BigNumberish; + gasLimit?: BigNumberish; + l1Fee?: BigNumberish; + denomination: BigNumberish; + ethRefund: BigNumberish; + tokenPriceInWei: BigNumberish; + tokenDecimals: number; + relayerFeePercent?: number; + isEth?: boolean; + premiumPercent?: number; +} +export declare class TornadoFeeOracle { + optimismL1FeeOracle?: OptimismL1FeeOracle; + constructor(netId: ChainIdType, rpcUrl: string, config: networkConfig); + /** + * Calculate L1 fee for op-stack chains + * + * This is required since relayers would pay the full transaction fees for users + */ + fetchL1OptimismFee(tx?: TransactionLike): Promise; + /** + * We don't need to distinguish default refunds by tokens since most users interact with other defi protocols after withdrawal + * So we default with 1M gas which is enough for two or three swaps + * Using 30 gwei for default but it is recommended to supply cached gasPrice value from the UI + */ + defaultEthRefund(gasPrice?: BigNumberish, gasLimit?: BigNumberish): bigint; + /** + * Calculates token amount for required ethRefund purchases required to calculate fees + */ + calculateTokenAmount(ethRefund: BigNumberish, tokenPriceInEth: BigNumberish, tokenDecimals?: number): bigint; + /** + * Warning: For tokens you need to check if the fees are above denomination + * (Usually happens for small denomination pool or if the gas price is high) + */ + calculateRelayerFee({ gasPrice, gasLimit, l1Fee, denomination, ethRefund, tokenPriceInWei, tokenDecimals, relayerFeePercent, isEth, premiumPercent, }: RelayerFeeParams): bigint; +} diff --git a/lib/feeOracle.js b/lib/feeOracle.js new file mode 100644 index 0000000..a7271d8 --- /dev/null +++ b/lib/feeOracle.js @@ -0,0 +1,74 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TornadoFeeOracle = void 0; +const ethers_1 = require("ethers"); +const contracts_1 = require("./contracts"); +const providers_1 = require("./providers"); +const utils_1 = require("./utils"); +const DUMMY_ADDRESS = '0x1111111111111111111111111111111111111111'; +const DUMMY_NONCE = 1024; +const DUMMY_WITHDRAW_DATA = '0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'; +class TornadoFeeOracle { + constructor(netId, rpcUrl, config) { + const { optimismL1FeeOracleAddress } = config; + if (optimismL1FeeOracleAddress) { + const provider = (0, providers_1.getProvider)(netId, rpcUrl, config); + this.optimismL1FeeOracle = contracts_1.OptimismL1FeeOracle__factory.connect(optimismL1FeeOracleAddress, provider); + } + } + /** + * Calculate L1 fee for op-stack chains + * + * This is required since relayers would pay the full transaction fees for users + */ + fetchL1OptimismFee(tx) { + if (!this.optimismL1FeeOracle) { + return new Promise((resolve) => resolve(BigInt(0))); + } + if (!tx) { + // this tx is only used to simulate bytes size of the encoded tx so has nothing to with the accuracy + // inspired by the old style classic-ui calculation + tx = { + type: 0, + gasLimit: 1000000, + nonce: DUMMY_NONCE, + data: DUMMY_WITHDRAW_DATA, + gasPrice: (0, ethers_1.parseUnits)('1', 'gwei'), + to: DUMMY_ADDRESS, + }; + } + return this.optimismL1FeeOracle.getL1Fee.staticCall(ethers_1.Transaction.from(tx).unsignedSerialized); + } + /** + * We don't need to distinguish default refunds by tokens since most users interact with other defi protocols after withdrawal + * So we default with 1M gas which is enough for two or three swaps + * Using 30 gwei for default but it is recommended to supply cached gasPrice value from the UI + */ + defaultEthRefund(gasPrice, gasLimit) { + return (gasPrice ? BigInt(gasPrice) : (0, ethers_1.parseUnits)('30', 'gwei')) * BigInt(gasLimit || 1000000); + } + /** + * Calculates token amount for required ethRefund purchases required to calculate fees + */ + calculateTokenAmount(ethRefund, tokenPriceInEth, tokenDecimals) { + return (0, utils_1.convertETHToTokenAmount)(ethRefund, tokenPriceInEth, tokenDecimals); + } + /** + * Warning: For tokens you need to check if the fees are above denomination + * (Usually happens for small denomination pool or if the gas price is high) + */ + calculateRelayerFee({ gasPrice, gasLimit = 600000, l1Fee = 0, denomination, ethRefund = BigInt(0), tokenPriceInWei, tokenDecimals = 18, relayerFeePercent = 0.33, isEth = true, premiumPercent = 20, }) { + const gasCosts = BigInt(gasPrice) * BigInt(gasLimit) + BigInt(l1Fee); + const relayerFee = (BigInt(denomination) * BigInt(Math.floor(10000 * relayerFeePercent))) / BigInt(10000 * 100); + if (isEth) { + // Add 20% premium + return ((gasCosts + relayerFee) * BigInt(premiumPercent ? 100 + premiumPercent : 100)) / BigInt(100); + } + const feeInEth = gasCosts + BigInt(ethRefund); + return ((((0, utils_1.convertETHToTokenAmount)(feeInEth, tokenPriceInWei, tokenDecimals) + relayerFee) * + BigInt(premiumPercent ? 100 + premiumPercent : 100)) / + BigInt(100)); + } +} +exports.TornadoFeeOracle = TornadoFeeOracle; +//# sourceMappingURL=feeOracle.js.map \ No newline at end of file diff --git a/lib/feeOracle.js.map b/lib/feeOracle.js.map new file mode 100644 index 0000000..f672eb2 --- /dev/null +++ b/lib/feeOracle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"feeOracle.js","sourceRoot":"","sources":["../src/feeOracle.ts"],"names":[],"mappings":";;;AAAA,mCAAiD;AAEjD,2CAAgF;AAEhF,2CAA0C;AAE1C,mCAAkD;AAElD,MAAM,aAAa,GAAG,4CAA4C,CAAC;AAEnE,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB,MAAM,mBAAmB,GACvB,4kCAA4kC,CAAC;AAe/kC,MAAa,gBAAgB;IAG3B,YAAY,KAAkB,EAAE,MAAc,EAAE,MAAqB;QACnE,MAAM,EAAE,0BAA0B,EAAE,GAAG,MAAM,CAAC;QAE9C,IAAI,0BAA0B,EAAE,CAAC;YAC/B,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;YACpD,IAAI,CA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AClB,KAAK,GAAG,CAAC,EACT,YAAY,EACZ,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,EACrB,eAAe,EACf,aAAa,GAAG,EAAE,EAClB,iBAAiB,GAAG,IAAI,EACxB,KAAK,GAAG,IAAI,EACZ,cAAc,GAAG,EAAE,GACF;QACjB,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAErE,MAAM,UAAU,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;QAEhH,IAAI,KAAK,EAAE,CAAC;YACV,kBAAkB;YAClB,OAAO,CAAC,CAAC,QAAQ,GAAG,UAAU,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACvG,CAAC;QAED,MAAM,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;QAE9C,OAAO,CACL,CAAC,CAAC,IAAA,+BAAuB,EAAC,QAAQ,EAAE,eAAe,EAAE,aAAa,CAAC,GAAG,UAAU,CAAC;YAC/E,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACtD,MAAM,CAAC,GAAG,CAAC,CACZ,CAAC;IACJ,CAAC;CACF;AAvFD,4CAuFC"} \ No newline at end of file diff --git a/lib/index.d.ts b/lib/index.d.ts new file mode 100644 index 0000000..b9c3074 --- /dev/null +++ b/lib/index.d.ts @@ -0,0 +1,7 @@ +export * from './constants'; +export * from './feeOracle'; +export * from './multicall'; +export * from './providers'; +export * from './tokenPriceOracle'; +export * from './types'; +export * from './utils'; diff --git a/lib/index.js b/lib/index.js new file mode 100644 index 0000000..29db82b --- /dev/null +++ b/lib/index.js @@ -0,0 +1,24 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./constants"), exports); +__exportStar(require("./feeOracle"), exports); +__exportStar(require("./multicall"), exports); +__exportStar(require("./providers"), exports); +__exportStar(require("./tokenPriceOracle"), exports); +__exportStar(require("./types"), exports); +__exportStar(require("./utils"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/index.js.map b/lib/index.js.map new file mode 100644 index 0000000..d90789c --- /dev/null +++ b/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,8CAA4B;AAC5B,8CAA4B;AAC5B,8CAA4B;AAC5B,qDAAmC;AACnC,0CAAwB;AACxB,0CAAwB"} \ No newline at end of file diff --git a/lib/multicall.d.ts b/lib/multicall.d.ts new file mode 100644 index 0000000..7534a0a --- /dev/null +++ b/lib/multicall.d.ts @@ -0,0 +1,3 @@ +import { Multicall } from './contracts'; +import type { Call3 } from './types'; +export declare function multicall(Multicall: Multicall, calls: Call3[]): Promise; diff --git a/lib/multicall.js b/lib/multicall.js new file mode 100644 index 0000000..6c7d423 --- /dev/null +++ b/lib/multicall.js @@ -0,0 +1,37 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.multicall = void 0; +function multicall(Multicall, calls) { + return __awaiter(this, void 0, void 0, function* () { + const calldata = calls.map((call) => { + var _a, _b, _c; + const target = (((_a = call.contract) === null || _a === void 0 ? void 0 : _a.target) || call.address); + const callInterface = (((_b = call.contract) === null || _b === void 0 ? void 0 : _b.interface) || call.interface); + return { + target, + callData: callInterface.encodeFunctionData(call.name, call.params), + allowFailure: (_c = call.allowFailure) !== null && _c !== void 0 ? _c : false, + }; + }); + const returnData = yield Multicall.aggregate3.staticCall(calldata); + const res = returnData.map((call, i) => { + var _a; + const callInterface = (((_a = calls[i].contract) === null || _a === void 0 ? void 0 : _a.interface) || calls[i].interface); + const [result, data] = call; + const decodeResult = result && data && data !== '0x' ? callInterface.decodeFunctionResult(calls[i].name, data) : null; + return !decodeResult ? null : decodeResult.length === 1 ? decodeResult[0] : decodeResult; + }); + return res; + }); +} +exports.multicall = multicall; +//# sourceMappingURL=multicall.js.map \ No newline at end of file diff --git a/lib/multicall.js.map b/lib/multicall.js.map new file mode 100644 index 0000000..7e2c5fb --- /dev/null +++ b/lib/multicall.js.map @@ -0,0 +1 @@ +{"version":3,"file":"multicall.js","sourceRoot":"","sources":["../src/multicall.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,SAAsB,SAAS,CAAC,SAAoB,EAAE,KAAc;;QAClE,MAAM,QAAQ,GAAG,KAAK,C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CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;IACb,CAAC;CAAA;AAvBD,8BAuBC"} \ No newline at end of file diff --git a/lib/providers.d.ts b/lib/providers.d.ts new file mode 100644 index 0000000..9c8323d --- /dev/null +++ b/lib/providers.d.ts @@ -0,0 +1,5 @@ +import { JsonRpcProvider, FetchUrlFeeDataNetworkPlugin } from 'ethers'; +import { ChainIdType } from './constants'; +import type { networkConfig, gasOracleOptions } from './types'; +export declare function getGasOraclePlugin(networkKey: string, gasOracleOptions?: gasOracleOptions): FetchUrlFeeDataNetworkPlugin; +export declare function getProvider(netId: ChainIdType, rpcUrl: string, config: networkConfig): JsonRpcProvider; diff --git a/lib/providers.js b/lib/providers.js new file mode 100644 index 0000000..2808877 --- /dev/null +++ b/lib/providers.js @@ -0,0 +1,94 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getProvider = exports.getGasOraclePlugin = void 0; +const ethers_1 = require("ethers"); +const contracts_1 = require("./contracts"); +const constants_1 = require("./constants"); +const multicall_1 = require("./multicall"); +const utils_1 = require("./utils"); +// caching to improve performance +const oracleMapper = new Map(); +const multicallMapper = new Map(); +function getGasOraclePlugin(networkKey, gasOracleOptions) { + const gasStationApi = (gasOracleOptions === null || gasOracleOptions === void 0 ? void 0 : gasOracleOptions.gasStationApi) || constants_1.POLYGON_GAS_STATION; + return new ethers_1.FetchUrlFeeDataNetworkPlugin(gasStationApi, (fetchFeeData, provider, request) => __awaiter(this, void 0, void 0, function* () { + if (!oracleMapper.has(networkKey)) { + oracleMapper.set(networkKey, contracts_1.GasPriceOracle__factory.connect(gasOracleOptions === null || gasOracleOptions === void 0 ? void 0 : gasOracleOptions.gasPriceOracle, provider)); + } + if (!multicallMapper.has(networkKey)) { + multicallMapper.set(networkKey, contracts_1.Multicall__factory.connect(constants_1.multiCallAddress, provider)); + } + const Oracle = oracleMapper.get(networkKey); + const Multicall = multicallMapper.get(networkKey); + const [timestamp, heartbeat, feePerGas, priorityFeePerGas] = yield (0, multicall_1.multicall)(Multicall, [ + { + contract: Oracle, + name: 'timestamp', + }, + { + contract: Oracle, + name: 'heartbeat', + }, + { + contract: Oracle, + name: 'maxFeePerGas', + }, + { + contract: Oracle, + name: 'maxPriorityFeePerGas', + }, + ]); + const isOutdated = Number(timestamp) <= Date.now() / 1000 - Number(heartbeat); + if (!isOutdated) { + const maxPriorityFeePerGas = (priorityFeePerGas * BigInt(13)) / BigInt(10); + const maxFeePerGas = feePerGas * BigInt(2) + maxPriorityFeePerGas; + return { + gasPrice: maxFeePerGas, + maxFeePerGas, + maxPriorityFeePerGas, + }; + } + if (utils_1.isNode) { + // Prevent Cloudflare from blocking our request in node.js + request.setHeader('User-Agent', 'ethers'); + } + const [{ bodyJson: { fast }, }, { gasPrice },] = yield Promise.all([request.send(), fetchFeeData()]); + return { + gasPrice, + maxFeePerGas: (0, ethers_1.parseUnits)(`${fast.maxFee}`, 9), + maxPriorityFeePerGas: (0, ethers_1.parseUnits)(`${fast.maxPriorityFee}`, 9), + }; + })); +} +exports.getGasOraclePlugin = getGasOraclePlugin; +function getProvider(netId, rpcUrl, config) { + const { networkName, gasPriceOracleContract, gasStationApi, pollInterval } = config; + const hasEns = constants_1.ENS_CHAINS.includes(netId); + const staticNetwork = new ethers_1.Network(networkName, netId); + if (hasEns) { + staticNetwork.attachPlugin(new ethers_1.EnsPlugin(null, Number(netId))); + } + staticNetwork.attachPlugin(new ethers_1.GasCostPlugin()); + if (gasPriceOracleContract) { + staticNetwork.attachPlugin(getGasOraclePlugin(`${netId}_${rpcUrl}`, { + gasPriceOracle: gasPriceOracleContract, + gasStationApi, + })); + } + const provider = new ethers_1.JsonRpcProvider(rpcUrl, staticNetwork, { + staticNetwork, + }); + provider.pollingInterval = pollInterval * 1000; + return provider; +} +exports.getProvider = getProvider; +//# sourceMappingURL=providers.js.map \ No newline at end of file diff --git a/lib/providers.js.map b/lib/providers.js.map new file mode 100644 index 0000000..3c6d9b4 --- /dev/null +++ b/lib/providers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"providers.js","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAsH;AACtH,2CAAqG;AACrG,2CAA6F;AAC7F,2CAAwC;AAExC,mCAAiC;AAEjC,iCAAiC;AACjC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;AAC/B,MAAM,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;AAElC,SAAgB,kBAAkB,CAAC,UAAkB,EAAE,gBAAmC;IACxF,MAAM,aAAa,GAAG,CAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,aAAa,KAAI,+BAAmB,CAAC;IAE7E,OAAO,IAAI,qCAA4B,CAAC,aAAa,EAAE,CAAO,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;QAC/F,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YAClC,YAAY,CAAC,GAAG,CACd,UAAU,EACV,mCAAuB,CAAC,OAAO,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,cAAwB,EAAE,QAAQ,CAAC,CACtF,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YACrC,eAAe,CAAC,GAAG,CAAC,UAAU,EAAE,8BAAkB,CAAC,OAAO,CAAC,4BAAgB,EAAE,QAAQ,CAAC,CAAC,CAAC;QA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racle.d.ts b/lib/tokenPriceOracle.d.ts new file mode 100644 index 0000000..283f955 --- /dev/null +++ b/lib/tokenPriceOracle.d.ts @@ -0,0 +1,11 @@ +import { Provider } from 'ethers'; +import { Multicall, OffchainOracle } from './contracts'; +import { ChainIdType } from './constants'; +import { Token, TokenPrices, networkConfig } from './types'; +export declare class TokenPriceOracle { + oracle?: OffchainOracle; + multicall: Multicall; + provider: Provider; + constructor(netId: ChainIdType, rpcUrl: string, config: networkConfig); + fetchPrices(tokens: Token[]): Promise; +} diff --git a/lib/tokenPriceOracle.js b/lib/tokenPriceOracle.js new file mode 100644 index 0000000..e7c3684 --- /dev/null +++ b/lib/tokenPriceOracle.js @@ -0,0 +1,50 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TokenPriceOracle = void 0; +const ethers_1 = require("ethers"); +const contracts_1 = require("./contracts"); +const constants_1 = require("./constants"); +const multicall_1 = require("./multicall"); +const providers_1 = require("./providers"); +class TokenPriceOracle { + constructor(netId, rpcUrl, config) { + const { offchainOracleContract } = config; + this.provider = (0, providers_1.getProvider)(netId, rpcUrl, config); + this.multicall = contracts_1.Multicall__factory.connect(constants_1.multiCallAddress, this.provider); + if (offchainOracleContract) { + this.oracle = contracts_1.OffchainOracle__factory.connect(offchainOracleContract, this.provider); + } + } + fetchPrices(tokens) { + return __awaiter(this, void 0, void 0, function* () { + // setup mock price for testnets + if (!this.oracle) { + return new Promise((resolve) => resolve(tokens.reduce((acc, _, index) => { + acc[tokens[index].symbol] = (0, ethers_1.parseEther)('0.0001').toString(); + return acc; + }, {}))); + } + const prices = (yield (0, multicall_1.multicall)(this.multicall, tokens.map(({ tokenAddress }) => ({ + contract: this.oracle, + name: 'getRateToEth', + params: [tokenAddress, true], + })))); + return prices.reduce((acc, price, index) => { + const tokenPriceInwei = (price * BigInt(10 ** tokens[index].decimals)) / BigInt(10 ** 18); + acc[tokens[index].symbol.toLowerCase()] = tokenPriceInwei.toString(); + return acc; + }, {}); + }); + } +} +exports.TokenPriceOracle = TokenPriceOracle; +//# sourceMappingURL=tokenPriceOracle.js.map \ No newline at end of file diff --git a/lib/tokenPriceOracle.js.map b/lib/tokenPriceOracle.js.map new file mode 100644 index 0000000..fd65f48 --- /dev/null +++ b/lib/tokenPriceOracle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tokenPriceOracle.js","sourceRoot":"","sources":["../src/tokenPriceOracle.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAA8C;AAC9C,2CAAqG;AACrG,2CAA4D;AAC5D,2CAAwC;AACxC,2CAA0C;AAG1C,MAAa,gBAAgB;IAK3B,YAAY,KAAkB,EAAE,MAAc,EAAE,MAAqB;QACnE,MAAM,EAAE,sBAAsB,EAAE,GAAG,MAAM,CAAC;QAE1C,IAAI,CAAC,QAAQ,GAAG,IAAA,uBAAW,EAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,GAAG,8BAAkB,CAAC,OAAO,CAAC,4BAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE7E,IAAI,sBAAsB,EAAE,CAAC;YAC3B,IAAI,CAAC,MAAM,GAAG,mCAAuB,CAAC,OAAO,CAAC,sBAAsB,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;IAEK,WAAW,CAAC,MAAe;;YAC/B,gCAAgC;YAChC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACjB,O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{ BaseContract, Interface } from 'ethers'; +export type Token = { + tokenAddress: string; + symbol: string; + decimals: number; +}; +export type TokenPrices = { + [tokenSymbol in string]?: string; +}; +export interface Call3 { + contract?: BaseContract; + address?: string; + interface?: Interface; + name: string; + params?: any[]; + allowFailure?: boolean; +} +export interface gasOracleOptions { + gasPriceOracle?: string; + gasStationApi?: string; +} +export interface networkConfig { + networkName: string; + offchainOracleContract?: string; + optimismL1FeeOracleAddress?: string; + gasPriceOracleContract?: string; + gasStationApi?: string; + pollInterval: number; +} diff --git a/lib/types.js b/lib/types.js new file mode 100644 index 0000000..11e638d --- /dev/null +++ b/lib/types.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/lib/types.js.map b/lib/types.js.map new file mode 100644 index 0000000..c768b79 --- /dev/null +++ b/lib/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib/utils.d.ts b/lib/utils.d.ts new file mode 100644 index 0000000..d7372dc --- /dev/null +++ b/lib/utils.d.ts @@ -0,0 +1,9 @@ +import type { BigNumberish } from 'ethers'; +export declare const isNode: boolean; +export declare function sleep(ms: number): Promise; +/** + * Example: + * + * amountInWei (0.1 ETH) * tokenDecimals (18) * tokenPriceInWei (0.0008) = 125 TOKEN + */ +export declare function convertETHToTokenAmount(amountInWei: BigNumberish, tokenPriceInWei: BigNumberish, tokenDecimals?: number): bigint; diff --git a/lib/utils.js b/lib/utils.js new file mode 100644 index 0000000..3b47c0d --- /dev/null +++ b/lib/utils.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.convertETHToTokenAmount = exports.sleep = exports.isNode = void 0; +exports.isNode = !(process.browser +// prettier-ignore +// @ts-ignore +) && typeof globalThis.window === 'undefined'; +function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} +exports.sleep = sleep; +/** + * Example: + * + * amountInWei (0.1 ETH) * tokenDecimals (18) * tokenPriceInWei (0.0008) = 125 TOKEN + */ +function convertETHToTokenAmount(amountInWei, tokenPriceInWei, tokenDecimals = 18) { + const tokenDecimalsMultiplier = BigInt(10 ** Number(tokenDecimals)); + return (BigInt(amountInWei) * tokenDecimalsMultiplier) / BigInt(tokenPriceInWei); +} +exports.convertETHToTokenAmount = convertETHToTokenAmount; +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/lib/utils.js.map b/lib/utils.js.map new file mode 100644 index 0000000..c50e2a6 --- /dev/null +++ b/lib/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAEa,QAAA,MAAM,GACjB,CAAC,CAEG,OAGD,CAAC,OAAO;AACT,kBAAkB;AAClB,aAAa;CACd,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,WAAW,CAAC;AAEhD,SAAgB,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAFD,sBAEC;AAED;;;;GAIG;AACH,SAAgB,uBAAuB,CACrC,WAAyB,EACzB,eAA6B,EAC7B,gBAAwB,EAAE;IAE1B,MAAM,uBAAuB,GAAG,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,uBAAuB,CAAC,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AACnF,CAAC;AAPD,0DAOC"} \ No newline at end of file