2 Commits

Author SHA1 Message Date
08635da692 Add built files for test 2024-11-21 13:03:30 +00:00
bef587cc1a Remove broken external oracle and fixed EIP-1559 gasPrice calculation
* Updated 1inch Oracle link and use multicall3 ( because this is the only contract supported on sepolia )
* Simplify EIP-1559 gasPrice calculation ( EIP-1559 removes necessity of using external oracles, just enough premium of basefee will ensure transaction being mined )
* Apply respective premium for fees ( Only applied on V6 Oracle class )
* Removed @tornado/gas-price-oracle oracle
2024-11-21 13:01:45 +00:00
98 changed files with 8248 additions and 5024 deletions

2
.gitignore vendored
View File

@@ -14,7 +14,7 @@ pids
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib
#lib
lib-cov
# Coverage directory used by tools like istanbul

View File

@@ -1,189 +0,0 @@
[
{
"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"
}
]

1
abis/Multicall.abi.json Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,440 +0,0 @@
[
{
"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"
}
]

View File

@@ -0,0 +1,292 @@
[
{
"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"
}
]

View File

@@ -1,555 +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"
},
{
"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"
}
]

36
lib/config.d.ts vendored Normal file
View File

@@ -0,0 +1,36 @@
import { LegacyGasPrices } from './types';
export declare enum ChainId {
MAINNET = 1,
GOERLI = 5,
BSC = 56,
XDAI = 100,
POLYGON = 137,
OPTIMISM = 10,
ARBITRUM = 42161,
AVAX = 43114,
SEPOLIA = 11155111
}
export declare enum InstanceTokenSymbol {
DAI = "dai",
cDAI = "cdai",
WBTC = "wbtc",
USDT = "usdt",
USDC = "usdc"
}
export type GasPricesConfig = {
[chainId in ChainId]: LegacyGasPrices;
};
export declare const defaultGasPrices: GasPricesConfig;
type GasLimitConfig = {
[chainId in ChainId]: number;
};
export declare const defaultWithdrawalGasLimit: GasLimitConfig;
type InstanceTokenGasLimitConfig = {
[tokenSymbol in InstanceTokenSymbol]: number;
};
export declare const defaultInstanceTokensGasLimit: InstanceTokenGasLimitConfig;
export declare const optimismL1FeeOracleAddress = "0x420000000000000000000000000000000000000F";
export declare const offchainOracleAddress = "0x00000000000D6FFc74A8feb35aF5827bf57f6786";
export declare const sepoliaOffchainOracleAddress = "0x1f89EAF03E5b260Bc6D4Ae3c3334b1B750F3e127";
export declare const multiCallAddress = "0xcA11bde05977b3631167028862bE2a173976CA11";
export {};

103
lib/config.js Normal file
View File

@@ -0,0 +1,103 @@
"use strict";
var _a, _b, _c;
Object.defineProperty(exports, "__esModule", { value: true });
exports.multiCallAddress = exports.sepoliaOffchainOracleAddress = exports.offchainOracleAddress = exports.optimismL1FeeOracleAddress = exports.defaultInstanceTokensGasLimit = exports.defaultWithdrawalGasLimit = exports.defaultGasPrices = exports.InstanceTokenSymbol = exports.ChainId = void 0;
var ChainId;
(function (ChainId) {
ChainId[ChainId["MAINNET"] = 1] = "MAINNET";
ChainId[ChainId["GOERLI"] = 5] = "GOERLI";
ChainId[ChainId["BSC"] = 56] = "BSC";
ChainId[ChainId["XDAI"] = 100] = "XDAI";
ChainId[ChainId["POLYGON"] = 137] = "POLYGON";
ChainId[ChainId["OPTIMISM"] = 10] = "OPTIMISM";
ChainId[ChainId["ARBITRUM"] = 42161] = "ARBITRUM";
ChainId[ChainId["AVAX"] = 43114] = "AVAX";
ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
})(ChainId || (exports.ChainId = ChainId = {}));
var InstanceTokenSymbol;
(function (InstanceTokenSymbol) {
InstanceTokenSymbol["DAI"] = "dai";
InstanceTokenSymbol["cDAI"] = "cdai";
InstanceTokenSymbol["WBTC"] = "wbtc";
InstanceTokenSymbol["USDT"] = "usdt";
InstanceTokenSymbol["USDC"] = "usdc";
})(InstanceTokenSymbol || (exports.InstanceTokenSymbol = InstanceTokenSymbol = {}));
exports.defaultGasPrices = (_a = {},
_a[ChainId.MAINNET] = {
instant: 80,
fast: 50,
standard: 25,
low: 8,
},
_a[ChainId.GOERLI] = {
instant: 80,
fast: 50,
standard: 25,
low: 8,
},
_a[ChainId.OPTIMISM] = {
instant: 0.001,
fast: 0.001,
standard: 0.001,
low: 0.001,
},
_a[ChainId.XDAI] = {
instant: 6,
fast: 5,
standard: 4,
low: 1,
},
_a[ChainId.BSC] = {
instant: 5,
fast: 4,
standard: 3,
low: 3,
},
_a[ChainId.POLYGON] = {
instant: 100,
fast: 75,
standard: 50,
low: 30,
},
_a[ChainId.ARBITRUM] = {
instant: 4,
fast: 3,
standard: 2.52,
low: 2.29,
},
_a[ChainId.AVAX] = {
instant: 225,
fast: 35,
standard: 25,
low: 25,
},
_a[ChainId.SEPOLIA] = {
instant: 80,
fast: 50,
standard: 25,
low: 8,
},
_a);
exports.defaultWithdrawalGasLimit = (_b = {},
_b[ChainId.MAINNET] = 550000,
_b[ChainId.GOERLI] = 550000,
_b[ChainId.ARBITRUM] = 1900000,
_b[ChainId.OPTIMISM] = 440000,
_b[ChainId.AVAX] = 390000,
_b[ChainId.BSC] = 390000,
_b[ChainId.POLYGON] = 390000,
_b[ChainId.XDAI] = 390000,
_b[ChainId.SEPOLIA] = 550000,
_b);
exports.defaultInstanceTokensGasLimit = (_c = {},
_c[InstanceTokenSymbol.DAI] = 55000,
_c[InstanceTokenSymbol.cDAI] = 425000,
_c[InstanceTokenSymbol.WBTC] = 85000,
_c[InstanceTokenSymbol.USDT] = 100000,
_c[InstanceTokenSymbol.USDC] = 80000,
_c);
exports.optimismL1FeeOracleAddress = '0x420000000000000000000000000000000000000F';
exports.offchainOracleAddress = '0x00000000000D6FFc74A8feb35aF5827bf57f6786';
exports.sepoliaOffchainOracleAddress = '0x1f89EAF03E5b260Bc6D4Ae3c3334b1B750F3e127';
exports.multiCallAddress = '0xcA11bde05977b3631167028862bE2a173976CA11';
//# sourceMappingURL=config.js.map

1
lib/config.js.map Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;AAEA,IAAY,OAUX;AAVD,WAAY,OAAO;IACjB,2CAAW,CAAA;IACX,yCAAU,CAAA;IACV,oCAAQ,CAAA;IACR,uCAAU,CAAA;IACV,6CAAa,CAAA;IACb,8CAAa,CAAA;IACb,iDAAgB,CAAA;IAChB,yCAAY,CAAA;IACZ,kDAAkB,CAAA;AACpB,CAAC,EAVW,OAAO,uBAAP,OAAO,QAUlB;AAED,IAAY,mBAMX;AAND,WAAY,mBAAmB;IAC7B,kCAAW,CAAA;IACX,oCAAa,CAAA;IACb,oCAAa,CAAA;IACb,oCAAa,CAAA;IACb,oCAAa,CAAA;AACf,CAAC,EANW,mBAAmB,mCAAnB,mBAAmB,QAM9B;AAMY,QAAA,gBAAgB;IAC3B,GAAC,OAAO,CAAC,OAAO,IAAG;QACjB,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,GAAG,EAAE,CAAC;KACP;IACD,GAAC,OAAO,CAAC,MAAM,IAAG;QAChB,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,GAAG,EAAE,CAAC;KACP;IACD,GAAC,OAAO,CAAC,QAAQ,IAAG;QAClB,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,KAAK;QACX,QAAQ,EAAE,KAAK;QACf,GAAG,EAAE,KAAK;KACX;IACD,GAAC,OAAO,CAAC,IAAI,IAAG;QACd,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,CAAC;QACX,GAAG,EAAE,CAAC;KACP;IACD,GAAC,OAAO,CAAC,GAAG,IAAG;QACb,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,CAAC;QACX,GAAG,EAAE,CAAC;KACP;IACD,GAAC,OAAO,CAAC,OAAO,IAAG;QACjB,OAAO,EAAE,GAAG;QACZ,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,GAAG,EAAE,EAAE;KACR;IACD,GAAC,OAAO,CAAC,QAAQ,IAAG;QAClB,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,IAAI;QACd,GAAG,EAAE,IAAI;KACV;IACD,GAAC,OAAO,CAAC,IAAI,IAAG;QACd,OAAO,EAAE,GAAG;QACZ,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,GAAG,EAAE,EAAE;KACR;IACD,GAAC,OAAO,CAAC,OAAO,IAAG;QACjB,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,GAAG,EAAE,CAAC;KACP;QACD;AAMW,QAAA,yBAAyB;IACpC,GAAC,OAAO,CAAC,OAAO,IAAG,MAAM;IACzB,GAAC,OAAO,CAAC,MAAM,IAAG,MAAM;IACxB,GAAC,OAAO,CAAC,QAAQ,IAAG,OAAO;IAC3B,GAAC,OAAO,CAAC,QAAQ,IAAG,MAAM;IAC1B,GAAC,OAAO,CAAC,IAAI,IAAG,MAAM;IACtB,GAAC,OAAO,CAAC,GAAG,IAAG,MAAM;IACrB,GAAC,OAAO,CAAC,OAAO,IAAG,MAAM;IACzB,GAAC,OAAO,CAAC,IAAI,IAAG,MAAM;IACtB,GAAC,OAAO,CAAC,OAAO,IAAG,MAAM;QACzB;AAMW,QAAA,6BAA6B;IACxC,GAAC,mBAAmB,CAAC,GAAG,IAAG,KAAK;IAChC,GAAC,mBAAmB,CAAC,IAAI,IAAG,MAAM;IAClC,GAAC,mBAAmB,CAAC,IAAI,IAAG,KAAK;IACjC,GAAC,mBAAmB,CAAC,IAAI,IAAG,MAAM;IAClC,GAAC,mBAAmB,CAAC,IAAI,IAAG,KAAK;QACjC;AAEW,QAAA,0BAA0B,GAAG,4CAA4C,CAAC;AAC1E,QAAA,qBAAqB,GAAG,4CAA4C,CAAC;AACrE,QAAA,4BAA4B,GAAG,4CAA4C,CAAC;AAC5E,QAAA,gBAAgB,GAAG,4CAA4C,CAAC"}

289
lib/contracts/MulticallAbi.d.ts vendored Normal file
View File

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

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=MulticallAbi.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"MulticallAbi.js","sourceRoot":"","sources":["../../src/contracts/MulticallAbi.ts"],"names":[],"mappings":""}

268
lib/contracts/OffchainOracleAbi.d.ts vendored Normal file
View File

@@ -0,0 +1,268 @@
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<ConnectorAddedEvent>;
export interface ConnectorRemovedEventObject {
connector: string;
}
export type ConnectorRemovedEvent = TypedEvent<[string], ConnectorRemovedEventObject>;
export type ConnectorRemovedEventFilter = TypedEventFilter<ConnectorRemovedEvent>;
export interface MultiWrapperUpdatedEventObject {
multiWrapper: string;
}
export type MultiWrapperUpdatedEvent = TypedEvent<[string], MultiWrapperUpdatedEventObject>;
export type MultiWrapperUpdatedEventFilter = TypedEventFilter<MultiWrapperUpdatedEvent>;
export interface OracleAddedEventObject {
oracle: string;
oracleType: number;
}
export type OracleAddedEvent = TypedEvent<[string, number], OracleAddedEventObject>;
export type OracleAddedEventFilter = TypedEventFilter<OracleAddedEvent>;
export interface OracleRemovedEventObject {
oracle: string;
oracleType: number;
}
export type OracleRemovedEvent = TypedEvent<[string, number], OracleRemovedEventObject>;
export type OracleRemovedEventFilter = TypedEventFilter<OracleRemovedEvent>;
export interface OwnershipTransferredEventObject {
previousOwner: string;
newOwner: string;
}
export type OwnershipTransferredEvent = TypedEvent<[string, string], OwnershipTransferredEventObject>;
export type OwnershipTransferredEventFilter = TypedEventFilter<OwnershipTransferredEvent>;
export interface OffchainOracleAbi extends BaseContract {
connect(signerOrProvider: Signer | Provider | string): this;
attach(addressOrName: string): this;
deployed(): Promise<this>;
interface: OffchainOracleAbiInterface;
queryFilter<TEvent extends TypedEvent>(event: TypedEventFilter<TEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TEvent>>;
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
listeners(eventName?: string): Array<Listener>;
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this;
removeAllListeners(eventName?: string): this;
off: OnEvent<this>;
on: OnEvent<this>;
once: OnEvent<this>;
removeListener: OnEvent<this>;
functions: {
addConnector(connector: string, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
addOracle(oracle: string, oracleKind: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
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<ContractTransaction>;
removeOracle(oracle: string, oracleKind: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
renounceOwnership(overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
setMultiWrapper(_multiWrapper: string, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
transferOwnership(newOwner: string, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
};
addConnector(connector: string, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
addOracle(oracle: string, oracleKind: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
connectors(overrides?: CallOverrides): Promise<string[]>;
getRate(srcToken: string, dstToken: string, useWrappers: boolean, overrides?: CallOverrides): Promise<BigNumber>;
getRateToEth(srcToken: string, useSrcWrappers: boolean, overrides?: CallOverrides): Promise<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<ContractTransaction>;
removeOracle(oracle: string, oracleKind: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
renounceOwnership(overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
setMultiWrapper(_multiWrapper: string, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
transferOwnership(newOwner: string, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
callStatic: {
addConnector(connector: string, overrides?: CallOverrides): Promise<void>;
addOracle(oracle: string, oracleKind: BigNumberish, overrides?: CallOverrides): Promise<void>;
connectors(overrides?: CallOverrides): Promise<string[]>;
getRate(srcToken: string, dstToken: string, useWrappers: boolean, overrides?: CallOverrides): Promise<BigNumber>;
getRateToEth(srcToken: string, useSrcWrappers: boolean, overrides?: CallOverrides): Promise<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?: CallOverrides): Promise<void>;
removeOracle(oracle: string, oracleKind: BigNumberish, overrides?: CallOverrides): Promise<void>;
renounceOwnership(overrides?: CallOverrides): Promise<void>;
setMultiWrapper(_multiWrapper: string, overrides?: CallOverrides): Promise<void>;
transferOwnership(newOwner: string, overrides?: CallOverrides): Promise<void>;
};
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<BigNumber>;
addOracle(oracle: string, oracleKind: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<BigNumber>;
connectors(overrides?: CallOverrides): Promise<BigNumber>;
getRate(srcToken: string, dstToken: string, useWrappers: boolean, overrides?: CallOverrides): Promise<BigNumber>;
getRateToEth(srcToken: string, useSrcWrappers: boolean, overrides?: CallOverrides): Promise<BigNumber>;
multiWrapper(overrides?: CallOverrides): Promise<BigNumber>;
oracles(overrides?: CallOverrides): Promise<BigNumber>;
owner(overrides?: CallOverrides): Promise<BigNumber>;
removeConnector(connector: string, overrides?: Overrides & {
from?: string;
}): Promise<BigNumber>;
removeOracle(oracle: string, oracleKind: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<BigNumber>;
renounceOwnership(overrides?: Overrides & {
from?: string;
}): Promise<BigNumber>;
setMultiWrapper(_multiWrapper: string, overrides?: Overrides & {
from?: string;
}): Promise<BigNumber>;
transferOwnership(newOwner: string, overrides?: Overrides & {
from?: string;
}): Promise<BigNumber>;
};
populateTransaction: {
addConnector(connector: string, overrides?: Overrides & {
from?: string;
}): Promise<PopulatedTransaction>;
addOracle(oracle: string, oracleKind: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<PopulatedTransaction>;
connectors(overrides?: CallOverrides): Promise<PopulatedTransaction>;
getRate(srcToken: string, dstToken: string, useWrappers: boolean, overrides?: CallOverrides): Promise<PopulatedTransaction>;
getRateToEth(srcToken: string, useSrcWrappers: boolean, overrides?: CallOverrides): Promise<PopulatedTransaction>;
multiWrapper(overrides?: CallOverrides): Promise<PopulatedTransaction>;
oracles(overrides?: CallOverrides): Promise<PopulatedTransaction>;
owner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
removeConnector(connector: string, overrides?: Overrides & {
from?: string;
}): Promise<PopulatedTransaction>;
removeOracle(oracle: string, oracleKind: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<PopulatedTransaction>;
renounceOwnership(overrides?: Overrides & {
from?: string;
}): Promise<PopulatedTransaction>;
setMultiWrapper(_multiWrapper: string, overrides?: Overrides & {
from?: string;
}): Promise<PopulatedTransaction>;
transferOwnership(newOwner: string, overrides?: Overrides & {
from?: string;
}): Promise<PopulatedTransaction>;
};
}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=OffchainOracleAbi.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"OffchainOracleAbi.js","sourceRoot":"","sources":["../../src/contracts/OffchainOracleAbi.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,267 @@
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<DecimalsUpdatedEvent>;
export interface GasPriceUpdatedEventObject {
arg0: BigNumber;
}
export type GasPriceUpdatedEvent = TypedEvent<[BigNumber], GasPriceUpdatedEventObject>;
export type GasPriceUpdatedEventFilter = TypedEventFilter<GasPriceUpdatedEvent>;
export interface L1BaseFeeUpdatedEventObject {
arg0: BigNumber;
}
export type L1BaseFeeUpdatedEvent = TypedEvent<[BigNumber], L1BaseFeeUpdatedEventObject>;
export type L1BaseFeeUpdatedEventFilter = TypedEventFilter<L1BaseFeeUpdatedEvent>;
export interface OverheadUpdatedEventObject {
arg0: BigNumber;
}
export type OverheadUpdatedEvent = TypedEvent<[BigNumber], OverheadUpdatedEventObject>;
export type OverheadUpdatedEventFilter = TypedEventFilter<OverheadUpdatedEvent>;
export interface OwnershipTransferredEventObject {
previousOwner: string;
newOwner: string;
}
export type OwnershipTransferredEvent = TypedEvent<[string, string], OwnershipTransferredEventObject>;
export type OwnershipTransferredEventFilter = TypedEventFilter<OwnershipTransferredEvent>;
export interface ScalarUpdatedEventObject {
arg0: BigNumber;
}
export type ScalarUpdatedEvent = TypedEvent<[BigNumber], ScalarUpdatedEventObject>;
export type ScalarUpdatedEventFilter = TypedEventFilter<ScalarUpdatedEvent>;
export interface OptimismL1FeeOracleAbi extends BaseContract {
connect(signerOrProvider: Signer | Provider | string): this;
attach(addressOrName: string): this;
deployed(): Promise<this>;
interface: OptimismL1FeeOracleAbiInterface;
queryFilter<TEvent extends TypedEvent>(event: TypedEventFilter<TEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TEvent>>;
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
listeners(eventName?: string): Array<Listener>;
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this;
removeAllListeners(eventName?: string): this;
off: OnEvent<this>;
on: OnEvent<this>;
once: OnEvent<this>;
removeListener: OnEvent<this>;
functions: {
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<ContractTransaction>;
scalar(overrides?: CallOverrides): Promise<[BigNumber]>;
setDecimals(_decimals: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
setGasPrice(_gasPrice: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
setL1BaseFee(_baseFee: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
setOverhead(_overhead: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
setScalar(_scalar: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
transferOwnership(newOwner: string, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
};
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<ContractTransaction>;
scalar(overrides?: CallOverrides): Promise<BigNumber>;
setDecimals(_decimals: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
setGasPrice(_gasPrice: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
setL1BaseFee(_baseFee: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
setOverhead(_overhead: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
setScalar(_scalar: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
transferOwnership(newOwner: string, overrides?: Overrides & {
from?: string;
}): Promise<ContractTransaction>;
callStatic: {
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?: CallOverrides): Promise<void>;
scalar(overrides?: CallOverrides): Promise<BigNumber>;
setDecimals(_decimals: BigNumberish, overrides?: CallOverrides): Promise<void>;
setGasPrice(_gasPrice: BigNumberish, overrides?: CallOverrides): Promise<void>;
setL1BaseFee(_baseFee: BigNumberish, overrides?: CallOverrides): Promise<void>;
setOverhead(_overhead: BigNumberish, overrides?: CallOverrides): Promise<void>;
setScalar(_scalar: BigNumberish, overrides?: CallOverrides): Promise<void>;
transferOwnership(newOwner: string, overrides?: CallOverrides): Promise<void>;
};
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<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<BigNumber>;
renounceOwnership(overrides?: Overrides & {
from?: string;
}): Promise<BigNumber>;
scalar(overrides?: CallOverrides): Promise<BigNumber>;
setDecimals(_decimals: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<BigNumber>;
setGasPrice(_gasPrice: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<BigNumber>;
setL1BaseFee(_baseFee: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<BigNumber>;
setOverhead(_overhead: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<BigNumber>;
setScalar(_scalar: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<BigNumber>;
transferOwnership(newOwner: string, overrides?: Overrides & {
from?: string;
}): Promise<BigNumber>;
};
populateTransaction: {
decimals(overrides?: CallOverrides): Promise<PopulatedTransaction>;
gasPrice(overrides?: CallOverrides): Promise<PopulatedTransaction>;
getL1Fee(_data: BytesLike, overrides?: CallOverrides): Promise<PopulatedTransaction>;
getL1GasUsed(_data: BytesLike, overrides?: CallOverrides): Promise<PopulatedTransaction>;
l1BaseFee(overrides?: CallOverrides): Promise<PopulatedTransaction>;
overhead(overrides?: CallOverrides): Promise<PopulatedTransaction>;
owner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
renounceOwnership(overrides?: Overrides & {
from?: string;
}): Promise<PopulatedTransaction>;
scalar(overrides?: CallOverrides): Promise<PopulatedTransaction>;
setDecimals(_decimals: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<PopulatedTransaction>;
setGasPrice(_gasPrice: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<PopulatedTransaction>;
setL1BaseFee(_baseFee: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<PopulatedTransaction>;
setOverhead(_overhead: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<PopulatedTransaction>;
setScalar(_scalar: BigNumberish, overrides?: Overrides & {
from?: string;
}): Promise<PopulatedTransaction>;
transferOwnership(newOwner: string, overrides?: Overrides & {
from?: string;
}): Promise<PopulatedTransaction>;
};
}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=OptimismL1FeeOracleAbi.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"OptimismL1FeeOracleAbi.js","sourceRoot":"","sources":["../../src/contracts/OptimismL1FeeOracleAbi.ts"],"names":[],"mappings":""}

21
lib/contracts/common.d.ts vendored Normal file
View File

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

3
lib/contracts/common.js Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=common.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/contracts/common.ts"],"names":[],"mappings":""}

5
lib/contracts/factories.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
import { Provider } from '@ethersproject/abstract-provider';
import { ChainId } from '../config';
export declare const getOptimismL1FeeOracle: (provider: Provider) => import("./OptimismL1FeeOracleAbi").OptimismL1FeeOracleAbi;
export declare const getOffchainOracleContract: (provider: Provider, chainId?: ChainId) => import("./OffchainOracleAbi").OffchainOracleAbi;
export declare const getMultiCallContract: (provider: Provider) => import("./MulticallAbi").MulticallAbi;

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMultiCallContract = exports.getOffchainOracleContract = exports.getOptimismL1FeeOracle = void 0;
var _1 = require("./");
var config_1 = require("../config");
var config_2 = require("../config");
var getOptimismL1FeeOracle = function (provider) {
return _1.OptimismL1FeeOracleAbi__factory.connect(config_1.optimismL1FeeOracleAddress, provider);
};
exports.getOptimismL1FeeOracle = getOptimismL1FeeOracle;
var getOffchainOracleContract = function (provider, chainId) {
if (chainId === config_2.ChainId.SEPOLIA) {
return _1.OffchainOracleAbi__factory.connect(config_1.sepoliaOffchainOracleAddress, provider);
}
return _1.OffchainOracleAbi__factory.connect(config_1.offchainOracleAddress, provider);
};
exports.getOffchainOracleContract = getOffchainOracleContract;
var getMultiCallContract = function (provider) {
return _1.MulticallAbi__factory.connect(config_1.multiCallAddress, provider);
};
exports.getMultiCallContract = getMultiCallContract;
//# sourceMappingURL=factories.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"factories.js","sourceRoot":"","sources":["../../src/contracts/factories.ts"],"names":[],"mappings":";;;AAAA,uBAAwG;AACxG,oCAKmB;AAEnB,oCAAoC;AAE7B,IAAM,sBAAsB,GAAG,UAAC,QAAkB;IACvD,OAAO,kCAA+B,CAAC,OAAO,CAAC,mCAA0B,EAAE,QAAQ,CAAC,CAAC;AACvF,CAAC,CAAC;AAFW,QAAA,sBAAsB,0BAEjC;AAEK,IAAM,yBAAyB,GAAG,UAAC,QAAkB,EAAE,OAAiB;IAC7E,IAAI,OAAO,KAAK,gBAAO,CAAC,OAAO,EAAE;QAC/B,OAAO,6BAA0B,CAAC,OAAO,CAAC,qCAA4B,EAAE,QAAQ,CAAC,CAAC;KACnF;IACD,OAAO,6BAA0B,CAAC,OAAO,CAAC,8BAAqB,EAAE,QAAQ,CAAC,CAAC;AAC7E,CAAC,CAAC;AALW,QAAA,yBAAyB,6BAKpC;AAEK,IAAM,oBAAoB,GAAG,UAAC,QAAkB;IACrD,OAAO,wBAAqB,CAAC,OAAO,CAAC,yBAAgB,EAAE,QAAQ,CAAC,CAAC;AACnE,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B"}

View File

@@ -0,0 +1,339 @@
import { Signer } from 'ethers';
import type { Provider } from '@ethersproject/providers';
import type { MulticallAbi, MulticallAbiInterface } from '../MulticallAbi';
export declare class MulticallAbi__factory {
static readonly abi: readonly [{
readonly inputs: readonly [{
readonly components: readonly [{
readonly internalType: "address";
readonly name: "target";
readonly type: "address";
}, {
readonly internalType: "bytes";
readonly name: "callData";
readonly type: "bytes";
}];
readonly internalType: "struct Multicall3.Call[]";
readonly name: "calls";
readonly type: "tuple[]";
}];
readonly name: "aggregate";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "blockNumber";
readonly type: "uint256";
}, {
readonly internalType: "bytes[]";
readonly name: "returnData";
readonly type: "bytes[]";
}];
readonly stateMutability: "payable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly components: readonly [{
readonly internalType: "address";
readonly name: "target";
readonly type: "address";
}, {
readonly internalType: "bool";
readonly name: "allowFailure";
readonly type: "bool";
}, {
readonly internalType: "bytes";
readonly name: "callData";
readonly type: "bytes";
}];
readonly internalType: "struct Multicall3.Call3[]";
readonly name: "calls";
readonly type: "tuple[]";
}];
readonly name: "aggregate3";
readonly outputs: readonly [{
readonly components: readonly [{
readonly internalType: "bool";
readonly name: "success";
readonly type: "bool";
}, {
readonly internalType: "bytes";
readonly name: "returnData";
readonly type: "bytes";
}];
readonly internalType: "struct Multicall3.Result[]";
readonly name: "returnData";
readonly type: "tuple[]";
}];
readonly stateMutability: "payable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly components: readonly [{
readonly internalType: "address";
readonly name: "target";
readonly type: "address";
}, {
readonly internalType: "bool";
readonly name: "allowFailure";
readonly type: "bool";
}, {
readonly internalType: "uint256";
readonly name: "value";
readonly type: "uint256";
}, {
readonly internalType: "bytes";
readonly name: "callData";
readonly type: "bytes";
}];
readonly internalType: "struct Multicall3.Call3Value[]";
readonly name: "calls";
readonly type: "tuple[]";
}];
readonly name: "aggregate3Value";
readonly outputs: readonly [{
readonly components: readonly [{
readonly internalType: "bool";
readonly name: "success";
readonly type: "bool";
}, {
readonly internalType: "bytes";
readonly name: "returnData";
readonly type: "bytes";
}];
readonly internalType: "struct Multicall3.Result[]";
readonly name: "returnData";
readonly type: "tuple[]";
}];
readonly stateMutability: "payable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly components: readonly [{
readonly internalType: "address";
readonly name: "target";
readonly type: "address";
}, {
readonly internalType: "bytes";
readonly name: "callData";
readonly type: "bytes";
}];
readonly internalType: "struct Multicall3.Call[]";
readonly name: "calls";
readonly type: "tuple[]";
}];
readonly name: "blockAndAggregate";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "blockNumber";
readonly type: "uint256";
}, {
readonly internalType: "bytes32";
readonly name: "blockHash";
readonly type: "bytes32";
}, {
readonly components: readonly [{
readonly internalType: "bool";
readonly name: "success";
readonly type: "bool";
}, {
readonly internalType: "bytes";
readonly name: "returnData";
readonly type: "bytes";
}];
readonly internalType: "struct Multicall3.Result[]";
readonly name: "returnData";
readonly type: "tuple[]";
}];
readonly stateMutability: "payable";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "getBasefee";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "basefee";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "blockNumber";
readonly type: "uint256";
}];
readonly name: "getBlockHash";
readonly outputs: readonly [{
readonly internalType: "bytes32";
readonly name: "blockHash";
readonly type: "bytes32";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "getBlockNumber";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "blockNumber";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "getChainId";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "chainid";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "getCurrentBlockCoinbase";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "coinbase";
readonly type: "address";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "getCurrentBlockDifficulty";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "difficulty";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "getCurrentBlockGasLimit";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "gaslimit";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "getCurrentBlockTimestamp";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "timestamp";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "address";
readonly name: "addr";
readonly type: "address";
}];
readonly name: "getEthBalance";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "balance";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "getLastBlockHash";
readonly outputs: readonly [{
readonly internalType: "bytes32";
readonly name: "blockHash";
readonly type: "bytes32";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "bool";
readonly name: "requireSuccess";
readonly type: "bool";
}, {
readonly components: readonly [{
readonly internalType: "address";
readonly name: "target";
readonly type: "address";
}, {
readonly internalType: "bytes";
readonly name: "callData";
readonly type: "bytes";
}];
readonly internalType: "struct Multicall3.Call[]";
readonly name: "calls";
readonly type: "tuple[]";
}];
readonly name: "tryAggregate";
readonly outputs: readonly [{
readonly components: readonly [{
readonly internalType: "bool";
readonly name: "success";
readonly type: "bool";
}, {
readonly internalType: "bytes";
readonly name: "returnData";
readonly type: "bytes";
}];
readonly internalType: "struct Multicall3.Result[]";
readonly name: "returnData";
readonly type: "tuple[]";
}];
readonly stateMutability: "payable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "bool";
readonly name: "requireSuccess";
readonly type: "bool";
}, {
readonly components: readonly [{
readonly internalType: "address";
readonly name: "target";
readonly type: "address";
}, {
readonly internalType: "bytes";
readonly name: "callData";
readonly type: "bytes";
}];
readonly internalType: "struct Multicall3.Call[]";
readonly name: "calls";
readonly type: "tuple[]";
}];
readonly name: "tryBlockAndAggregate";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "blockNumber";
readonly type: "uint256";
}, {
readonly internalType: "bytes32";
readonly name: "blockHash";
readonly type: "bytes32";
}, {
readonly components: readonly [{
readonly internalType: "bool";
readonly name: "success";
readonly type: "bool";
}, {
readonly internalType: "bytes";
readonly name: "returnData";
readonly type: "bytes";
}];
readonly internalType: "struct Multicall3.Result[]";
readonly name: "returnData";
readonly type: "tuple[]";
}];
readonly stateMutability: "payable";
readonly type: "function";
}];
static createInterface(): MulticallAbiInterface;
static connect(address: string, signerOrProvider: Signer | Provider): MulticallAbi;
}

View File

@@ -0,0 +1,460 @@
"use strict";
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
Object.defineProperty(exports, "__esModule", { value: true });
exports.MulticallAbi__factory = void 0;
var ethers_1 = require("ethers");
var _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',
},
];
var MulticallAbi__factory = exports.MulticallAbi__factory = /** @class */ (function () {
function MulticallAbi__factory() {
}
MulticallAbi__factory.createInterface = function () {
return new ethers_1.utils.Interface(_abi);
};
MulticallAbi__factory.connect = function (address, signerOrProvider) {
return new ethers_1.Contract(address, _abi, signerOrProvider);
};
MulticallAbi__factory.abi = _abi;
return MulticallAbi__factory;
}());
//# sourceMappingURL=MulticallAbi__factory.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,265 @@
import { Signer } from 'ethers';
import type { Provider } from '@ethersproject/providers';
import type { OffchainOracleAbi, OffchainOracleAbiInterface } from '../OffchainOracleAbi';
export declare class OffchainOracleAbi__factory {
static readonly abi: readonly [{
readonly inputs: readonly [{
readonly internalType: "contract MultiWrapper";
readonly name: "_multiWrapper";
readonly type: "address";
}, {
readonly internalType: "contract IOracle[]";
readonly name: "existingOracles";
readonly type: "address[]";
}, {
readonly internalType: "enum OffchainOracle.OracleType[]";
readonly name: "oracleTypes";
readonly type: "uint8[]";
}, {
readonly internalType: "contract IERC20[]";
readonly name: "existingConnectors";
readonly type: "address[]";
}, {
readonly internalType: "contract IERC20";
readonly name: "wBase";
readonly type: "address";
}];
readonly stateMutability: "nonpayable";
readonly type: "constructor";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "contract IERC20";
readonly name: "connector";
readonly type: "address";
}];
readonly name: "ConnectorAdded";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "contract IERC20";
readonly name: "connector";
readonly type: "address";
}];
readonly name: "ConnectorRemoved";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "contract MultiWrapper";
readonly name: "multiWrapper";
readonly type: "address";
}];
readonly name: "MultiWrapperUpdated";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "contract IOracle";
readonly name: "oracle";
readonly type: "address";
}, {
readonly indexed: false;
readonly internalType: "enum OffchainOracle.OracleType";
readonly name: "oracleType";
readonly type: "uint8";
}];
readonly name: "OracleAdded";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "contract IOracle";
readonly name: "oracle";
readonly type: "address";
}, {
readonly indexed: false;
readonly internalType: "enum OffchainOracle.OracleType";
readonly name: "oracleType";
readonly type: "uint8";
}];
readonly name: "OracleRemoved";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly internalType: "address";
readonly name: "previousOwner";
readonly type: "address";
}, {
readonly indexed: true;
readonly internalType: "address";
readonly name: "newOwner";
readonly type: "address";
}];
readonly name: "OwnershipTransferred";
readonly type: "event";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "connector";
readonly type: "address";
}];
readonly name: "addConnector";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IOracle";
readonly name: "oracle";
readonly type: "address";
}, {
readonly internalType: "enum OffchainOracle.OracleType";
readonly name: "oracleKind";
readonly type: "uint8";
}];
readonly name: "addOracle";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "connectors";
readonly outputs: readonly [{
readonly internalType: "contract IERC20[]";
readonly name: "allConnectors";
readonly type: "address[]";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "srcToken";
readonly type: "address";
}, {
readonly internalType: "contract IERC20";
readonly name: "dstToken";
readonly type: "address";
}, {
readonly internalType: "bool";
readonly name: "useWrappers";
readonly type: "bool";
}];
readonly name: "getRate";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "weightedRate";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "srcToken";
readonly type: "address";
}, {
readonly internalType: "bool";
readonly name: "useSrcWrappers";
readonly type: "bool";
}];
readonly name: "getRateToEth";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "weightedRate";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "multiWrapper";
readonly outputs: readonly [{
readonly internalType: "contract MultiWrapper";
readonly name: "";
readonly type: "address";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "oracles";
readonly outputs: readonly [{
readonly internalType: "contract IOracle[]";
readonly name: "allOracles";
readonly type: "address[]";
}, {
readonly internalType: "enum OffchainOracle.OracleType[]";
readonly name: "oracleTypes";
readonly type: "uint8[]";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "owner";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "";
readonly type: "address";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "connector";
readonly type: "address";
}];
readonly name: "removeConnector";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IOracle";
readonly name: "oracle";
readonly type: "address";
}, {
readonly internalType: "enum OffchainOracle.OracleType";
readonly name: "oracleKind";
readonly type: "uint8";
}];
readonly name: "removeOracle";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "renounceOwnership";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract MultiWrapper";
readonly name: "_multiWrapper";
readonly type: "address";
}];
readonly name: "setMultiWrapper";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "address";
readonly name: "newOwner";
readonly type: "address";
}];
readonly name: "transferOwnership";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}];
static createInterface(): OffchainOracleAbiInterface;
static connect(address: string, signerOrProvider: Signer | Provider): OffchainOracleAbi;
}

View File

@@ -0,0 +1,354 @@
"use strict";
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
Object.defineProperty(exports, "__esModule", { value: true });
exports.OffchainOracleAbi__factory = void 0;
var ethers_1 = require("ethers");
var _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',
},
];
var OffchainOracleAbi__factory = exports.OffchainOracleAbi__factory = /** @class */ (function () {
function OffchainOracleAbi__factory() {
}
OffchainOracleAbi__factory.createInterface = function () {
return new ethers_1.utils.Interface(_abi);
};
OffchainOracleAbi__factory.connect = function (address, signerOrProvider) {
return new ethers_1.Contract(address, _abi, signerOrProvider);
};
OffchainOracleAbi__factory.abi = _abi;
return OffchainOracleAbi__factory;
}());
//# sourceMappingURL=OffchainOracleAbi__factory.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,235 @@
import { Signer } from 'ethers';
import type { Provider } from '@ethersproject/providers';
import type { OptimismL1FeeOracleAbi, OptimismL1FeeOracleAbiInterface } from '../OptimismL1FeeOracleAbi';
export declare class OptimismL1FeeOracleAbi__factory {
static readonly abi: readonly [{
readonly inputs: readonly [{
readonly internalType: "address";
readonly name: "_owner";
readonly type: "address";
}];
readonly stateMutability: "nonpayable";
readonly type: "constructor";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly name: "DecimalsUpdated";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly name: "GasPriceUpdated";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly name: "L1BaseFeeUpdated";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly name: "OverheadUpdated";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly internalType: "address";
readonly name: "previousOwner";
readonly type: "address";
}, {
readonly indexed: true;
readonly internalType: "address";
readonly name: "newOwner";
readonly type: "address";
}];
readonly name: "OwnershipTransferred";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly name: "ScalarUpdated";
readonly type: "event";
}, {
readonly inputs: readonly [];
readonly name: "decimals";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "gasPrice";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "bytes";
readonly name: "_data";
readonly type: "bytes";
}];
readonly name: "getL1Fee";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "bytes";
readonly name: "_data";
readonly type: "bytes";
}];
readonly name: "getL1GasUsed";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "l1BaseFee";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "overhead";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "owner";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "";
readonly type: "address";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "renounceOwnership";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "scalar";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "_decimals";
readonly type: "uint256";
}];
readonly name: "setDecimals";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "_gasPrice";
readonly type: "uint256";
}];
readonly name: "setGasPrice";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "_baseFee";
readonly type: "uint256";
}];
readonly name: "setL1BaseFee";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "_overhead";
readonly type: "uint256";
}];
readonly name: "setOverhead";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "_scalar";
readonly type: "uint256";
}];
readonly name: "setScalar";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "address";
readonly name: "newOwner";
readonly type: "address";
}];
readonly name: "transferOwnership";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}];
static createInterface(): OptimismL1FeeOracleAbiInterface;
static connect(address: string, signerOrProvider: Signer | Provider): OptimismL1FeeOracleAbi;
}

View File

@@ -0,0 +1,318 @@
"use strict";
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
Object.defineProperty(exports, "__esModule", { value: true });
exports.OptimismL1FeeOracleAbi__factory = void 0;
var ethers_1 = require("ethers");
var _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',
},
];
var OptimismL1FeeOracleAbi__factory = exports.OptimismL1FeeOracleAbi__factory = /** @class */ (function () {
function OptimismL1FeeOracleAbi__factory() {
}
OptimismL1FeeOracleAbi__factory.createInterface = function () {
return new ethers_1.utils.Interface(_abi);
};
OptimismL1FeeOracleAbi__factory.connect = function (address, signerOrProvider) {
return new ethers_1.Contract(address, _abi, signerOrProvider);
};
OptimismL1FeeOracleAbi__factory.abi = _abi;
return OptimismL1FeeOracleAbi__factory;
}());
//# sourceMappingURL=OptimismL1FeeOracleAbi__factory.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"OptimismL1FeeOracleAbi__factory.js","sourceRoot":"","sources":["../../../src/contracts/factories/OptimismL1FeeOracleAbi__factory.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;;;AAEpB,iCAAiD;AAIjD,IAAM,IAAI,GAAG;IACX;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,aAAa;KACpB;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,sBAAsB;QAC5B,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,OAAO;KACd;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,OAAO;gBACrB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,OAAO;aACd;SACF;QACD,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,OAAO;gBACrB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,OAAO;aACd;SACF;QACD,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,OAAO;QACb,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;CACO,CAAC;AAEX;IAAA;IAQA,CAAC;IANQ,+CAAe,GAAtB;QACE,OAAO,IAAI,cAAK,CAAC,SAAS,CAAC,IAAI,CAAoC,CAAC;IACtE,CAAC;IACM,uCAAO,GAAd,UAAe,OAAe,EAAE,gBAAmC;QACjE,OAAO,IAAI,iBAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,gBAAgB,CAA2B,CAAC;IACjF,CAAC;IANe,mCAAG,GAAG,IAAI,CAAC;IAO7B,sCAAC;CAAA,AARD,IAQC"}

3
lib/contracts/factories/index.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
export { MulticallAbi__factory } from './MulticallAbi__factory';
export { OffchainOracleAbi__factory } from './OffchainOracleAbi__factory';
export { OptimismL1FeeOracleAbi__factory } from './OptimismL1FeeOracleAbi__factory';

View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OptimismL1FeeOracleAbi__factory = exports.OffchainOracleAbi__factory = exports.MulticallAbi__factory = void 0;
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
var MulticallAbi__factory_1 = require("./MulticallAbi__factory");
Object.defineProperty(exports, "MulticallAbi__factory", { enumerable: true, get: function () { return MulticallAbi__factory_1.MulticallAbi__factory; } });
var OffchainOracleAbi__factory_1 = require("./OffchainOracleAbi__factory");
Object.defineProperty(exports, "OffchainOracleAbi__factory", { enumerable: true, get: function () { return OffchainOracleAbi__factory_1.OffchainOracleAbi__factory; } });
var OptimismL1FeeOracleAbi__factory_1 = require("./OptimismL1FeeOracleAbi__factory");
Object.defineProperty(exports, "OptimismL1FeeOracleAbi__factory", { enumerable: true, get: function () { return OptimismL1FeeOracleAbi__factory_1.OptimismL1FeeOracleAbi__factory; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/contracts/factories/index.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AACpB,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,2EAA0E;AAAjE,wIAAA,0BAA0B,OAAA;AACnC,qFAAoF;AAA3E,kJAAA,+BAA+B,OAAA"}

7
lib/contracts/index.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
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';

34
lib/contracts/index.js Normal file
View File

@@ -0,0 +1,34 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OptimismL1FeeOracleAbi__factory = exports.OffchainOracleAbi__factory = exports.MulticallAbi__factory = exports.factories = void 0;
exports.factories = __importStar(require("./factories"));
var MulticallAbi__factory_1 = require("./factories/MulticallAbi__factory");
Object.defineProperty(exports, "MulticallAbi__factory", { enumerable: true, get: function () { return MulticallAbi__factory_1.MulticallAbi__factory; } });
var OffchainOracleAbi__factory_1 = require("./factories/OffchainOracleAbi__factory");
Object.defineProperty(exports, "OffchainOracleAbi__factory", { enumerable: true, get: function () { return OffchainOracleAbi__factory_1.OffchainOracleAbi__factory; } });
var OptimismL1FeeOracleAbi__factory_1 = require("./factories/OptimismL1FeeOracleAbi__factory");
Object.defineProperty(exports, "OptimismL1FeeOracleAbi__factory", { enumerable: true, get: function () { return OptimismL1FeeOracleAbi__factory_1.OptimismL1FeeOracleAbi__factory; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,yDAAyC;AACzC,2EAA0E;AAAjE,8HAAA,qBAAqB,OAAA;AAC9B,qFAAoF;AAA3E,wIAAA,0BAA0B,OAAA;AACnC,+FAA8F;AAArF,kJAAA,+BAA+B,OAAA"}

122
lib/feeOracle.d.ts vendored Normal file
View File

@@ -0,0 +1,122 @@
import { BigNumberish } from 'ethers';
import { TransactionData, TxType, ITornadoFeeOracle, LegacyGasPriceKey, GasPriceParams, GetGasParamsRes, HexadecimalStringifiedNumber, GetGasInput, GetGasParamsInput } from './types';
import { JsonRpcProvider } from '@ethersproject/providers';
import { ChainId, InstanceTokenSymbol } from './config';
import { GetWithdrawalFeeViaRelayerInput } from './types';
export declare abstract class TornadoFeeOracle implements ITornadoFeeOracle {
version: 4 | 5 | 6;
protected chainId: ChainId;
protected provider: JsonRpcProvider;
constructor(version: 4 | 5 | 6, chainId: ChainId, rpcUrl: string);
/**
* 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<HexadecimalStringifiedNumber>} Fee in WEI (MATIC), '0' if chain is not Optimism
*/
fetchL1OptimismFee(tx?: TransactionData): Promise<HexadecimalStringifiedNumber>;
/**
* 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<GetGasParamsRes>} Object with fields 'gasPrice' and 'gasLimit', L1 fee, if exists, included in gasLimit
*/
getGasParams(params?: GetGasParamsInput): Promise<GetGasParamsRes>;
/**
* 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<HexadecimalStringifiedNumber>} Gas value in WEI (hex-format)
*/
getGas(params?: GetGasInput): Promise<HexadecimalStringifiedNumber>;
/**
* 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<GasPriceParams>} Estimated gas price info in WEI (hexed) - legacy object with gasPrice property or
* EIP-1559 object with maxFeePerGas and maxPriorityFeePerGas properties
* NOTICE: It is recommended to bump fees for EIP-1559 transactions, because they can bump 12.5% per block
*/
getGasPriceParams(speed?: LegacyGasPriceKey, bumpPercent?: number): Promise<GasPriceParams>;
/**
* 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<HexadecimalStringifiedNumber>} Gas price in WEI (hex string)
*/
getGasPrice(speed?: LegacyGasPriceKey, bumpPercent?: number): Promise<HexadecimalStringifiedNumber>;
/**
* 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<number>} Gas limit
*/
abstract getGasLimit(tx?: TransactionData, type?: TxType, bumpPercent?: number): Promise<number>;
/**
* 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.
*
* 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)
*/
calculateRefundInETH(gasPrice: BigNumberish, tokenSymbol: InstanceTokenSymbol): HexadecimalStringifiedNumber;
/**
* Fetched actual gas price and calculates refund amount
* @param {InstanceTokenSymbol} tokenSymbol Withdrawal token (currency) symbol - for example, 'dai'
* @returns {Promise<HexadecimalStringifiedNumber>} Refund amount in WEI (in hex format)
*/
fetchRefundInETH(tokenSymbol: InstanceTokenSymbol): Promise<HexadecimalStringifiedNumber>;
/**
* 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;
/**
* 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;
/**
* 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<AvailableTokenSymbols>} 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<HexadecimalStringifiedNumber>} Fee in WEI (hexed string)
*/
calculateWithdrawalFeeViaRelayer({ tx, txType, relayerFeePercent, currency, amount, decimals, refundInEth, tokenPriceInEth, predefinedGasLimit, predefinedGasPrice, }: GetWithdrawalFeeViaRelayerInput): Promise<HexadecimalStringifiedNumber>;
}

374
lib/feeOracle.js Normal file
View File

@@ -0,0 +1,374 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TornadoFeeOracle = void 0;
var ethers_1 = require("ethers");
var bignumber_js_1 = __importDefault(require("bignumber.js"));
var utils_1 = require("ethers/lib/utils");
var config_1 = require("./config");
var utils_2 = require("./utils");
var factories_1 = require("./contracts/factories");
var TornadoFeeOracle = /** @class */ (function () {
function TornadoFeeOracle(version, chainId, rpcUrl) {
this.version = version;
this.chainId = chainId;
this.provider = new ethers_1.ethers.providers.JsonRpcProvider(rpcUrl);
}
/**
* 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<HexadecimalStringifiedNumber>} Fee in WEI (MATIC), '0' if chain is not Optimism
*/
TornadoFeeOracle.prototype.fetchL1OptimismFee = function (tx) {
return __awaiter(this, void 0, void 0, function () {
var optimismL1FeeOracle, l1Fee;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (this.chainId != config_1.ChainId.OPTIMISM)
return [2 /*return*/, ethers_1.BigNumber.from(0).toHexString()];
optimismL1FeeOracle = (0, factories_1.getOptimismL1FeeOracle)(this.provider);
return [4 /*yield*/, optimismL1FeeOracle.getL1Fee((0, utils_2.serializeTx)(tx))];
case 1:
l1Fee = _a.sent();
return [2 /*return*/, l1Fee.toHexString()];
}
});
});
};
/**
* 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<GetGasParamsRes>} Object with fields 'gasPrice' and 'gasLimit', L1 fee, if exists, included in gasLimit
*/
TornadoFeeOracle.prototype.getGasParams = function (params) {
if (params === void 0) { params = {}; }
return __awaiter(this, void 0, void 0, function () {
var tx, _a, txType, bumpGasLimitPercent, bumpGasPricePercent, gasLimit, gasPrice, speed, _b, includeL1FeeToGasLimit, l1Fee;
var _c, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
tx = params.tx, _a = params.txType, txType = _a === void 0 ? 'other' : _a, bumpGasLimitPercent = params.bumpGasLimitPercent, bumpGasPricePercent = params.bumpGasPricePercent, gasLimit = params.predefinedGasLimit, gasPrice = params.predefinedGasPrice, speed = params.speed, _b = params.includeL1FeeToGasLimit, includeL1FeeToGasLimit = _b === void 0 ? true : _b;
l1Fee = '0';
if (!(!gasLimit && !gasPrice)) return [3 /*break*/, 2];
return [4 /*yield*/, Promise.all([
this.getGasPrice(speed, bumpGasPricePercent),
this.getGasLimit(tx, txType, bumpGasLimitPercent),
this.fetchL1OptimismFee(tx),
])];
case 1:
_c = _e.sent(), gasPrice = _c[0], gasLimit = _c[1], l1Fee = _c[2];
_e.label = 2;
case 2:
if (!!gasLimit) return [3 /*break*/, 4];
return [4 /*yield*/, Promise.all([
this.getGasLimit(tx, txType, bumpGasLimitPercent),
this.fetchL1OptimismFee(tx),
])];
case 3:
_d = _e.sent(), gasLimit = _d[0], l1Fee = _d[1];
_e.label = 4;
case 4:
if (!!gasPrice) return [3 /*break*/, 6];
return [4 /*yield*/, this.getGasPrice(speed, bumpGasPricePercent)];
case 5:
gasPrice = _e.sent();
_e.label = 6;
case 6:
if (includeL1FeeToGasLimit)
// Include L1 fee in gas limit (divide by gas price before), if l1 fee is 0, gas limit wont change
gasLimit = (0, bignumber_js_1.default)(gasLimit)
.plus((0, bignumber_js_1.default)(l1Fee).div((0, bignumber_js_1.default)(gasPrice)))
.decimalPlaces(0, 1)
.toNumber();
return [2 /*return*/, { gasLimit: gasLimit, gasPrice: 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<HexadecimalStringifiedNumber>} Gas value in WEI (hex-format)
*/
TornadoFeeOracle.prototype.getGas = function (params) {
if (params === void 0) { params = {}; }
return __awaiter(this, void 0, void 0, function () {
var _a, gasPrice, gasLimit;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.getGasParams(__assign(__assign({}, params), { includeL1FeeToGasLimit: true }))];
case 1:
_a = _b.sent(), gasPrice = _a.gasPrice, gasLimit = _a.gasLimit;
return [2 /*return*/, ethers_1.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<GasPriceParams>} Estimated gas price info in WEI (hexed) - legacy object with gasPrice property or
* EIP-1559 object with maxFeePerGas and maxPriorityFeePerGas properties
* NOTICE: It is recommended to bump fees for EIP-1559 transactions, because they can bump 12.5% per block
*/
TornadoFeeOracle.prototype.getGasPriceParams = function (speed, bumpPercent) {
var _a;
if (bumpPercent === void 0) { bumpPercent = 0; }
return __awaiter(this, void 0, void 0, function () {
var _b, block, gasPrice, priorityFee, maxPriorityFeePerGas, maxFeePerGas, e_1;
var _this = this;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
// 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 === config_1.ChainId.BSC ? 'instant' : 'fast';
_c.label = 1;
case 1:
_c.trys.push([1, 3, , 4]);
return [4 /*yield*/, Promise.all([
this.provider.getBlock('latest'),
this.provider.getGasPrice(),
(function () { return __awaiter(_this, void 0, void 0, function () {
var _a, _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_d.trys.push([0, 2, , 3]);
_b = (_a = ethers_1.BigNumber).from;
return [4 /*yield*/, this.provider.send('eth_maxPriorityFeePerGas', [])];
case 1: return [2 /*return*/, _b.apply(_a, [(_d.sent()) || (0, utils_1.parseUnits)('1.5', 'gwei')])];
case 2:
_c = _d.sent();
return [2 /*return*/, (0, utils_1.parseUnits)('1.5', 'gwei')];
case 3: return [2 /*return*/];
}
});
}); })(),
])];
case 2:
_b = _c.sent(), block = _b[0], gasPrice = _b[1], priorityFee = _b[2];
if ((_a = block === null || block === void 0 ? void 0 : block.baseFeePerGas) === null || _a === void 0 ? void 0 : _a.gt(0)) {
maxPriorityFeePerGas = priorityFee.toHexString();
maxFeePerGas = (0, utils_2.bump)(block.baseFeePerGas, bumpPercent)
.add(priorityFee)
.toHexString();
return [2 /*return*/, {
maxFeePerGas: maxFeePerGas,
maxPriorityFeePerGas: maxPriorityFeePerGas,
}];
}
return [2 /*return*/, {
gasPrice: (0, utils_2.bump)(gasPrice, bumpPercent).toHexString(),
}];
case 3:
e_1 = _c.sent();
return [2 /*return*/, { gasPrice: (0, utils_2.bump)((0, utils_2.fromGweiToWeiHex)(config_1.defaultGasPrices[this.chainId][speed]), bumpPercent).toHexString() }];
case 4: return [2 /*return*/];
}
});
});
};
/**
* 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<HexadecimalStringifiedNumber>} Gas price in WEI (hex string)
*/
TornadoFeeOracle.prototype.getGasPrice = function (speed, bumpPercent) {
return __awaiter(this, void 0, void 0, function () {
var gasPriceParams;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getGasPriceParams(speed, bumpPercent)];
case 1:
gasPriceParams = _a.sent();
return [2 /*return*/, (0, utils_2.calculateGasPriceInWei)(gasPriceParams).toHexString()];
}
});
});
};
/**
* 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.
*
* 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)
*/
TornadoFeeOracle.prototype.calculateRefundInETH = function (gasPrice, tokenSymbol) {
// Refund only available for non-native tokens on Ethereum Mainnet and Goerli
if (![config_1.ChainId.MAINNET, config_1.ChainId.GOERLI].includes(this.chainId) || tokenSymbol === 'eth')
return '0';
// Notify user about error if incorrect token symbol provided
if (!Object.values(config_1.InstanceTokenSymbol).includes(tokenSymbol)) {
console.error("Invalid token symbol: ".concat(tokenSymbol, ", must be lowercase token from one of Tornado ETH Mainnet pools"));
return '0';
}
// In Tornado we need to calculate refund only on user side, relayer get refund value in proof
var gasLimit = config_1.defaultInstanceTokensGasLimit[tokenSymbol];
return ethers_1.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<HexadecimalStringifiedNumber>} Refund amount in WEI (in hex format)
*/
TornadoFeeOracle.prototype.fetchRefundInETH = function (tokenSymbol) {
return __awaiter(this, void 0, void 0, function () {
var gasPrice;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getGasPrice()];
case 1:
gasPrice = _a.sent();
return [2 /*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)
*/
TornadoFeeOracle.prototype.calculateRefundInToken = function (gasPrice, tokenPriceInEth, tokenDecimals, tokenSymbol) {
var refundInEth = this.calculateRefundInETH(gasPrice, tokenSymbol);
return (0, utils_2.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)
*/
TornadoFeeOracle.prototype.calculateRelayerFeeInWei = function (relayerFeePercent, amount, decimals) {
return (0, utils_1.parseUnits)(amount.toString(), decimals)
.mul("".concat(Math.floor(Number(relayerFeePercent) * 1e10)))
.div("".concat(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<AvailableTokenSymbols>} 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<HexadecimalStringifiedNumber>} Fee in WEI (hexed string)
*/
TornadoFeeOracle.prototype.calculateWithdrawalFeeViaRelayer = function (_a) {
var tx = _a.tx, txType = _a.txType, relayerFeePercent = _a.relayerFeePercent, currency = _a.currency, amount = _a.amount, decimals = _a.decimals, refundInEth = _a.refundInEth, tokenPriceInEth = _a.tokenPriceInEth, predefinedGasLimit = _a.predefinedGasLimit, predefinedGasPrice = _a.predefinedGasPrice;
return __awaiter(this, void 0, void 0, function () {
var relayerFee, _b, gasPrice, gasLimit, gasCosts, hasTokenPrice, feeInEth;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
relayerFee = this.calculateRelayerFeeInWei(relayerFeePercent, amount, decimals);
return [4 /*yield*/, this.getGasParams({ tx: tx, txType: txType, predefinedGasLimit: predefinedGasLimit, predefinedGasPrice: predefinedGasPrice })];
case 1:
_b = _c.sent(), gasPrice = _b.gasPrice, gasLimit = _b.gasLimit;
gasCosts = ethers_1.BigNumber.from(gasPrice).mul(gasLimit);
hasTokenPrice = typeof tokenPriceInEth === 'object' && typeof (tokenPriceInEth === null || tokenPriceInEth === void 0 ? void 0 : tokenPriceInEth.gt) === 'function'
? Boolean(tokenPriceInEth.gt(0))
: Boolean(tokenPriceInEth);
if (hasTokenPrice) {
if (txType === 'user_withdrawal' && refundInEth === undefined)
refundInEth = this.calculateRefundInETH(gasPrice, currency.toLowerCase());
feeInEth = ethers_1.BigNumber.from(gasCosts).add(refundInEth || 0);
return [2 /*return*/, (0, utils_2.convertETHToToken)(feeInEth, decimals, tokenPriceInEth)
.add(relayerFee)
.toHexString()];
}
return [2 /*return*/, ethers_1.BigNumber.from(gasCosts).add(relayerFee).toHexString()];
}
});
});
};
return TornadoFeeOracle;
}());
exports.TornadoFeeOracle = TornadoFeeOracle;
//# sourceMappingURL=feeOracle.js.map

1
lib/feeOracle.js.map Normal file

File diff suppressed because one or more lines are too long

9
lib/feeOracleV4.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
import { TornadoFeeOracle } from './feeOracle';
import { ITornadoFeeOracle, TransactionData, TxType } from './types';
/**
* Oracle for V4 (old-version) transactions - estimates fee with predefined gas limit and without smart bumping
*/
export declare class TornadoFeeOracleV4 extends TornadoFeeOracle implements ITornadoFeeOracle {
constructor(chainId: number, rpcUrl: string);
getGasLimit(tx?: TransactionData, type?: TxType, bumpPercent?: number): Promise<number>;
}

96
lib/feeOracleV4.js Normal file
View File

@@ -0,0 +1,96 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TornadoFeeOracleV4 = void 0;
var config_1 = require("./config");
var feeOracle_1 = require("./feeOracle");
var utils_1 = require("./utils");
/**
* Oracle for V4 (old-version) transactions - estimates fee with predefined gas limit and without smart bumping
*/
var TornadoFeeOracleV4 = /** @class */ (function (_super) {
__extends(TornadoFeeOracleV4, _super);
function TornadoFeeOracleV4(chainId, rpcUrl) {
return _super.call(this, 4, chainId, rpcUrl) || this;
}
TornadoFeeOracleV4.prototype.getGasLimit = function (tx, type, bumpPercent) {
if (type === void 0) { type = 'other'; }
if (bumpPercent === void 0) { bumpPercent = 0; }
return __awaiter(this, void 0, void 0, function () {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
if (type === 'user_withdrawal')
return [2 /*return*/, (0, utils_1.bump)(config_1.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 [2 /*return*/, (0, utils_1.bump)(config_1.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 [2 /*return*/, (0, utils_1.bump)(config_1.defaultWithdrawalGasLimit[this.chainId], -25).toNumber()];
if (!tx || Object.keys(tx).length === 0)
return [2 /*return*/, (0, utils_1.bump)(23000, bumpPercent).toNumber()];
_a = utils_1.bump;
return [4 /*yield*/, this.provider.estimateGas(tx)];
case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent(), bumpPercent]).toNumber()];
}
});
});
};
return TornadoFeeOracleV4;
}(feeOracle_1.TornadoFeeOracle));
exports.TornadoFeeOracleV4 = TornadoFeeOracleV4;
//# sourceMappingURL=feeOracleV4.js.map

1
lib/feeOracleV4.js.map Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"feeOracleV4.js","sourceRoot":"","sources":["../src/feeOracleV4.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAqD;AACrD,yCAA+C;AAE/C,iCAA+B;AAE/B;;GAEG;AACH;IAAwC,sCAAgB;IACtD,4BAAmB,OAAe,EAAE,MAAc;eAChD,kBAAM,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC;IAC3B,CAAC;IAEK,wCAAW,GAAjB,UAAkB,EAAoB,EAAE,IAAsB,EAAE,WAAuB;QAA/C,qBAAA,EAAA,cAAsB;QAAE,4BAAA,EAAA,eAAuB;;;;;;wBACrF,IAAI,IAAI,KAAK,iBAAiB;4BAAE,sBAAO,IAAA,YAAI,EAAC,kCAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC,QAAQ,EAAE,EAAC;wBAE7G,sIAAsI;wBACtI,iIAAiI;wBACjI,IAAI,IAAI,KAAK,oBAAoB;4BAC/B,sBAAO,IAAA,YAAI,EAAC,kCAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAC;wBACrF,oHAAoH;wBACpH,6GAA6G;wBAC7G,IAAI,IAAI,KAAK,6BAA6B;4BAAE,sBAAO,IAAA,YAAI,EAAC,kCAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAC;wBACjH,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC;4BAAE,sBAAO,IAAA,YAAI,EAAC,KAAM,EAAE,WAAW,CAAC,CAAC,QAAQ,EAAE,EAAC;wBAE9E,KAAA,YAAI,CAAA;wBAAC,qBAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,EAAA;4BAA/C,sBAAO,kBAAK,SAAmC,EAAE,WAAW,EAAC,CAAC,QAAQ,EAAE,EAAC;;;;KAC1E;IACH,yBAAC;AAAD,CAAC,AAnBD,CAAwC,4BAAgB,GAmBvD;AAnBY,gDAAkB"}

11
lib/feeOracleV5.d.ts vendored Normal file
View File

@@ -0,0 +1,11 @@
import { TornadoFeeOracle } from './feeOracle';
import { ITornadoFeeOracle, TransactionData, TxType, LegacyGasPriceKey, GasPriceParams } from './types';
/**
* Oracle for new V5 version - estimates transaction fees with smart gas limit & bumping
*/
export declare class TornadoFeeOracleV5 extends TornadoFeeOracle implements ITornadoFeeOracle {
private fallbackFeeOracle;
constructor(chainId: number, rpcUrl: string);
getGasLimit(tx?: TransactionData, type?: TxType, bumpPercent?: number): Promise<number>;
getGasPriceParams(speed?: LegacyGasPriceKey, bumpPercent?: number): Promise<GasPriceParams>;
}

127
lib/feeOracleV5.js Normal file
View File

@@ -0,0 +1,127 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TornadoFeeOracleV5 = void 0;
var config_1 = require("./config");
var feeOracle_1 = require("./feeOracle");
var utils_1 = require("./utils");
var feeOracleV4_1 = require("./feeOracleV4");
/**
* Oracle for new V5 version - estimates transaction fees with smart gas limit & bumping
*/
var TornadoFeeOracleV5 = /** @class */ (function (_super) {
__extends(TornadoFeeOracleV5, _super);
function TornadoFeeOracleV5(chainId, rpcUrl) {
var _this = _super.call(this, 5, chainId, rpcUrl) || this;
_this.fallbackFeeOracle = new feeOracleV4_1.TornadoFeeOracleV4(chainId, rpcUrl);
return _this;
}
TornadoFeeOracleV5.prototype.getGasLimit = function (tx, type, bumpPercent) {
if (type === void 0) { type = 'other'; }
if (bumpPercent === void 0) { bumpPercent = 20; }
return __awaiter(this, void 0, void 0, function () {
var fetchedGasLimit, e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!tx || Object.keys(tx).length === 0)
return [2 /*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;
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.provider.estimateGas(tx)];
case 2:
fetchedGasLimit = _a.sent();
return [2 /*return*/, (0, utils_1.bump)(fetchedGasLimit, bumpPercent).toNumber()];
case 3:
e_1 = _a.sent();
return [2 /*return*/, this.fallbackFeeOracle.getGasLimit(tx, type, bumpPercent)];
case 4: return [2 /*return*/];
}
});
});
};
TornadoFeeOracleV5.prototype.getGasPriceParams = function (speed, bumpPercent) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
// Only if bump percent didn't provided (if user provides 0, no need to recalculate)
if (bumpPercent === undefined) {
switch (this.chainId) {
case config_1.ChainId.GOERLI:
bumpPercent = 100;
break;
case config_1.ChainId.POLYGON:
case config_1.ChainId.AVAX:
case config_1.ChainId.XDAI:
bumpPercent = 30;
break;
default:
bumpPercent = 10;
}
}
return [2 /*return*/, _super.prototype.getGasPriceParams.call(this, speed, bumpPercent)];
});
});
};
return TornadoFeeOracleV5;
}(feeOracle_1.TornadoFeeOracle));
exports.TornadoFeeOracleV5 = TornadoFeeOracleV5;
//# sourceMappingURL=feeOracleV5.js.map

1
lib/feeOracleV5.js.map Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"feeOracleV5.js","sourceRoot":"","sources":["../src/feeOracleV5.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAmC;AACnC,yCAA+C;AAE/C,iCAA+B;AAC/B,6CAAmD;AAEnD;;GAEG;AACH;IAAwC,sCAAgB;IAGtD,4BAAmB,OAAe,EAAE,MAAc;QAAlD,YACE,kBAAM,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,SAG1B;QADC,KAAI,CAAC,iBAAiB,GAAG,IAAI,gCAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;;IACnE,CAAC;IAEK,wCAAW,GAAjB,UAAkB,EAAoB,EAAE,IAAsB,EAAE,WAAwB;QAAhD,qBAAA,EAAA,cAAsB;QAAE,4BAAA,EAAA,gBAAwB;;;;;;wBACtF,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC;4BAAE,sBAAO,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,EAAC;wBAE1G;;;2BAGG;wBACH,IAAI,IAAI,KAAK,oBAAoB;4BAAE,WAAW,GAAG,EAAE,CAAC;wBACpD,IAAI,IAAI,KAAK,iBAAiB;4BAAE,WAAW,GAAG,EAAE,CAAC;;;;wBAGvB,qBAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,EAAA;;wBAArD,eAAe,GAAG,SAAmC;wBAC3D,sBAAO,IAAA,YAAI,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC,QAAQ,EAAE,EAAC;;;wBAErD,sBAAO,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,EAAC;;;;;KAEpE;IAEK,8CAAiB,GAAvB,UAAwB,KAAyB,EAAE,WAAoB;;;gBACrE,oFAAoF;gBACpF,IAAI,WAAW,KAAK,SAAS,EAAE;oBAC7B,QAAQ,IAAI,CAAC,OAAO,EAAE;wBACpB,KAAK,gBAAO,CAAC,MAAM;4BACjB,WAAW,GAAG,GAAG,CAAC;4BAClB,MAAM;wBACR,KAAK,gBAAO,CAAC,OAAO,CAAC;wBACrB,KAAK,gBAAO,CAAC,IAAI,CAAC;wBAClB,KAAK,gBAAO,CAAC,IAAI;4BACf,WAAW,GAAG,EAAE,CAAC;4BACjB,MAAM;wBACR;4BACE,WAAW,GAAG,EAAE,CAAC;qBACpB;iBACF;gBAED,sBAAO,iBAAM,iBAAiB,YAAC,KAAK,EAAE,WAAW,CAAC,EAAC;;;KACpD;IACH,yBAAC;AAAD,CAAC,AA9CD,CAAwC,4BAAgB,GA8CvD;AA9CY,gDAAkB"}

32
lib/feeOracleV6.d.ts vendored Normal file
View File

@@ -0,0 +1,32 @@
import { TornadoFeeOracle } from './feeOracle';
import { ITornadoFeeOracle, TransactionData, TxType, LegacyGasPriceKey, GasPriceParams, GetWithdrawalFeeViaRelayerInput, HexadecimalStringifiedNumber } from './types';
/**
* V6 version that would cover every available networks and relayers
*
* Ported from https://git.tornado.ws/tornadocontrib/tornado-core/src/branch/main/src/fees.ts and has been verified over time
*/
export declare class TornadoFeeOracleV6 extends TornadoFeeOracle implements ITornadoFeeOracle {
private fallbackFeeOracle;
overrideGasPrice?: GasPriceParams;
constructor(chainId: number, rpcUrl: string, overrideGasPrice?: GasPriceParams);
/**
* Apply static 10% gasLimit premium as it wouldn't change across nodes or relayers
*/
getGasLimit(tx?: TransactionData, type?: TxType, bumpPercent?: number): Promise<number>;
/**
* Apply static 30% gasPrice premium for EIP-1559 enabled networks
*
* Because Tornado Transactions are censored from block builders
* it would take some time to be confirmed after when the transaction is broadcasted.
*
* We apply 30% premium and 56% overall premium to combat basefee spike
* (Can spike 12.5% per block accoring to the EIP-1559 metrics https://metamask.io/1559/)
*/
getGasPriceParams(speed?: LegacyGasPriceKey, bumpPercent?: number): Promise<GasPriceParams>;
/**
* Apply 20% premium from the calculated fee from UI, applies 5% fee from relayer to prevent arbitrage from refund
*/
calculateWithdrawalFeeViaRelayer(params: GetWithdrawalFeeViaRelayerInput & {
premium?: number;
}): Promise<HexadecimalStringifiedNumber>;
}

135
lib/feeOracleV6.js Normal file
View File

@@ -0,0 +1,135 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TornadoFeeOracleV6 = void 0;
var config_1 = require("./config");
var feeOracle_1 = require("./feeOracle");
var utils_1 = require("./utils");
var feeOracleV5_1 = require("./feeOracleV5");
/**
* V6 version that would cover every available networks and relayers
*
* Ported from https://git.tornado.ws/tornadocontrib/tornado-core/src/branch/main/src/fees.ts and has been verified over time
*/
var TornadoFeeOracleV6 = /** @class */ (function (_super) {
__extends(TornadoFeeOracleV6, _super);
function TornadoFeeOracleV6(chainId, rpcUrl, overrideGasPrice) {
var _this = _super.call(this, 6, chainId, rpcUrl) || this;
_this.fallbackFeeOracle = new feeOracleV5_1.TornadoFeeOracleV5(chainId, rpcUrl);
_this.overrideGasPrice = overrideGasPrice;
return _this;
}
/**
* Apply static 10% gasLimit premium as it wouldn't change across nodes or relayers
*/
TornadoFeeOracleV6.prototype.getGasLimit = function (tx, type, bumpPercent) {
if (type === void 0) { type = 'other'; }
if (bumpPercent === void 0) { bumpPercent = 10; }
return __awaiter(this, void 0, void 0, function () {
var fetchedGasLimit;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!tx || Object.keys(tx).length === 0)
return [2 /*return*/, this.fallbackFeeOracle.getGasLimit(tx, type, bumpPercent)];
return [4 /*yield*/, this.provider.estimateGas(tx)];
case 1:
fetchedGasLimit = _a.sent();
return [2 /*return*/, (0, utils_1.bump)(fetchedGasLimit, bumpPercent).toNumber()];
}
});
});
};
/**
* Apply static 30% gasPrice premium for EIP-1559 enabled networks
*
* Because Tornado Transactions are censored from block builders
* it would take some time to be confirmed after when the transaction is broadcasted.
*
* We apply 30% premium and 56% overall premium to combat basefee spike
* (Can spike 12.5% per block accoring to the EIP-1559 metrics https://metamask.io/1559/)
*/
TornadoFeeOracleV6.prototype.getGasPriceParams = function (speed, bumpPercent) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
if (this.overrideGasPrice) {
return [2 /*return*/, this.overrideGasPrice];
}
if (typeof bumpPercent === 'undefined') {
bumpPercent = this.chainId === config_1.ChainId.BSC ? undefined : 30;
}
return [2 /*return*/, _super.prototype.getGasPriceParams.call(this, speed, bumpPercent)];
});
});
};
/**
* Apply 20% premium from the calculated fee from UI, applies 5% fee from relayer to prevent arbitrage from refund
*/
TornadoFeeOracleV6.prototype.calculateWithdrawalFeeViaRelayer = function (params) {
return __awaiter(this, void 0, void 0, function () {
var fees, premium;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, _super.prototype.calculateWithdrawalFeeViaRelayer.call(this, params)];
case 1:
fees = _a.sent();
premium = params.premium || (params.txType === 'user_withdrawal' ? 20 : 5);
return [2 /*return*/, (0, utils_1.bump)(fees, premium).toHexString()];
}
});
});
};
return TornadoFeeOracleV6;
}(feeOracle_1.TornadoFeeOracle));
exports.TornadoFeeOracleV6 = TornadoFeeOracleV6;
//# sourceMappingURL=feeOracleV6.js.map

1
lib/feeOracleV6.js.map Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"feeOracleV6.js","sourceRoot":"","sources":["../src/feeOracleV6.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAmC;AACnC,yCAA+C;AAU/C,iCAA+B;AAC/B,6CAAmD;AAEnD;;;;GAIG;AACH;IAAwC,sCAAgB;IAKtD,4BAAmB,OAAe,EAAE,MAAc,EAAE,gBAAiC;QAArF,YACE,kBAAM,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,SAI1B;QAFC,KAAI,CAAC,iBAAiB,GAAG,IAAI,gCAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACjE,KAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;;IAC3C,CAAC;IAED;;OAEG;IACG,wCAAW,GAAjB,UAAkB,EAAoB,EAAE,IAAsB,EAAE,WAAwB;QAAhD,qBAAA,EAAA,cAAsB;QAAE,4BAAA,EAAA,gBAAwB;;;;;;wBACtF,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC;4BAAE,sBAAO,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,EAAC;wBAElF,qBAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,EAAA;;wBAArD,eAAe,GAAG,SAAmC;wBAC3D,sBAAO,IAAA,YAAI,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC,QAAQ,EAAE,EAAC;;;;KACtD;IAED;;;;;;;;OAQG;IACG,8CAAiB,GAAvB,UAAwB,KAAyB,EAAE,WAAoB;;;gBACrE,IAAI,IAAI,CAAC,gBAAgB,EAAE;oBACzB,sBAAO,IAAI,CAAC,gBAAgB,EAAC;iBAC9B;gBACD,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE;oBACtC,WAAW,GAAG,IAAI,CAAC,OAAO,KAAK,gBAAO,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;iBAC7D;gBACD,sBAAO,iBAAM,iBAAiB,YAAC,KAAK,EAAE,WAAW,CAAC,EAAC;;;KACpD;IAED;;OAEG;IACG,6DAAgC,GAAtC,UACE,MAA8D;;;;;4BAEjD,qBAAM,iBAAM,gCAAgC,YAAC,MAAM,CAAC,EAAA;;wBAA3D,IAAI,GAAG,SAAoD;wBAE3D,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;wBAEjF,sBAAO,IAAA,YAAI,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,EAAC;;;;KAC1C;IACH,yBAAC;AAAD,CAAC,AArDD,CAAwC,4BAAgB,GAqDvD;AArDY,gDAAkB"}

4
lib/index.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
export * from './feeOracleV4';
export * from './feeOracleV5';
export * from './feeOracleV6';
export * from './tokenPriceOracle';

21
lib/index.js Normal file
View File

@@ -0,0 +1,21 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./feeOracleV4"), exports);
__exportStar(require("./feeOracleV5"), exports);
__exportStar(require("./feeOracleV6"), exports);
__exportStar(require("./tokenPriceOracle"), exports);
//# sourceMappingURL=index.js.map

1
lib/index.js.map Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,qDAAmC"}

29
lib/tokenPriceOracle.d.ts vendored Normal file
View File

@@ -0,0 +1,29 @@
import { ITornadoPriceOracle, Token, TokenPrices } from './types';
import { ChainId } from './config';
export declare class TokenPriceOracle implements ITornadoPriceOracle {
private tokens;
private defaultTokenPrices;
private oracle;
private multiCall;
private 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, tokens?: Token[], defaultTokenPrices?: TokenPrices, chainId?: ChainId);
get defaultPrices(): TokenPrices;
/**
* Prepare data for MultiCall contract
* @param {Token[]} [tokens] Tokens array
* @returns Valid structure to provide to MultiCall contract
*/
private prepareCallData;
/**
* 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
*/
fetchPrices(tokens?: Token[]): Promise<TokenPrices>;
}

161
lib/tokenPriceOracle.js Normal file
View File

@@ -0,0 +1,161 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TokenPriceOracle = void 0;
var factories_1 = require("./contracts/factories");
var ethers_1 = require("ethers");
var utils_1 = require("ethers/lib/utils");
var tornado_config_1 = require("@tornado/tornado-config");
var config_1 = require("./config");
/**
* 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) {
var ethInstances = Object.values(instances[config_1.ChainId.MAINNET]);
return ethInstances.filter(function (tokenInstance) { return !!tokenInstance.tokenAddress; });
}
var tornToken = {
tokenAddress: '0x77777FeDdddFfC19Ff86DB637967013e6C6A116C',
symbol: 'torn',
decimals: 18,
};
var tornadoTokens = __spreadArray([tornToken], filterTokensFromTornadoInstances(tornado_config_1.instances), true);
var defaultTornadoTokenPrices = {
torn: '1689423546359032',
dai: '598416104472725',
cdai: '13384388487019',
usdc: '599013776676721',
usdt: '599323410893614',
wbtc: '15659889148334216720',
};
var TokenPriceOracle = /** @class */ (function () {
/**
* 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
*/
function TokenPriceOracle(rpcUrl, tokens, defaultTokenPrices, chainId) {
if (tokens === void 0) { tokens = tornadoTokens; }
if (defaultTokenPrices === void 0) { defaultTokenPrices = defaultTornadoTokenPrices; }
this.tokens = tokens;
this.defaultTokenPrices = defaultTokenPrices;
this.provider = new ethers_1.ethers.providers.JsonRpcProvider(rpcUrl);
this.oracle = (0, factories_1.getOffchainOracleContract)(this.provider, chainId);
this.multiCall = (0, factories_1.getMultiCallContract)(this.provider);
}
Object.defineProperty(TokenPriceOracle.prototype, "defaultPrices", {
// Instant return default token prices
get: function () {
return this.defaultTokenPrices;
},
enumerable: false,
configurable: true
});
/**
* Prepare data for MultiCall contract
* @param {Token[]} [tokens] Tokens array
* @returns Valid structure to provide to MultiCall contract
*/
TokenPriceOracle.prototype.prepareCallData = function (tokens) {
var _this = this;
if (tokens === void 0) { tokens = this.tokens; }
return tokens.map(function (token) { return ({
target: _this.oracle.address,
allowFailure: true,
callData: _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
*/
TokenPriceOracle.prototype.fetchPrices = function (tokens) {
if (tokens === void 0) { tokens = this.tokens; }
return __awaiter(this, void 0, void 0, function () {
var callData, results, prices, i, tokenSymbol, decodedRate, tokenDecimals, ethDecimals, price, e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
if (!(tokens === null || tokens === void 0 ? void 0 : tokens.length))
return [2 /*return*/, {}];
callData = this.prepareCallData(tokens);
return [4 /*yield*/, this.multiCall.callStatic.aggregate3(callData)];
case 1:
results = _a.sent();
prices = {};
for (i = 0; i < results.length; i++) {
tokenSymbol = tokens[i].symbol.toLowerCase();
if (!results[i].success) {
if (this.defaultTokenPrices[tokenSymbol])
prices[tokenSymbol] = this.defaultTokenPrices[tokenSymbol];
continue;
}
decodedRate = utils_1.defaultAbiCoder.decode(['uint256'], results[i].returnData).toString();
tokenDecimals = ethers_1.BigNumber.from(10).pow(tokens[i].decimals);
ethDecimals = ethers_1.BigNumber.from(10).pow(18);
price = ethers_1.BigNumber.from(decodedRate).mul(tokenDecimals).div(ethDecimals);
prices[tokenSymbol] = price.toString();
}
return [2 /*return*/, prices];
case 2:
e_1 = _a.sent();
console.error('Cannot get token prices, return default: ' + e_1);
return [2 /*return*/, this.defaultTokenPrices];
case 3: return [2 /*return*/];
}
});
});
};
return TokenPriceOracle;
}());
exports.TokenPriceOracle = TokenPriceOracle;
//# sourceMappingURL=tokenPriceOracle.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"tokenPriceOracle.js","sourceRoot":"","sources":["../src/tokenPriceOracle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,mDAAwF;AAExF,iCAA2C;AAC3C,0CAAmD;AACnD,0DAA+D;AAC/D,mCAAmC;AAEnC;;;;GAIG;AACH,SAAS,gCAAgC,CAAC,SAAoB;IAC5D,IAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,gBAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/D,OAAO,YAAY,CAAC,MAAM,CAAC,UAAC,aAAa,IAAK,OAAA,CAAC,CAAC,aAAa,CAAC,YAAY,EAA5B,CAA4B,CAAY,CAAC;AACzF,CAAC;AAED,IAAM,SAAS,GAAU;IACvB,YAAY,EAAE,4CAA4C;IAC1D,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,EAAE;CACb,CAAC;AACF,IAAM,aAAa,kBAAI,SAAS,GAAK,gCAAgC,CAAC,0BAAS,CAAC,OAAC,CAAC;AAElF,IAAM,yBAAyB,GAAgB;IAC7C,IAAI,EAAE,kBAAkB;IACxB,GAAG,EAAE,iBAAiB;IACtB,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,sBAAsB;CAC7B,CAAC;AAEF;IAKE;;;;;OAKG;IACH,0BACE,MAAc,EACN,MAA+B,EAC/B,kBAA2D,EACnE,OAAiB;QAFT,uBAAA,EAAA,sBAA+B;QAC/B,mCAAA,EAAA,8CAA2D;QAD3D,WAAM,GAAN,MAAM,CAAyB;QAC/B,uBAAkB,GAAlB,kBAAkB,CAAyC;QAGnE,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAM,CAAC,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAC7D,IAAI,CAAC,MAAM,GAAG,IAAA,qCAAyB,EAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS,GAAG,IAAA,gCAAoB,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC;IAGD,sBAAI,2CAAa;QADjB,sCAAsC;aACtC;YACE,OAAO,IAAI,CAAC,kBAAkB,CAAC;QACjC,CAAC;;;OAAA;IAED;;;;OAIG;IACK,0CAAe,GAAvB,UAAwB,MAA6B;QAArD,iBAMC;QANuB,uBAAA,EAAA,SAAkB,IAAI,CAAC,MAAM;QACnD,OAAO,MAAM,CAAC,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,CAAC;YAC5B,MAAM,EAAE,KAAI,CAAC,MAAM,CAAC,OAAO;YAC3B,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,KAAI,CAAC,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;SAC/F,CAAC,EAJ2B,CAI3B,CAAC,CAAC;IACN,CAAC;IAED;;;;OAIG;IACG,sCAAW,GAAjB,UAAkB,MAA6B;QAA7B,uBAAA,EAAA,SAAkB,IAAI,CAAC,MAAM;;;;;;;wBAE3C,IAAI,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,CAAA;4BAAE,sBAAO,EAAE,EAAC;wBAEzB,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;wBAC9B,qBAAM,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAA;;wBAA9D,OAAO,GAAG,SAAoD;wBAC9D,MAAM,GAAgB,EAAE,CAAC;wBAE/B,KAAS,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;4BACjC,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAiB,CAAC;4BAClE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE;gCACvB,IAAI,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC;oCAAE,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;gCACrG,SAAS;6BACV;4BAEK,WAAW,GAAG,uBAAe,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC;4BACpF,aAAa,GAAG,kBAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;4BAC3D,WAAW,GAAG,kBAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;4BACzC,KAAK,GAAG,kBAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;4BAC9E,MAAM,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;yBACxC;wBACD,sBAAO,MAAM,EAAC;;;wBAEd,OAAO,CAAC,KAAK,CAAC,2CAA2C,GAAG,GAAC,CAAC,CAAC;wBAC/D,sBAAO,IAAI,CAAC,kBAAkB,EAAC;;;;;KAElC;IACH,uBAAC;AAAD,CAAC,AAxED,IAwEC;AAxEY,4CAAgB"}

92
lib/types.d.ts vendored Normal file
View File

@@ -0,0 +1,92 @@
import { BigNumberish, BytesLike } from 'ethers';
import { AvailableTokenSymbols } from '@tornado/tornado-config';
import { InstanceTokenSymbol } from './config';
export type HexadecimalStringifiedNumber = string;
export type LegacyGasPriceKey = 'instant' | 'fast' | 'standard' | 'low';
export type GasPriceParams = {
gasPrice: string;
} | {
maxFeePerGas: string;
maxPriorityFeePerGas: string;
};
export type LegacyGasPrices = {
[gasPriceType in LegacyGasPriceKey]: number;
};
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<GetGasParamsRes>;
getGas: (params?: GetGasInput) => Promise<HexadecimalStringifiedNumber>;
getGasPriceParams: (speed?: LegacyGasPriceKey, bumpPercent?: number) => Promise<GasPriceParams>;
getGasPrice: (speed?: LegacyGasPriceKey, bumpPercent?: number) => Promise<HexadecimalStringifiedNumber>;
getGasLimit: (tx?: TransactionData, type?: TxType, bumpPercent?: number) => Promise<number>;
fetchL1OptimismFee: (tx?: TransactionData) => Promise<HexadecimalStringifiedNumber>;
calculateRefundInETH: (gasPrice: BigNumberish, tokenSymbol: InstanceTokenSymbol) => HexadecimalStringifiedNumber;
fetchRefundInETH: (tokenSymbol: InstanceTokenSymbol) => Promise<HexadecimalStringifiedNumber>;
calculateRefundInToken: (gasPrice: BigNumberish, tokenPriceInEth: BigNumberish, tokenDecimals: HexadecimalStringifiedNumber | number, tokenSymbol: InstanceTokenSymbol) => HexadecimalStringifiedNumber;
calculateWithdrawalFeeViaRelayer: (params: GetWithdrawalFeeViaRelayerInput) => Promise<HexadecimalStringifiedNumber>;
}
export interface ITornadoPriceOracle {
defaultPrices: TokenPrices;
fetchPrices: (tokens?: Token[]) => Promise<TokenPrices>;
}
export type WithdrawalData = {
contract: string;
proof: BytesLike;
args: [BytesLike, BytesLike, string, string, BigNumberish, BigNumberish];
};
export type TornadoPoolInstance = {
currency: AvailableTokenSymbols;
amount: number;
decimals: number;
};
export type TokenSymbol = 'dai' | 'cdai' | 'usdc' | 'usdt' | 'wbtc' | 'torn';
export type Token = {
tokenAddress: string;
symbol: TokenSymbol;
decimals: number;
};
export type TokenPrices = {
[tokenSymbol in TokenSymbol]?: BigNumberish;
};
export type GetGasParamsRes = {
gasLimit: number;
gasPrice: HexadecimalStringifiedNumber;
};
export type GetGasInput = {
txType?: TxType;
tx?: TransactionData;
predefinedGasPrice?: HexadecimalStringifiedNumber;
predefinedGasLimit?: number;
bumpGasLimitPercent?: number;
bumpGasPricePercent?: number;
speed?: LegacyGasPriceKey;
};
export type GetGasParamsInput = GetGasInput & {
includeL1FeeToGasLimit?: boolean;
};
export type GetWithdrawalFeeViaRelayerInput = {
txType: WithdrawalTxType;
tx?: TransactionData;
relayerFeePercent: number | string;
currency: AvailableTokenSymbols | Uppercase<AvailableTokenSymbols>;
amount: string | number;
decimals: string | number;
refundInEth?: HexadecimalStringifiedNumber;
tokenPriceInEth?: HexadecimalStringifiedNumber | string;
predefinedGasPrice?: HexadecimalStringifiedNumber;
predefinedGasLimit?: number;
};

3
lib/types.js Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

1
lib/types.js.map Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}

7
lib/utils.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
import { GasPriceParams, TransactionData } from './types';
import { BigNumber, BigNumberish } from 'ethers';
export declare function serializeTx(tx?: TransactionData | string): string;
export declare function calculateGasPriceInWei(gasPrice: GasPriceParams): BigNumber;
export declare function bump(value: BigNumberish, percent: number): BigNumber;
export declare function fromGweiToWeiHex(value: number | string): BigNumberish;
export declare function convertETHToToken(amountInWEI: BigNumberish, tokenDecimals: number | string, tokenPriceInWei: BigNumberish): BigNumber;

43
lib/utils.js Normal file
View File

@@ -0,0 +1,43 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertETHToToken = exports.fromGweiToWeiHex = exports.bump = exports.calculateGasPriceInWei = exports.serializeTx = void 0;
var transactions_1 = require("@ethersproject/transactions");
var ethers_1 = require("ethers");
var bignumber_js_1 = __importDefault(require("bignumber.js"));
bignumber_js_1.default.config({ EXPONENTIAL_AT: 100 });
var GWEI = 1e9;
function serializeTx(tx) {
if (!tx)
tx = '0x';
if (typeof tx === 'string')
return tx;
return (0, transactions_1.serialize)(tx);
}
exports.serializeTx = serializeTx;
function calculateGasPriceInWei(gasPrice) {
// @ts-ignore
return ethers_1.BigNumber.from(gasPrice.gasPrice || gasPrice.maxFeePerGas);
}
exports.calculateGasPriceInWei = calculateGasPriceInWei;
function bump(value, percent) {
var hundredPercents = (0, bignumber_js_1.default)(100);
return ethers_1.BigNumber.from((0, bignumber_js_1.default)(ethers_1.BigNumber.from(value).toHexString())
.times(hundredPercents.plus((0, bignumber_js_1.default)(percent)))
.div(hundredPercents)
.decimalPlaces(0, 1)
.toString());
}
exports.bump = bump;
function fromGweiToWeiHex(value) {
return ethers_1.BigNumber.from((0, bignumber_js_1.default)(value).times(GWEI).toString()).toHexString();
}
exports.fromGweiToWeiHex = fromGweiToWeiHex;
function convertETHToToken(amountInWEI, tokenDecimals, tokenPriceInWei) {
var tokenDecimalsMultiplier = ethers_1.BigNumber.from(10).pow(tokenDecimals);
return ethers_1.BigNumber.from(amountInWEI).mul(tokenDecimalsMultiplier).div(tokenPriceInWei);
}
exports.convertETHToToken = convertETHToToken;
//# sourceMappingURL=utils.js.map

1
lib/utils.js.map Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAwD;AAExD,iCAAiD;AACjD,8DAA0C;AAC1C,sBAAc,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;AAE/C,IAAM,IAAI,GAAG,GAAG,CAAC;AAEjB,SAAgB,WAAW,CAAC,EAA6B;IACvD,IAAI,CAAC,EAAE;QAAE,EAAE,GAAG,IAAI,CAAC;IACnB,IAAI,OAAO,EAAE,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEtC,OAAO,IAAA,wBAAS,EAAC,EAAE,CAAC,CAAC;AACvB,CAAC;AALD,kCAKC;AAED,SAAgB,sBAAsB,CAAC,QAAwB;IAC7D,aAAa;IACb,OAAO,kBAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAC;AACpE,CAAC;AAHD,wDAGC;AAED,SAAgB,IAAI,CAAC,KAAmB,EAAE,OAAe;IACvD,IAAM,eAAe,GAAG,IAAA,sBAAc,EAAC,GAAG,CAAC,CAAC;IAE5C,OAAO,kBAAS,CAAC,IAAI,CACnB,IAAA,sBAAc,EAAC,kBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;SAChD,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,IAAA,sBAAc,EAAC,OAAO,CAAC,CAAC,CAAC;SACpD,GAAG,CAAC,eAAe,CAAC;SACpB,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC;SACnB,QAAQ,EAAE,CACd,CAAC;AACJ,CAAC;AAVD,oBAUC;AAED,SAAgB,gBAAgB,CAAC,KAAsB;IACrD,OAAO,kBAAS,CAAC,IAAI,CAAC,IAAA,sBAAc,EAAC,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AACpF,CAAC;AAFD,4CAEC;AAED,SAAgB,iBAAiB,CAC/B,WAAyB,EACzB,aAA8B,EAC9B,eAA6B;IAE7B,IAAM,uBAAuB,GAAG,kBAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACtE,OAAO,kBAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AACvF,CAAC;AAPD,8CAOC"}

View File

@@ -1,6 +1,6 @@
{
"name": "@tornado/tornado-oracles",
"version": "4.0.0",
"version": "3.4.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": "typechain --target ethers-v6 --out-dir src/contracts ./abis/*.json",
"build:abi": "yarn typechain --target ethers-v5 --out-dir src/contracts ./abis/*.abi.json",
"test": "echo \"Error: no test specified\" && exit 1",
"prepare": "npm run build && npm run build:esm",
"prepublish": "npm run prettier:fix"
@@ -29,16 +29,18 @@
"author": "Theo",
"license": "MIT",
"dependencies": {
"ethers": "^6.4.0"
"@tornado/tornado-config": "^2.0.0",
"@types/node": "^20.5.1",
"bignumber.js": "^9.1.1",
"ethers": "5.7"
},
"devDependencies": {
"@types/node": "^20.5.1",
"@typechain/ethers-v6": "^0.5.1",
"@typechain/ethers-v5": "^11.1.1",
"nodemon": "^3.0.1",
"prettier": "^3.0.1",
"ts-node": "^10.9.1",
"typechain": "^8.3.2",
"typescript": "^5.4.4"
"typechain": "^8.3.1",
"typescript": "^5.1.6"
},
"files": [
"lib/**/*"

115
src/config.ts Normal file
View File

@@ -0,0 +1,115 @@
import { LegacyGasPrices } from './types';
export enum ChainId {
MAINNET = 1,
GOERLI = 5,
BSC = 56,
XDAI = 100,
POLYGON = 137,
OPTIMISM = 10,
ARBITRUM = 42161,
AVAX = 43114,
SEPOLIA = 11155111,
}
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,
},
[ChainId.SEPOLIA]: {
instant: 80,
fast: 50,
standard: 25,
low: 8,
},
};
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,
[ChainId.SEPOLIA]: 550000,
};
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 = '0x00000000000D6FFc74A8feb35aF5827bf57f6786';
export const sepoliaOffchainOracleAddress = '0x1f89EAF03E5b260Bc6D4Ae3c3334b1B750F3e127';
export const multiCallAddress = '0xcA11bde05977b3631167028862bE2a173976CA11';

View File

@@ -1,18 +0,0 @@
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';

View File

@@ -1,271 +0,0 @@
/* 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<this>;
interface: GasPriceOracleInterface;
queryFilter<TCEvent extends TypedContractEvent>(
event: TCEvent,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;
queryFilter<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;
on<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
on<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;
listeners<TCEvent extends TypedContractEvent>(
event: TCEvent
): Promise<Array<TypedListener<TCEvent>>>;
listeners(eventName?: string): Promise<Array<Listener>>;
removeAllListeners<TCEvent extends TypedContractEvent>(
event?: TCEvent
): Promise<this>;
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<T extends ContractMethod = ContractMethod>(
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: {};
}

View File

@@ -1,416 +0,0 @@
/* 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<this>;
interface: MulticallInterface;
queryFilter<TCEvent extends TypedContractEvent>(
event: TCEvent,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;
queryFilter<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;
on<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
on<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;
listeners<TCEvent extends TypedContractEvent>(
event: TCEvent
): Promise<Array<TypedListener<TCEvent>>>;
listeners(eventName?: string): Promise<Array<Listener>>;
removeAllListeners<TCEvent extends TypedContractEvent>(
event?: TCEvent
): Promise<this>;
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<T extends ContractMethod = ContractMethod>(
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: {};
}

View File

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

View File

@@ -1,622 +0,0 @@
/* 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<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
export namespace ConnectorRemovedEvent {
export type InputTuple = [connector: AddressLike];
export type OutputTuple = [connector: string];
export interface OutputObject {
connector: string;
}
export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
export namespace MultiWrapperUpdatedEvent {
export type InputTuple = [multiWrapper: AddressLike];
export type OutputTuple = [multiWrapper: string];
export interface OutputObject {
multiWrapper: string;
}
export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
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<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
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<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
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<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
export interface OffchainOracle extends BaseContract {
connect(runner?: ContractRunner | null): OffchainOracle;
waitForDeployment(): Promise<this>;
interface: OffchainOracleInterface;
queryFilter<TCEvent extends TypedContractEvent>(
event: TCEvent,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;
queryFilter<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;
on<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
on<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;
listeners<TCEvent extends TypedContractEvent>(
event: TCEvent
): Promise<Array<TypedListener<TCEvent>>>;
listeners(eventName?: string): Promise<Array<Listener>>;
removeAllListeners<TCEvent extends TypedContractEvent>(
event?: TCEvent
): Promise<this>;
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<T extends ContractMethod = ContractMethod>(
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
>;
};
}

View File

@@ -0,0 +1,368 @@
/* 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<ConnectorAddedEvent>;
export interface ConnectorRemovedEventObject {
connector: string;
}
export type ConnectorRemovedEvent = TypedEvent<[string], ConnectorRemovedEventObject>;
export type ConnectorRemovedEventFilter = TypedEventFilter<ConnectorRemovedEvent>;
export interface MultiWrapperUpdatedEventObject {
multiWrapper: string;
}
export type MultiWrapperUpdatedEvent = TypedEvent<[string], MultiWrapperUpdatedEventObject>;
export type MultiWrapperUpdatedEventFilter = TypedEventFilter<MultiWrapperUpdatedEvent>;
export interface OracleAddedEventObject {
oracle: string;
oracleType: number;
}
export type OracleAddedEvent = TypedEvent<[string, number], OracleAddedEventObject>;
export type OracleAddedEventFilter = TypedEventFilter<OracleAddedEvent>;
export interface OracleRemovedEventObject {
oracle: string;
oracleType: number;
}
export type OracleRemovedEvent = TypedEvent<[string, number], OracleRemovedEventObject>;
export type OracleRemovedEventFilter = TypedEventFilter<OracleRemovedEvent>;
export interface OwnershipTransferredEventObject {
previousOwner: string;
newOwner: string;
}
export type OwnershipTransferredEvent = TypedEvent<[string, string], OwnershipTransferredEventObject>;
export type OwnershipTransferredEventFilter = TypedEventFilter<OwnershipTransferredEvent>;
export interface OffchainOracleAbi extends BaseContract {
connect(signerOrProvider: Signer | Provider | string): this;
attach(addressOrName: string): this;
deployed(): Promise<this>;
interface: OffchainOracleAbiInterface;
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined,
): Promise<Array<TEvent>>;
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
listeners(eventName?: string): Array<Listener>;
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this;
removeAllListeners(eventName?: string): this;
off: OnEvent<this>;
on: OnEvent<this>;
once: OnEvent<this>;
removeListener: OnEvent<this>;
functions: {
addConnector(connector: string, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
addOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: Overrides & { from?: string },
): Promise<ContractTransaction>;
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<ContractTransaction>;
removeOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: Overrides & { from?: string },
): Promise<ContractTransaction>;
renounceOwnership(overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
setMultiWrapper(_multiWrapper: string, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
};
addConnector(connector: string, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
addOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: Overrides & { from?: string },
): Promise<ContractTransaction>;
connectors(overrides?: CallOverrides): Promise<string[]>;
getRate(srcToken: string, dstToken: string, useWrappers: boolean, overrides?: CallOverrides): Promise<BigNumber>;
getRateToEth(srcToken: string, useSrcWrappers: boolean, overrides?: CallOverrides): Promise<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<ContractTransaction>;
removeOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: Overrides & { from?: string },
): Promise<ContractTransaction>;
renounceOwnership(overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
setMultiWrapper(_multiWrapper: string, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
callStatic: {
addConnector(connector: string, overrides?: CallOverrides): Promise<void>;
addOracle(oracle: string, oracleKind: BigNumberish, overrides?: CallOverrides): Promise<void>;
connectors(overrides?: CallOverrides): Promise<string[]>;
getRate(srcToken: string, dstToken: string, useWrappers: boolean, overrides?: CallOverrides): Promise<BigNumber>;
getRateToEth(srcToken: string, useSrcWrappers: boolean, overrides?: CallOverrides): Promise<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?: CallOverrides): Promise<void>;
removeOracle(oracle: string, oracleKind: BigNumberish, overrides?: CallOverrides): Promise<void>;
renounceOwnership(overrides?: CallOverrides): Promise<void>;
setMultiWrapper(_multiWrapper: string, overrides?: CallOverrides): Promise<void>;
transferOwnership(newOwner: string, overrides?: CallOverrides): Promise<void>;
};
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<BigNumber>;
addOracle(oracle: string, oracleKind: BigNumberish, overrides?: Overrides & { from?: string }): Promise<BigNumber>;
connectors(overrides?: CallOverrides): Promise<BigNumber>;
getRate(srcToken: string, dstToken: string, useWrappers: boolean, overrides?: CallOverrides): Promise<BigNumber>;
getRateToEth(srcToken: string, useSrcWrappers: boolean, overrides?: CallOverrides): Promise<BigNumber>;
multiWrapper(overrides?: CallOverrides): Promise<BigNumber>;
oracles(overrides?: CallOverrides): Promise<BigNumber>;
owner(overrides?: CallOverrides): Promise<BigNumber>;
removeConnector(connector: string, overrides?: Overrides & { from?: string }): Promise<BigNumber>;
removeOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: Overrides & { from?: string },
): Promise<BigNumber>;
renounceOwnership(overrides?: Overrides & { from?: string }): Promise<BigNumber>;
setMultiWrapper(_multiWrapper: string, overrides?: Overrides & { from?: string }): Promise<BigNumber>;
transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise<BigNumber>;
};
populateTransaction: {
addConnector(connector: string, overrides?: Overrides & { from?: string }): Promise<PopulatedTransaction>;
addOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: Overrides & { from?: string },
): Promise<PopulatedTransaction>;
connectors(overrides?: CallOverrides): Promise<PopulatedTransaction>;
getRate(
srcToken: string,
dstToken: string,
useWrappers: boolean,
overrides?: CallOverrides,
): Promise<PopulatedTransaction>;
getRateToEth(srcToken: string, useSrcWrappers: boolean, overrides?: CallOverrides): Promise<PopulatedTransaction>;
multiWrapper(overrides?: CallOverrides): Promise<PopulatedTransaction>;
oracles(overrides?: CallOverrides): Promise<PopulatedTransaction>;
owner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
removeConnector(connector: string, overrides?: Overrides & { from?: string }): Promise<PopulatedTransaction>;
removeOracle(
oracle: string,
oracleKind: BigNumberish,
overrides?: Overrides & { from?: string },
): Promise<PopulatedTransaction>;
renounceOwnership(overrides?: Overrides & { from?: string }): Promise<PopulatedTransaction>;
setMultiWrapper(_multiWrapper: string, overrides?: Overrides & { from?: string }): Promise<PopulatedTransaction>;
transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise<PopulatedTransaction>;
};
}

View File

@@ -1,460 +0,0 @@
/* 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<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
export namespace GasPriceUpdatedEvent {
export type InputTuple = [arg0: BigNumberish];
export type OutputTuple = [arg0: bigint];
export interface OutputObject {
arg0: bigint;
}
export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
export namespace L1BaseFeeUpdatedEvent {
export type InputTuple = [arg0: BigNumberish];
export type OutputTuple = [arg0: bigint];
export interface OutputObject {
arg0: bigint;
}
export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
export namespace OverheadUpdatedEvent {
export type InputTuple = [arg0: BigNumberish];
export type OutputTuple = [arg0: bigint];
export interface OutputObject {
arg0: bigint;
}
export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
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<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
export namespace ScalarUpdatedEvent {
export type InputTuple = [arg0: BigNumberish];
export type OutputTuple = [arg0: bigint];
export interface OutputObject {
arg0: bigint;
}
export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
export interface OptimismL1FeeOracle extends BaseContract {
connect(runner?: ContractRunner | null): OptimismL1FeeOracle;
waitForDeployment(): Promise<this>;
interface: OptimismL1FeeOracleInterface;
queryFilter<TCEvent extends TypedContractEvent>(
event: TCEvent,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;
queryFilter<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;
on<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
on<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;
listeners<TCEvent extends TypedContractEvent>(
event: TCEvent
): Promise<Array<TypedListener<TCEvent>>>;
listeners(eventName?: string): Promise<Array<Listener>>;
removeAllListeners<TCEvent extends TypedContractEvent>(
event?: TCEvent
): Promise<this>;
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<T extends ContractMethod = ContractMethod>(
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
>;
};
}

View File

@@ -0,0 +1,352 @@
/* 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<DecimalsUpdatedEvent>;
export interface GasPriceUpdatedEventObject {
arg0: BigNumber;
}
export type GasPriceUpdatedEvent = TypedEvent<[BigNumber], GasPriceUpdatedEventObject>;
export type GasPriceUpdatedEventFilter = TypedEventFilter<GasPriceUpdatedEvent>;
export interface L1BaseFeeUpdatedEventObject {
arg0: BigNumber;
}
export type L1BaseFeeUpdatedEvent = TypedEvent<[BigNumber], L1BaseFeeUpdatedEventObject>;
export type L1BaseFeeUpdatedEventFilter = TypedEventFilter<L1BaseFeeUpdatedEvent>;
export interface OverheadUpdatedEventObject {
arg0: BigNumber;
}
export type OverheadUpdatedEvent = TypedEvent<[BigNumber], OverheadUpdatedEventObject>;
export type OverheadUpdatedEventFilter = TypedEventFilter<OverheadUpdatedEvent>;
export interface OwnershipTransferredEventObject {
previousOwner: string;
newOwner: string;
}
export type OwnershipTransferredEvent = TypedEvent<[string, string], OwnershipTransferredEventObject>;
export type OwnershipTransferredEventFilter = TypedEventFilter<OwnershipTransferredEvent>;
export interface ScalarUpdatedEventObject {
arg0: BigNumber;
}
export type ScalarUpdatedEvent = TypedEvent<[BigNumber], ScalarUpdatedEventObject>;
export type ScalarUpdatedEventFilter = TypedEventFilter<ScalarUpdatedEvent>;
export interface OptimismL1FeeOracleAbi extends BaseContract {
connect(signerOrProvider: Signer | Provider | string): this;
attach(addressOrName: string): this;
deployed(): Promise<this>;
interface: OptimismL1FeeOracleAbiInterface;
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined,
): Promise<Array<TEvent>>;
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
listeners(eventName?: string): Array<Listener>;
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this;
removeAllListeners(eventName?: string): this;
off: OnEvent<this>;
on: OnEvent<this>;
once: OnEvent<this>;
removeListener: OnEvent<this>;
functions: {
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<ContractTransaction>;
scalar(overrides?: CallOverrides): Promise<[BigNumber]>;
setDecimals(_decimals: BigNumberish, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
setGasPrice(_gasPrice: BigNumberish, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
setL1BaseFee(_baseFee: BigNumberish, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
setOverhead(_overhead: BigNumberish, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
setScalar(_scalar: BigNumberish, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
};
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<ContractTransaction>;
scalar(overrides?: CallOverrides): Promise<BigNumber>;
setDecimals(_decimals: BigNumberish, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
setGasPrice(_gasPrice: BigNumberish, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
setL1BaseFee(_baseFee: BigNumberish, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
setOverhead(_overhead: BigNumberish, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
setScalar(_scalar: BigNumberish, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise<ContractTransaction>;
callStatic: {
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?: CallOverrides): Promise<void>;
scalar(overrides?: CallOverrides): Promise<BigNumber>;
setDecimals(_decimals: BigNumberish, overrides?: CallOverrides): Promise<void>;
setGasPrice(_gasPrice: BigNumberish, overrides?: CallOverrides): Promise<void>;
setL1BaseFee(_baseFee: BigNumberish, overrides?: CallOverrides): Promise<void>;
setOverhead(_overhead: BigNumberish, overrides?: CallOverrides): Promise<void>;
setScalar(_scalar: BigNumberish, overrides?: CallOverrides): Promise<void>;
transferOwnership(newOwner: string, overrides?: CallOverrides): Promise<void>;
};
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<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<BigNumber>;
renounceOwnership(overrides?: Overrides & { from?: string }): Promise<BigNumber>;
scalar(overrides?: CallOverrides): Promise<BigNumber>;
setDecimals(_decimals: BigNumberish, overrides?: Overrides & { from?: string }): Promise<BigNumber>;
setGasPrice(_gasPrice: BigNumberish, overrides?: Overrides & { from?: string }): Promise<BigNumber>;
setL1BaseFee(_baseFee: BigNumberish, overrides?: Overrides & { from?: string }): Promise<BigNumber>;
setOverhead(_overhead: BigNumberish, overrides?: Overrides & { from?: string }): Promise<BigNumber>;
setScalar(_scalar: BigNumberish, overrides?: Overrides & { from?: string }): Promise<BigNumber>;
transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise<BigNumber>;
};
populateTransaction: {
decimals(overrides?: CallOverrides): Promise<PopulatedTransaction>;
gasPrice(overrides?: CallOverrides): Promise<PopulatedTransaction>;
getL1Fee(_data: BytesLike, overrides?: CallOverrides): Promise<PopulatedTransaction>;
getL1GasUsed(_data: BytesLike, overrides?: CallOverrides): Promise<PopulatedTransaction>;
l1BaseFee(overrides?: CallOverrides): Promise<PopulatedTransaction>;
overhead(overrides?: CallOverrides): Promise<PopulatedTransaction>;
owner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
renounceOwnership(overrides?: Overrides & { from?: string }): Promise<PopulatedTransaction>;
scalar(overrides?: CallOverrides): Promise<PopulatedTransaction>;
setDecimals(_decimals: BigNumberish, overrides?: Overrides & { from?: string }): Promise<PopulatedTransaction>;
setGasPrice(_gasPrice: BigNumberish, overrides?: Overrides & { from?: string }): Promise<PopulatedTransaction>;
setL1BaseFee(_baseFee: BigNumberish, overrides?: Overrides & { from?: string }): Promise<PopulatedTransaction>;
setOverhead(_overhead: BigNumberish, overrides?: Overrides & { from?: string }): Promise<PopulatedTransaction>;
setScalar(_scalar: BigNumberish, overrides?: Overrides & { from?: string }): Promise<PopulatedTransaction>;
transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise<PopulatedTransaction>;
};
}

View File

@@ -1,131 +1,30 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
FunctionFragment,
Typed,
EventFragment,
ContractTransaction,
ContractTransactionResponse,
DeferredTopicFilter,
EventLog,
TransactionRequest,
LogDescription,
} from "ethers";
import type { Listener } from '@ethersproject/providers';
import type { Event, EventFilter } from 'ethers';
export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent>
extends DeferredTopicFilter {}
export interface TypedContractEvent<
InputTuple extends Array<any> = any,
OutputTuple extends Array<any> = any,
OutputObject = any
> {
(...args: Partial<InputTuple>): TypedDeferredTopicFilter<
TypedContractEvent<InputTuple, OutputTuple, OutputObject>
>;
name: string;
fragment: EventFragment;
getFragment(...args: Partial<InputTuple>): EventFragment;
export interface TypedEvent<TArgsArray extends Array<any> = any, TArgsObject = any> extends Event {
args: TArgsArray & TArgsObject;
}
type __TypechainAOutputTuple<T> = T extends TypedContractEvent<
infer _U,
infer W
>
? W
: never;
type __TypechainOutputObject<T> = T extends TypedContractEvent<
infer _U,
infer _W,
infer V
>
? V
: never;
export interface TypedEventFilter<_TEvent extends TypedEvent> extends EventFilter {}
export interface TypedEventLog<TCEvent extends TypedContractEvent>
extends Omit<EventLog, "args"> {
args: __TypechainAOutputTuple<TCEvent> & __TypechainOutputObject<TCEvent>;
export interface TypedListener<TEvent extends TypedEvent> {
(...listenerArg: [...__TypechainArgsArray<TEvent>, TEvent]): void;
}
export interface TypedLogDescription<TCEvent extends TypedContractEvent>
extends Omit<LogDescription, "args"> {
args: __TypechainAOutputTuple<TCEvent> & __TypechainOutputObject<TCEvent>;
}
type __TypechainArgsArray<T> = T extends TypedEvent<infer U> ? U : never;
export type TypedListener<TCEvent extends TypedContractEvent> = (
...listenerArg: [
...__TypechainAOutputTuple<TCEvent>,
TypedEventLog<TCEvent>,
...undefined[]
]
) => void;
export interface OnEvent<TRes> {
<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>, listener: TypedListener<TEvent>): TRes;
(eventName: string, listener: Listener): TRes;
}
export type MinEthersFactory<C, ARGS> = {
deploy(...a: ARGS[]): Promise<C>;
};
export type GetContractTypeFromFactory<F> = F extends MinEthersFactory<
infer C,
any
>
? C
: never;
export type GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any>
? Parameters<F["deploy"]>
: never;
export type GetContractTypeFromFactory<F> = F extends MinEthersFactory<infer C, any> ? C : never;
export type StateMutability = "nonpayable" | "payable" | "view";
export type BaseOverrides = Omit<TransactionRequest, "to" | "data">;
export type NonPayableOverrides = Omit<
BaseOverrides,
"value" | "blockTag" | "enableCcipRead"
>;
export type PayableOverrides = Omit<
BaseOverrides,
"blockTag" | "enableCcipRead"
>;
export type ViewOverrides = Omit<TransactionRequest, "to" | "data">;
export type Overrides<S extends StateMutability> = S extends "nonpayable"
? NonPayableOverrides
: S extends "payable"
? PayableOverrides
: ViewOverrides;
export type PostfixOverrides<A extends Array<any>, S extends StateMutability> =
| A
| [...A, Overrides<S>];
export type ContractMethodArgs<
A extends Array<any>,
S extends StateMutability
> = PostfixOverrides<{ [I in keyof A]-?: A[I] | Typed }, S>;
export type DefaultReturnType<R> = R extends Array<any> ? R[0] : R;
// export interface ContractMethod<A extends Array<any> = Array<any>, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> {
export interface TypedContractMethod<
A extends Array<any> = Array<any>,
R = any,
S extends StateMutability = "payable"
> {
(...args: ContractMethodArgs<A, S>): S extends "view"
? Promise<DefaultReturnType<R>>
: Promise<ContractTransactionResponse>;
name: string;
fragment: FunctionFragment;
getFragment(...args: ContractMethodArgs<A, S>): FunctionFragment;
populateTransaction(
...args: ContractMethodArgs<A, S>
): Promise<ContractTransaction>;
staticCall(
...args: ContractMethodArgs<A, "view">
): Promise<DefaultReturnType<R>>;
send(...args: ContractMethodArgs<A, S>): Promise<ContractTransactionResponse>;
estimateGas(...args: ContractMethodArgs<A, S>): Promise<bigint>;
staticCallResult(...args: ContractMethodArgs<A, "view">): Promise<R>;
}
export type GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any> ? Parameters<F['deploy']> : never;

View File

@@ -0,0 +1,24 @@
import { OptimismL1FeeOracleAbi__factory, OffchainOracleAbi__factory, MulticallAbi__factory } from './';
import {
optimismL1FeeOracleAddress,
offchainOracleAddress,
multiCallAddress,
sepoliaOffchainOracleAddress,
} from '../config';
import { Provider } from '@ethersproject/abstract-provider';
import { ChainId } from '../config';
export const getOptimismL1FeeOracle = (provider: Provider) => {
return OptimismL1FeeOracleAbi__factory.connect(optimismL1FeeOracleAddress, provider);
};
export const getOffchainOracleContract = (provider: Provider, chainId?: ChainId) => {
if (chainId === ChainId.SEPOLIA) {
return OffchainOracleAbi__factory.connect(sepoliaOffchainOracleAddress, provider);
}
return OffchainOracleAbi__factory.connect(offchainOracleAddress, provider);
};
export const getMultiCallContract = (provider: Provider) => {
return MulticallAbi__factory.connect(multiCallAddress, provider);
};

View File

@@ -1,212 +0,0 @@
/* 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;
}
}

View File

@@ -0,0 +1,458 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, Signer, utils } from 'ethers';
import type { Provider } from '@ethersproject/providers';
import type { MulticallAbi, MulticallAbiInterface } from '../MulticallAbi';
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 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;
}
}

View File

@@ -1,457 +0,0 @@
/* 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;
}
}

View File

@@ -0,0 +1,352 @@
/* 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;
}
}

View File

@@ -1,538 +0,0 @@
/* 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;
}
}

View File

@@ -0,0 +1,316 @@
/* 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;
}
}

View File

@@ -1,325 +0,0 @@
/* 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;
}
}

View File

@@ -1,7 +1,6 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
export { GasPriceOracle__factory } from "./GasPriceOracle__factory";
export { Multicall__factory } from "./Multicall__factory";
export { OffchainOracle__factory } from "./OffchainOracle__factory";
export { OptimismL1FeeOracle__factory } from "./OptimismL1FeeOracle__factory";
export { MulticallAbi__factory } from './MulticallAbi__factory';
export { OffchainOracleAbi__factory } from './OffchainOracleAbi__factory';
export { OptimismL1FeeOracleAbi__factory } from './OptimismL1FeeOracleAbi__factory';

View File

@@ -1,12 +1,10 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
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";
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';

View File

@@ -1,116 +1,308 @@
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';
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';
const DUMMY_ADDRESS = '0x1111111111111111111111111111111111111111';
export abstract class TornadoFeeOracle implements ITornadoFeeOracle {
protected provider: JsonRpcProvider;
const DUMMY_NONCE = 1024;
const DUMMY_WITHDRAW_DATA =
'0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111';
export interface RelayerFeeParams {
gasPrice: BigNumberish;
gasLimit?: BigNumberish;
l1Fee?: BigNumberish;
denomination: BigNumberish;
ethRefund: BigNumberish;
tokenPriceInWei: BigNumberish;
tokenDecimals: number;
relayerFeePercent?: number;
isEth?: boolean;
premiumPercent?: number;
}
export class TornadoFeeOracle {
optimismL1FeeOracle?: OptimismL1FeeOracle;
constructor(netId: ChainIdType, rpcUrl: string, config: networkConfig) {
const { optimismL1FeeOracleAddress } = config;
if (optimismL1FeeOracleAddress) {
const provider = getProvider(netId, rpcUrl, config);
this.optimismL1FeeOracle = OptimismL1FeeOracle__factory.connect(optimismL1FeeOracleAddress, provider);
}
public constructor(
public version: 4 | 5 | 6,
protected chainId: ChainId,
rpcUrl: string,
) {
this.provider = new ethers.providers.JsonRpcProvider(rpcUrl);
}
/**
* Calculate L1 fee for op-stack chains
*
* This is required since relayers would pay the full transaction fees for users
* 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<HexadecimalStringifiedNumber>} Fee in WEI (MATIC), '0' if chain is not Optimism
*/
fetchL1OptimismFee(tx?: TransactionLike): Promise<bigint> {
if (!this.optimismL1FeeOracle) {
return new Promise((resolve) => resolve(BigInt(0)));
async fetchL1OptimismFee(tx?: TransactionData): Promise<HexadecimalStringifiedNumber> {
if (this.chainId != ChainId.OPTIMISM) return BigNumber.from(0).toHexString();
const optimismL1FeeOracle = getOptimismL1FeeOracle(this.provider);
const l1Fee = await optimismL1FeeOracle.getL1Fee(serializeTx(tx));
return l1Fee.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,
/**
* 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<GetGasParamsRes>} Object with fields 'gasPrice' and 'gasLimit', L1 fee, if exists, included in gasLimit
*/
async getGasParams(params: GetGasParamsInput = {}): Promise<GetGasParamsRes> {
let {
tx,
txType = 'other',
bumpGasLimitPercent,
bumpGasPricePercent,
predefinedGasLimit: gasLimit,
predefinedGasPrice: gasPrice,
speed,
includeL1FeeToGasLimit = true,
} = params;
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<HexadecimalStringifiedNumber>} Gas value in WEI (hex-format)
*/
async getGas(params: GetGasInput = {}): Promise<HexadecimalStringifiedNumber> {
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<GasPriceParams>} Estimated gas price info in WEI (hexed) - legacy object with gasPrice property or
* EIP-1559 object with maxFeePerGas and maxPriorityFeePerGas properties
* NOTICE: It is recommended to bump fees for EIP-1559 transactions, because they can bump 12.5% per block
*/
async getGasPriceParams(speed?: LegacyGasPriceKey, bumpPercent: number = 0): Promise<GasPriceParams> {
// 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 {
const [block, gasPrice, priorityFee] = await Promise.all([
this.provider.getBlock('latest'),
this.provider.getGasPrice(),
(async () => {
try {
return BigNumber.from(
(await this.provider.send('eth_maxPriorityFeePerGas', [])) || parseUnits('1.5', 'gwei'),
);
} catch {
return parseUnits('1.5', 'gwei');
}
})(),
]);
if (block?.baseFeePerGas?.gt(0)) {
const maxPriorityFeePerGas = priorityFee.toHexString();
const maxFeePerGas = bump(block.baseFeePerGas as BigNumber, bumpPercent)
.add(priorityFee)
.toHexString();
return {
maxFeePerGas,
maxPriorityFeePerGas,
};
}
return this.optimismL1FeeOracle.getL1Fee.staticCall(Transaction.from(tx).unsignedSerialized);
return {
gasPrice: bump(gasPrice, bumpPercent).toHexString(),
};
} catch (e) {
return { gasPrice: bump(fromGweiToWeiHex(defaultGasPrices[this.chainId][speed]), bumpPercent).toHexString() };
}
}
/**
* 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
* 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<HexadecimalStringifiedNumber>} Gas price in WEI (hex string)
*/
defaultEthRefund(gasPrice?: BigNumberish, gasLimit?: BigNumberish): bigint {
return (gasPrice ? BigInt(gasPrice) : parseUnits('30', 'gwei')) * BigInt(gasLimit || 1_000_000);
async getGasPrice(speed?: LegacyGasPriceKey, bumpPercent?: number): Promise<HexadecimalStringifiedNumber> {
const gasPriceParams = await this.getGasPriceParams(speed, bumpPercent);
return calculateGasPriceInWei(gasPriceParams).toHexString();
}
/**
* Calculates token amount for required ethRefund purchases required to calculate fees
* 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<number>} Gas limit
*/
calculateTokenAmount(ethRefund: BigNumberish, tokenPriceInEth: BigNumberish, tokenDecimals?: number): bigint {
return convertETHToTokenAmount(ethRefund, tokenPriceInEth, tokenDecimals);
}
abstract getGasLimit(tx?: TransactionData, type?: TxType, bumpPercent?: number): Promise<number>;
/**
* 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)
* 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.
*
* 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)
*/
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);
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';
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)
// 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';
}
// 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<HexadecimalStringifiedNumber>} Refund amount in WEI (in hex format)
*/
async fetchRefundInETH(tokenSymbol: InstanceTokenSymbol): Promise<HexadecimalStringifiedNumber> {
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<AvailableTokenSymbols>} 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<HexadecimalStringifiedNumber>} Fee in WEI (hexed string)
*/
async calculateWithdrawalFeeViaRelayer({
tx,
txType,
relayerFeePercent,
currency,
amount,
decimals,
refundInEth,
tokenPriceInEth,
predefinedGasLimit,
predefinedGasPrice,
}: GetWithdrawalFeeViaRelayerInput): Promise<HexadecimalStringifiedNumber> {
const relayerFee = this.calculateRelayerFeeInWei(relayerFeePercent, amount, decimals);
const { gasPrice, gasLimit } = await this.getGasParams({ tx, txType, predefinedGasLimit, predefinedGasPrice });
const gasCosts = BigNumber.from(gasPrice).mul(gasLimit);
const hasTokenPrice =
typeof tokenPriceInEth === 'object' && typeof (tokenPriceInEth as BigNumber)?.gt === 'function'
? Boolean((tokenPriceInEth as BigNumber).gt(0))
: Boolean(tokenPriceInEth);
if (hasTokenPrice) {
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 as BigNumberish)
.add(relayerFee)
.toHexString();
}
return BigNumber.from(gasCosts).add(relayerFee).toHexString();
}
}

28
src/feeOracleV4.ts Normal file
View File

@@ -0,0 +1,28 @@
import { defaultWithdrawalGasLimit } from './config';
import { TornadoFeeOracle } from './feeOracle';
import { ITornadoFeeOracle, TransactionData, TxType } from './types';
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) {
super(4, chainId, rpcUrl);
}
async getGasLimit(tx?: TransactionData, type: TxType = 'other', bumpPercent: number = 0): Promise<number> {
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();
}
}

56
src/feeOracleV5.ts Normal file
View File

@@ -0,0 +1,56 @@
import { ChainId } from './config';
import { TornadoFeeOracle } from './feeOracle';
import { ITornadoFeeOracle, TransactionData, TxType, LegacyGasPriceKey, GasPriceParams } from './types';
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) {
super(5, chainId, rpcUrl);
this.fallbackFeeOracle = new TornadoFeeOracleV4(chainId, rpcUrl);
}
async getGasLimit(tx?: TransactionData, type: TxType = 'other', bumpPercent: number = 20): Promise<number> {
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<GasPriceParams> {
// 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);
}
}

73
src/feeOracleV6.ts Normal file
View File

@@ -0,0 +1,73 @@
import { ChainId } from './config';
import { TornadoFeeOracle } from './feeOracle';
import {
ITornadoFeeOracle,
TransactionData,
TxType,
LegacyGasPriceKey,
GasPriceParams,
GetWithdrawalFeeViaRelayerInput,
HexadecimalStringifiedNumber,
} from './types';
import { bump } from './utils';
import { TornadoFeeOracleV5 } from './feeOracleV5';
/**
* V6 version that would cover every available networks and relayers
*
* Ported from https://git.tornado.ws/tornadocontrib/tornado-core/src/branch/main/src/fees.ts and has been verified over time
*/
export class TornadoFeeOracleV6 extends TornadoFeeOracle implements ITornadoFeeOracle {
private fallbackFeeOracle: TornadoFeeOracleV5;
// Override value for BSC (Since old relayers use static value of 3.3 gwei)
public overrideGasPrice?: GasPriceParams;
public constructor(chainId: number, rpcUrl: string, overrideGasPrice?: GasPriceParams) {
super(6, chainId, rpcUrl);
this.fallbackFeeOracle = new TornadoFeeOracleV5(chainId, rpcUrl);
this.overrideGasPrice = overrideGasPrice;
}
/**
* Apply static 10% gasLimit premium as it wouldn't change across nodes or relayers
*/
async getGasLimit(tx?: TransactionData, type: TxType = 'other', bumpPercent: number = 10): Promise<number> {
if (!tx || Object.keys(tx).length === 0) return this.fallbackFeeOracle.getGasLimit(tx, type, bumpPercent);
const fetchedGasLimit = await this.provider.estimateGas(tx);
return bump(fetchedGasLimit, bumpPercent).toNumber();
}
/**
* Apply static 30% gasPrice premium for EIP-1559 enabled networks
*
* Because Tornado Transactions are censored from block builders
* it would take some time to be confirmed after when the transaction is broadcasted.
*
* We apply 30% premium and 56% overall premium to combat basefee spike
* (Can spike 12.5% per block accoring to the EIP-1559 metrics https://metamask.io/1559/)
*/
async getGasPriceParams(speed?: LegacyGasPriceKey, bumpPercent?: number): Promise<GasPriceParams> {
if (this.overrideGasPrice) {
return this.overrideGasPrice;
}
if (typeof bumpPercent === 'undefined') {
bumpPercent = this.chainId === ChainId.BSC ? undefined : 30;
}
return super.getGasPriceParams(speed, bumpPercent);
}
/**
* Apply 20% premium from the calculated fee from UI, applies 5% fee from relayer to prevent arbitrage from refund
*/
async calculateWithdrawalFeeViaRelayer(
params: GetWithdrawalFeeViaRelayerInput & { premium?: number },
): Promise<HexadecimalStringifiedNumber> {
const fees = await super.calculateWithdrawalFeeViaRelayer(params);
const premium = params.premium || (params.txType === 'user_withdrawal' ? 20 : 5);
return bump(fees, premium).toHexString();
}
}

View File

@@ -1,7 +1,4 @@
export * from './constants';
export * from './feeOracle';
export * from './multicall';
export * from './providers';
export * from './feeOracleV4';
export * from './feeOracleV5';
export * from './feeOracleV6';
export * from './tokenPriceOracle';
export * from './types';
export * from './utils';

View File

@@ -1,28 +0,0 @@
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;
}

View File

@@ -1,107 +0,0 @@
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;
}

View File

@@ -1,54 +1,109 @@
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';
import { Multicall3 } 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';
export class TokenPriceOracle {
oracle?: OffchainOracle;
multicall: Multicall;
provider: Provider;
/**
* 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[];
}
constructor(netId: ChainIdType, rpcUrl: string, config: networkConfig) {
const { offchainOracleContract } = config;
const tornToken: Token = {
tokenAddress: '0x77777FeDdddFfC19Ff86DB637967013e6C6A116C',
symbol: 'torn',
decimals: 18,
};
const tornadoTokens = [tornToken, ...filterTokensFromTornadoInstances(instances)];
this.provider = getProvider(netId, rpcUrl, config);
this.multicall = Multicall__factory.connect(multiCallAddress, this.provider);
const defaultTornadoTokenPrices: TokenPrices = {
torn: '1689423546359032',
dai: '598416104472725',
cdai: '13384388487019',
usdc: '599013776676721',
usdt: '599323410893614',
wbtc: '15659889148334216720',
};
if (offchainOracleContract) {
this.oracle = OffchainOracle__factory.connect(offchainOracleContract, 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,
chainId?: ChainId,
) {
this.provider = new ethers.providers.JsonRpcProvider(rpcUrl);
this.oracle = getOffchainOracleContract(this.provider, chainId);
this.multiCall = getMultiCallContract(this.provider);
}
async fetchPrices(tokens: Token[]): Promise<TokenPrices> {
// 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),
),
);
// Instant return default token prices
get defaultPrices(): TokenPrices {
return this.defaultTokenPrices;
}
const prices = (await multicall(
this.multicall,
tokens.map(({ tokenAddress }) => ({
contract: this.oracle,
name: 'getRateToEth',
params: [tokenAddress, true],
})),
)) as bigint[];
/**
* Prepare data for MultiCall contract
* @param {Token[]} [tokens] Tokens array
* @returns Valid structure to provide to MultiCall contract
*/
private prepareCallData(tokens: Token[] = this.tokens): Multicall3.Call3Struct[] {
return tokens.map((token) => ({
target: this.oracle.address,
allowFailure: true,
callData: this.oracle.interface.encodeFunctionData('getRateToEth', [token.tokenAddress, true]),
}));
}
return prices.reduce((acc, price, index) => {
const tokenPriceInwei = (price * BigInt(10 ** tokens[index].decimals)) / BigInt(10 ** 18);
/**
* 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<TokenPrices> {
try {
if (!tokens?.length) return {};
acc[tokens[index].symbol.toLowerCase()] = tokenPriceInwei.toString();
const callData = this.prepareCallData(tokens);
const results = await this.multiCall.callStatic.aggregate3(callData);
const prices: TokenPrices = {};
return acc;
}, {} as TokenPrices);
for (let i = 0; i < results.length; i++) {
const tokenSymbol = tokens[i].symbol.toLowerCase() as TokenSymbol;
if (!results[i].success) {
if (this.defaultTokenPrices[tokenSymbol]) prices[tokenSymbol] = this.defaultTokenPrices[tokenSymbol];
continue;
}
const decodedRate = defaultAbiCoder.decode(['uint256'], results[i].returnData).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;
}
}
}

View File

@@ -1,31 +1,120 @@
import type { BaseContract, Interface } from 'ethers';
import { BigNumberish, BytesLike } from 'ethers';
import { AvailableTokenSymbols } from '@tornado/tornado-config';
import { InstanceTokenSymbol } from './config';
export type Token = {
tokenAddress: string;
symbol: string;
// Type for big hexadecimal numbers, like 0x1eff87f47e37a0
export type HexadecimalStringifiedNumber = string;
export type LegacyGasPriceKey = 'instant' | 'fast' | 'standard' | 'low';
export type GasPriceParams =
| {
gasPrice: string;
}
| {
maxFeePerGas: string;
maxPriorityFeePerGas: string;
};
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<GetGasParamsRes>;
getGas: (params?: GetGasInput) => Promise<HexadecimalStringifiedNumber>;
getGasPriceParams: (speed?: LegacyGasPriceKey, bumpPercent?: number) => Promise<GasPriceParams>;
getGasPrice: (speed?: LegacyGasPriceKey, bumpPercent?: number) => Promise<HexadecimalStringifiedNumber>;
getGasLimit: (tx?: TransactionData, type?: TxType, bumpPercent?: number) => Promise<number>;
fetchL1OptimismFee: (tx?: TransactionData) => Promise<HexadecimalStringifiedNumber>;
calculateRefundInETH: (gasPrice: BigNumberish, tokenSymbol: InstanceTokenSymbol) => HexadecimalStringifiedNumber;
fetchRefundInETH: (tokenSymbol: InstanceTokenSymbol) => Promise<HexadecimalStringifiedNumber>;
calculateRefundInToken: (
gasPrice: BigNumberish,
tokenPriceInEth: BigNumberish,
tokenDecimals: HexadecimalStringifiedNumber | number,
tokenSymbol: InstanceTokenSymbol,
) => HexadecimalStringifiedNumber;
calculateWithdrawalFeeViaRelayer: (params: GetWithdrawalFeeViaRelayerInput) => Promise<HexadecimalStringifiedNumber>;
}
export interface ITornadoPriceOracle {
defaultPrices: TokenPrices;
fetchPrices: (tokens?: Token[]) => Promise<TokenPrices>;
}
export type WithdrawalData = {
contract: string;
proof: BytesLike;
args: [BytesLike, BytesLike, string, string, BigNumberish, BigNumberish];
};
export type TornadoPoolInstance = {
currency: AvailableTokenSymbols;
amount: number;
decimals: number;
};
export type TokenPrices = { [tokenSymbol in string]?: string };
export interface Call3 {
contract?: BaseContract;
address?: string;
interface?: Interface;
name: string;
params?: any[];
allowFailure?: boolean;
}
// 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;
decimals: number;
};
export type TokenPrices = { [tokenSymbol in TokenSymbol]?: BigNumberish };
export interface gasOracleOptions {
gasPriceOracle?: string;
gasStationApi?: string;
}
// Reponse type for getGasParams function of fee oracle
export type GetGasParamsRes = {
gasLimit: number;
gasPrice: HexadecimalStringifiedNumber; // Gas price in native currency
};
export interface networkConfig {
networkName: string;
offchainOracleContract?: string;
optimismL1FeeOracleAddress?: string;
gasPriceOracleContract?: string;
gasStationApi?: string;
pollInterval: number;
}
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 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<AvailableTokenSymbols>; // 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)
};

View File

@@ -1,30 +1,44 @@
import type { BigNumberish } from 'ethers';
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 });
export const isNode =
!(
(
process as typeof process & {
browser?: boolean;
}
).browser
// prettier-ignore
const GWEI = 1e9;
export function serializeTx(tx?: TransactionData | string): string {
if (!tx) tx = '0x';
if (typeof tx === 'string') return tx;
return serialize(tx);
}
export function calculateGasPriceInWei(gasPrice: GasPriceParams): BigNumber {
// @ts-ignore
) && typeof globalThis.window === 'undefined';
export function sleep(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
return BigNumber.from(gasPrice.gasPrice || gasPrice.maxFeePerGas);
}
/**
* Example:
*
* amountInWei (0.1 ETH) * tokenDecimals (18) * tokenPriceInWei (0.0008) = 125 TOKEN
*/
export function convertETHToTokenAmount(
amountInWei: BigNumberish,
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,
tokenPriceInWei: BigNumberish,
tokenDecimals: number = 18,
): bigint {
const tokenDecimalsMultiplier = BigInt(10 ** Number(tokenDecimals));
return (BigInt(amountInWei) * tokenDecimalsMultiplier) / BigInt(tokenPriceInWei);
): BigNumber {
const tokenDecimalsMultiplier = BigNumber.from(10).pow(tokenDecimals);
return BigNumber.from(amountInWEI).mul(tokenDecimalsMultiplier).div(tokenPriceInWei);
}

View File

@@ -2,8 +2,8 @@
"extends": "./tsconfig",
"compilerOptions": {
"declaration": false,
"target": "es2016",
"module": "es6",
"target": "es2015",
"module": "es2015",
"outDir": "lib/esm"
}
}

View File

@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es2016",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"lib": ["es5", "es6", "es2021", "esnext"],

531
yarn.lock
View File

@@ -2,11 +2,6 @@
# 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"
@@ -14,6 +9,348 @@
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"
@@ -32,17 +369,10 @@
"@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10"
"@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:
"@noble/hashes" "1.3.2"
"@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==
"@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==
"@tsconfig/node10@^1.0.7":
version "1.0.9"
@@ -64,19 +394,14 @@
resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9"
integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==
"@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==
"@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==
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"
@@ -102,10 +427,10 @@ acorn@^8.4.1:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5"
integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==
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==
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==
ansi-styles@^3.2.1:
version "3.2.1"
@@ -149,11 +474,31 @@ balanced-match@^1.0.0:
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.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"
@@ -169,6 +514,11 @@ 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"
@@ -279,23 +629,59 @@ 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@^6.4.0:
version "6.12.1"
resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.12.1.tgz#517ff6d66d4fd5433e38e903051da3e57c87ff37"
integrity sha512-j6wcVoZf06nqEcBbDWkKg8Fp895SS96dSnTCjiXT+8vt2o02raTn4Lo9ERUuIVU5bAjoPYeA+7ytQFexFmLuVw==
ethers@5.7:
version "5.7.2"
resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e"
integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==
dependencies:
"@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"
"@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"
fill-range@^7.0.1:
version "7.0.1"
@@ -364,6 +750,23 @@ 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"
@@ -377,7 +780,7 @@ inflight@^1.0.4:
once "^1.3.0"
wrappy "1"
inherits@2:
inherits@2, inherits@^2.0.3, inherits@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
@@ -406,7 +809,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==
@@ -440,6 +843,16 @@ 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"
@@ -534,6 +947,11 @@ 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"
@@ -625,15 +1043,10 @@ ts-node@^10.9.1:
v8-compile-cache-lib "^3.0.1"
yn "3.1.1"
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==
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==
dependencies:
"@types/prettier" "^2.1.1"
debug "^4.3.1"
@@ -646,10 +1059,10 @@ typechain@^8.3.2:
ts-command-line-args "^2.2.0"
ts-essentials "^7.0.1"
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==
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==
typical@^4.0.0:
version "4.0.0"
@@ -689,10 +1102,10 @@ wrappy@1:
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
ws@8.5.0:
version "8.5.0"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f"
integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==
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==
yallist@^4.0.0:
version "4.0.0"