diff --git a/abis/GasPriceOracle.json b/abis/GasPriceOracle.json new file mode 100644 index 0000000..2ef8f09 --- /dev/null +++ b/abis/GasPriceOracle.json @@ -0,0 +1,189 @@ +[ + { + "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" + } +] \ No newline at end of file diff --git a/abis/Multicall.abi.json b/abis/Multicall.abi.json deleted file mode 100644 index 8f30555..0000000 --- a/abis/Multicall.abi.json +++ /dev/null @@ -1,38 +0,0 @@ -[ - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct MultiCall.Call[]", - "name": "calls", - "type": "tuple[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - }, - { - "internalType": "bool[]", - "name": "success", - "type": "bool[]" - } - ], - "stateMutability": "view", - "type": "function" - } -] diff --git a/abis/Multicall.json b/abis/Multicall.json new file mode 100644 index 0000000..d9c5855 --- /dev/null +++ b/abis/Multicall.json @@ -0,0 +1,440 @@ +[ + { + "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" + } +] \ No newline at end of file diff --git a/abis/OffchainOracle.abi.json b/abis/OffchainOracle.abi.json deleted file mode 100644 index d43f1b5..0000000 --- a/abis/OffchainOracle.abi.json +++ /dev/null @@ -1,292 +0,0 @@ -[ - { - "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" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "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": [], - "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" - } -] diff --git a/abis/OffchainOracle.json b/abis/OffchainOracle.json new file mode 100644 index 0000000..6461670 --- /dev/null +++ b/abis/OffchainOracle.json @@ -0,0 +1,555 @@ +[ + { + "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" + } +] \ No newline at end of file diff --git a/abis/OptimismL1FeeOracle.abi.json b/abis/OptimismL1FeeOracle.json similarity index 100% rename from abis/OptimismL1FeeOracle.abi.json rename to abis/OptimismL1FeeOracle.json diff --git a/package.json b/package.json index 1c5baa1..2ca4ad4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tornado/tornado-oracles", - "version": "3.3.0", + "version": "4.0.0", "description": "Oracles for Tornado-specific transactions & actions", "main": "./lib/index.js", "types": "./lib/index.d.ts", @@ -9,7 +9,7 @@ "build:esm": "tsc -p tsconfig.esm.json", "prettier:check": "prettier --check . --config .prettierrc", "prettier:fix": "prettier --write . --config .prettierrc", - "build:abi": "yarn typechain --target ethers-v5 --out-dir src/contracts ./abis/*.abi.json", + "build:abi": "typechain --target ethers-v6 --out-dir src/contracts ./abis/*.json", "test": "echo \"Error: no test specified\" && exit 1", "prepare": "npm run build && npm run build:esm", "prepublish": "npm run prettier:fix" @@ -29,19 +29,16 @@ "author": "Theo", "license": "MIT", "dependencies": { - "@tornado/gas-price-oracle": "^0.5.3", - "@tornado/tornado-config": "^2.0.0", - "@types/node": "^20.5.1", - "bignumber.js": "^9.1.1", - "ethers": "5.7" + "ethers": "^6.4.0" }, "devDependencies": { - "@typechain/ethers-v5": "^11.1.1", + "@types/node": "^20.5.1", + "@typechain/ethers-v6": "^0.5.1", "nodemon": "^3.0.1", "prettier": "^3.0.1", "ts-node": "^10.9.1", - "typechain": "^8.3.1", - "typescript": "^5.1.6" + "typechain": "^8.3.2", + "typescript": "^5.4.4" }, "files": [ "lib/**/*" diff --git a/src/config.ts b/src/config.ts deleted file mode 100644 index 502c9ba..0000000 --- a/src/config.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { LegacyGasPrices } from './types'; - -export enum ChainId { - MAINNET = 1, - GOERLI = 5, - BSC = 56, - XDAI = 100, - POLYGON = 137, - OPTIMISM = 10, - ARBITRUM = 42161, - AVAX = 43114, -} - -export enum InstanceTokenSymbol { - DAI = 'dai', - cDAI = 'cdai', - WBTC = 'wbtc', - USDT = 'usdt', - USDC = 'usdc', -} - -export type GasPricesConfig = { - [chainId in ChainId]: LegacyGasPrices; -}; - -export const defaultGasPrices: GasPricesConfig = { - [ChainId.MAINNET]: { - instant: 80, - fast: 50, - standard: 25, - low: 8, - }, - [ChainId.GOERLI]: { - instant: 80, - fast: 50, - standard: 25, - low: 8, - }, - [ChainId.OPTIMISM]: { - instant: 0.001, - fast: 0.001, - standard: 0.001, - low: 0.001, - }, - [ChainId.XDAI]: { - instant: 6, - fast: 5, - standard: 4, - low: 1, - }, - [ChainId.BSC]: { - instant: 5, - fast: 4, - standard: 3, - low: 3, - }, - [ChainId.POLYGON]: { - instant: 100, - fast: 75, - standard: 50, - low: 30, - }, - [ChainId.ARBITRUM]: { - instant: 4, - fast: 3, - standard: 2.52, - low: 2.29, - }, - [ChainId.AVAX]: { - instant: 225, - fast: 35, - standard: 25, - low: 25, - }, -}; - -type GasLimitConfig = { - [chainId in ChainId]: number; -}; - -export const defaultWithdrawalGasLimit: GasLimitConfig = { - [ChainId.MAINNET]: 550000, - [ChainId.GOERLI]: 550000, - [ChainId.ARBITRUM]: 1900000, - [ChainId.OPTIMISM]: 440000, - [ChainId.AVAX]: 390000, - [ChainId.BSC]: 390000, - [ChainId.POLYGON]: 390000, - [ChainId.XDAI]: 390000, -}; - -type InstanceTokenGasLimitConfig = { - [tokenSymbol in InstanceTokenSymbol]: number; -}; - -export const defaultInstanceTokensGasLimit: InstanceTokenGasLimitConfig = { - [InstanceTokenSymbol.DAI]: 55000, - [InstanceTokenSymbol.cDAI]: 425000, - [InstanceTokenSymbol.WBTC]: 85000, - [InstanceTokenSymbol.USDT]: 100000, - [InstanceTokenSymbol.USDC]: 80000, -}; - -export const optimismL1FeeOracleAddress = '0x420000000000000000000000000000000000000F'; -export const offchainOracleAddress = '0x07D91f5fb9Bf7798734C3f606dB065549F6893bb'; -export const multiCallAddress = '0xda3c19c6fe954576707fa24695efb830d9cca1ca'; diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..6e7d1d0 --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,18 @@ +export enum ChainId { + MAINNET = 1, + BSC = 56, + XDAI = 100, + POLYGON = 137, + OPTIMISM = 10, + ARBITRUM = 42161, + AVAX = 43114, + SEPOLIA = 11155111, +} + +export type ChainIdType = ChainId | number; + +export const ENS_CHAINS = [ChainId.MAINNET, ChainId.SEPOLIA]; + +export const multiCallAddress = '0xcA11bde05977b3631167028862bE2a173976CA11'; + +export const POLYGON_GAS_STATION = 'https://gasstation.polygon.technology/v2'; diff --git a/src/contracts/GasPriceOracle.ts b/src/contracts/GasPriceOracle.ts new file mode 100644 index 0000000..081c93d --- /dev/null +++ b/src/contracts/GasPriceOracle.ts @@ -0,0 +1,271 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +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/src/contracts/Multicall.ts b/src/contracts/Multicall.ts new file mode 100644 index 0000000..7488ef9 --- /dev/null +++ b/src/contracts/Multicall.ts @@ -0,0 +1,416 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +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 { + export type CallStruct = { target: AddressLike; callData: BytesLike }; + + export type CallStructOutput = [target: string, callData: string] & { + target: string; + callData: string; + }; + + export type Call3Struct = { + target: AddressLike; + allowFailure: boolean; + callData: BytesLike; + }; + + export type Call3StructOutput = [ + target: string, + allowFailure: boolean, + callData: string + ] & { target: string; allowFailure: boolean; callData: string }; + + export type ResultStruct = { success: boolean; returnData: BytesLike }; + + export type ResultStructOutput = [success: boolean, returnData: string] & { + success: boolean; + returnData: string; + }; + + export type Call3ValueStruct = { + target: AddressLike; + allowFailure: boolean; + value: BigNumberish; + callData: BytesLike; + }; + + export 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/src/contracts/MulticallAbi.ts b/src/contracts/MulticallAbi.ts deleted file mode 100644 index e4730b6..0000000 --- a/src/contracts/MulticallAbi.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { BaseContract, BigNumber, BytesLike, CallOverrides, PopulatedTransaction, Signer, utils } from 'ethers'; -import type { FunctionFragment, Result } from '@ethersproject/abi'; -import type { Listener, Provider } from '@ethersproject/providers'; -import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from './common'; - -export declare namespace MultiCall { - export type CallStruct = { to: string; data: BytesLike }; - - export type CallStructOutput = [string, string] & { - to: string; - data: string; - }; -} - -export interface MulticallAbiInterface extends utils.Interface { - functions: { - 'multicall((address,bytes)[])': FunctionFragment; - }; - - getFunction(nameOrSignatureOrTopic: 'multicall'): FunctionFragment; - - encodeFunctionData(functionFragment: 'multicall', values: [MultiCall.CallStruct[]]): string; - - decodeFunctionResult(functionFragment: 'multicall', data: BytesLike): Result; - - events: {}; -} - -export interface MulticallAbi extends BaseContract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - interface: MulticallAbiInterface; - - queryFilter( - event: TypedEventFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>; - - listeners(eventFilter?: TypedEventFilter): Array>; - listeners(eventName?: string): Array; - removeAllListeners(eventFilter: TypedEventFilter): this; - removeAllListeners(eventName?: string): this; - off: OnEvent; - on: OnEvent; - once: OnEvent; - removeListener: OnEvent; - - functions: { - multicall( - calls: MultiCall.CallStruct[], - overrides?: CallOverrides, - ): Promise<[string[], boolean[]] & { results: string[]; success: boolean[] }>; - }; - - multicall( - calls: MultiCall.CallStruct[], - overrides?: CallOverrides, - ): Promise<[string[], boolean[]] & { results: string[]; success: boolean[] }>; - - callStatic: { - multicall( - calls: MultiCall.CallStruct[], - overrides?: CallOverrides, - ): Promise<[string[], boolean[]] & { results: string[]; success: boolean[] }>; - }; - - filters: {}; - - estimateGas: { - multicall(calls: MultiCall.CallStruct[], overrides?: CallOverrides): Promise; - }; - - populateTransaction: { - multicall(calls: MultiCall.CallStruct[], overrides?: CallOverrides): Promise; - }; -} diff --git a/src/contracts/OffchainOracle.ts b/src/contracts/OffchainOracle.ts new file mode 100644 index 0000000..6729f68 --- /dev/null +++ b/src/contracts/OffchainOracle.ts @@ -0,0 +1,622 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +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 namespace ConnectorAddedEvent { + export type InputTuple = [connector: AddressLike]; + export type OutputTuple = [connector: string]; + export interface OutputObject { + connector: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace ConnectorRemovedEvent { + export type InputTuple = [connector: AddressLike]; + export type OutputTuple = [connector: string]; + export interface OutputObject { + connector: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace MultiWrapperUpdatedEvent { + export type InputTuple = [multiWrapper: AddressLike]; + export type OutputTuple = [multiWrapper: string]; + export interface OutputObject { + multiWrapper: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace OracleAddedEvent { + export type InputTuple = [oracle: AddressLike, oracleType: BigNumberish]; + export type OutputTuple = [oracle: string, oracleType: bigint]; + export interface OutputObject { + oracle: string; + oracleType: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace OracleRemovedEvent { + export type InputTuple = [oracle: AddressLike, oracleType: BigNumberish]; + export type OutputTuple = [oracle: string, oracleType: bigint]; + export interface OutputObject { + oracle: string; + oracleType: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace OwnershipTransferredEvent { + export type InputTuple = [previousOwner: AddressLike, newOwner: AddressLike]; + export type OutputTuple = [previousOwner: string, newOwner: string]; + export interface OutputObject { + previousOwner: string; + newOwner: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export 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< + ConnectorAddedEvent.InputTuple, + ConnectorAddedEvent.OutputTuple, + ConnectorAddedEvent.OutputObject + >; + getEvent( + key: "ConnectorRemoved" + ): TypedContractEvent< + ConnectorRemovedEvent.InputTuple, + ConnectorRemovedEvent.OutputTuple, + ConnectorRemovedEvent.OutputObject + >; + getEvent( + key: "MultiWrapperUpdated" + ): TypedContractEvent< + MultiWrapperUpdatedEvent.InputTuple, + MultiWrapperUpdatedEvent.OutputTuple, + MultiWrapperUpdatedEvent.OutputObject + >; + getEvent( + key: "OracleAdded" + ): TypedContractEvent< + OracleAddedEvent.InputTuple, + OracleAddedEvent.OutputTuple, + OracleAddedEvent.OutputObject + >; + getEvent( + key: "OracleRemoved" + ): TypedContractEvent< + OracleRemovedEvent.InputTuple, + OracleRemovedEvent.OutputTuple, + OracleRemovedEvent.OutputObject + >; + getEvent( + key: "OwnershipTransferred" + ): TypedContractEvent< + OwnershipTransferredEvent.InputTuple, + OwnershipTransferredEvent.OutputTuple, + OwnershipTransferredEvent.OutputObject + >; + + filters: { + "ConnectorAdded(address)": TypedContractEvent< + ConnectorAddedEvent.InputTuple, + ConnectorAddedEvent.OutputTuple, + ConnectorAddedEvent.OutputObject + >; + ConnectorAdded: TypedContractEvent< + ConnectorAddedEvent.InputTuple, + ConnectorAddedEvent.OutputTuple, + ConnectorAddedEvent.OutputObject + >; + + "ConnectorRemoved(address)": TypedContractEvent< + ConnectorRemovedEvent.InputTuple, + ConnectorRemovedEvent.OutputTuple, + ConnectorRemovedEvent.OutputObject + >; + ConnectorRemoved: TypedContractEvent< + ConnectorRemovedEvent.InputTuple, + ConnectorRemovedEvent.OutputTuple, + ConnectorRemovedEvent.OutputObject + >; + + "MultiWrapperUpdated(address)": TypedContractEvent< + MultiWrapperUpdatedEvent.InputTuple, + MultiWrapperUpdatedEvent.OutputTuple, + MultiWrapperUpdatedEvent.OutputObject + >; + MultiWrapperUpdated: TypedContractEvent< + MultiWrapperUpdatedEvent.InputTuple, + MultiWrapperUpdatedEvent.OutputTuple, + MultiWrapperUpdatedEvent.OutputObject + >; + + "OracleAdded(address,uint8)": TypedContractEvent< + OracleAddedEvent.InputTuple, + OracleAddedEvent.OutputTuple, + OracleAddedEvent.OutputObject + >; + OracleAdded: TypedContractEvent< + OracleAddedEvent.InputTuple, + OracleAddedEvent.OutputTuple, + OracleAddedEvent.OutputObject + >; + + "OracleRemoved(address,uint8)": TypedContractEvent< + OracleRemovedEvent.InputTuple, + OracleRemovedEvent.OutputTuple, + OracleRemovedEvent.OutputObject + >; + OracleRemoved: TypedContractEvent< + OracleRemovedEvent.InputTuple, + OracleRemovedEvent.OutputTuple, + OracleRemovedEvent.OutputObject + >; + + "OwnershipTransferred(address,address)": TypedContractEvent< + OwnershipTransferredEvent.InputTuple, + OwnershipTransferredEvent.OutputTuple, + OwnershipTransferredEvent.OutputObject + >; + OwnershipTransferred: TypedContractEvent< + OwnershipTransferredEvent.InputTuple, + OwnershipTransferredEvent.OutputTuple, + OwnershipTransferredEvent.OutputObject + >; + }; +} diff --git a/src/contracts/OffchainOracleAbi.ts b/src/contracts/OffchainOracleAbi.ts deleted file mode 100644 index 1838514..0000000 --- a/src/contracts/OffchainOracleAbi.ts +++ /dev/null @@ -1,368 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BigNumber, - BigNumberish, - BytesLike, - CallOverrides, - ContractTransaction, - Overrides, - PopulatedTransaction, - Signer, - utils, -} from 'ethers'; -import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi'; -import type { Listener, Provider } from '@ethersproject/providers'; -import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from './common'; - -export interface OffchainOracleAbiInterface extends utils.Interface { - functions: { - 'addConnector(address)': FunctionFragment; - 'addOracle(address,uint8)': FunctionFragment; - 'connectors()': FunctionFragment; - 'getRate(address,address,bool)': FunctionFragment; - 'getRateToEth(address,bool)': FunctionFragment; - 'multiWrapper()': FunctionFragment; - 'oracles()': FunctionFragment; - 'owner()': FunctionFragment; - 'removeConnector(address)': FunctionFragment; - 'removeOracle(address,uint8)': FunctionFragment; - 'renounceOwnership()': FunctionFragment; - 'setMultiWrapper(address)': FunctionFragment; - 'transferOwnership(address)': FunctionFragment; - }; - - getFunction( - nameOrSignatureOrTopic: - | 'addConnector' - | 'addOracle' - | 'connectors' - | 'getRate' - | 'getRateToEth' - | 'multiWrapper' - | 'oracles' - | 'owner' - | 'removeConnector' - | 'removeOracle' - | 'renounceOwnership' - | 'setMultiWrapper' - | 'transferOwnership', - ): FunctionFragment; - - encodeFunctionData(functionFragment: 'addConnector', values: [string]): string; - encodeFunctionData(functionFragment: 'addOracle', values: [string, BigNumberish]): string; - encodeFunctionData(functionFragment: 'connectors', values?: undefined): string; - encodeFunctionData(functionFragment: 'getRate', values: [string, string, boolean]): string; - encodeFunctionData(functionFragment: 'getRateToEth', values: [string, boolean]): string; - encodeFunctionData(functionFragment: 'multiWrapper', values?: undefined): string; - encodeFunctionData(functionFragment: 'oracles', values?: undefined): string; - encodeFunctionData(functionFragment: 'owner', values?: undefined): string; - encodeFunctionData(functionFragment: 'removeConnector', values: [string]): string; - encodeFunctionData(functionFragment: 'removeOracle', values: [string, BigNumberish]): string; - encodeFunctionData(functionFragment: 'renounceOwnership', values?: undefined): string; - encodeFunctionData(functionFragment: 'setMultiWrapper', values: [string]): string; - encodeFunctionData(functionFragment: 'transferOwnership', values: [string]): 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: '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; - - events: { - 'ConnectorAdded(address)': EventFragment; - 'ConnectorRemoved(address)': EventFragment; - 'MultiWrapperUpdated(address)': EventFragment; - 'OracleAdded(address,uint8)': EventFragment; - 'OracleRemoved(address,uint8)': EventFragment; - 'OwnershipTransferred(address,address)': EventFragment; - }; - - getEvent(nameOrSignatureOrTopic: 'ConnectorAdded'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'ConnectorRemoved'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'MultiWrapperUpdated'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'OracleAdded'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'OracleRemoved'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'OwnershipTransferred'): EventFragment; -} - -export interface ConnectorAddedEventObject { - connector: string; -} -export type ConnectorAddedEvent = TypedEvent<[string], ConnectorAddedEventObject>; - -export type ConnectorAddedEventFilter = TypedEventFilter; - -export interface ConnectorRemovedEventObject { - connector: string; -} -export type ConnectorRemovedEvent = TypedEvent<[string], ConnectorRemovedEventObject>; - -export type ConnectorRemovedEventFilter = TypedEventFilter; - -export interface MultiWrapperUpdatedEventObject { - multiWrapper: string; -} -export type MultiWrapperUpdatedEvent = TypedEvent<[string], MultiWrapperUpdatedEventObject>; - -export type MultiWrapperUpdatedEventFilter = TypedEventFilter; - -export interface OracleAddedEventObject { - oracle: string; - oracleType: number; -} -export type OracleAddedEvent = TypedEvent<[string, number], OracleAddedEventObject>; - -export type OracleAddedEventFilter = TypedEventFilter; - -export interface OracleRemovedEventObject { - oracle: string; - oracleType: number; -} -export type OracleRemovedEvent = TypedEvent<[string, number], OracleRemovedEventObject>; - -export type OracleRemovedEventFilter = TypedEventFilter; - -export interface OwnershipTransferredEventObject { - previousOwner: string; - newOwner: string; -} -export type OwnershipTransferredEvent = TypedEvent<[string, string], OwnershipTransferredEventObject>; - -export type OwnershipTransferredEventFilter = TypedEventFilter; - -export interface OffchainOracleAbi extends BaseContract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - interface: OffchainOracleAbiInterface; - - queryFilter( - event: TypedEventFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>; - - listeners(eventFilter?: TypedEventFilter): Array>; - listeners(eventName?: string): Array; - removeAllListeners(eventFilter: TypedEventFilter): this; - removeAllListeners(eventName?: string): this; - off: OnEvent; - on: OnEvent; - once: OnEvent; - removeListener: OnEvent; - - functions: { - addConnector(connector: string, overrides?: Overrides & { from?: string }): Promise; - - addOracle( - oracle: string, - oracleKind: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - connectors(overrides?: CallOverrides): Promise<[string[]] & { allConnectors: string[] }>; - - getRate( - srcToken: string, - dstToken: string, - useWrappers: boolean, - overrides?: CallOverrides, - ): Promise<[BigNumber] & { weightedRate: BigNumber }>; - - getRateToEth( - srcToken: string, - useSrcWrappers: boolean, - overrides?: CallOverrides, - ): Promise<[BigNumber] & { weightedRate: BigNumber }>; - - multiWrapper(overrides?: CallOverrides): Promise<[string]>; - - oracles(overrides?: CallOverrides): Promise<[string[], number[]] & { allOracles: string[]; oracleTypes: number[] }>; - - owner(overrides?: CallOverrides): Promise<[string]>; - - removeConnector(connector: string, overrides?: Overrides & { from?: string }): Promise; - - removeOracle( - oracle: string, - oracleKind: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - renounceOwnership(overrides?: Overrides & { from?: string }): Promise; - - setMultiWrapper(_multiWrapper: string, overrides?: Overrides & { from?: string }): Promise; - - transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise; - }; - - addConnector(connector: string, overrides?: Overrides & { from?: string }): Promise; - - addOracle( - oracle: string, - oracleKind: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - connectors(overrides?: CallOverrides): Promise; - - getRate(srcToken: string, dstToken: string, useWrappers: boolean, overrides?: CallOverrides): Promise; - - getRateToEth(srcToken: string, useSrcWrappers: boolean, overrides?: CallOverrides): Promise; - - multiWrapper(overrides?: CallOverrides): Promise; - - oracles(overrides?: CallOverrides): Promise<[string[], number[]] & { allOracles: string[]; oracleTypes: number[] }>; - - owner(overrides?: CallOverrides): Promise; - - removeConnector(connector: string, overrides?: Overrides & { from?: string }): Promise; - - removeOracle( - oracle: string, - oracleKind: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - renounceOwnership(overrides?: Overrides & { from?: string }): Promise; - - setMultiWrapper(_multiWrapper: string, overrides?: Overrides & { from?: string }): Promise; - - transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise; - - callStatic: { - addConnector(connector: string, overrides?: CallOverrides): Promise; - - addOracle(oracle: string, oracleKind: BigNumberish, overrides?: CallOverrides): Promise; - - connectors(overrides?: CallOverrides): Promise; - - getRate(srcToken: string, dstToken: string, useWrappers: boolean, overrides?: CallOverrides): Promise; - - getRateToEth(srcToken: string, useSrcWrappers: boolean, overrides?: CallOverrides): Promise; - - multiWrapper(overrides?: CallOverrides): Promise; - - oracles(overrides?: CallOverrides): Promise<[string[], number[]] & { allOracles: string[]; oracleTypes: number[] }>; - - owner(overrides?: CallOverrides): Promise; - - removeConnector(connector: string, overrides?: CallOverrides): Promise; - - removeOracle(oracle: string, oracleKind: BigNumberish, overrides?: CallOverrides): Promise; - - renounceOwnership(overrides?: CallOverrides): Promise; - - setMultiWrapper(_multiWrapper: string, overrides?: CallOverrides): Promise; - - transferOwnership(newOwner: string, overrides?: CallOverrides): Promise; - }; - - filters: { - 'ConnectorAdded(address)'(connector?: null): ConnectorAddedEventFilter; - ConnectorAdded(connector?: null): ConnectorAddedEventFilter; - - 'ConnectorRemoved(address)'(connector?: null): ConnectorRemovedEventFilter; - ConnectorRemoved(connector?: null): ConnectorRemovedEventFilter; - - 'MultiWrapperUpdated(address)'(multiWrapper?: null): MultiWrapperUpdatedEventFilter; - MultiWrapperUpdated(multiWrapper?: null): MultiWrapperUpdatedEventFilter; - - 'OracleAdded(address,uint8)'(oracle?: null, oracleType?: null): OracleAddedEventFilter; - OracleAdded(oracle?: null, oracleType?: null): OracleAddedEventFilter; - - 'OracleRemoved(address,uint8)'(oracle?: null, oracleType?: null): OracleRemovedEventFilter; - OracleRemoved(oracle?: null, oracleType?: null): OracleRemovedEventFilter; - - 'OwnershipTransferred(address,address)'( - previousOwner?: string | null, - newOwner?: string | null, - ): OwnershipTransferredEventFilter; - OwnershipTransferred(previousOwner?: string | null, newOwner?: string | null): OwnershipTransferredEventFilter; - }; - - estimateGas: { - addConnector(connector: string, overrides?: Overrides & { from?: string }): Promise; - - addOracle(oracle: string, oracleKind: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - connectors(overrides?: CallOverrides): Promise; - - getRate(srcToken: string, dstToken: string, useWrappers: boolean, overrides?: CallOverrides): Promise; - - getRateToEth(srcToken: string, useSrcWrappers: boolean, overrides?: CallOverrides): Promise; - - multiWrapper(overrides?: CallOverrides): Promise; - - oracles(overrides?: CallOverrides): Promise; - - owner(overrides?: CallOverrides): Promise; - - removeConnector(connector: string, overrides?: Overrides & { from?: string }): Promise; - - removeOracle( - oracle: string, - oracleKind: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - renounceOwnership(overrides?: Overrides & { from?: string }): Promise; - - setMultiWrapper(_multiWrapper: string, overrides?: Overrides & { from?: string }): Promise; - - transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise; - }; - - populateTransaction: { - addConnector(connector: string, overrides?: Overrides & { from?: string }): Promise; - - addOracle( - oracle: string, - oracleKind: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - connectors(overrides?: CallOverrides): Promise; - - getRate( - srcToken: string, - dstToken: string, - useWrappers: boolean, - overrides?: CallOverrides, - ): Promise; - - getRateToEth(srcToken: string, useSrcWrappers: boolean, overrides?: CallOverrides): Promise; - - multiWrapper(overrides?: CallOverrides): Promise; - - oracles(overrides?: CallOverrides): Promise; - - owner(overrides?: CallOverrides): Promise; - - removeConnector(connector: string, overrides?: Overrides & { from?: string }): Promise; - - removeOracle( - oracle: string, - oracleKind: BigNumberish, - overrides?: Overrides & { from?: string }, - ): Promise; - - renounceOwnership(overrides?: Overrides & { from?: string }): Promise; - - setMultiWrapper(_multiWrapper: string, overrides?: Overrides & { from?: string }): Promise; - - transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise; - }; -} diff --git a/src/contracts/OptimismL1FeeOracle.ts b/src/contracts/OptimismL1FeeOracle.ts new file mode 100644 index 0000000..cc80bb4 --- /dev/null +++ b/src/contracts/OptimismL1FeeOracle.ts @@ -0,0 +1,460 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +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 namespace DecimalsUpdatedEvent { + export type InputTuple = [arg0: BigNumberish]; + export type OutputTuple = [arg0: bigint]; + export interface OutputObject { + arg0: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace GasPriceUpdatedEvent { + export type InputTuple = [arg0: BigNumberish]; + export type OutputTuple = [arg0: bigint]; + export interface OutputObject { + arg0: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace L1BaseFeeUpdatedEvent { + export type InputTuple = [arg0: BigNumberish]; + export type OutputTuple = [arg0: bigint]; + export interface OutputObject { + arg0: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace OverheadUpdatedEvent { + export type InputTuple = [arg0: BigNumberish]; + export type OutputTuple = [arg0: bigint]; + export interface OutputObject { + arg0: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace OwnershipTransferredEvent { + export type InputTuple = [previousOwner: AddressLike, newOwner: AddressLike]; + export type OutputTuple = [previousOwner: string, newOwner: string]; + export interface OutputObject { + previousOwner: string; + newOwner: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace ScalarUpdatedEvent { + export type InputTuple = [arg0: BigNumberish]; + export type OutputTuple = [arg0: bigint]; + export interface OutputObject { + arg0: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export 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< + DecimalsUpdatedEvent.InputTuple, + DecimalsUpdatedEvent.OutputTuple, + DecimalsUpdatedEvent.OutputObject + >; + getEvent( + key: "GasPriceUpdated" + ): TypedContractEvent< + GasPriceUpdatedEvent.InputTuple, + GasPriceUpdatedEvent.OutputTuple, + GasPriceUpdatedEvent.OutputObject + >; + getEvent( + key: "L1BaseFeeUpdated" + ): TypedContractEvent< + L1BaseFeeUpdatedEvent.InputTuple, + L1BaseFeeUpdatedEvent.OutputTuple, + L1BaseFeeUpdatedEvent.OutputObject + >; + getEvent( + key: "OverheadUpdated" + ): TypedContractEvent< + OverheadUpdatedEvent.InputTuple, + OverheadUpdatedEvent.OutputTuple, + OverheadUpdatedEvent.OutputObject + >; + getEvent( + key: "OwnershipTransferred" + ): TypedContractEvent< + OwnershipTransferredEvent.InputTuple, + OwnershipTransferredEvent.OutputTuple, + OwnershipTransferredEvent.OutputObject + >; + getEvent( + key: "ScalarUpdated" + ): TypedContractEvent< + ScalarUpdatedEvent.InputTuple, + ScalarUpdatedEvent.OutputTuple, + ScalarUpdatedEvent.OutputObject + >; + + filters: { + "DecimalsUpdated(uint256)": TypedContractEvent< + DecimalsUpdatedEvent.InputTuple, + DecimalsUpdatedEvent.OutputTuple, + DecimalsUpdatedEvent.OutputObject + >; + DecimalsUpdated: TypedContractEvent< + DecimalsUpdatedEvent.InputTuple, + DecimalsUpdatedEvent.OutputTuple, + DecimalsUpdatedEvent.OutputObject + >; + + "GasPriceUpdated(uint256)": TypedContractEvent< + GasPriceUpdatedEvent.InputTuple, + GasPriceUpdatedEvent.OutputTuple, + GasPriceUpdatedEvent.OutputObject + >; + GasPriceUpdated: TypedContractEvent< + GasPriceUpdatedEvent.InputTuple, + GasPriceUpdatedEvent.OutputTuple, + GasPriceUpdatedEvent.OutputObject + >; + + "L1BaseFeeUpdated(uint256)": TypedContractEvent< + L1BaseFeeUpdatedEvent.InputTuple, + L1BaseFeeUpdatedEvent.OutputTuple, + L1BaseFeeUpdatedEvent.OutputObject + >; + L1BaseFeeUpdated: TypedContractEvent< + L1BaseFeeUpdatedEvent.InputTuple, + L1BaseFeeUpdatedEvent.OutputTuple, + L1BaseFeeUpdatedEvent.OutputObject + >; + + "OverheadUpdated(uint256)": TypedContractEvent< + OverheadUpdatedEvent.InputTuple, + OverheadUpdatedEvent.OutputTuple, + OverheadUpdatedEvent.OutputObject + >; + OverheadUpdated: TypedContractEvent< + OverheadUpdatedEvent.InputTuple, + OverheadUpdatedEvent.OutputTuple, + OverheadUpdatedEvent.OutputObject + >; + + "OwnershipTransferred(address,address)": TypedContractEvent< + OwnershipTransferredEvent.InputTuple, + OwnershipTransferredEvent.OutputTuple, + OwnershipTransferredEvent.OutputObject + >; + OwnershipTransferred: TypedContractEvent< + OwnershipTransferredEvent.InputTuple, + OwnershipTransferredEvent.OutputTuple, + OwnershipTransferredEvent.OutputObject + >; + + "ScalarUpdated(uint256)": TypedContractEvent< + ScalarUpdatedEvent.InputTuple, + ScalarUpdatedEvent.OutputTuple, + ScalarUpdatedEvent.OutputObject + >; + ScalarUpdated: TypedContractEvent< + ScalarUpdatedEvent.InputTuple, + ScalarUpdatedEvent.OutputTuple, + ScalarUpdatedEvent.OutputObject + >; + }; +} diff --git a/src/contracts/OptimismL1FeeOracleAbi.ts b/src/contracts/OptimismL1FeeOracleAbi.ts deleted file mode 100644 index 23dc0fb..0000000 --- a/src/contracts/OptimismL1FeeOracleAbi.ts +++ /dev/null @@ -1,352 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BigNumber, - BigNumberish, - BytesLike, - CallOverrides, - ContractTransaction, - Overrides, - PopulatedTransaction, - Signer, - utils, -} from 'ethers'; -import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi'; -import type { Listener, Provider } from '@ethersproject/providers'; -import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from './common'; - -export interface OptimismL1FeeOracleAbiInterface extends utils.Interface { - functions: { - 'decimals()': FunctionFragment; - 'gasPrice()': FunctionFragment; - 'getL1Fee(bytes)': FunctionFragment; - 'getL1GasUsed(bytes)': FunctionFragment; - 'l1BaseFee()': FunctionFragment; - 'overhead()': FunctionFragment; - 'owner()': FunctionFragment; - 'renounceOwnership()': FunctionFragment; - 'scalar()': FunctionFragment; - 'setDecimals(uint256)': FunctionFragment; - 'setGasPrice(uint256)': FunctionFragment; - 'setL1BaseFee(uint256)': FunctionFragment; - 'setOverhead(uint256)': FunctionFragment; - 'setScalar(uint256)': FunctionFragment; - 'transferOwnership(address)': FunctionFragment; - }; - - getFunction( - nameOrSignatureOrTopic: - | 'decimals' - | 'gasPrice' - | 'getL1Fee' - | 'getL1GasUsed' - | 'l1BaseFee' - | 'overhead' - | 'owner' - | 'renounceOwnership' - | 'scalar' - | 'setDecimals' - | 'setGasPrice' - | 'setL1BaseFee' - | 'setOverhead' - | 'setScalar' - | 'transferOwnership', - ): FunctionFragment; - - 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: [string]): 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; - - events: { - 'DecimalsUpdated(uint256)': EventFragment; - 'GasPriceUpdated(uint256)': EventFragment; - 'L1BaseFeeUpdated(uint256)': EventFragment; - 'OverheadUpdated(uint256)': EventFragment; - 'OwnershipTransferred(address,address)': EventFragment; - 'ScalarUpdated(uint256)': EventFragment; - }; - - getEvent(nameOrSignatureOrTopic: 'DecimalsUpdated'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'GasPriceUpdated'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'L1BaseFeeUpdated'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'OverheadUpdated'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'OwnershipTransferred'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'ScalarUpdated'): EventFragment; -} - -export interface DecimalsUpdatedEventObject { - arg0: BigNumber; -} -export type DecimalsUpdatedEvent = TypedEvent<[BigNumber], DecimalsUpdatedEventObject>; - -export type DecimalsUpdatedEventFilter = TypedEventFilter; - -export interface GasPriceUpdatedEventObject { - arg0: BigNumber; -} -export type GasPriceUpdatedEvent = TypedEvent<[BigNumber], GasPriceUpdatedEventObject>; - -export type GasPriceUpdatedEventFilter = TypedEventFilter; - -export interface L1BaseFeeUpdatedEventObject { - arg0: BigNumber; -} -export type L1BaseFeeUpdatedEvent = TypedEvent<[BigNumber], L1BaseFeeUpdatedEventObject>; - -export type L1BaseFeeUpdatedEventFilter = TypedEventFilter; - -export interface OverheadUpdatedEventObject { - arg0: BigNumber; -} -export type OverheadUpdatedEvent = TypedEvent<[BigNumber], OverheadUpdatedEventObject>; - -export type OverheadUpdatedEventFilter = TypedEventFilter; - -export interface OwnershipTransferredEventObject { - previousOwner: string; - newOwner: string; -} -export type OwnershipTransferredEvent = TypedEvent<[string, string], OwnershipTransferredEventObject>; - -export type OwnershipTransferredEventFilter = TypedEventFilter; - -export interface ScalarUpdatedEventObject { - arg0: BigNumber; -} -export type ScalarUpdatedEvent = TypedEvent<[BigNumber], ScalarUpdatedEventObject>; - -export type ScalarUpdatedEventFilter = TypedEventFilter; - -export interface OptimismL1FeeOracleAbi extends BaseContract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - interface: OptimismL1FeeOracleAbiInterface; - - queryFilter( - event: TypedEventFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>; - - listeners(eventFilter?: TypedEventFilter): Array>; - listeners(eventName?: string): Array; - removeAllListeners(eventFilter: TypedEventFilter): this; - removeAllListeners(eventName?: string): this; - off: OnEvent; - on: OnEvent; - once: OnEvent; - removeListener: OnEvent; - - functions: { - decimals(overrides?: CallOverrides): Promise<[BigNumber]>; - - gasPrice(overrides?: CallOverrides): Promise<[BigNumber]>; - - getL1Fee(_data: BytesLike, overrides?: CallOverrides): Promise<[BigNumber]>; - - getL1GasUsed(_data: BytesLike, overrides?: CallOverrides): Promise<[BigNumber]>; - - l1BaseFee(overrides?: CallOverrides): Promise<[BigNumber]>; - - overhead(overrides?: CallOverrides): Promise<[BigNumber]>; - - owner(overrides?: CallOverrides): Promise<[string]>; - - renounceOwnership(overrides?: Overrides & { from?: string }): Promise; - - scalar(overrides?: CallOverrides): Promise<[BigNumber]>; - - setDecimals(_decimals: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setGasPrice(_gasPrice: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setL1BaseFee(_baseFee: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setOverhead(_overhead: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setScalar(_scalar: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise; - }; - - decimals(overrides?: CallOverrides): Promise; - - gasPrice(overrides?: CallOverrides): Promise; - - getL1Fee(_data: BytesLike, overrides?: CallOverrides): Promise; - - getL1GasUsed(_data: BytesLike, overrides?: CallOverrides): Promise; - - l1BaseFee(overrides?: CallOverrides): Promise; - - overhead(overrides?: CallOverrides): Promise; - - owner(overrides?: CallOverrides): Promise; - - renounceOwnership(overrides?: Overrides & { from?: string }): Promise; - - scalar(overrides?: CallOverrides): Promise; - - setDecimals(_decimals: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setGasPrice(_gasPrice: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setL1BaseFee(_baseFee: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setOverhead(_overhead: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setScalar(_scalar: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise; - - callStatic: { - decimals(overrides?: CallOverrides): Promise; - - gasPrice(overrides?: CallOverrides): Promise; - - getL1Fee(_data: BytesLike, overrides?: CallOverrides): Promise; - - getL1GasUsed(_data: BytesLike, overrides?: CallOverrides): Promise; - - l1BaseFee(overrides?: CallOverrides): Promise; - - overhead(overrides?: CallOverrides): Promise; - - owner(overrides?: CallOverrides): Promise; - - renounceOwnership(overrides?: CallOverrides): Promise; - - scalar(overrides?: CallOverrides): Promise; - - setDecimals(_decimals: BigNumberish, overrides?: CallOverrides): Promise; - - setGasPrice(_gasPrice: BigNumberish, overrides?: CallOverrides): Promise; - - setL1BaseFee(_baseFee: BigNumberish, overrides?: CallOverrides): Promise; - - setOverhead(_overhead: BigNumberish, overrides?: CallOverrides): Promise; - - setScalar(_scalar: BigNumberish, overrides?: CallOverrides): Promise; - - transferOwnership(newOwner: string, overrides?: CallOverrides): Promise; - }; - - filters: { - 'DecimalsUpdated(uint256)'(arg0?: null): DecimalsUpdatedEventFilter; - DecimalsUpdated(arg0?: null): DecimalsUpdatedEventFilter; - - 'GasPriceUpdated(uint256)'(arg0?: null): GasPriceUpdatedEventFilter; - GasPriceUpdated(arg0?: null): GasPriceUpdatedEventFilter; - - 'L1BaseFeeUpdated(uint256)'(arg0?: null): L1BaseFeeUpdatedEventFilter; - L1BaseFeeUpdated(arg0?: null): L1BaseFeeUpdatedEventFilter; - - 'OverheadUpdated(uint256)'(arg0?: null): OverheadUpdatedEventFilter; - OverheadUpdated(arg0?: null): OverheadUpdatedEventFilter; - - 'OwnershipTransferred(address,address)'( - previousOwner?: string | null, - newOwner?: string | null, - ): OwnershipTransferredEventFilter; - OwnershipTransferred(previousOwner?: string | null, newOwner?: string | null): OwnershipTransferredEventFilter; - - 'ScalarUpdated(uint256)'(arg0?: null): ScalarUpdatedEventFilter; - ScalarUpdated(arg0?: null): ScalarUpdatedEventFilter; - }; - - estimateGas: { - decimals(overrides?: CallOverrides): Promise; - - gasPrice(overrides?: CallOverrides): Promise; - - getL1Fee(_data: BytesLike, overrides?: CallOverrides): Promise; - - getL1GasUsed(_data: BytesLike, overrides?: CallOverrides): Promise; - - l1BaseFee(overrides?: CallOverrides): Promise; - - overhead(overrides?: CallOverrides): Promise; - - owner(overrides?: CallOverrides): Promise; - - renounceOwnership(overrides?: Overrides & { from?: string }): Promise; - - scalar(overrides?: CallOverrides): Promise; - - setDecimals(_decimals: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setGasPrice(_gasPrice: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setL1BaseFee(_baseFee: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setOverhead(_overhead: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setScalar(_scalar: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise; - }; - - populateTransaction: { - decimals(overrides?: CallOverrides): Promise; - - gasPrice(overrides?: CallOverrides): Promise; - - getL1Fee(_data: BytesLike, overrides?: CallOverrides): Promise; - - getL1GasUsed(_data: BytesLike, overrides?: CallOverrides): Promise; - - l1BaseFee(overrides?: CallOverrides): Promise; - - overhead(overrides?: CallOverrides): Promise; - - owner(overrides?: CallOverrides): Promise; - - renounceOwnership(overrides?: Overrides & { from?: string }): Promise; - - scalar(overrides?: CallOverrides): Promise; - - setDecimals(_decimals: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setGasPrice(_gasPrice: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setL1BaseFee(_baseFee: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setOverhead(_overhead: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - setScalar(_scalar: BigNumberish, overrides?: Overrides & { from?: string }): Promise; - - transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise; - }; -} diff --git a/src/contracts/common.ts b/src/contracts/common.ts index 6cfb104..56b5f21 100644 --- a/src/contracts/common.ts +++ b/src/contracts/common.ts @@ -1,30 +1,131 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -import type { Listener } from '@ethersproject/providers'; -import type { Event, EventFilter } from 'ethers'; +import type { + FunctionFragment, + Typed, + EventFragment, + ContractTransaction, + ContractTransactionResponse, + DeferredTopicFilter, + EventLog, + TransactionRequest, + LogDescription, +} from "ethers"; -export interface TypedEvent = any, TArgsObject = any> extends Event { - args: TArgsArray & TArgsObject; +export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> + extends DeferredTopicFilter {} + +export interface TypedContractEvent< + InputTuple extends Array = any, + OutputTuple extends Array = any, + OutputObject = any +> { + (...args: Partial): TypedDeferredTopicFilter< + TypedContractEvent + >; + name: string; + fragment: EventFragment; + getFragment(...args: Partial): EventFragment; } -export interface TypedEventFilter<_TEvent extends TypedEvent> extends EventFilter {} +type __TypechainAOutputTuple = T extends TypedContractEvent< + infer _U, + infer W +> + ? W + : never; +type __TypechainOutputObject = T extends TypedContractEvent< + infer _U, + infer _W, + infer V +> + ? V + : never; -export interface TypedListener { - (...listenerArg: [...__TypechainArgsArray, TEvent]): void; +export interface TypedEventLog + extends Omit { + args: __TypechainAOutputTuple & __TypechainOutputObject; } -type __TypechainArgsArray = T extends TypedEvent ? U : never; - -export interface OnEvent { - (eventFilter: TypedEventFilter, listener: TypedListener): TRes; - (eventName: string, listener: Listener): TRes; +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 GetContractTypeFromFactory = F extends MinEthersFactory< + infer C, + any +> + ? C + : never; +export type GetARGsTypeFromFactory = F extends MinEthersFactory + ? Parameters + : never; -export type GetARGsTypeFromFactory = F extends MinEthersFactory ? Parameters : never; +export type StateMutability = "nonpayable" | "payable" | "view"; + +export type BaseOverrides = Omit; +export type NonPayableOverrides = Omit< + BaseOverrides, + "value" | "blockTag" | "enableCcipRead" +>; +export type PayableOverrides = Omit< + BaseOverrides, + "blockTag" | "enableCcipRead" +>; +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< + A extends Array, + S extends StateMutability +> = PostfixOverrides<{ [I in keyof A]-?: A[I] | Typed }, S>; + +export type DefaultReturnType = R extends Array ? R[0] : R; + +// export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> { +export interface TypedContractMethod< + A extends Array = 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; +} diff --git a/src/contracts/factories.ts b/src/contracts/factories.ts deleted file mode 100644 index 7b9efd2..0000000 --- a/src/contracts/factories.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { OptimismL1FeeOracleAbi__factory, OffchainOracleAbi__factory, MulticallAbi__factory } from './'; -import { optimismL1FeeOracleAddress, offchainOracleAddress, multiCallAddress } from '../config'; -import { Provider } from '@ethersproject/abstract-provider'; - -export const getOptimismL1FeeOracle = (provider: Provider) => { - return OptimismL1FeeOracleAbi__factory.connect(optimismL1FeeOracleAddress, provider); -}; - -export const getOffchainOracleContract = (provider: Provider) => { - return OffchainOracleAbi__factory.connect(offchainOracleAddress, provider); -}; - -export const getMultiCallContract = (provider: Provider) => { - return MulticallAbi__factory.connect(multiCallAddress, provider); -}; diff --git a/src/contracts/factories/GasPriceOracle__factory.ts b/src/contracts/factories/GasPriceOracle__factory.ts new file mode 100644 index 0000000..d09ba98 --- /dev/null +++ b/src/contracts/factories/GasPriceOracle__factory.ts @@ -0,0 +1,212 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { + GasPriceOracle, + GasPriceOracleInterface, +} from "../GasPriceOracle"; + +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", + }, +] as const; + +export class GasPriceOracle__factory { + static readonly abi = _abi; + static createInterface(): GasPriceOracleInterface { + return new Interface(_abi) as GasPriceOracleInterface; + } + static connect( + address: string, + runner?: ContractRunner | null + ): GasPriceOracle { + return new Contract(address, _abi, runner) as unknown as GasPriceOracle; + } +} diff --git a/src/contracts/factories/MulticallAbi__factory.ts b/src/contracts/factories/MulticallAbi__factory.ts deleted file mode 100644 index a598f0f..0000000 --- a/src/contracts/factories/MulticallAbi__factory.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { Contract, Signer, utils } from 'ethers'; -import type { Provider } from '@ethersproject/providers'; -import type { MulticallAbi, MulticallAbiInterface } from '../MulticallAbi'; - -const _abi = [ - { - inputs: [ - { - components: [ - { - internalType: 'address', - name: 'to', - type: 'address', - }, - { - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - ], - internalType: 'struct MultiCall.Call[]', - name: 'calls', - type: 'tuple[]', - }, - ], - name: 'multicall', - outputs: [ - { - internalType: 'bytes[]', - name: 'results', - type: 'bytes[]', - }, - { - internalType: 'bool[]', - name: 'success', - type: 'bool[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, -] as const; - -export class MulticallAbi__factory { - static readonly abi = _abi; - static createInterface(): MulticallAbiInterface { - return new utils.Interface(_abi) as MulticallAbiInterface; - } - static connect(address: string, signerOrProvider: Signer | Provider): MulticallAbi { - return new Contract(address, _abi, signerOrProvider) as MulticallAbi; - } -} diff --git a/src/contracts/factories/Multicall__factory.ts b/src/contracts/factories/Multicall__factory.ts new file mode 100644 index 0000000..36664f2 --- /dev/null +++ b/src/contracts/factories/Multicall__factory.ts @@ -0,0 +1,457 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { Multicall, MulticallInterface } from "../Multicall"; + +const _abi = [ + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "target", + type: "address", + }, + { + internalType: "bytes", + name: "callData", + type: "bytes", + }, + ], + internalType: "struct Multicall3.Call[]", + name: "calls", + type: "tuple[]", + }, + ], + name: "aggregate", + outputs: [ + { + internalType: "uint256", + name: "blockNumber", + type: "uint256", + }, + { + internalType: "bytes[]", + name: "returnData", + type: "bytes[]", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "target", + type: "address", + }, + { + internalType: "bool", + name: "allowFailure", + type: "bool", + }, + { + internalType: "bytes", + name: "callData", + type: "bytes", + }, + ], + internalType: "struct Multicall3.Call3[]", + name: "calls", + type: "tuple[]", + }, + ], + name: "aggregate3", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "success", + type: "bool", + }, + { + internalType: "bytes", + name: "returnData", + type: "bytes", + }, + ], + internalType: "struct Multicall3.Result[]", + name: "returnData", + type: "tuple[]", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "target", + type: "address", + }, + { + internalType: "bool", + name: "allowFailure", + type: "bool", + }, + { + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + internalType: "bytes", + name: "callData", + type: "bytes", + }, + ], + internalType: "struct Multicall3.Call3Value[]", + name: "calls", + type: "tuple[]", + }, + ], + name: "aggregate3Value", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "success", + type: "bool", + }, + { + internalType: "bytes", + name: "returnData", + type: "bytes", + }, + ], + internalType: "struct Multicall3.Result[]", + name: "returnData", + type: "tuple[]", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "target", + type: "address", + }, + { + internalType: "bytes", + name: "callData", + type: "bytes", + }, + ], + internalType: "struct Multicall3.Call[]", + name: "calls", + type: "tuple[]", + }, + ], + name: "blockAndAggregate", + outputs: [ + { + internalType: "uint256", + name: "blockNumber", + type: "uint256", + }, + { + internalType: "bytes32", + name: "blockHash", + type: "bytes32", + }, + { + components: [ + { + internalType: "bool", + name: "success", + type: "bool", + }, + { + internalType: "bytes", + name: "returnData", + type: "bytes", + }, + ], + internalType: "struct Multicall3.Result[]", + name: "returnData", + type: "tuple[]", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "getBasefee", + outputs: [ + { + internalType: "uint256", + name: "basefee", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "blockNumber", + type: "uint256", + }, + ], + name: "getBlockHash", + outputs: [ + { + internalType: "bytes32", + name: "blockHash", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getBlockNumber", + outputs: [ + { + internalType: "uint256", + name: "blockNumber", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getChainId", + outputs: [ + { + internalType: "uint256", + name: "chainid", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getCurrentBlockCoinbase", + outputs: [ + { + internalType: "address", + name: "coinbase", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getCurrentBlockDifficulty", + outputs: [ + { + internalType: "uint256", + name: "difficulty", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getCurrentBlockGasLimit", + outputs: [ + { + internalType: "uint256", + name: "gaslimit", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getCurrentBlockTimestamp", + outputs: [ + { + internalType: "uint256", + name: "timestamp", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "addr", + type: "address", + }, + ], + name: "getEthBalance", + outputs: [ + { + internalType: "uint256", + name: "balance", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getLastBlockHash", + outputs: [ + { + internalType: "bytes32", + name: "blockHash", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bool", + name: "requireSuccess", + type: "bool", + }, + { + components: [ + { + internalType: "address", + name: "target", + type: "address", + }, + { + internalType: "bytes", + name: "callData", + type: "bytes", + }, + ], + internalType: "struct Multicall3.Call[]", + name: "calls", + type: "tuple[]", + }, + ], + name: "tryAggregate", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "success", + type: "bool", + }, + { + internalType: "bytes", + name: "returnData", + type: "bytes", + }, + ], + internalType: "struct Multicall3.Result[]", + name: "returnData", + type: "tuple[]", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "bool", + name: "requireSuccess", + type: "bool", + }, + { + components: [ + { + internalType: "address", + name: "target", + type: "address", + }, + { + internalType: "bytes", + name: "callData", + type: "bytes", + }, + ], + internalType: "struct Multicall3.Call[]", + name: "calls", + type: "tuple[]", + }, + ], + name: "tryBlockAndAggregate", + outputs: [ + { + internalType: "uint256", + name: "blockNumber", + type: "uint256", + }, + { + internalType: "bytes32", + name: "blockHash", + type: "bytes32", + }, + { + components: [ + { + internalType: "bool", + name: "success", + type: "bool", + }, + { + internalType: "bytes", + name: "returnData", + type: "bytes", + }, + ], + internalType: "struct Multicall3.Result[]", + name: "returnData", + type: "tuple[]", + }, + ], + stateMutability: "payable", + type: "function", + }, +] as const; + +export class Multicall__factory { + static readonly abi = _abi; + static createInterface(): MulticallInterface { + return new Interface(_abi) as MulticallInterface; + } + static connect(address: string, runner?: ContractRunner | null): Multicall { + return new Contract(address, _abi, runner) as unknown as Multicall; + } +} diff --git a/src/contracts/factories/OffchainOracleAbi__factory.ts b/src/contracts/factories/OffchainOracleAbi__factory.ts deleted file mode 100644 index 21916c3..0000000 --- a/src/contracts/factories/OffchainOracleAbi__factory.ts +++ /dev/null @@ -1,352 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { Contract, Signer, utils } from 'ethers'; -import type { Provider } from '@ethersproject/providers'; -import type { OffchainOracleAbi, OffchainOracleAbiInterface } from '../OffchainOracleAbi'; - -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', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - 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: [], - 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', - }, -] as const; - -export class OffchainOracleAbi__factory { - static readonly abi = _abi; - static createInterface(): OffchainOracleAbiInterface { - return new utils.Interface(_abi) as OffchainOracleAbiInterface; - } - static connect(address: string, signerOrProvider: Signer | Provider): OffchainOracleAbi { - return new Contract(address, _abi, signerOrProvider) as OffchainOracleAbi; - } -} diff --git a/src/contracts/factories/OffchainOracle__factory.ts b/src/contracts/factories/OffchainOracle__factory.ts new file mode 100644 index 0000000..351c5db --- /dev/null +++ b/src/contracts/factories/OffchainOracle__factory.ts @@ -0,0 +1,538 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { + OffchainOracle, + OffchainOracleInterface, +} from "../OffchainOracle"; + +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", + }, +] as const; + +export class OffchainOracle__factory { + static readonly abi = _abi; + static createInterface(): OffchainOracleInterface { + return new Interface(_abi) as OffchainOracleInterface; + } + static connect( + address: string, + runner?: ContractRunner | null + ): OffchainOracle { + return new Contract(address, _abi, runner) as unknown as OffchainOracle; + } +} diff --git a/src/contracts/factories/OptimismL1FeeOracleAbi__factory.ts b/src/contracts/factories/OptimismL1FeeOracleAbi__factory.ts deleted file mode 100644 index a06ea0f..0000000 --- a/src/contracts/factories/OptimismL1FeeOracleAbi__factory.ts +++ /dev/null @@ -1,316 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { Contract, Signer, utils } from 'ethers'; -import type { Provider } from '@ethersproject/providers'; -import type { OptimismL1FeeOracleAbi, OptimismL1FeeOracleAbiInterface } from '../OptimismL1FeeOracleAbi'; - -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', - }, -] as const; - -export class OptimismL1FeeOracleAbi__factory { - static readonly abi = _abi; - static createInterface(): OptimismL1FeeOracleAbiInterface { - return new utils.Interface(_abi) as OptimismL1FeeOracleAbiInterface; - } - static connect(address: string, signerOrProvider: Signer | Provider): OptimismL1FeeOracleAbi { - return new Contract(address, _abi, signerOrProvider) as OptimismL1FeeOracleAbi; - } -} diff --git a/src/contracts/factories/OptimismL1FeeOracle__factory.ts b/src/contracts/factories/OptimismL1FeeOracle__factory.ts new file mode 100644 index 0000000..5fbc987 --- /dev/null +++ b/src/contracts/factories/OptimismL1FeeOracle__factory.ts @@ -0,0 +1,325 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { + OptimismL1FeeOracle, + OptimismL1FeeOracleInterface, +} from "../OptimismL1FeeOracle"; + +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", + }, +] as const; + +export class OptimismL1FeeOracle__factory { + static readonly abi = _abi; + static createInterface(): OptimismL1FeeOracleInterface { + return new Interface(_abi) as OptimismL1FeeOracleInterface; + } + static connect( + address: string, + runner?: ContractRunner | null + ): OptimismL1FeeOracle { + return new Contract( + address, + _abi, + runner + ) as unknown as OptimismL1FeeOracle; + } +} diff --git a/src/contracts/factories/index.ts b/src/contracts/factories/index.ts index 76d7bed..0d2445d 100644 --- a/src/contracts/factories/index.ts +++ b/src/contracts/factories/index.ts @@ -1,6 +1,7 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -export { MulticallAbi__factory } from './MulticallAbi__factory'; -export { OffchainOracleAbi__factory } from './OffchainOracleAbi__factory'; -export { OptimismL1FeeOracleAbi__factory } from './OptimismL1FeeOracleAbi__factory'; +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/src/contracts/index.ts b/src/contracts/index.ts index 805bcd2..d3d098f 100644 --- a/src/contracts/index.ts +++ b/src/contracts/index.ts @@ -1,10 +1,12 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -export type { MulticallAbi } from './MulticallAbi'; -export type { OffchainOracleAbi } from './OffchainOracleAbi'; -export type { OptimismL1FeeOracleAbi } from './OptimismL1FeeOracleAbi'; -export * as factories from './factories'; -export { MulticallAbi__factory } from './factories/MulticallAbi__factory'; -export { OffchainOracleAbi__factory } from './factories/OffchainOracleAbi__factory'; -export { OptimismL1FeeOracleAbi__factory } from './factories/OptimismL1FeeOracleAbi__factory'; +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/src/feeOracle.ts b/src/feeOracle.ts index 9fb44ac..e7e28a1 100644 --- a/src/feeOracle.ts +++ b/src/feeOracle.ts @@ -1,279 +1,116 @@ -import { GasPriceOracle } from '@tornado/gas-price-oracle'; -import { BigNumber, BigNumberish, ethers } from 'ethers'; -import BigNumberFloat from 'bignumber.js'; -import { parseUnits } from 'ethers/lib/utils'; -import { - TransactionData, - TxType, - ITornadoFeeOracle, - LegacyGasPriceKey, - GasPriceParams, - GetGasParamsRes, - HexadecimalStringifiedNumber, - GetGasInput, - GetGasParamsInput, -} from './types'; -import { JsonRpcProvider } from '@ethersproject/providers'; -import { ChainId, defaultGasPrices, defaultInstanceTokensGasLimit, InstanceTokenSymbol } from './config'; -import { bump, calculateGasPriceInWei, convertETHToToken, fromGweiToWeiHex, serializeTx } from './utils'; -import { getOptimismL1FeeOracle } from './contracts/factories'; -import { GetWithdrawalFeeViaRelayerInput } from './types'; -import { AvailableTokenSymbols } from '@tornado/tornado-config'; +import { Transaction, parseUnits } from 'ethers'; +import type { BigNumberish, TransactionLike } from 'ethers'; +import { OptimismL1FeeOracle, OptimismL1FeeOracle__factory } from './contracts'; +import { ChainIdType } from './constants'; +import { getProvider } from './providers'; +import { networkConfig } from './types'; +import { convertETHToTokenAmount } from './utils'; -export abstract class TornadoFeeOracle implements ITornadoFeeOracle { - protected provider: JsonRpcProvider; +const DUMMY_ADDRESS = '0x1111111111111111111111111111111111111111'; - public constructor( - public version: 4 | 5, - protected chainId: ChainId, - rpcUrl: string, - protected oracle: GasPriceOracle, - ) { - this.provider = new ethers.providers.JsonRpcProvider(rpcUrl); - } +const DUMMY_NONCE = 1024; - /** - * Because Optimism transaction published on Mainnet, for each OP transaction we need to calculate L1 security fee: - * https://community.optimism.io/docs/developers/build/transaction-fees/#priority-fee - * @param {TransactionData} [tx] Transaction data to estimate L1 additional fee - * @returns {Promise} Fee in WEI (MATIC), '0' if chain is not Optimism - */ - async fetchL1OptimismFee(tx?: TransactionData): Promise { - if (this.chainId != ChainId.OPTIMISM) return BigNumber.from(0).toHexString(); +const DUMMY_WITHDRAW_DATA = + '0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'; - const optimismL1FeeOracle = getOptimismL1FeeOracle(this.provider); - const l1Fee = await optimismL1FeeOracle.getL1Fee(serializeTx(tx)); +export interface RelayerFeeParams { + gasPrice: BigNumberish; + gasLimit?: BigNumberish; + l1Fee?: BigNumberish; + denomination: BigNumberish; + ethRefund: BigNumberish; + tokenPriceInWei: BigNumberish; + tokenDecimals: number; + relayerFeePercent?: number; + isEth?: boolean; + premiumPercent?: number; +} - return l1Fee.toHexString(); - } +export class TornadoFeeOracle { + optimismL1FeeOracle?: OptimismL1FeeOracle; - /** - * Estimate gas price, gas limit and l1Fee for sidechain (if exists) - * @param {GetGasParamsInput} [params] Function input arguments object - * @param {TransactionData} [params.tx] Transaction data in web3 / ethers format - * @param {TxType} [params.txType=other] Tornado transaction type: withdrawal by user, withdrawal by relayer or 'other' - * @param {number} [params.predefinedGasLimit] Predefined gas limit, if already calculated (no refetching) - * @param {number} [params.predefinedGasPrice] Predefined gas price, if already calculated (no refetching) - * @param {number} [params.bumpGasLimitPercent] Gas limit bump percent to prioritize transaction (if gas limit not predefined, recenlty used) - * @param {number} [params.bumpGasPricePercent] Gas price bump percent to prioritize transaction (if gas limit not predefined, rarely used) - * @param {LegacyGasPriceKey} [params.speed] Preferred transaction speed, if uses legacy gas (before EIP-1559) - * @param {boolean} [params.includeL1FeeToGasLimit=true] Include L1 additional fee on Optimism to gas limit (get fee and divide by gas price) - * @returns {Promise} Object with fields 'gasPrice' and 'gasLimit', L1 fee, if exists, included in gasLimit - */ - async getGasParams(params: GetGasParamsInput = {}): Promise { - let { - tx, - txType = 'other', - bumpGasLimitPercent, - bumpGasPricePercent, - predefinedGasLimit: gasLimit, - predefinedGasPrice: gasPrice, - speed, - includeL1FeeToGasLimit = true, - } = params; + constructor(netId: ChainIdType, rpcUrl: string, config: networkConfig) { + const { optimismL1FeeOracleAddress } = config; - let l1Fee: string = '0'; - if (!gasLimit && !gasPrice) { - [gasPrice, gasLimit, l1Fee] = await Promise.all([ - this.getGasPrice(speed, bumpGasPricePercent), - this.getGasLimit(tx, txType, bumpGasLimitPercent), - this.fetchL1OptimismFee(tx), - ]); - } - if (!gasLimit) { - [gasLimit, l1Fee] = await Promise.all([ - this.getGasLimit(tx, txType, bumpGasLimitPercent), - this.fetchL1OptimismFee(tx), - ]); - } - if (!gasPrice) gasPrice = await this.getGasPrice(speed, bumpGasPricePercent); - - if (includeL1FeeToGasLimit) - // Include L1 fee in gas limit (divide by gas price before), if l1 fee is 0, gas limit wont change - gasLimit = BigNumberFloat(gasLimit) - .plus(BigNumberFloat(l1Fee).div(BigNumberFloat(gasPrice))) - .decimalPlaces(0, 1) - .toNumber(); - - return { gasLimit, gasPrice }; - } - - /** - * Estimates next block gas for signed, unsigned or incomplete Tornado transaction - * @param {GetGasInput} [params] Function input arguments object - * @param {TransactionData} [params.tx] Transaction data in web3 / ethers format - * @param {TxType} [params.txType] Tornado transaction type: withdrawal by user, withdrawal by relayer or 'other' - * @param {number} [params.predefinedGasLimit] Predefined gas limit, if already calculated (no refetching) - * @param {number} [params.predefinedGasPrice] Predefined gas price, if already calculated (no refetching) - * @param {number} [params.bumpGasLimitPercent] Gas limit bump percent to prioritize transaction (if gas limit not predefined, recenlty used) - * @param {number} [params.bumpGasPricePercent] Gas price bump percent to prioritize transaction (if gas price not predefined, rarely used) - * @param {LegacyGasPriceKey} [params.speed] Preferred transaction speed, if uses legacy gas (before EIP-1559) - * @returns {Promise} Gas value in WEI (hex-format) - */ - async getGas(params: GetGasInput = {}): Promise { - const { gasPrice, gasLimit } = await this.getGasParams({ ...params, includeL1FeeToGasLimit: true }); - - return BigNumber.from(gasPrice).mul(gasLimit).toHexString(); - } - - /** - * Estimate next block gas price - * @param {LegacyGasPriceKey} [speed] Preferred transaction speed, if uses legacy gas (before EIP-1559) - * @param {number} [bumpPercent=0] Gas bump percent to prioritize transaction - * @returns {Promise} Estimated gas price info in WEI (hexed) - legacy object with gasPrice property or - * EIP-1559 object with maxFeePerGas and maxPriorityFeePerGas properties - */ - async getGasPriceParams(speed?: LegacyGasPriceKey, bumpPercent: number = 0): Promise { - // Use instant for BSC, because on this chain "fast" and "instant" differs more than third and "fast" transaction can take hours - if (!speed) speed = this.chainId === ChainId.BSC ? 'instant' : 'fast'; - try { - return await this.oracle.getTxGasParams({ legacySpeed: speed, bumpPercent }); - } catch (e) { - return { gasPrice: bump(fromGweiToWeiHex(defaultGasPrices[this.chainId][speed]), bumpPercent).toHexString() }; + if (optimismL1FeeOracleAddress) { + const provider = getProvider(netId, rpcUrl, config); + this.optimismL1FeeOracle = OptimismL1FeeOracle__factory.connect(optimismL1FeeOracleAddress, provider); } } /** - * Estimate next block gas price - * @param {LegacyGasPriceKey} [speed] Preferred transaction speed, if uses legacy gas (before EIP-1559) - * @param {number} [bumpPercent] Gas bump percent to prioritize transaction - * @returns {Promise} Gas price in WEI (hex string) - */ - async getGasPrice(speed?: LegacyGasPriceKey, bumpPercent?: number): Promise { - const gasPriceParams = await this.getGasPriceParams(speed, bumpPercent); - return calculateGasPriceInWei(gasPriceParams).toHexString(); - } - - /** - * Estimates gas limit for transaction (or basic gas limit, if no tx data provided) - * @param {TransactionData} [tx] Transaction data (object in web3 / ethers format) - * @param {TxType} [type] Tornado transaction type: withdrawal by user, withdrawal by relayer, relayer fee check or 'other' - * @param {number} [bumpPercent] Gas bump percent to prioritize transaction - * @returns {Promise} Gas limit - */ - abstract getGasLimit(tx?: TransactionData, type?: TxType, bumpPercent?: number): Promise; - - /** - * If user withdraw non-native tokens on ETH or Goerli, we need to calculate refund value: - * if the withdrawal is successful, this amount will be returned to the user after the transfer to the relayer, - * and if the relayer pays a commission and the transfer of tokens fails, this commission will remain to the relayer. + * Calculate L1 fee for op-stack chains * - * Refund needed that recipient can use tokens after withdrawal (covers gas fee for send/swap) - * @param {BigNumberish} gasPrice Actual gas price - * @param {InstanceTokenSymbol} tokenSymbol Withdrawal token (currency) symbol - for example, 'dai' - * @returns {HexadecimalStringifiedNumber} Refund amount in WEI (in hex format) + * This is required since relayers would pay the full transaction fees for users */ - calculateRefundInETH(gasPrice: BigNumberish, tokenSymbol: InstanceTokenSymbol): HexadecimalStringifiedNumber { - // Refund only available for non-native tokens on Ethereum Mainnet and Goerli - if (![ChainId.MAINNET, ChainId.GOERLI].includes(this.chainId) || (tokenSymbol as AvailableTokenSymbols) === 'eth') - return '0'; - - // Notify user about error if incorrect token symbol provided - if (!Object.values(InstanceTokenSymbol).includes(tokenSymbol)) { - console.error( - `Invalid token symbol: ${tokenSymbol}, must be lowercase token from one of Tornado ETH Mainnet pools`, - ); - return '0'; + fetchL1OptimismFee(tx?: TransactionLike): Promise { + if (!this.optimismL1FeeOracle) { + return new Promise((resolve) => resolve(BigInt(0))); } - // In Tornado we need to calculate refund only on user side, relayer get refund value in proof - const gasLimit = defaultInstanceTokensGasLimit[tokenSymbol]; - return BigNumber.from(gasPrice).mul(gasLimit).mul(2).toHexString(); - } - - /** - * Fetched actual gas price and calculates refund amount - * @param {InstanceTokenSymbol} tokenSymbol Withdrawal token (currency) symbol - for example, 'dai' - * @returns {Promise} Refund amount in WEI (in hex format) - */ - async fetchRefundInETH(tokenSymbol: InstanceTokenSymbol): Promise { - const gasPrice = await this.getGasPrice(); - return this.calculateRefundInETH(gasPrice, tokenSymbol); - } - - /** - * Get refund amount on ETH or Goerli in non-native token - * @param {BigNumberish} gasPrice Actual gas price in ETH - * @param {BigNumberish} tokenPriceInEth Token price in WEI in ETH - * @param {HexadecimalStringifiedNumber | number} tokenDecimals Token (currency) decimals - * @param {InstanceTokenSymbol} tokenSymbol Withdrawal token (currency) symbol - for example, 'dai' - * @returns {HexadecimalStringifiedNumber} Refund amount in WEI in selected token (hexed number) - */ - calculateRefundInToken( - gasPrice: BigNumberish, - tokenPriceInEth: BigNumberish, - tokenDecimals: HexadecimalStringifiedNumber | number, - tokenSymbol: InstanceTokenSymbol, - ): HexadecimalStringifiedNumber { - const refundInEth = this.calculateRefundInETH(gasPrice, tokenSymbol); - return convertETHToToken(refundInEth, tokenDecimals, tokenPriceInEth).toHexString(); - } - - /** - * Calculates relayer fee in selected currency (ETH, DAI, BNB etc) in WEI - * @param {number | string} relayerFeePercent Relayer percent (0.4 for ETH Mainnet, for example) - * @param {HexadecimalStringifiedNumber | number} amount Amount in selected currency (10 for 10 ETH, 1000 for 1000 DAI) - * @param {string | number} decimals Decimal places in selected token (currency) - * @returns {HexadecimalStringifiedNumber} Fee in WEI (hexed stingified number) - */ - calculateRelayerFeeInWei( - relayerFeePercent: number | string, - amount: HexadecimalStringifiedNumber | number, - decimals: string | number, - ): HexadecimalStringifiedNumber { - return parseUnits(amount.toString(), decimals) - .mul(`${Math.floor(Number(relayerFeePercent) * 1e10)}`) - .div(`${100 * 1e10}`) - .toHexString(); - } - - /** - * Estimates fee for withdrawal via relayer depending on type: gas bump percent is bigger, if it calculates by user, - * so that the real commission from the relayer side is a little less, - * in order to the relayer can send a transaction without fear that he will go into the red - * @param {GetWithdrawalFeeViaRelayerInput} params Function input arguments object - * @param {TxType} params.txType Tornado transaction type: withdrawal costs calculation from user side or from relayer side - * @param {TransactionData} [params.tx] Transaction data (object in web3 / ethers format) - * @param {number} params.relayerFeePercent Relayer fee percent from the transaction amount (for example, 0.15 for BNB or 0.4 for ETH Mainnet) - * @param {AvailableTokenSymbols | Uppercase} params.currency Currency symbol - * @param {number | HexadecimalStringifiedNumber } params.amount Withdrawal amount in selected currency - * @param {number | HexadecimalStringifiedNumber } params.decimals Token (currency) decimals - * @param {BigNumberish} [params.refundInEth] Refund in ETH, if withdrawed other tokens on Mainnet (not ETH). Can not be provided, if user-side calculation - * @param {BigNumberish} [params.tokenPriceInEth] If withdrawing other token on Mainnet or Goerli, need to provide token price in ETH (in WEI) - * @param {number} [params.gasLimit] Predefined gas limit, if already calculated (no refetching) - * @param {number} [params.gasPrice] Predefined gas price, if already calculated (no refetching) - * - * @returns {Promise} Fee in WEI (hexed string) - */ - async calculateWithdrawalFeeViaRelayer({ - tx, - txType, - relayerFeePercent, - currency, - amount, - decimals, - refundInEth, - tokenPriceInEth, - predefinedGasLimit, - predefinedGasPrice, - }: GetWithdrawalFeeViaRelayerInput): Promise { - const relayerFee = this.calculateRelayerFeeInWei(relayerFeePercent, amount, decimals); - const { gasPrice, gasLimit } = await this.getGasParams({ tx, txType, predefinedGasLimit, predefinedGasPrice }); - const gasCosts = BigNumber.from(gasPrice).mul(gasLimit); - - if ((this.chainId === ChainId.MAINNET || this.chainId === ChainId.GOERLI) && currency.toLowerCase() != 'eth') { - if (!tokenPriceInEth) { - console.error('Token price is required argument, if not native chain token is withdrawed'); - return '0'; - } - - if (txType === 'user_withdrawal' && refundInEth === undefined) - refundInEth = this.calculateRefundInETH(gasPrice, currency.toLowerCase() as InstanceTokenSymbol); - - const feeInEth = BigNumber.from(gasCosts).add(refundInEth || 0); - return convertETHToToken(feeInEth, decimals, tokenPriceInEth).add(relayerFee).toHexString(); + 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: 1_000_000, + nonce: DUMMY_NONCE, + data: DUMMY_WITHDRAW_DATA, + gasPrice: parseUnits('1', 'gwei'), + to: DUMMY_ADDRESS, + }; } - return BigNumber.from(gasCosts).add(relayerFee).toHexString(); + 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?: BigNumberish, gasLimit?: BigNumberish): bigint { + return (gasPrice ? BigInt(gasPrice) : parseUnits('30', 'gwei')) * BigInt(gasLimit || 1_000_000); + } + + /** + * Calculates token amount for required ethRefund purchases required to calculate fees + */ + calculateTokenAmount(ethRefund: BigNumberish, tokenPriceInEth: BigNumberish, tokenDecimals?: number): bigint { + 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 = 600_000, + l1Fee = 0, + denomination, + ethRefund = BigInt(0), + tokenPriceInWei, + tokenDecimals = 18, + relayerFeePercent = 0.33, + isEth = true, + premiumPercent = 20, + }: RelayerFeeParams): bigint { + 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) + ); } } diff --git a/src/feeOracleV4.ts b/src/feeOracleV4.ts deleted file mode 100644 index d073362..0000000 --- a/src/feeOracleV4.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { defaultWithdrawalGasLimit } from './config'; -import { TornadoFeeOracle } from './feeOracle'; -import { ITornadoFeeOracle, TransactionData, TxType, LegacyGasPrices } from './types'; -import { GasPriceOracle } from '@tornado/gas-price-oracle'; -import { bump } from './utils'; - -/** - * Oracle for V4 (old-version) transactions - estimates fee with predefined gas limit and without smart bumping - */ -export class TornadoFeeOracleV4 extends TornadoFeeOracle implements ITornadoFeeOracle { - public constructor(chainId: number, rpcUrl: string, defaultGasPrices?: LegacyGasPrices) { - const oracleConfig = { - chainId, - defaultRpc: rpcUrl, - defaultFallbackGasPrices: defaultGasPrices, - }; - const gasPriceOracle = new GasPriceOracle(oracleConfig); - - super(4, chainId, rpcUrl, gasPriceOracle); - } - - async getGasLimit(tx?: TransactionData, type: TxType = 'other', bumpPercent: number = 0): Promise { - if (type === 'user_withdrawal') return bump(defaultWithdrawalGasLimit[this.chainId], bumpPercent).toNumber(); - - // Need to bump relayer gas limit for transaction, because predefined gas limit to small to be 100% sure that transaction will be sent - // This leads to fact that relayer often pays extra for gas from his own funds, however, this was designed by previous developers - if (type === 'relayer_withdrawal') - return bump(defaultWithdrawalGasLimit[this.chainId], bumpPercent || 25).toNumber(); - // For compatibility reasons, when wee check user-provided fee for V4 withdrawal transaction, we need dump gas limit - // for about 20 percent,so that the transaction will be sent, even if it results in some loss for the relayer - if (type === 'relayer_withdrawal_check_v4') return bump(defaultWithdrawalGasLimit[this.chainId], -25).toNumber(); - if (!tx || Object.keys(tx).length === 0) return bump(23_000, bumpPercent).toNumber(); - - return bump(await this.provider.estimateGas(tx), bumpPercent).toNumber(); - } -} diff --git a/src/feeOracleV5.ts b/src/feeOracleV5.ts deleted file mode 100644 index 7babced..0000000 --- a/src/feeOracleV5.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { ChainId } from './config'; -import { TornadoFeeOracle } from './feeOracle'; -import { - ITornadoFeeOracle, - TransactionData, - TxType, - LegacyGasPrices, - LegacyGasPriceKey, - GasPriceParams, -} from './types'; -import { GasPriceOracle } from '@tornado/gas-price-oracle'; -import { bump } from './utils'; -import { TornadoFeeOracleV4 } from './feeOracleV4'; - -/** - * Oracle for new V5 version - estimates transaction fees with smart gas limit & bumping - */ -export class TornadoFeeOracleV5 extends TornadoFeeOracle implements ITornadoFeeOracle { - private fallbackFeeOracle: TornadoFeeOracleV4; - - public constructor(chainId: number, rpcUrl: string, defaultGasPrices?: LegacyGasPrices) { - const oracleConfig = { - chainId, - defaultRpc: rpcUrl, - minPriority: chainId === ChainId.MAINNET || chainId === ChainId.GOERLI ? 2 : chainId === ChainId.BSC ? 3 : 0.05, - percentile: 5, - blocksCount: 20, - defaultFallbackGasPrices: defaultGasPrices, - }; - const gasPriceOracle = new GasPriceOracle(oracleConfig); - - super(5, chainId, rpcUrl, gasPriceOracle); - - this.fallbackFeeOracle = new TornadoFeeOracleV4(chainId, rpcUrl, defaultGasPrices); - } - - async getGasLimit(tx?: TransactionData, type: TxType = 'other', bumpPercent: number = 20): Promise { - if (!tx || Object.keys(tx).length === 0) return this.fallbackFeeOracle.getGasLimit(tx, type, bumpPercent); - - /* Relayer gas limit must be lower so that fluctuations in gas price cannot lead to the fact that - * the relayer will actually pay for gas more than the money allocated for this by the user - * (that is, in fact, relayer will pay for gas from his own money, unless we make the bump percent less for him) - */ - if (type === 'relayer_withdrawal') bumpPercent = 10; - if (type === 'user_withdrawal') bumpPercent = 30; - - try { - const fetchedGasLimit = await this.provider.estimateGas(tx); - return bump(fetchedGasLimit, bumpPercent).toNumber(); - } catch (e) { - return this.fallbackFeeOracle.getGasLimit(tx, type, bumpPercent); - } - } - - async getGasPriceParams(speed?: LegacyGasPriceKey, bumpPercent?: number): Promise { - // Only if bump percent didn't provided (if user provides 0, no need to recalculate) - if (bumpPercent === undefined) { - switch (this.chainId) { - case ChainId.GOERLI: - bumpPercent = 100; - break; - case ChainId.POLYGON: - case ChainId.AVAX: - case ChainId.XDAI: - bumpPercent = 30; - break; - default: - bumpPercent = 10; - } - } - - return super.getGasPriceParams(speed, bumpPercent); - } -} diff --git a/src/index.ts b/src/index.ts index bbf0996..b9c3074 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,7 @@ -export * from './feeOracleV4'; -export * from './feeOracleV5'; +export * from './constants'; +export * from './feeOracle'; +export * from './multicall'; +export * from './providers'; export * from './tokenPriceOracle'; +export * from './types'; +export * from './utils'; diff --git a/src/multicall.ts b/src/multicall.ts new file mode 100644 index 0000000..7e92944 --- /dev/null +++ b/src/multicall.ts @@ -0,0 +1,28 @@ +import { Interface } from 'ethers'; +import { Multicall } from './contracts'; +import type { Call3 } from './types'; + +export async function multicall(Multicall: Multicall, calls: Call3[]) { + const calldata = calls.map((call) => { + const target = (call.contract?.target || call.address) as string; + const callInterface = (call.contract?.interface || call.interface) as Interface; + + return { + target, + callData: callInterface.encodeFunctionData(call.name, call.params), + allowFailure: call.allowFailure ?? false, + }; + }); + + const returnData = await Multicall.aggregate3.staticCall(calldata); + + const res = returnData.map((call, i) => { + const callInterface = (calls[i].contract?.interface || calls[i].interface) as 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; +} diff --git a/src/providers.ts b/src/providers.ts new file mode 100644 index 0000000..2b8b14c --- /dev/null +++ b/src/providers.ts @@ -0,0 +1,107 @@ +import { JsonRpcProvider, Network, parseUnits, FetchUrlFeeDataNetworkPlugin, EnsPlugin, GasCostPlugin } from 'ethers'; +import { GasPriceOracle, GasPriceOracle__factory, Multicall, Multicall__factory } from './contracts'; +import { ENS_CHAINS, ChainIdType, multiCallAddress, POLYGON_GAS_STATION } from './constants'; +import { multicall } from './multicall'; +import type { networkConfig, gasOracleOptions } from './types'; +import { isNode } from './utils'; + +// caching to improve performance +const oracleMapper = new Map(); +const multicallMapper = new Map(); + +export function getGasOraclePlugin(networkKey: string, gasOracleOptions?: gasOracleOptions) { + const gasStationApi = gasOracleOptions?.gasStationApi || POLYGON_GAS_STATION; + + return new FetchUrlFeeDataNetworkPlugin(gasStationApi, async (fetchFeeData, provider, request) => { + if (!oracleMapper.has(networkKey)) { + oracleMapper.set( + networkKey, + GasPriceOracle__factory.connect(gasOracleOptions?.gasPriceOracle as string, provider), + ); + } + if (!multicallMapper.has(networkKey)) { + multicallMapper.set(networkKey, Multicall__factory.connect(multiCallAddress, provider)); + } + const Oracle = oracleMapper.get(networkKey) as GasPriceOracle; + const Multicall = multicallMapper.get(networkKey) as Multicall; + + const [timestamp, heartbeat, feePerGas, priorityFeePerGas] = await 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 }, + ] = await Promise.all([request.send(), fetchFeeData()]); + + return { + gasPrice, + maxFeePerGas: parseUnits(`${fast.maxFee}`, 9), + maxPriorityFeePerGas: parseUnits(`${fast.maxPriorityFee}`, 9), + }; + }); +} + +export function getProvider(netId: ChainIdType, rpcUrl: string, config: networkConfig): JsonRpcProvider { + 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; +} diff --git a/src/tokenPriceOracle.ts b/src/tokenPriceOracle.ts index a2c0ae8..823b6fd 100644 --- a/src/tokenPriceOracle.ts +++ b/src/tokenPriceOracle.ts @@ -1,107 +1,54 @@ -import { MultiCall } from './contracts/MulticallAbi'; -import { ITornadoPriceOracle, Token, TokenPrices, TokenSymbol } from './types'; -import { MulticallAbi, OffchainOracleAbi } from './contracts'; -import { getMultiCallContract, getOffchainOracleContract } from './contracts/factories'; -import { Provider } from '@ethersproject/abstract-provider'; -import { ethers, BigNumber } from 'ethers'; -import { defaultAbiCoder } from 'ethers/lib/utils'; -import { instances, Instances } from '@tornado/tornado-config'; -import { ChainId } from './config'; +import { Provider, parseEther } from 'ethers'; +import { Multicall, Multicall__factory, OffchainOracle, OffchainOracle__factory } from './contracts'; +import { ChainIdType, multiCallAddress } from './constants'; +import { multicall } from './multicall'; +import { getProvider } from './providers'; +import { Token, TokenPrices, networkConfig } from './types'; -/** - * Filter non-native tokens from Tornado instances config - * @param instances Tornado instances from torn-token config ('@tornado/tornado-config' library) - * @returns Array of non-native tokens - */ -function filterTokensFromTornadoInstances(instances: Instances): Token[] { - const ethInstances = Object.values(instances[ChainId.MAINNET]); - return ethInstances.filter((tokenInstance) => !!tokenInstance.tokenAddress) as Token[]; -} +export class TokenPriceOracle { + oracle?: OffchainOracle; + multicall: Multicall; + provider: Provider; -const tornToken: Token = { - tokenAddress: '0x77777FeDdddFfC19Ff86DB637967013e6C6A116C', - symbol: 'torn', - decimals: 18, -}; -const tornadoTokens = [tornToken, ...filterTokensFromTornadoInstances(instances)]; + constructor(netId: ChainIdType, rpcUrl: string, config: networkConfig) { + const { offchainOracleContract } = config; -const defaultTornadoTokenPrices: TokenPrices = { - torn: '1689423546359032', - dai: '598416104472725', - cdai: '13384388487019', - usdc: '599013776676721', - usdt: '599323410893614', - wbtc: '15659889148334216720', -}; + this.provider = getProvider(netId, rpcUrl, config); + this.multicall = Multicall__factory.connect(multiCallAddress, this.provider); -export class TokenPriceOracle implements ITornadoPriceOracle { - private oracle: OffchainOracleAbi; - private multiCall: MulticallAbi; - private provider: Provider; - - /** - * Constructs TokenPriceOracle class instance - * @param {string} rpcUrl http RPC (Ethereum Mainnet) url to fetch token prices from contract - * @param {Token[]} [tokens] Array of tokens - * @param {TokenPrices} [defaultTokenPrices] Default token prices, fallback if nothing loaded from contract - */ - constructor( - rpcUrl: string, - private tokens: Token[] = tornadoTokens, - private defaultTokenPrices: TokenPrices = defaultTornadoTokenPrices, - ) { - this.provider = new ethers.providers.JsonRpcProvider(rpcUrl); - this.oracle = getOffchainOracleContract(this.provider); - this.multiCall = getMultiCallContract(this.provider); - } - - // Instant return default token prices - get defaultPrices(): TokenPrices { - return this.defaultTokenPrices; - } - - /** - * Prepare data for MultiCall contract - * @param {Token[]} [tokens] Tokens array - * @returns Valid structure to provide to MultiCall contract - */ - private prepareCallData(tokens: Token[] = this.tokens): MultiCall.CallStruct[] { - return tokens.map((token) => ({ - to: this.oracle.address, - data: this.oracle.interface.encodeFunctionData('getRateToEth', [token.tokenAddress, true]), - })); - } - - /** - * Fetch actual tokens price rate to ETH from offchain oracles - * @param {Token[]} [tokens] Token array - * @returns {TokenPrices} Object with token price rate to ETH in WEI - */ - async fetchPrices(tokens: Token[] = this.tokens): Promise { - try { - if (!tokens?.length) return {}; - - const callData = this.prepareCallData(tokens); - const { results, success } = await this.multiCall.multicall(callData); - const prices: TokenPrices = {}; - - for (let i = 0; i < results.length; i++) { - const tokenSymbol = tokens[i].symbol.toLowerCase() as TokenSymbol; - if (!success[i]) { - if (this.defaultTokenPrices[tokenSymbol]) prices[tokenSymbol] = this.defaultTokenPrices[tokenSymbol]; - continue; - } - - const decodedRate = defaultAbiCoder.decode(['uint256'], results[i]).toString(); - const tokenDecimals = BigNumber.from(10).pow(tokens[i].decimals); - const ethDecimals = BigNumber.from(10).pow(18); - const price = BigNumber.from(decodedRate).mul(tokenDecimals).div(ethDecimals); - prices[tokenSymbol] = price.toString(); - } - return prices; - } catch (e) { - console.error('Cannot get token prices, return default: ' + e); - return this.defaultTokenPrices; + if (offchainOracleContract) { + this.oracle = OffchainOracle__factory.connect(offchainOracleContract, this.provider); } } + + async fetchPrices(tokens: Token[]): Promise { + // 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; + }, {} as TokenPrices), + ), + ); + } + + const prices = (await multicall( + this.multicall, + tokens.map(({ tokenAddress }) => ({ + contract: this.oracle, + name: 'getRateToEth', + params: [tokenAddress, true], + })), + )) as bigint[]; + + 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; + }, {} as TokenPrices); + } } diff --git a/src/types.ts b/src/types.ts index b21a705..59cea99 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,114 +1,31 @@ -import { BigNumberish, BytesLike } from 'ethers'; -import { GasPriceKey, GetTxGasParamsRes } from '@tornado/gas-price-oracle/lib/services'; -import { AvailableTokenSymbols } from '@tornado/tornado-config'; -import { InstanceTokenSymbol } from './config'; +import type { BaseContract, Interface } from 'ethers'; -// Type for big hexadecimal numbers, like 0x1eff87f47e37a0 -export type HexadecimalStringifiedNumber = string; - -export type LegacyGasPriceKey = GasPriceKey; -export type GasPriceParams = GetTxGasParamsRes; -export type LegacyGasPrices = { - [gasPriceType in LegacyGasPriceKey]: number; -}; - -/* Tornado-specific transaction types: - - 'user_withdrawal' - Fee calculation on user side, when user withdraw funds itself or via relayer on site - - 'relayer_withdrawal' - Fee calculation on relayer side, when relayer sends withdrawal transaction - - 'relayer_withdrawal_check_v4' - Fee calculation on relayer side, when V4 relayer checks user-provided fee. For compatibility reasons - - 'other' - Any other non-specific transaction -*/ -export type WithdrawalTxType = 'user_withdrawal' | 'relayer_withdrawal' | 'relayer_withdrawal_check_v4'; -export type TxType = WithdrawalTxType | 'other'; - -export interface TransactionData { - to: string; - from?: string; - nonce?: number; - gasLimit?: BigNumberish; - gasPrice?: BigNumberish; - data?: string; - value: BigNumberish; - chainId?: number; - type?: number; - maxFeePerGas?: BigNumberish; - maxPriorityFeePerGas?: BigNumberish; -} - -export interface ITornadoFeeOracle { - getGasParams: (params?: GetGasParamsInput) => Promise; - getGas: (params?: GetGasInput) => Promise; - getGasPriceParams: (speed?: LegacyGasPriceKey, bumpPercent?: number) => Promise; - getGasPrice: (speed?: LegacyGasPriceKey, bumpPercent?: number) => Promise; - getGasLimit: (tx?: TransactionData, type?: TxType, bumpPercent?: number) => Promise; - fetchL1OptimismFee: (tx?: TransactionData) => Promise; - calculateRefundInETH: (gasPrice: BigNumberish, tokenSymbol: InstanceTokenSymbol) => HexadecimalStringifiedNumber; - fetchRefundInETH: (tokenSymbol: InstanceTokenSymbol) => Promise; - calculateRefundInToken: ( - gasPrice: BigNumberish, - tokenPriceInEth: BigNumberish, - tokenDecimals: HexadecimalStringifiedNumber | number, - tokenSymbol: InstanceTokenSymbol, - ) => HexadecimalStringifiedNumber; - calculateWithdrawalFeeViaRelayer: (params: GetWithdrawalFeeViaRelayerInput) => Promise; -} - -export interface ITornadoPriceOracle { - defaultPrices: TokenPrices; - fetchPrices: (tokens?: Token[]) => Promise; -} - -export type WithdrawalData = { - contract: string; - proof: BytesLike; - args: [BytesLike, BytesLike, string, string, BigNumberish, BigNumberish]; -}; -export type TornadoPoolInstance = { - currency: AvailableTokenSymbols; - amount: number; - decimals: number; -}; - -// All non-native tokens from Tornado instances on ETH mainnet and TORN itself -export type TokenSymbol = 'dai' | 'cdai' | 'usdc' | 'usdt' | 'wbtc' | 'torn'; export type Token = { tokenAddress: string; - symbol: TokenSymbol; + symbol: string; decimals: number; }; -export type TokenPrices = { [tokenSymbol in TokenSymbol]?: BigNumberish }; +export type TokenPrices = { [tokenSymbol in string]?: string }; -// Reponse type for getGasParams function of fee oracle -export type GetGasParamsRes = { - gasLimit: number; - gasPrice: HexadecimalStringifiedNumber; // Gas price in native currency -}; +export interface Call3 { + contract?: BaseContract; + address?: string; + interface?: Interface; + name: string; + params?: any[]; + allowFailure?: boolean; +} -export type GetGasInput = { - // Transaction type: user-side calculation, relayer-side calculation or - // relayer calculation to check user-provided fee in old V4 relayer (for backwards compatibility) - txType?: TxType; - tx?: TransactionData; // Transaction data in ethers format - predefinedGasPrice?: HexadecimalStringifiedNumber; // Predefined gas price for withdrawal tx (wont be calculated again in function) - predefinedGasLimit?: number; // Predefined gas limit for withdrawal tx (wont be calculated again in function) - bumpGasLimitPercent?: number; // Gas limit bump percent to prioritize transaction (recenlty used) - bumpGasPricePercent?: number; // Gas price bump percent to prioritize transaction (rarely used) - speed?: LegacyGasPriceKey; // Preferred transaction speed, if uses legacy gas (before EIP-1559) -}; +export interface gasOracleOptions { + gasPriceOracle?: string; + gasStationApi?: string; +} -export type GetGasParamsInput = GetGasInput & { includeL1FeeToGasLimit?: boolean }; - -export type GetWithdrawalFeeViaRelayerInput = { - // Transaction type: user-side calculation, relayer-side calculation or - // relayer calculation to check user-provided fee in old V4 relayer (for backwards compatibility) - txType: WithdrawalTxType; - tx?: TransactionData; // Transaction data in ethers format - relayerFeePercent: number | string; // Relayer fee percent from withdrawal amount (for example, 0.15 for BNB or 0.4 for ETH Mainnet) - currency: AvailableTokenSymbols | Uppercase; // Currency (token) symbol - amount: string | number; // Withdrawal amount in selected currency (10 for 10 ETH, 10000 for 10000 DAI) - decimals: string | number; // Token (currency) decimal places - refundInEth?: HexadecimalStringifiedNumber; // Refund amount in ETH, if withdrawing non-native currency on ETH Mainnet or Goerli - tokenPriceInEth?: HexadecimalStringifiedNumber | string; // Token (currency) price in ETH wei, if withdrawing non-native currency - predefinedGasPrice?: HexadecimalStringifiedNumber; // Predefined gas price for withdrawal tx (wont be calculated again in function) - predefinedGasLimit?: number; // Predefined gas limit for withdrawal tx (wont be calculated again in function) -}; +export interface networkConfig { + networkName: string; + offchainOracleContract?: string; + optimismL1FeeOracleAddress?: string; + gasPriceOracleContract?: string; + gasStationApi?: string; + pollInterval: number; +} diff --git a/src/utils.ts b/src/utils.ts index 60cc307..6b9fcd3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,44 +1,30 @@ -import { serialize } from '@ethersproject/transactions'; -import { GasPriceParams, TransactionData } from './types'; -import { BigNumber, BigNumberish } from 'ethers'; -import BigNumberFloat from 'bignumber.js'; -BigNumberFloat.config({ EXPONENTIAL_AT: 100 }); +import type { BigNumberish } from 'ethers'; -const GWEI = 1e9; +export const isNode = + !( + ( + process as typeof process & { + browser?: boolean; + } + ).browser + // prettier-ignore + // @ts-ignore + ) && typeof globalThis.window === 'undefined'; -export function serializeTx(tx?: TransactionData | string): string { - if (!tx) tx = '0x'; - if (typeof tx === 'string') return tx; - - return serialize(tx); +export function sleep(ms: number) { + return new Promise((resolve) => setTimeout(resolve, ms)); } -export function calculateGasPriceInWei(gasPrice: GasPriceParams): BigNumber { - // @ts-ignore - return BigNumber.from(gasPrice.gasPrice || gasPrice.maxFeePerGas); -} - -export function bump(value: BigNumberish, percent: number): BigNumber { - const hundredPercents = BigNumberFloat(100); - - return BigNumber.from( - BigNumberFloat(BigNumber.from(value).toHexString()) - .times(hundredPercents.plus(BigNumberFloat(percent))) - .div(hundredPercents) - .decimalPlaces(0, 1) - .toString(), - ); -} - -export function fromGweiToWeiHex(value: number | string): BigNumberish { - return BigNumber.from(BigNumberFloat(value).times(GWEI).toString()).toHexString(); -} - -export function convertETHToToken( - amountInWEI: BigNumberish, - tokenDecimals: number | string, +/** + * Example: + * + * amountInWei (0.1 ETH) * tokenDecimals (18) * tokenPriceInWei (0.0008) = 125 TOKEN + */ +export function convertETHToTokenAmount( + amountInWei: BigNumberish, tokenPriceInWei: BigNumberish, -): BigNumber { - const tokenDecimalsMultiplier = BigNumber.from(10).pow(tokenDecimals); - return BigNumber.from(amountInWEI).mul(tokenDecimalsMultiplier).div(tokenPriceInWei); + tokenDecimals: number = 18, +): bigint { + const tokenDecimalsMultiplier = BigInt(10 ** Number(tokenDecimals)); + return (BigInt(amountInWei) * tokenDecimalsMultiplier) / BigInt(tokenPriceInWei); } diff --git a/tsconfig.esm.json b/tsconfig.esm.json index f6421c6..c53c29e 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -2,8 +2,8 @@ "extends": "./tsconfig", "compilerOptions": { "declaration": false, - "target": "es2015", - "module": "es2015", + "target": "es2016", + "module": "es6", "outDir": "lib/esm" } } diff --git a/tsconfig.json b/tsconfig.json index 7dd9c15..f8c268c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es5", + "target": "es2016", "module": "commonjs", "moduleResolution": "node", "lib": ["es5", "es6", "es2021", "esnext"], diff --git a/yarn.lock b/yarn.lock index cadb3b5..ef74c5f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@adraffy/ens-normalize@1.10.1": + version "1.10.1" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" + integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== + "@cspotcode/source-map-support@^0.8.0": version "0.8.1" resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" @@ -9,348 +14,6 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" - integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== - dependencies: - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@ethersproject/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz#b0a8550f88b6bf9d51f90e4795d48294630cb9ef" - integrity sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/networks" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/web" "^5.7.0" - -"@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz#13f4f32117868452191a4649723cb086d2b596b2" - integrity sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ== - dependencies: - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - -"@ethersproject/address@5.7.0", "@ethersproject/address@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" - integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/rlp" "^5.7.0" - -"@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz#ac4ee92aa36c1628173e221d0d01f53692059e1c" - integrity sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ== - dependencies: - "@ethersproject/bytes" "^5.7.0" - -"@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.7.0.tgz#97034dc7e8938a8ca943ab20f8a5e492ece4020b" - integrity sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - -"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" - integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - bn.js "^5.2.1" - -"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" - integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== - dependencies: - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz#df80a9705a7e08984161f09014ea012d1c75295e" - integrity sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - -"@ethersproject/contracts@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" - integrity sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg== - dependencies: - "@ethersproject/abi" "^5.7.0" - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - -"@ethersproject/hash@5.7.0", "@ethersproject/hash@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.7.0.tgz#eb7aca84a588508369562e16e514b539ba5240a7" - integrity sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g== - dependencies: - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/base64" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf" - integrity sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg== - dependencies: - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/basex" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/pbkdf2" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - "@ethersproject/signing-key" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/wordlists" "^5.7.0" - -"@ethersproject/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360" - integrity sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g== - dependencies: - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/hdnode" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/pbkdf2" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/random" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - aes-js "3.0.0" - scrypt-js "3.0.1" - -"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" - integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== - dependencies: - "@ethersproject/bytes" "^5.7.0" - js-sha3 "0.8.0" - -"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" - integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== - -"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.7.0": - version "5.7.1" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" - integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== - dependencies: - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102" - integrity sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - -"@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30" - integrity sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw== - dependencies: - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/providers@5.7.2": - version "5.7.2" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" - integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== - dependencies: - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/base64" "^5.7.0" - "@ethersproject/basex" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/networks" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/random" "^5.7.0" - "@ethersproject/rlp" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/web" "^5.7.0" - bech32 "1.1.4" - ws "7.4.6" - -"@ethersproject/random@5.7.0", "@ethersproject/random@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.7.0.tgz#af19dcbc2484aae078bb03656ec05df66253280c" - integrity sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" - integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" - integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - hash.js "1.1.7" - -"@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3" - integrity sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - bn.js "^5.2.1" - elliptic "6.5.4" - hash.js "1.1.7" - -"@ethersproject/solidity@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" - integrity sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz#54c9d2a7c57ae8f1205c88a9d3a56471e14d5ed2" - integrity sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" - integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== - dependencies: - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/rlp" "^5.7.0" - "@ethersproject/signing-key" "^5.7.0" - -"@ethersproject/units@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" - integrity sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/wallet@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" - integrity sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA== - dependencies: - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ethersproject/hdnode" "^5.7.0" - "@ethersproject/json-wallets" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/random" "^5.7.0" - "@ethersproject/signing-key" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/wordlists" "^5.7.0" - -"@ethersproject/web@5.7.1", "@ethersproject/web@^5.7.0": - version "5.7.1" - resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae" - integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w== - dependencies: - "@ethersproject/base64" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5" - integrity sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - "@jridgewell/resolve-uri@^3.0.3": version "3.1.1" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" @@ -369,19 +32,17 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@tornado/gas-price-oracle@^0.5.3": - version "0.5.3" - resolved "https://git.tornado.ws/api/packages/tornado-packages/npm/%40tornado%2Fgas-price-oracle/-/0.5.3/gas-price-oracle-0.5.3.tgz#fb5423dddee2f52edbc16174c5ddce90bea5413d" - integrity sha512-LpVfPiPIz3FOmJdiqJf/yoeO5n9/Pd5jgtdY+6hB9lNW0AiWhylhpScojICViS+3OL9QC8CoTlgr+kbfGeO9pQ== +"@noble/curves@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== dependencies: - axios "^0.21.2" - bignumber.js "^9.0.0" - node-cache "^5.1.2" + "@noble/hashes" "1.3.2" -"@tornado/tornado-config@^2.0.0": - version "2.0.0" - resolved "https://git.tornado.ws/api/packages/tornado-packages/npm/%40tornado%2Ftornado-config/-/2.0.0/tornado-config-2.0.0.tgz#52bbc179ecb2385f71b4d56e060b68e7dd6fb8b4" - integrity sha512-7EkpWNfEm34VEOrbLnPpvd/aUJYnA1L+6/qx2fZ/AfmuJFkjSZ18Z4jvVGNY7ktKIhTu3/Tbze+9l3eNueCNIA== +"@noble/hashes@1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== "@tsconfig/node10@^1.0.7": version "1.0.9" @@ -403,14 +64,19 @@ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== -"@typechain/ethers-v5@^11.1.1": - version "11.1.1" - resolved "https://registry.yarnpkg.com/@typechain/ethers-v5/-/ethers-v5-11.1.1.tgz#23a358135a302140cf89a186592464dd6bbf1f98" - integrity sha512-D9WyUrCJ4Z5Gg8T00HWLpuqn1CqSDXlCiUOOpLaWoCbnZrE2jSIOUwR9blBZNo6LE5058e3niVu6xk205Et7tg== +"@typechain/ethers-v6@^0.5.1": + version "0.5.1" + resolved "https://registry.yarnpkg.com/@typechain/ethers-v6/-/ethers-v6-0.5.1.tgz#42fe214a19a8b687086c93189b301e2b878797ea" + integrity sha512-F+GklO8jBWlsaVV+9oHaPh5NJdd6rAKN4tklGfInX1Q7h0xPgVLP39Jl3eCulPB5qexI71ZFHwbljx4ZXNfouA== dependencies: lodash "^4.17.15" ts-essentials "^7.0.1" +"@types/node@18.15.13": + version "18.15.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" + integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== + "@types/node@^20.5.1": version "20.5.1" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.5.1.tgz#178d58ee7e4834152b0e8b4d30cbfab578b9bb30" @@ -436,10 +102,10 @@ acorn@^8.4.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== -aes-js@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" - integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== +aes-js@4.0.0-beta.5: + version "4.0.0-beta.5" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" + integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== ansi-styles@^3.2.1: version "3.2.1" @@ -478,43 +144,16 @@ array-back@^4.0.1, array-back@^4.0.2: resolved "https://registry.yarnpkg.com/array-back/-/array-back-4.0.2.tgz#8004e999a6274586beeb27342168652fdb89fa1e" integrity sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg== -axios@^0.21.2: - version "0.21.4" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" - integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== - dependencies: - follow-redirects "^1.14.0" - balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -bech32@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" - integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== - -bignumber.js@^9.0.0, bignumber.js@^9.1.1: - version "9.1.1" - resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.1.tgz#c4df7dc496bd849d4c9464344c1aa74228b4dac6" - integrity sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig== - binary-extensions@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== -bn.js@^4.11.9: - version "4.12.0" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" - integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== - -bn.js@^5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" - integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== - brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -530,11 +169,6 @@ braces@~3.0.2: dependencies: fill-range "^7.0.1" -brorand@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" - integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== - chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -567,11 +201,6 @@ chokidar@^3.5.2: optionalDependencies: fsevents "~2.3.2" -clone@2.x: - version "2.1.2" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" - integrity sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w== - color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" @@ -650,59 +279,23 @@ diff@^4.0.1: resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== -elliptic@6.5.4: - version "6.5.4" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" - integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== - dependencies: - bn.js "^4.11.9" - brorand "^1.1.0" - hash.js "^1.0.0" - hmac-drbg "^1.0.1" - inherits "^2.0.4" - minimalistic-assert "^1.0.1" - minimalistic-crypto-utils "^1.0.1" - escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== -ethers@5.7: - version "5.7.2" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" - integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== +ethers@^6.4.0: + version "6.12.1" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.12.1.tgz#517ff6d66d4fd5433e38e903051da3e57c87ff37" + integrity sha512-j6wcVoZf06nqEcBbDWkKg8Fp895SS96dSnTCjiXT+8vt2o02raTn4Lo9ERUuIVU5bAjoPYeA+7ytQFexFmLuVw== dependencies: - "@ethersproject/abi" "5.7.0" - "@ethersproject/abstract-provider" "5.7.0" - "@ethersproject/abstract-signer" "5.7.0" - "@ethersproject/address" "5.7.0" - "@ethersproject/base64" "5.7.0" - "@ethersproject/basex" "5.7.0" - "@ethersproject/bignumber" "5.7.0" - "@ethersproject/bytes" "5.7.0" - "@ethersproject/constants" "5.7.0" - "@ethersproject/contracts" "5.7.0" - "@ethersproject/hash" "5.7.0" - "@ethersproject/hdnode" "5.7.0" - "@ethersproject/json-wallets" "5.7.0" - "@ethersproject/keccak256" "5.7.0" - "@ethersproject/logger" "5.7.0" - "@ethersproject/networks" "5.7.1" - "@ethersproject/pbkdf2" "5.7.0" - "@ethersproject/properties" "5.7.0" - "@ethersproject/providers" "5.7.2" - "@ethersproject/random" "5.7.0" - "@ethersproject/rlp" "5.7.0" - "@ethersproject/sha2" "5.7.0" - "@ethersproject/signing-key" "5.7.0" - "@ethersproject/solidity" "5.7.0" - "@ethersproject/strings" "5.7.0" - "@ethersproject/transactions" "5.7.0" - "@ethersproject/units" "5.7.0" - "@ethersproject/wallet" "5.7.0" - "@ethersproject/web" "5.7.1" - "@ethersproject/wordlists" "5.7.0" + "@adraffy/ens-normalize" "1.10.1" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@types/node" "18.15.13" + aes-js "4.0.0-beta.5" + tslib "2.4.0" + ws "8.5.0" fill-range@^7.0.1: version "7.0.1" @@ -718,11 +311,6 @@ find-replace@^3.0.0: dependencies: array-back "^3.0.1" -follow-redirects@^1.14.0: - version "1.15.2" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" - integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== - fs-extra@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" @@ -776,23 +364,6 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" - integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== - dependencies: - inherits "^2.0.3" - minimalistic-assert "^1.0.1" - -hmac-drbg@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" - integrity sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg== - dependencies: - hash.js "^1.0.3" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.1" - ignore-by-default@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" @@ -806,7 +377,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.3, inherits@^2.0.4: +inherits@2: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -835,7 +406,7 @@ is-number@^7.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== -js-sha3@0.8.0, js-sha3@^0.8.0: +js-sha3@^0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== @@ -869,16 +440,6 @@ make-error@^1.1.1: resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== -minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" - integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== - -minimalistic-crypto-utils@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" - integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== - minimatch@^3.0.4, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" @@ -901,13 +462,6 @@ ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -node-cache@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/node-cache/-/node-cache-5.1.2.tgz#f264dc2ccad0a780e76253a694e9fd0ed19c398d" - integrity sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg== - dependencies: - clone "2.x" - nodemon@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-3.0.1.tgz#affe822a2c5f21354466b2fc8ae83277d27dadc7" @@ -980,11 +534,6 @@ reduce-flatten@^2.0.0: resolved "https://registry.yarnpkg.com/reduce-flatten/-/reduce-flatten-2.0.0.tgz#734fd84e65f375d7ca4465c69798c25c9d10ae27" integrity sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w== -scrypt-js@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" - integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== - semver@^7.5.3: version "7.5.4" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" @@ -1076,10 +625,15 @@ ts-node@^10.9.1: v8-compile-cache-lib "^3.0.1" yn "3.1.1" -typechain@^8.3.1: - version "8.3.1" - resolved "https://registry.yarnpkg.com/typechain/-/typechain-8.3.1.tgz#dccbc839b94877997536c356380eff7325395cfb" - integrity sha512-fA7clol2IP/56yq6vkMTR+4URF1nGjV82Wx6Rf09EsqD4tkzMAvEaqYxVFCavJm/1xaRga/oD55K+4FtuXwQOQ== +tslib@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + +typechain@^8.3.2: + version "8.3.2" + resolved "https://registry.yarnpkg.com/typechain/-/typechain-8.3.2.tgz#1090dd8d9c57b6ef2aed3640a516bdbf01b00d73" + integrity sha512-x/sQYr5w9K7yv3es7jo4KTX05CLxOf7TRWwoHlrjRh8H82G64g+k7VuWPJlgMo6qrjfCulOdfBjiaDtmhFYD/Q== dependencies: "@types/prettier" "^2.1.1" debug "^4.3.1" @@ -1092,10 +646,10 @@ typechain@^8.3.1: ts-command-line-args "^2.2.0" ts-essentials "^7.0.1" -typescript@^5.1.6: - version "5.1.6" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274" - integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA== +typescript@^5.4.4: + version "5.4.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611" + integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ== typical@^4.0.0: version "4.0.0" @@ -1135,10 +689,10 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -ws@7.4.6: - version "7.4.6" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" - integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== +ws@8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" + integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== yallist@^4.0.0: version "4.0.0"