6 Commits

159 changed files with 9953 additions and 7290 deletions

1
.gitignore vendored
View File

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

189
abis/GasPriceOracle.json Normal file
View File

@@ -0,0 +1,189 @@
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "GAS_UNIT",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint32",
"name": "_derivationThresold",
"type": "uint32"
}
],
"name": "changeDerivationThresold",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint32",
"name": "_gasUnit",
"type": "uint32"
}
],
"name": "changeGasUnit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint32",
"name": "_heartbeat",
"type": "uint32"
}
],
"name": "changeHeartbeat",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_owner",
"type": "address"
}
],
"name": "changeOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "derivationThresold",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "gasPrice",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "heartbeat",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "maxFeePerGas",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "maxPriorityFeePerGas",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pastGasPrice",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint32",
"name": "_gasPrice",
"type": "uint32"
}
],
"name": "setGasPrice",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "timestamp",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
}
]

File diff suppressed because one or more lines are too long

440
abis/Multicall.json Normal file
View File

@@ -0,0 +1,440 @@
[
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Call[]",
"name": "calls",
"type": "tuple[]"
}
],
"name": "aggregate",
"outputs": [
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
},
{
"internalType": "bytes[]",
"name": "returnData",
"type": "bytes[]"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "bool",
"name": "allowFailure",
"type": "bool"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Call3[]",
"name": "calls",
"type": "tuple[]"
}
],
"name": "aggregate3",
"outputs": [
{
"components": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
},
{
"internalType": "bytes",
"name": "returnData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Result[]",
"name": "returnData",
"type": "tuple[]"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "bool",
"name": "allowFailure",
"type": "bool"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Call3Value[]",
"name": "calls",
"type": "tuple[]"
}
],
"name": "aggregate3Value",
"outputs": [
{
"components": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
},
{
"internalType": "bytes",
"name": "returnData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Result[]",
"name": "returnData",
"type": "tuple[]"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Call[]",
"name": "calls",
"type": "tuple[]"
}
],
"name": "blockAndAggregate",
"outputs": [
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "blockHash",
"type": "bytes32"
},
{
"components": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
},
{
"internalType": "bytes",
"name": "returnData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Result[]",
"name": "returnData",
"type": "tuple[]"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "getBasefee",
"outputs": [
{
"internalType": "uint256",
"name": "basefee",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
}
],
"name": "getBlockHash",
"outputs": [
{
"internalType": "bytes32",
"name": "blockHash",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getBlockNumber",
"outputs": [
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getChainId",
"outputs": [
{
"internalType": "uint256",
"name": "chainid",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getCurrentBlockCoinbase",
"outputs": [
{
"internalType": "address",
"name": "coinbase",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getCurrentBlockDifficulty",
"outputs": [
{
"internalType": "uint256",
"name": "difficulty",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getCurrentBlockGasLimit",
"outputs": [
{
"internalType": "uint256",
"name": "gaslimit",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getCurrentBlockTimestamp",
"outputs": [
{
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "addr",
"type": "address"
}
],
"name": "getEthBalance",
"outputs": [
{
"internalType": "uint256",
"name": "balance",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getLastBlockHash",
"outputs": [
{
"internalType": "bytes32",
"name": "blockHash",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bool",
"name": "requireSuccess",
"type": "bool"
},
{
"components": [
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Call[]",
"name": "calls",
"type": "tuple[]"
}
],
"name": "tryAggregate",
"outputs": [
{
"components": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
},
{
"internalType": "bytes",
"name": "returnData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Result[]",
"name": "returnData",
"type": "tuple[]"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bool",
"name": "requireSuccess",
"type": "bool"
},
{
"components": [
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Call[]",
"name": "calls",
"type": "tuple[]"
}
],
"name": "tryBlockAndAggregate",
"outputs": [
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "blockHash",
"type": "bytes32"
},
{
"components": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
},
{
"internalType": "bytes",
"name": "returnData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Result[]",
"name": "returnData",
"type": "tuple[]"
}
],
"stateMutability": "payable",
"type": "function"
}
]

View File

@@ -1,292 +0,0 @@
[
{
"inputs": [
{
"internalType": "contract MultiWrapper",
"name": "_multiWrapper",
"type": "address"
},
{
"internalType": "contract IOracle[]",
"name": "existingOracles",
"type": "address[]"
},
{
"internalType": "enum OffchainOracle.OracleType[]",
"name": "oracleTypes",
"type": "uint8[]"
},
{
"internalType": "contract IERC20[]",
"name": "existingConnectors",
"type": "address[]"
},
{ "internalType": "contract IERC20", "name": "wBase", "type": "address" }
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "contract IERC20",
"name": "connector",
"type": "address"
}
],
"name": "ConnectorAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "contract IERC20",
"name": "connector",
"type": "address"
}
],
"name": "ConnectorRemoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "contract MultiWrapper",
"name": "multiWrapper",
"type": "address"
}
],
"name": "MultiWrapperUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "contract IOracle",
"name": "oracle",
"type": "address"
},
{
"indexed": false,
"internalType": "enum OffchainOracle.OracleType",
"name": "oracleType",
"type": "uint8"
}
],
"name": "OracleAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "contract IOracle",
"name": "oracle",
"type": "address"
},
{
"indexed": false,
"internalType": "enum OffchainOracle.OracleType",
"name": "oracleType",
"type": "uint8"
}
],
"name": "OracleRemoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [
{
"internalType": "contract IERC20",
"name": "connector",
"type": "address"
}
],
"name": "addConnector",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IOracle",
"name": "oracle",
"type": "address"
},
{
"internalType": "enum OffchainOracle.OracleType",
"name": "oracleKind",
"type": "uint8"
}
],
"name": "addOracle",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "connectors",
"outputs": [
{
"internalType": "contract IERC20[]",
"name": "allConnectors",
"type": "address[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20",
"name": "srcToken",
"type": "address"
},
{
"internalType": "contract IERC20",
"name": "dstToken",
"type": "address"
},
{ "internalType": "bool", "name": "useWrappers", "type": "bool" }
],
"name": "getRate",
"outputs": [{ "internalType": "uint256", "name": "weightedRate", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20",
"name": "srcToken",
"type": "address"
},
{ "internalType": "bool", "name": "useSrcWrappers", "type": "bool" }
],
"name": "getRateToEth",
"outputs": [{ "internalType": "uint256", "name": "weightedRate", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "multiWrapper",
"outputs": [{ "internalType": "contract MultiWrapper", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "oracles",
"outputs": [
{
"internalType": "contract IOracle[]",
"name": "allOracles",
"type": "address[]"
},
{
"internalType": "enum OffchainOracle.OracleType[]",
"name": "oracleTypes",
"type": "uint8[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20",
"name": "connector",
"type": "address"
}
],
"name": "removeConnector",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IOracle",
"name": "oracle",
"type": "address"
},
{
"internalType": "enum OffchainOracle.OracleType",
"name": "oracleKind",
"type": "uint8"
}
],
"name": "removeOracle",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract MultiWrapper",
"name": "_multiWrapper",
"type": "address"
}
],
"name": "setMultiWrapper",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]

555
abis/OffchainOracle.json Normal file
View File

@@ -0,0 +1,555 @@
[
{
"inputs":[
{
"internalType":"contract MultiWrapper",
"name":"_multiWrapper",
"type":"address"
},
{
"internalType":"contract IOracle[]",
"name":"existingOracles",
"type":"address[]"
},
{
"internalType":"enum OffchainOracle.OracleType[]",
"name":"oracleTypes",
"type":"uint8[]"
},
{
"internalType":"contract IERC20[]",
"name":"existingConnectors",
"type":"address[]"
},
{
"internalType":"contract IERC20",
"name":"wBase",
"type":"address"
},
{
"internalType":"address",
"name":"owner",
"type":"address"
}
],
"stateMutability":"nonpayable",
"type":"constructor"
},
{
"inputs":[
],
"name":"ArraysLengthMismatch",
"type":"error"
},
{
"inputs":[
],
"name":"ConnectorAlreadyAdded",
"type":"error"
},
{
"inputs":[
],
"name":"InvalidOracleTokenKind",
"type":"error"
},
{
"inputs":[
],
"name":"OracleAlreadyAdded",
"type":"error"
},
{
"inputs":[
],
"name":"SameTokens",
"type":"error"
},
{
"inputs":[
],
"name":"TooBigThreshold",
"type":"error"
},
{
"inputs":[
],
"name":"UnknownConnector",
"type":"error"
},
{
"inputs":[
],
"name":"UnknownOracle",
"type":"error"
},
{
"anonymous":false,
"inputs":[
{
"indexed":false,
"internalType":"contract IERC20",
"name":"connector",
"type":"address"
}
],
"name":"ConnectorAdded",
"type":"event"
},
{
"anonymous":false,
"inputs":[
{
"indexed":false,
"internalType":"contract IERC20",
"name":"connector",
"type":"address"
}
],
"name":"ConnectorRemoved",
"type":"event"
},
{
"anonymous":false,
"inputs":[
{
"indexed":false,
"internalType":"contract MultiWrapper",
"name":"multiWrapper",
"type":"address"
}
],
"name":"MultiWrapperUpdated",
"type":"event"
},
{
"anonymous":false,
"inputs":[
{
"indexed":false,
"internalType":"contract IOracle",
"name":"oracle",
"type":"address"
},
{
"indexed":false,
"internalType":"enum OffchainOracle.OracleType",
"name":"oracleType",
"type":"uint8"
}
],
"name":"OracleAdded",
"type":"event"
},
{
"anonymous":false,
"inputs":[
{
"indexed":false,
"internalType":"contract IOracle",
"name":"oracle",
"type":"address"
},
{
"indexed":false,
"internalType":"enum OffchainOracle.OracleType",
"name":"oracleType",
"type":"uint8"
}
],
"name":"OracleRemoved",
"type":"event"
},
{
"anonymous":false,
"inputs":[
{
"indexed":true,
"internalType":"address",
"name":"previousOwner",
"type":"address"
},
{
"indexed":true,
"internalType":"address",
"name":"newOwner",
"type":"address"
}
],
"name":"OwnershipTransferred",
"type":"event"
},
{
"inputs":[
{
"internalType":"contract IERC20",
"name":"connector",
"type":"address"
}
],
"name":"addConnector",
"outputs":[
],
"stateMutability":"nonpayable",
"type":"function"
},
{
"inputs":[
{
"internalType":"contract IOracle",
"name":"oracle",
"type":"address"
},
{
"internalType":"enum OffchainOracle.OracleType",
"name":"oracleKind",
"type":"uint8"
}
],
"name":"addOracle",
"outputs":[
],
"stateMutability":"nonpayable",
"type":"function"
},
{
"inputs":[
],
"name":"connectors",
"outputs":[
{
"internalType":"contract IERC20[]",
"name":"allConnectors",
"type":"address[]"
}
],
"stateMutability":"view",
"type":"function"
},
{
"inputs":[
{
"internalType":"contract IERC20",
"name":"srcToken",
"type":"address"
},
{
"internalType":"contract IERC20",
"name":"dstToken",
"type":"address"
},
{
"internalType":"bool",
"name":"useWrappers",
"type":"bool"
}
],
"name":"getRate",
"outputs":[
{
"internalType":"uint256",
"name":"weightedRate",
"type":"uint256"
}
],
"stateMutability":"view",
"type":"function"
},
{
"inputs":[
{
"internalType":"contract IERC20",
"name":"srcToken",
"type":"address"
},
{
"internalType":"bool",
"name":"useSrcWrappers",
"type":"bool"
}
],
"name":"getRateToEth",
"outputs":[
{
"internalType":"uint256",
"name":"weightedRate",
"type":"uint256"
}
],
"stateMutability":"view",
"type":"function"
},
{
"inputs":[
{
"internalType":"contract IERC20",
"name":"srcToken",
"type":"address"
},
{
"internalType":"bool",
"name":"useSrcWrappers",
"type":"bool"
},
{
"internalType":"contract IERC20[]",
"name":"customConnectors",
"type":"address[]"
},
{
"internalType":"uint256",
"name":"thresholdFilter",
"type":"uint256"
}
],
"name":"getRateToEthWithCustomConnectors",
"outputs":[
{
"internalType":"uint256",
"name":"weightedRate",
"type":"uint256"
}
],
"stateMutability":"view",
"type":"function"
},
{
"inputs":[
{
"internalType":"contract IERC20",
"name":"srcToken",
"type":"address"
},
{
"internalType":"bool",
"name":"useSrcWrappers",
"type":"bool"
},
{
"internalType":"uint256",
"name":"thresholdFilter",
"type":"uint256"
}
],
"name":"getRateToEthWithThreshold",
"outputs":[
{
"internalType":"uint256",
"name":"weightedRate",
"type":"uint256"
}
],
"stateMutability":"view",
"type":"function"
},
{
"inputs":[
{
"internalType":"contract IERC20",
"name":"srcToken",
"type":"address"
},
{
"internalType":"contract IERC20",
"name":"dstToken",
"type":"address"
},
{
"internalType":"bool",
"name":"useWrappers",
"type":"bool"
},
{
"internalType":"contract IERC20[]",
"name":"customConnectors",
"type":"address[]"
},
{
"internalType":"uint256",
"name":"thresholdFilter",
"type":"uint256"
}
],
"name":"getRateWithCustomConnectors",
"outputs":[
{
"internalType":"uint256",
"name":"weightedRate",
"type":"uint256"
}
],
"stateMutability":"view",
"type":"function"
},
{
"inputs":[
{
"internalType":"contract IERC20",
"name":"srcToken",
"type":"address"
},
{
"internalType":"contract IERC20",
"name":"dstToken",
"type":"address"
},
{
"internalType":"bool",
"name":"useWrappers",
"type":"bool"
},
{
"internalType":"uint256",
"name":"thresholdFilter",
"type":"uint256"
}
],
"name":"getRateWithThreshold",
"outputs":[
{
"internalType":"uint256",
"name":"weightedRate",
"type":"uint256"
}
],
"stateMutability":"view",
"type":"function"
},
{
"inputs":[
],
"name":"multiWrapper",
"outputs":[
{
"internalType":"contract MultiWrapper",
"name":"",
"type":"address"
}
],
"stateMutability":"view",
"type":"function"
},
{
"inputs":[
],
"name":"oracles",
"outputs":[
{
"internalType":"contract IOracle[]",
"name":"allOracles",
"type":"address[]"
},
{
"internalType":"enum OffchainOracle.OracleType[]",
"name":"oracleTypes",
"type":"uint8[]"
}
],
"stateMutability":"view",
"type":"function"
},
{
"inputs":[
],
"name":"owner",
"outputs":[
{
"internalType":"address",
"name":"",
"type":"address"
}
],
"stateMutability":"view",
"type":"function"
},
{
"inputs":[
{
"internalType":"contract IERC20",
"name":"connector",
"type":"address"
}
],
"name":"removeConnector",
"outputs":[
],
"stateMutability":"nonpayable",
"type":"function"
},
{
"inputs":[
{
"internalType":"contract IOracle",
"name":"oracle",
"type":"address"
},
{
"internalType":"enum OffchainOracle.OracleType",
"name":"oracleKind",
"type":"uint8"
}
],
"name":"removeOracle",
"outputs":[
],
"stateMutability":"nonpayable",
"type":"function"
},
{
"inputs":[
],
"name":"renounceOwnership",
"outputs":[
],
"stateMutability":"nonpayable",
"type":"function"
},
{
"inputs":[
{
"internalType":"contract MultiWrapper",
"name":"_multiWrapper",
"type":"address"
}
],
"name":"setMultiWrapper",
"outputs":[
],
"stateMutability":"nonpayable",
"type":"function"
},
{
"inputs":[
{
"internalType":"address",
"name":"newOwner",
"type":"address"
}
],
"name":"transferOwnership",
"outputs":[
],
"stateMutability":"nonpayable",
"type":"function"
}
]

36
lib/config.d.ts vendored
View File

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

View File

@@ -1,103 +0,0 @@
"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

View File

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

14
lib/constants.d.ts vendored Normal file
View File

@@ -0,0 +1,14 @@
export declare enum ChainId {
MAINNET = 1,
BSC = 56,
XDAI = 100,
POLYGON = 137,
OPTIMISM = 10,
ARBITRUM = 42161,
AVAX = 43114,
SEPOLIA = 11155111
}
export type ChainIdType = ChainId | number;
export declare const ENS_CHAINS: ChainId[];
export declare const multiCallAddress = "0xcA11bde05977b3631167028862bE2a173976CA11";
export declare const POLYGON_GAS_STATION = "https://gasstation.polygon.technology/v2";

18
lib/constants.js Normal file
View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.POLYGON_GAS_STATION = exports.multiCallAddress = exports.ENS_CHAINS = exports.ChainId = void 0;
var ChainId;
(function (ChainId) {
ChainId[ChainId["MAINNET"] = 1] = "MAINNET";
ChainId[ChainId["BSC"] = 56] = "BSC";
ChainId[ChainId["XDAI"] = 100] = "XDAI";
ChainId[ChainId["POLYGON"] = 137] = "POLYGON";
ChainId[ChainId["OPTIMISM"] = 10] = "OPTIMISM";
ChainId[ChainId["ARBITRUM"] = 42161] = "ARBITRUM";
ChainId[ChainId["AVAX"] = 43114] = "AVAX";
ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
})(ChainId || (exports.ChainId = ChainId = {}));
exports.ENS_CHAINS = [ChainId.MAINNET, ChainId.SEPOLIA];
exports.multiCallAddress = '0xcA11bde05977b3631167028862bE2a173976CA11';
exports.POLYGON_GAS_STATION = 'https://gasstation.polygon.technology/v2';
//# sourceMappingURL=constants.js.map

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

@@ -0,0 +1 @@
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA,IAAY,OASX;AATD,WAAY,OAAO;IACjB,2CAAW,CAAA;IACX,oCAAQ,CAAA;IACR,uCAAU,CAAA;IACV,6CAAa,CAAA;IACb,8CAAa,CAAA;IACb,iDAAgB,CAAA;IAChB,yCAAY,CAAA;IACZ,kDAAkB,CAAA;AACpB,CAAC,EATW,OAAO,uBAAP,OAAO,QASlB;AAIY,QAAA,UAAU,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;AAEhD,QAAA,gBAAgB,GAAG,4CAA4C,CAAC;AAEhE,QAAA,mBAAmB,GAAG,0CAA0C,CAAC"}

101
lib/contracts/GasPriceOracle.d.ts vendored Normal file
View File

@@ -0,0 +1,101 @@
import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers";
import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedListener, TypedContractMethod } from "./common";
export interface GasPriceOracleInterface extends Interface {
getFunction(nameOrSignature: "GAS_UNIT" | "changeDerivationThresold" | "changeGasUnit" | "changeHeartbeat" | "changeOwnership" | "derivationThresold" | "gasPrice" | "heartbeat" | "maxFeePerGas" | "maxPriorityFeePerGas" | "owner" | "pastGasPrice" | "setGasPrice" | "timestamp"): FunctionFragment;
encodeFunctionData(functionFragment: "GAS_UNIT", values?: undefined): string;
encodeFunctionData(functionFragment: "changeDerivationThresold", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "changeGasUnit", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "changeHeartbeat", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "changeOwnership", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "derivationThresold", values?: undefined): string;
encodeFunctionData(functionFragment: "gasPrice", values?: undefined): string;
encodeFunctionData(functionFragment: "heartbeat", values?: undefined): string;
encodeFunctionData(functionFragment: "maxFeePerGas", values?: undefined): string;
encodeFunctionData(functionFragment: "maxPriorityFeePerGas", values?: undefined): string;
encodeFunctionData(functionFragment: "owner", values?: undefined): string;
encodeFunctionData(functionFragment: "pastGasPrice", values?: undefined): string;
encodeFunctionData(functionFragment: "setGasPrice", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "timestamp", values?: undefined): string;
decodeFunctionResult(functionFragment: "GAS_UNIT", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "changeDerivationThresold", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "changeGasUnit", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "changeHeartbeat", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "changeOwnership", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "derivationThresold", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "gasPrice", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "heartbeat", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "maxFeePerGas", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "maxPriorityFeePerGas", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "pastGasPrice", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setGasPrice", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "timestamp", data: BytesLike): Result;
}
export interface GasPriceOracle extends BaseContract {
connect(runner?: ContractRunner | null): GasPriceOracle;
waitForDeployment(): Promise<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,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=OffchainOracleAbi.js.map
//# sourceMappingURL=GasPriceOracle.js.map

View File

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

228
lib/contracts/Multicall.d.ts vendored Normal file
View File

@@ -0,0 +1,228 @@
import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers";
import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedListener, TypedContractMethod } from "./common";
export declare namespace Multicall3 {
type CallStruct = {
target: AddressLike;
callData: BytesLike;
};
type CallStructOutput = [target: string, callData: string] & {
target: string;
callData: string;
};
type Call3Struct = {
target: AddressLike;
allowFailure: boolean;
callData: BytesLike;
};
type Call3StructOutput = [
target: string,
allowFailure: boolean,
callData: string
] & {
target: string;
allowFailure: boolean;
callData: string;
};
type ResultStruct = {
success: boolean;
returnData: BytesLike;
};
type ResultStructOutput = [success: boolean, returnData: string] & {
success: boolean;
returnData: string;
};
type Call3ValueStruct = {
target: AddressLike;
allowFailure: boolean;
value: BigNumberish;
callData: BytesLike;
};
type Call3ValueStructOutput = [
target: string,
allowFailure: boolean,
value: bigint,
callData: string
] & {
target: string;
allowFailure: boolean;
value: bigint;
callData: string;
};
}
export interface MulticallInterface extends Interface {
getFunction(nameOrSignature: "aggregate" | "aggregate3" | "aggregate3Value" | "blockAndAggregate" | "getBasefee" | "getBlockHash" | "getBlockNumber" | "getChainId" | "getCurrentBlockCoinbase" | "getCurrentBlockDifficulty" | "getCurrentBlockGasLimit" | "getCurrentBlockTimestamp" | "getEthBalance" | "getLastBlockHash" | "tryAggregate" | "tryBlockAndAggregate"): FunctionFragment;
encodeFunctionData(functionFragment: "aggregate", values: [Multicall3.CallStruct[]]): string;
encodeFunctionData(functionFragment: "aggregate3", values: [Multicall3.Call3Struct[]]): string;
encodeFunctionData(functionFragment: "aggregate3Value", values: [Multicall3.Call3ValueStruct[]]): string;
encodeFunctionData(functionFragment: "blockAndAggregate", values: [Multicall3.CallStruct[]]): string;
encodeFunctionData(functionFragment: "getBasefee", values?: undefined): string;
encodeFunctionData(functionFragment: "getBlockHash", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "getBlockNumber", values?: undefined): string;
encodeFunctionData(functionFragment: "getChainId", values?: undefined): string;
encodeFunctionData(functionFragment: "getCurrentBlockCoinbase", values?: undefined): string;
encodeFunctionData(functionFragment: "getCurrentBlockDifficulty", values?: undefined): string;
encodeFunctionData(functionFragment: "getCurrentBlockGasLimit", values?: undefined): string;
encodeFunctionData(functionFragment: "getCurrentBlockTimestamp", values?: undefined): string;
encodeFunctionData(functionFragment: "getEthBalance", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "getLastBlockHash", values?: undefined): string;
encodeFunctionData(functionFragment: "tryAggregate", values: [boolean, Multicall3.CallStruct[]]): string;
encodeFunctionData(functionFragment: "tryBlockAndAggregate", values: [boolean, Multicall3.CallStruct[]]): string;
decodeFunctionResult(functionFragment: "aggregate", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "aggregate3", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "aggregate3Value", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "blockAndAggregate", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getBasefee", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getBlockHash", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getBlockNumber", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getChainId", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getCurrentBlockCoinbase", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getCurrentBlockDifficulty", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getCurrentBlockGasLimit", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getCurrentBlockTimestamp", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getEthBalance", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getLastBlockHash", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "tryAggregate", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "tryBlockAndAggregate", data: BytesLike): Result;
}
export interface Multicall extends BaseContract {
connect(runner?: ContractRunner | null): Multicall;
waitForDeployment(): Promise<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

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

View File

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

View File

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

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

304
lib/contracts/OffchainOracle.d.ts vendored Normal file
View File

@@ -0,0 +1,304 @@
import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers";
import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "./common";
export interface OffchainOracleInterface extends Interface {
getFunction(nameOrSignature: "addConnector" | "addOracle" | "connectors" | "getRate" | "getRateToEth" | "getRateToEthWithCustomConnectors" | "getRateToEthWithThreshold" | "getRateWithCustomConnectors" | "getRateWithThreshold" | "multiWrapper" | "oracles" | "owner" | "removeConnector" | "removeOracle" | "renounceOwnership" | "setMultiWrapper" | "transferOwnership"): FunctionFragment;
getEvent(nameOrSignatureOrTopic: "ConnectorAdded" | "ConnectorRemoved" | "MultiWrapperUpdated" | "OracleAdded" | "OracleRemoved" | "OwnershipTransferred"): EventFragment;
encodeFunctionData(functionFragment: "addConnector", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "addOracle", values: [AddressLike, BigNumberish]): string;
encodeFunctionData(functionFragment: "connectors", values?: undefined): string;
encodeFunctionData(functionFragment: "getRate", values: [AddressLike, AddressLike, boolean]): string;
encodeFunctionData(functionFragment: "getRateToEth", values: [AddressLike, boolean]): string;
encodeFunctionData(functionFragment: "getRateToEthWithCustomConnectors", values: [AddressLike, boolean, AddressLike[], BigNumberish]): string;
encodeFunctionData(functionFragment: "getRateToEthWithThreshold", values: [AddressLike, boolean, BigNumberish]): string;
encodeFunctionData(functionFragment: "getRateWithCustomConnectors", values: [AddressLike, AddressLike, boolean, AddressLike[], BigNumberish]): string;
encodeFunctionData(functionFragment: "getRateWithThreshold", values: [AddressLike, AddressLike, boolean, BigNumberish]): string;
encodeFunctionData(functionFragment: "multiWrapper", values?: undefined): string;
encodeFunctionData(functionFragment: "oracles", values?: undefined): string;
encodeFunctionData(functionFragment: "owner", values?: undefined): string;
encodeFunctionData(functionFragment: "removeConnector", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "removeOracle", values: [AddressLike, BigNumberish]): string;
encodeFunctionData(functionFragment: "renounceOwnership", values?: undefined): string;
encodeFunctionData(functionFragment: "setMultiWrapper", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "transferOwnership", values: [AddressLike]): string;
decodeFunctionResult(functionFragment: "addConnector", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "addOracle", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "connectors", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getRate", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getRateToEth", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getRateToEthWithCustomConnectors", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getRateToEthWithThreshold", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getRateWithCustomConnectors", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getRateWithThreshold", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "multiWrapper", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "oracles", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "removeConnector", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "removeOracle", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "renounceOwnership", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setMultiWrapper", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "transferOwnership", data: BytesLike): Result;
}
export declare namespace ConnectorAddedEvent {
type InputTuple = [connector: AddressLike];
type OutputTuple = [connector: string];
interface OutputObject {
connector: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace ConnectorRemovedEvent {
type InputTuple = [connector: AddressLike];
type OutputTuple = [connector: string];
interface OutputObject {
connector: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace MultiWrapperUpdatedEvent {
type InputTuple = [multiWrapper: AddressLike];
type OutputTuple = [multiWrapper: string];
interface OutputObject {
multiWrapper: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace OracleAddedEvent {
type InputTuple = [oracle: AddressLike, oracleType: BigNumberish];
type OutputTuple = [oracle: string, oracleType: bigint];
interface OutputObject {
oracle: string;
oracleType: bigint;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace OracleRemovedEvent {
type InputTuple = [oracle: AddressLike, oracleType: BigNumberish];
type OutputTuple = [oracle: string, oracleType: bigint];
interface OutputObject {
oracle: string;
oracleType: bigint;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace OwnershipTransferredEvent {
type InputTuple = [previousOwner: AddressLike, newOwner: AddressLike];
type OutputTuple = [previousOwner: string, newOwner: string];
interface OutputObject {
previousOwner: string;
newOwner: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
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

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

View File

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

View File

@@ -1,268 +0,0 @@
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 +0,0 @@
{"version":3,"file":"OffchainOracleAbi.js","sourceRoot":"","sources":["../../src/contracts/OffchainOracleAbi.ts"],"names":[],"mappings":""}

188
lib/contracts/OptimismL1FeeOracle.d.ts vendored Normal file
View File

@@ -0,0 +1,188 @@
import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers";
import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "./common";
export interface OptimismL1FeeOracleInterface extends Interface {
getFunction(nameOrSignature: "decimals" | "gasPrice" | "getL1Fee" | "getL1GasUsed" | "l1BaseFee" | "overhead" | "owner" | "renounceOwnership" | "scalar" | "setDecimals" | "setGasPrice" | "setL1BaseFee" | "setOverhead" | "setScalar" | "transferOwnership"): FunctionFragment;
getEvent(nameOrSignatureOrTopic: "DecimalsUpdated" | "GasPriceUpdated" | "L1BaseFeeUpdated" | "OverheadUpdated" | "OwnershipTransferred" | "ScalarUpdated"): EventFragment;
encodeFunctionData(functionFragment: "decimals", values?: undefined): string;
encodeFunctionData(functionFragment: "gasPrice", values?: undefined): string;
encodeFunctionData(functionFragment: "getL1Fee", values: [BytesLike]): string;
encodeFunctionData(functionFragment: "getL1GasUsed", values: [BytesLike]): string;
encodeFunctionData(functionFragment: "l1BaseFee", values?: undefined): string;
encodeFunctionData(functionFragment: "overhead", values?: undefined): string;
encodeFunctionData(functionFragment: "owner", values?: undefined): string;
encodeFunctionData(functionFragment: "renounceOwnership", values?: undefined): string;
encodeFunctionData(functionFragment: "scalar", values?: undefined): string;
encodeFunctionData(functionFragment: "setDecimals", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "setGasPrice", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "setL1BaseFee", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "setOverhead", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "setScalar", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "transferOwnership", values: [AddressLike]): string;
decodeFunctionResult(functionFragment: "decimals", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "gasPrice", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getL1Fee", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getL1GasUsed", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "l1BaseFee", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "overhead", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "renounceOwnership", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "scalar", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setDecimals", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setGasPrice", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setL1BaseFee", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setOverhead", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setScalar", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "transferOwnership", data: BytesLike): Result;
}
export declare namespace DecimalsUpdatedEvent {
type InputTuple = [arg0: BigNumberish];
type OutputTuple = [arg0: bigint];
interface OutputObject {
arg0: bigint;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace GasPriceUpdatedEvent {
type InputTuple = [arg0: BigNumberish];
type OutputTuple = [arg0: bigint];
interface OutputObject {
arg0: bigint;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace L1BaseFeeUpdatedEvent {
type InputTuple = [arg0: BigNumberish];
type OutputTuple = [arg0: bigint];
interface OutputObject {
arg0: bigint;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace OverheadUpdatedEvent {
type InputTuple = [arg0: BigNumberish];
type OutputTuple = [arg0: bigint];
interface OutputObject {
arg0: bigint;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace OwnershipTransferredEvent {
type InputTuple = [previousOwner: AddressLike, newOwner: AddressLike];
type OutputTuple = [previousOwner: string, newOwner: string];
interface OutputObject {
previousOwner: string;
newOwner: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace ScalarUpdatedEvent {
type InputTuple = [arg0: BigNumberish];
type OutputTuple = [arg0: bigint];
interface OutputObject {
arg0: bigint;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
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,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=OptimismL1FeeOracle.js.map

View File

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

View File

@@ -1,267 +0,0 @@
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 +0,0 @@
{"version":3,"file":"OptimismL1FeeOracleAbi.js","sourceRoot":"","sources":["../../src/contracts/OptimismL1FeeOracleAbi.ts"],"names":[],"mappings":""}

View File

@@ -1,21 +1,50 @@
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;
import type { FunctionFragment, Typed, EventFragment, ContractTransaction, ContractTransactionResponse, DeferredTopicFilter, EventLog, TransactionRequest, LogDescription } from "ethers";
export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> extends DeferredTopicFilter {
}
export interface TypedEventFilter<_TEvent extends TypedEvent> extends EventFilter {
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 TypedListener<TEvent extends TypedEvent> {
(...listenerArg: [...__TypechainArgsArray<TEvent>, TEvent]): void;
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 TypedEventLog<TCEvent extends TypedContractEvent> extends Omit<EventLog, "args"> {
args: __TypechainAOutputTuple<TCEvent> & __TypechainOutputObject<TCEvent>;
}
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 interface TypedLogDescription<TCEvent extends TypedContractEvent> extends Omit<LogDescription, "args"> {
args: __TypechainAOutputTuple<TCEvent> & __TypechainOutputObject<TCEvent>;
}
export type TypedListener<TCEvent extends TypedContractEvent> = (...listenerArg: [
...__TypechainAOutputTuple<TCEvent>,
TypedEventLog<TCEvent>,
...undefined[]
]) => void;
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 GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any> ? Parameters<F["deploy"]> : 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 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 {};

View File

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

@@ -1,22 +0,0 @@
"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

@@ -1 +0,0 @@
{"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,151 @@
import { type ContractRunner } from "ethers";
import type { GasPriceOracle, GasPriceOracleInterface } from "../GasPriceOracle";
export declare class GasPriceOracle__factory {
static readonly abi: readonly [{
readonly inputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "constructor";
}, {
readonly inputs: readonly [];
readonly name: "GAS_UNIT";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint32";
readonly name: "_derivationThresold";
readonly type: "uint32";
}];
readonly name: "changeDerivationThresold";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint32";
readonly name: "_gasUnit";
readonly type: "uint32";
}];
readonly name: "changeGasUnit";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint32";
readonly name: "_heartbeat";
readonly type: "uint32";
}];
readonly name: "changeHeartbeat";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "address";
readonly name: "_owner";
readonly type: "address";
}];
readonly name: "changeOwnership";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "derivationThresold";
readonly outputs: readonly [{
readonly internalType: "uint32";
readonly name: "";
readonly type: "uint32";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "gasPrice";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "heartbeat";
readonly outputs: readonly [{
readonly internalType: "uint32";
readonly name: "";
readonly type: "uint32";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "maxFeePerGas";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "maxPriorityFeePerGas";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "owner";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "";
readonly type: "address";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "pastGasPrice";
readonly outputs: readonly [{
readonly internalType: "uint32";
readonly name: "";
readonly type: "uint32";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint32";
readonly name: "_gasPrice";
readonly type: "uint32";
}];
readonly name: "setGasPrice";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "timestamp";
readonly outputs: readonly [{
readonly internalType: "uint32";
readonly name: "";
readonly type: "uint32";
}];
readonly stateMutability: "view";
readonly type: "function";
}];
static createInterface(): GasPriceOracleInterface;
static connect(address: string, runner?: ContractRunner | null): GasPriceOracle;
}

View File

@@ -0,0 +1,207 @@
"use strict";
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
Object.defineProperty(exports, "__esModule", { value: true });
exports.GasPriceOracle__factory = void 0;
const ethers_1 = require("ethers");
const _abi = [
{
inputs: [],
stateMutability: "nonpayable",
type: "constructor",
},
{
inputs: [],
name: "GAS_UNIT",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint32",
name: "_derivationThresold",
type: "uint32",
},
],
name: "changeDerivationThresold",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint32",
name: "_gasUnit",
type: "uint32",
},
],
name: "changeGasUnit",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint32",
name: "_heartbeat",
type: "uint32",
},
],
name: "changeHeartbeat",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "_owner",
type: "address",
},
],
name: "changeOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "derivationThresold",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "gasPrice",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "heartbeat",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "maxFeePerGas",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "maxPriorityFeePerGas",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "owner",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "pastGasPrice",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint32",
name: "_gasPrice",
type: "uint32",
},
],
name: "setGasPrice",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "timestamp",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
stateMutability: "view",
type: "function",
},
];
class GasPriceOracle__factory {
static createInterface() {
return new ethers_1.Interface(_abi);
}
static connect(address, runner) {
return new ethers_1.Contract(address, _abi, runner);
}
}
exports.GasPriceOracle__factory = GasPriceOracle__factory;
GasPriceOracle__factory.abi = _abi;
//# sourceMappingURL=GasPriceOracle__factory.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"GasPriceOracle__factory.js","sourceRoot":"","sources":["../../../src/contracts/factories/GasPriceOracle__factory.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;;;AAEpB,mCAAkE;AAMlE,MAAM,IAAI,GAAG;IACX;QACE,MAAM,EAAE,EAAE;QACV,eAAe,EAA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ACE,YAAY,EAAE,QAAQ;gBACtB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,QAAQ;aACf;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,QAAQ;gBACtB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;aACf;SACF;QACD,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,QAAQ;gBACtB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,QAAQ;aACf;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;CACO,CAAC;AAEX,MAAa,uBAAuB;IAElC,MAAM,CAAC,eAAe;QACpB,OAAO,IAAI,kBAAS,CAAC,IAAI,CAA4B,CAAC;IACxD,CAAC;IACD,MAAM,CAAC,OAAO,CACZ,OAAe,EACf,MAA8B;QAE9B,OAAO,IAAI,iBAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAA8B,CAAC;IAC1E,CAAC;;AAVH,0DAWC;AAViB,2BAAG,GAAG,IAAI,CAAC"}

View File

@@ -1,460 +0,0 @@
"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

@@ -1,7 +1,6 @@
import { Signer } from 'ethers';
import type { Provider } from '@ethersproject/providers';
import type { MulticallAbi, MulticallAbiInterface } from '../MulticallAbi';
export declare class MulticallAbi__factory {
import { type ContractRunner } from "ethers";
import type { Multicall, MulticallInterface } from "../Multicall";
export declare class Multicall__factory {
static readonly abi: readonly [{
readonly inputs: readonly [{
readonly components: readonly [{
@@ -334,6 +333,6 @@ export declare class MulticallAbi__factory {
readonly stateMutability: "payable";
readonly type: "function";
}];
static createInterface(): MulticallAbiInterface;
static connect(address: string, signerOrProvider: Signer | Provider): MulticallAbi;
static createInterface(): MulticallInterface;
static connect(address: string, runner?: ContractRunner | null): Multicall;
}

View File

@@ -0,0 +1,458 @@
"use strict";
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
Object.defineProperty(exports, "__esModule", { value: true });
exports.Multicall__factory = void 0;
const ethers_1 = require("ethers");
const _abi = [
{
inputs: [
{
components: [
{
internalType: "address",
name: "target",
type: "address",
},
{
internalType: "bytes",
name: "callData",
type: "bytes",
},
],
internalType: "struct Multicall3.Call[]",
name: "calls",
type: "tuple[]",
},
],
name: "aggregate",
outputs: [
{
internalType: "uint256",
name: "blockNumber",
type: "uint256",
},
{
internalType: "bytes[]",
name: "returnData",
type: "bytes[]",
},
],
stateMutability: "payable",
type: "function",
},
{
inputs: [
{
components: [
{
internalType: "address",
name: "target",
type: "address",
},
{
internalType: "bool",
name: "allowFailure",
type: "bool",
},
{
internalType: "bytes",
name: "callData",
type: "bytes",
},
],
internalType: "struct Multicall3.Call3[]",
name: "calls",
type: "tuple[]",
},
],
name: "aggregate3",
outputs: [
{
components: [
{
internalType: "bool",
name: "success",
type: "bool",
},
{
internalType: "bytes",
name: "returnData",
type: "bytes",
},
],
internalType: "struct Multicall3.Result[]",
name: "returnData",
type: "tuple[]",
},
],
stateMutability: "payable",
type: "function",
},
{
inputs: [
{
components: [
{
internalType: "address",
name: "target",
type: "address",
},
{
internalType: "bool",
name: "allowFailure",
type: "bool",
},
{
internalType: "uint256",
name: "value",
type: "uint256",
},
{
internalType: "bytes",
name: "callData",
type: "bytes",
},
],
internalType: "struct Multicall3.Call3Value[]",
name: "calls",
type: "tuple[]",
},
],
name: "aggregate3Value",
outputs: [
{
components: [
{
internalType: "bool",
name: "success",
type: "bool",
},
{
internalType: "bytes",
name: "returnData",
type: "bytes",
},
],
internalType: "struct Multicall3.Result[]",
name: "returnData",
type: "tuple[]",
},
],
stateMutability: "payable",
type: "function",
},
{
inputs: [
{
components: [
{
internalType: "address",
name: "target",
type: "address",
},
{
internalType: "bytes",
name: "callData",
type: "bytes",
},
],
internalType: "struct Multicall3.Call[]",
name: "calls",
type: "tuple[]",
},
],
name: "blockAndAggregate",
outputs: [
{
internalType: "uint256",
name: "blockNumber",
type: "uint256",
},
{
internalType: "bytes32",
name: "blockHash",
type: "bytes32",
},
{
components: [
{
internalType: "bool",
name: "success",
type: "bool",
},
{
internalType: "bytes",
name: "returnData",
type: "bytes",
},
],
internalType: "struct Multicall3.Result[]",
name: "returnData",
type: "tuple[]",
},
],
stateMutability: "payable",
type: "function",
},
{
inputs: [],
name: "getBasefee",
outputs: [
{
internalType: "uint256",
name: "basefee",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "blockNumber",
type: "uint256",
},
],
name: "getBlockHash",
outputs: [
{
internalType: "bytes32",
name: "blockHash",
type: "bytes32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "getBlockNumber",
outputs: [
{
internalType: "uint256",
name: "blockNumber",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "getChainId",
outputs: [
{
internalType: "uint256",
name: "chainid",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "getCurrentBlockCoinbase",
outputs: [
{
internalType: "address",
name: "coinbase",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "getCurrentBlockDifficulty",
outputs: [
{
internalType: "uint256",
name: "difficulty",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "getCurrentBlockGasLimit",
outputs: [
{
internalType: "uint256",
name: "gaslimit",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "getCurrentBlockTimestamp",
outputs: [
{
internalType: "uint256",
name: "timestamp",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "addr",
type: "address",
},
],
name: "getEthBalance",
outputs: [
{
internalType: "uint256",
name: "balance",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "getLastBlockHash",
outputs: [
{
internalType: "bytes32",
name: "blockHash",
type: "bytes32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "bool",
name: "requireSuccess",
type: "bool",
},
{
components: [
{
internalType: "address",
name: "target",
type: "address",
},
{
internalType: "bytes",
name: "callData",
type: "bytes",
},
],
internalType: "struct Multicall3.Call[]",
name: "calls",
type: "tuple[]",
},
],
name: "tryAggregate",
outputs: [
{
components: [
{
internalType: "bool",
name: "success",
type: "bool",
},
{
internalType: "bytes",
name: "returnData",
type: "bytes",
},
],
internalType: "struct Multicall3.Result[]",
name: "returnData",
type: "tuple[]",
},
],
stateMutability: "payable",
type: "function",
},
{
inputs: [
{
internalType: "bool",
name: "requireSuccess",
type: "bool",
},
{
components: [
{
internalType: "address",
name: "target",
type: "address",
},
{
internalType: "bytes",
name: "callData",
type: "bytes",
},
],
internalType: "struct Multicall3.Call[]",
name: "calls",
type: "tuple[]",
},
],
name: "tryBlockAndAggregate",
outputs: [
{
internalType: "uint256",
name: "blockNumber",
type: "uint256",
},
{
internalType: "bytes32",
name: "blockHash",
type: "bytes32",
},
{
components: [
{
internalType: "bool",
name: "success",
type: "bool",
},
{
internalType: "bytes",
name: "returnData",
type: "bytes",
},
],
internalType: "struct Multicall3.Result[]",
name: "returnData",
type: "tuple[]",
},
],
stateMutability: "payable",
type: "function",
},
];
class Multicall__factory {
static createInterface() {
return new ethers_1.Interface(_abi);
}
static connect(address, runner) {
return new ethers_1.Contract(address, _abi, runner);
}
}
exports.Multicall__factory = Multicall__factory;
Multicall__factory.abi = _abi;
//# sourceMappingURL=Multicall__factory.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,354 +0,0 @@
"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

@@ -1,7 +1,6 @@
import { Signer } from 'ethers';
import type { Provider } from '@ethersproject/providers';
import type { OffchainOracleAbi, OffchainOracleAbiInterface } from '../OffchainOracleAbi';
export declare class OffchainOracleAbi__factory {
import { type ContractRunner } from "ethers";
import type { OffchainOracle, OffchainOracleInterface } from "../OffchainOracle";
export declare class OffchainOracle__factory {
static readonly abi: readonly [{
readonly inputs: readonly [{
readonly internalType: "contract MultiWrapper";
@@ -23,9 +22,45 @@ export declare class OffchainOracleAbi__factory {
readonly internalType: "contract IERC20";
readonly name: "wBase";
readonly type: "address";
}, {
readonly internalType: "address";
readonly name: "owner";
readonly type: "address";
}];
readonly stateMutability: "nonpayable";
readonly type: "constructor";
}, {
readonly inputs: readonly [];
readonly name: "ArraysLengthMismatch";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "ConnectorAlreadyAdded";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "InvalidOracleTokenKind";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "OracleAlreadyAdded";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "SameTokens";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "TooBigThreshold";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "UnknownConnector";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "UnknownOracle";
readonly type: "error";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
@@ -175,6 +210,110 @@ export declare class OffchainOracleAbi__factory {
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "srcToken";
readonly type: "address";
}, {
readonly internalType: "bool";
readonly name: "useSrcWrappers";
readonly type: "bool";
}, {
readonly internalType: "contract IERC20[]";
readonly name: "customConnectors";
readonly type: "address[]";
}, {
readonly internalType: "uint256";
readonly name: "thresholdFilter";
readonly type: "uint256";
}];
readonly name: "getRateToEthWithCustomConnectors";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "weightedRate";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "srcToken";
readonly type: "address";
}, {
readonly internalType: "bool";
readonly name: "useSrcWrappers";
readonly type: "bool";
}, {
readonly internalType: "uint256";
readonly name: "thresholdFilter";
readonly type: "uint256";
}];
readonly name: "getRateToEthWithThreshold";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "weightedRate";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "srcToken";
readonly type: "address";
}, {
readonly internalType: "contract IERC20";
readonly name: "dstToken";
readonly type: "address";
}, {
readonly internalType: "bool";
readonly name: "useWrappers";
readonly type: "bool";
}, {
readonly internalType: "contract IERC20[]";
readonly name: "customConnectors";
readonly type: "address[]";
}, {
readonly internalType: "uint256";
readonly name: "thresholdFilter";
readonly type: "uint256";
}];
readonly name: "getRateWithCustomConnectors";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "weightedRate";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "srcToken";
readonly type: "address";
}, {
readonly internalType: "contract IERC20";
readonly name: "dstToken";
readonly type: "address";
}, {
readonly internalType: "bool";
readonly name: "useWrappers";
readonly type: "bool";
}, {
readonly internalType: "uint256";
readonly name: "thresholdFilter";
readonly type: "uint256";
}];
readonly name: "getRateWithThreshold";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "weightedRate";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "multiWrapper";
@@ -260,6 +399,6 @@ export declare class OffchainOracleAbi__factory {
readonly stateMutability: "nonpayable";
readonly type: "function";
}];
static createInterface(): OffchainOracleAbiInterface;
static connect(address: string, signerOrProvider: Signer | Provider): OffchainOracleAbi;
static createInterface(): OffchainOracleInterface;
static connect(address: string, runner?: ContractRunner | null): OffchainOracle;
}

View File

@@ -0,0 +1,533 @@
"use strict";
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
Object.defineProperty(exports, "__esModule", { value: true });
exports.OffchainOracle__factory = void 0;
const ethers_1 = require("ethers");
const _abi = [
{
inputs: [
{
internalType: "contract MultiWrapper",
name: "_multiWrapper",
type: "address",
},
{
internalType: "contract IOracle[]",
name: "existingOracles",
type: "address[]",
},
{
internalType: "enum OffchainOracle.OracleType[]",
name: "oracleTypes",
type: "uint8[]",
},
{
internalType: "contract IERC20[]",
name: "existingConnectors",
type: "address[]",
},
{
internalType: "contract IERC20",
name: "wBase",
type: "address",
},
{
internalType: "address",
name: "owner",
type: "address",
},
],
stateMutability: "nonpayable",
type: "constructor",
},
{
inputs: [],
name: "ArraysLengthMismatch",
type: "error",
},
{
inputs: [],
name: "ConnectorAlreadyAdded",
type: "error",
},
{
inputs: [],
name: "InvalidOracleTokenKind",
type: "error",
},
{
inputs: [],
name: "OracleAlreadyAdded",
type: "error",
},
{
inputs: [],
name: "SameTokens",
type: "error",
},
{
inputs: [],
name: "TooBigThreshold",
type: "error",
},
{
inputs: [],
name: "UnknownConnector",
type: "error",
},
{
inputs: [],
name: "UnknownOracle",
type: "error",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "contract IERC20",
name: "connector",
type: "address",
},
],
name: "ConnectorAdded",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "contract IERC20",
name: "connector",
type: "address",
},
],
name: "ConnectorRemoved",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "contract MultiWrapper",
name: "multiWrapper",
type: "address",
},
],
name: "MultiWrapperUpdated",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "contract IOracle",
name: "oracle",
type: "address",
},
{
indexed: false,
internalType: "enum OffchainOracle.OracleType",
name: "oracleType",
type: "uint8",
},
],
name: "OracleAdded",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "contract IOracle",
name: "oracle",
type: "address",
},
{
indexed: false,
internalType: "enum OffchainOracle.OracleType",
name: "oracleType",
type: "uint8",
},
],
name: "OracleRemoved",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "newOwner",
type: "address",
},
],
name: "OwnershipTransferred",
type: "event",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "connector",
type: "address",
},
],
name: "addConnector",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "contract IOracle",
name: "oracle",
type: "address",
},
{
internalType: "enum OffchainOracle.OracleType",
name: "oracleKind",
type: "uint8",
},
],
name: "addOracle",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "connectors",
outputs: [
{
internalType: "contract IERC20[]",
name: "allConnectors",
type: "address[]",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "srcToken",
type: "address",
},
{
internalType: "contract IERC20",
name: "dstToken",
type: "address",
},
{
internalType: "bool",
name: "useWrappers",
type: "bool",
},
],
name: "getRate",
outputs: [
{
internalType: "uint256",
name: "weightedRate",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "srcToken",
type: "address",
},
{
internalType: "bool",
name: "useSrcWrappers",
type: "bool",
},
],
name: "getRateToEth",
outputs: [
{
internalType: "uint256",
name: "weightedRate",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "srcToken",
type: "address",
},
{
internalType: "bool",
name: "useSrcWrappers",
type: "bool",
},
{
internalType: "contract IERC20[]",
name: "customConnectors",
type: "address[]",
},
{
internalType: "uint256",
name: "thresholdFilter",
type: "uint256",
},
],
name: "getRateToEthWithCustomConnectors",
outputs: [
{
internalType: "uint256",
name: "weightedRate",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "srcToken",
type: "address",
},
{
internalType: "bool",
name: "useSrcWrappers",
type: "bool",
},
{
internalType: "uint256",
name: "thresholdFilter",
type: "uint256",
},
],
name: "getRateToEthWithThreshold",
outputs: [
{
internalType: "uint256",
name: "weightedRate",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "srcToken",
type: "address",
},
{
internalType: "contract IERC20",
name: "dstToken",
type: "address",
},
{
internalType: "bool",
name: "useWrappers",
type: "bool",
},
{
internalType: "contract IERC20[]",
name: "customConnectors",
type: "address[]",
},
{
internalType: "uint256",
name: "thresholdFilter",
type: "uint256",
},
],
name: "getRateWithCustomConnectors",
outputs: [
{
internalType: "uint256",
name: "weightedRate",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "srcToken",
type: "address",
},
{
internalType: "contract IERC20",
name: "dstToken",
type: "address",
},
{
internalType: "bool",
name: "useWrappers",
type: "bool",
},
{
internalType: "uint256",
name: "thresholdFilter",
type: "uint256",
},
],
name: "getRateWithThreshold",
outputs: [
{
internalType: "uint256",
name: "weightedRate",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "multiWrapper",
outputs: [
{
internalType: "contract MultiWrapper",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "oracles",
outputs: [
{
internalType: "contract IOracle[]",
name: "allOracles",
type: "address[]",
},
{
internalType: "enum OffchainOracle.OracleType[]",
name: "oracleTypes",
type: "uint8[]",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "owner",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "connector",
type: "address",
},
],
name: "removeConnector",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "contract IOracle",
name: "oracle",
type: "address",
},
{
internalType: "enum OffchainOracle.OracleType",
name: "oracleKind",
type: "uint8",
},
],
name: "removeOracle",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "renounceOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "contract MultiWrapper",
name: "_multiWrapper",
type: "address",
},
],
name: "setMultiWrapper",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "newOwner",
type: "address",
},
],
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
];
class OffchainOracle__factory {
static createInterface() {
return new ethers_1.Interface(_abi);
}
static connect(address, runner) {
return new ethers_1.Contract(address, _abi, runner);
}
}
exports.OffchainOracle__factory = OffchainOracle__factory;
OffchainOracle__factory.abi = _abi;
//# sourceMappingURL=OffchainOracle__factory.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,318 +0,0 @@
"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

@@ -1 +0,0 @@
{"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;gB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ACE,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"}

View File

@@ -1,7 +1,6 @@
import { Signer } from 'ethers';
import type { Provider } from '@ethersproject/providers';
import type { OptimismL1FeeOracleAbi, OptimismL1FeeOracleAbiInterface } from '../OptimismL1FeeOracleAbi';
export declare class OptimismL1FeeOracleAbi__factory {
import { type ContractRunner } from "ethers";
import type { OptimismL1FeeOracle, OptimismL1FeeOracleInterface } from "../OptimismL1FeeOracle";
export declare class OptimismL1FeeOracle__factory {
static readonly abi: readonly [{
readonly inputs: readonly [{
readonly internalType: "address";
@@ -230,6 +229,6 @@ export declare class OptimismL1FeeOracleAbi__factory {
readonly stateMutability: "nonpayable";
readonly type: "function";
}];
static createInterface(): OptimismL1FeeOracleAbiInterface;
static connect(address: string, signerOrProvider: Signer | Provider): OptimismL1FeeOracleAbi;
static createInterface(): OptimismL1FeeOracleInterface;
static connect(address: string, runner?: ContractRunner | null): OptimismL1FeeOracle;
}

View File

@@ -0,0 +1,316 @@
"use strict";
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
Object.defineProperty(exports, "__esModule", { value: true });
exports.OptimismL1FeeOracle__factory = void 0;
const ethers_1 = require("ethers");
const _abi = [
{
inputs: [
{
internalType: "address",
name: "_owner",
type: "address",
},
],
stateMutability: "nonpayable",
type: "constructor",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "DecimalsUpdated",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "GasPriceUpdated",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "L1BaseFeeUpdated",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "OverheadUpdated",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "newOwner",
type: "address",
},
],
name: "OwnershipTransferred",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "ScalarUpdated",
type: "event",
},
{
inputs: [],
name: "decimals",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "gasPrice",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "bytes",
name: "_data",
type: "bytes",
},
],
name: "getL1Fee",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "bytes",
name: "_data",
type: "bytes",
},
],
name: "getL1GasUsed",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "l1BaseFee",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "overhead",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "owner",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "renounceOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "scalar",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "_decimals",
type: "uint256",
},
],
name: "setDecimals",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "_gasPrice",
type: "uint256",
},
],
name: "setGasPrice",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "_baseFee",
type: "uint256",
},
],
name: "setL1BaseFee",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "_overhead",
type: "uint256",
},
],
name: "setOverhead",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "_scalar",
type: "uint256",
},
],
name: "setScalar",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "newOwner",
type: "address",
},
],
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
];
class OptimismL1FeeOracle__factory {
static createInterface() {
return new ethers_1.Interface(_abi);
}
static connect(address, runner) {
return new ethers_1.Contract(address, _abi, runner);
}
}
exports.OptimismL1FeeOracle__factory = OptimismL1FeeOracle__factory;
OptimismL1FeeOracle__factory.abi = _abi;
//# sourceMappingURL=OptimismL1FeeOracle__factory.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"OptimismL1FeeOracle__factory.js","sourceRoot":"","sources":["../../../src/contracts/factories/OptimismL1FeeOracle__factory.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;;;AAEpB,mCAAkE;AAMlE,MAAM,IAAI,GAAG;IACX;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,aAAa;KACpB;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,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,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AChB;SACF;QACD,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;CACO,CAAC;AAEX,MAAa,4BAA4B;IAEvC,MAAM,CAAC,eAAe;QACpB,OAAO,IAAI,kBAAS,CAAC,IAAI,CAAiC,CAAC;IAC7D,CAAC;IACD,MAAM,CAAC,OAAO,CACZ,OAAe,EACf,MAA8B;QAE9B,OAAO,IAAI,iBAAQ,CACjB,OAAO,EACP,IAAI,EACJ,MAAM,CAC2B,CAAC;IACtC,CAAC;;AAdH,oEAeC;AAdiB,gCAAG,GAAG,IAAI,CAAC"}

View File

@@ -1,3 +1,4 @@
export { MulticallAbi__factory } from './MulticallAbi__factory';
export { OffchainOracleAbi__factory } from './OffchainOracleAbi__factory';
export { OptimismL1FeeOracleAbi__factory } from './OptimismL1FeeOracleAbi__factory';
export { GasPriceOracle__factory } from "./GasPriceOracle__factory";
export { Multicall__factory } from "./Multicall__factory";
export { OffchainOracle__factory } from "./OffchainOracle__factory";
export { OptimismL1FeeOracle__factory } from "./OptimismL1FeeOracle__factory";

View File

@@ -1,13 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OptimismL1FeeOracleAbi__factory = exports.OffchainOracleAbi__factory = exports.MulticallAbi__factory = void 0;
exports.OptimismL1FeeOracle__factory = exports.OffchainOracle__factory = exports.Multicall__factory = exports.GasPriceOracle__factory = void 0;
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
var 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; } });
var GasPriceOracle__factory_1 = require("./GasPriceOracle__factory");
Object.defineProperty(exports, "GasPriceOracle__factory", { enumerable: true, get: function () { return GasPriceOracle__factory_1.GasPriceOracle__factory; } });
var Multicall__factory_1 = require("./Multicall__factory");
Object.defineProperty(exports, "Multicall__factory", { enumerable: true, get: function () { return Multicall__factory_1.Multicall__factory; } });
var OffchainOracle__factory_1 = require("./OffchainOracle__factory");
Object.defineProperty(exports, "OffchainOracle__factory", { enumerable: true, get: function () { return OffchainOracle__factory_1.OffchainOracle__factory; } });
var OptimismL1FeeOracle__factory_1 = require("./OptimismL1FeeOracle__factory");
Object.defineProperty(exports, "OptimismL1FeeOracle__factory", { enumerable: true, get: function () { return OptimismL1FeeOracle__factory_1.OptimismL1FeeOracle__factory; } });
//# sourceMappingURL=index.js.map

View File

@@ -1 +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"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/contracts/factories/index.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AACpB,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAChC,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAChC,+EAA8E;AAArE,4IAAA,4BAA4B,OAAA"}

View File

@@ -1,7 +1,9 @@
export type { MulticallAbi } from './MulticallAbi';
export type { OffchainOracleAbi } from './OffchainOracleAbi';
export type { OptimismL1FeeOracleAbi } from './OptimismL1FeeOracleAbi';
export * as factories from './factories';
export { MulticallAbi__factory } from './factories/MulticallAbi__factory';
export { OffchainOracleAbi__factory } from './factories/OffchainOracleAbi__factory';
export { OptimismL1FeeOracleAbi__factory } from './factories/OptimismL1FeeOracleAbi__factory';
export type { GasPriceOracle } from "./GasPriceOracle";
export type { Multicall } from "./Multicall";
export type { OffchainOracle } from "./OffchainOracle";
export type { OptimismL1FeeOracle } from "./OptimismL1FeeOracle";
export * as factories from "./factories";
export { GasPriceOracle__factory } from "./factories/GasPriceOracle__factory";
export { Multicall__factory } from "./factories/Multicall__factory";
export { OffchainOracle__factory } from "./factories/OffchainOracle__factory";
export { OptimismL1FeeOracle__factory } from "./factories/OptimismL1FeeOracle__factory";

View File

@@ -23,12 +23,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OptimismL1FeeOracleAbi__factory = exports.OffchainOracleAbi__factory = exports.MulticallAbi__factory = exports.factories = void 0;
exports.OptimismL1FeeOracle__factory = exports.OffchainOracle__factory = exports.Multicall__factory = exports.GasPriceOracle__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; } });
var GasPriceOracle__factory_1 = require("./factories/GasPriceOracle__factory");
Object.defineProperty(exports, "GasPriceOracle__factory", { enumerable: true, get: function () { return GasPriceOracle__factory_1.GasPriceOracle__factory; } });
var Multicall__factory_1 = require("./factories/Multicall__factory");
Object.defineProperty(exports, "Multicall__factory", { enumerable: true, get: function () { return Multicall__factory_1.Multicall__factory; } });
var OffchainOracle__factory_1 = require("./factories/OffchainOracle__factory");
Object.defineProperty(exports, "OffchainOracle__factory", { enumerable: true, get: function () { return OffchainOracle__factory_1.OffchainOracle__factory; } });
var OptimismL1FeeOracle__factory_1 = require("./factories/OptimismL1FeeOracle__factory");
Object.defineProperty(exports, "OptimismL1FeeOracle__factory", { enumerable: true, get: function () { return OptimismL1FeeOracle__factory_1.OptimismL1FeeOracle__factory; } });
//# sourceMappingURL=index.js.map

View File

@@ -1 +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"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,yDAAyC;AACzC,+EAA8E;AAArE,kIAAA,uBAAuB,OAAA;AAChC,qEAAoE;AAA3D,wHAAA,kBAAkB,OAAA;AAC3B,+EAA8E;AAArE,kIAAA,uBAAuB,OAAA;AAChC,yFAAwF;AAA/E,4IAAA,4BAA4B,OAAA"}

15
lib/esm/constants.js Normal file
View File

@@ -0,0 +1,15 @@
export var ChainId;
(function (ChainId) {
ChainId[ChainId["MAINNET"] = 1] = "MAINNET";
ChainId[ChainId["BSC"] = 56] = "BSC";
ChainId[ChainId["XDAI"] = 100] = "XDAI";
ChainId[ChainId["POLYGON"] = 137] = "POLYGON";
ChainId[ChainId["OPTIMISM"] = 10] = "OPTIMISM";
ChainId[ChainId["ARBITRUM"] = 42161] = "ARBITRUM";
ChainId[ChainId["AVAX"] = 43114] = "AVAX";
ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
})(ChainId || (ChainId = {}));
export const ENS_CHAINS = [ChainId.MAINNET, ChainId.SEPOLIA];
export const multiCallAddress = '0xcA11bde05977b3631167028862bE2a173976CA11';
export const POLYGON_GAS_STATION = 'https://gasstation.polygon.technology/v2';
//# sourceMappingURL=constants.js.map

1
lib/esm/constants.js.map Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,OASX;AATD,WAAY,OAAO;IACjB,2CAAW,CAAA;IACX,oCAAQ,CAAA;IACR,uCAAU,CAAA;IACV,6CAAa,CAAA;IACb,8CAAa,CAAA;IACb,iDAAgB,CAAA;IAChB,yCAAY,CAAA;IACZ,kDAAkB,CAAA;AACpB,CAAC,EATW,OAAO,KAAP,OAAO,QASlB;AAID,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,4CAA4C,CAAC;AAE7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,0CAA0C,CAAC"}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=GasPriceOracle.js.map

View File

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

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=Multicall.js.map

View File

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

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=OffchainOracle.js.map

View File

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

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=OptimismL1FeeOracle.js.map

View File

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

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=common.js.map

View File

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

View File

@@ -0,0 +1,203 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, Interface } from "ethers";
const _abi = [
{
inputs: [],
stateMutability: "nonpayable",
type: "constructor",
},
{
inputs: [],
name: "GAS_UNIT",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint32",
name: "_derivationThresold",
type: "uint32",
},
],
name: "changeDerivationThresold",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint32",
name: "_gasUnit",
type: "uint32",
},
],
name: "changeGasUnit",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint32",
name: "_heartbeat",
type: "uint32",
},
],
name: "changeHeartbeat",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "_owner",
type: "address",
},
],
name: "changeOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "derivationThresold",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "gasPrice",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "heartbeat",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "maxFeePerGas",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "maxPriorityFeePerGas",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "owner",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "pastGasPrice",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint32",
name: "_gasPrice",
type: "uint32",
},
],
name: "setGasPrice",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "timestamp",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32",
},
],
stateMutability: "view",
type: "function",
},
];
export class GasPriceOracle__factory {
static createInterface() {
return new Interface(_abi);
}
static connect(address, runner) {
return new Contract(address, _abi, runner);
}
}
GasPriceOracle__factory.abi = _abi;
//# sourceMappingURL=GasPriceOracle__factory.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"GasPriceOracle__factory.js","sourceRoot":"","sources":["../../../../src/contracts/factories/GasPriceOracle__factory.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAuB,MAAM,QAAQ,CAAC;AAMlE,MAAM,IAAI,GAAG;IACX;QACE,MAAM,EAAE,EAAE;QACV,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,aAAa;KACpB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,S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AAQ;gBACtB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;aACf;SACF;QACD,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,QAAQ;gBACtB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,QAAQ;aACf;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;CACO,CAAC;AAEX,MAAM,OAAO,uBAAuB;IAElC,MAAM,CAAC,eAAe;QACpB,OAAO,IAAI,SAAS,CAAC,IAAI,CAA4B,CAAC;IACxD,CAAC;IACD,MAAM,CAAC,OAAO,CACZ,OAAe,EACf,MAA8B;QAE9B,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAA8B,CAAC;IAC1E,CAAC;;AATe,2BAAG,GAAG,IAAI,CAAC"}

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,529 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, Interface } from "ethers";
const _abi = [
{
inputs: [
{
internalType: "contract MultiWrapper",
name: "_multiWrapper",
type: "address",
},
{
internalType: "contract IOracle[]",
name: "existingOracles",
type: "address[]",
},
{
internalType: "enum OffchainOracle.OracleType[]",
name: "oracleTypes",
type: "uint8[]",
},
{
internalType: "contract IERC20[]",
name: "existingConnectors",
type: "address[]",
},
{
internalType: "contract IERC20",
name: "wBase",
type: "address",
},
{
internalType: "address",
name: "owner",
type: "address",
},
],
stateMutability: "nonpayable",
type: "constructor",
},
{
inputs: [],
name: "ArraysLengthMismatch",
type: "error",
},
{
inputs: [],
name: "ConnectorAlreadyAdded",
type: "error",
},
{
inputs: [],
name: "InvalidOracleTokenKind",
type: "error",
},
{
inputs: [],
name: "OracleAlreadyAdded",
type: "error",
},
{
inputs: [],
name: "SameTokens",
type: "error",
},
{
inputs: [],
name: "TooBigThreshold",
type: "error",
},
{
inputs: [],
name: "UnknownConnector",
type: "error",
},
{
inputs: [],
name: "UnknownOracle",
type: "error",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "contract IERC20",
name: "connector",
type: "address",
},
],
name: "ConnectorAdded",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "contract IERC20",
name: "connector",
type: "address",
},
],
name: "ConnectorRemoved",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "contract MultiWrapper",
name: "multiWrapper",
type: "address",
},
],
name: "MultiWrapperUpdated",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "contract IOracle",
name: "oracle",
type: "address",
},
{
indexed: false,
internalType: "enum OffchainOracle.OracleType",
name: "oracleType",
type: "uint8",
},
],
name: "OracleAdded",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "contract IOracle",
name: "oracle",
type: "address",
},
{
indexed: false,
internalType: "enum OffchainOracle.OracleType",
name: "oracleType",
type: "uint8",
},
],
name: "OracleRemoved",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "newOwner",
type: "address",
},
],
name: "OwnershipTransferred",
type: "event",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "connector",
type: "address",
},
],
name: "addConnector",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "contract IOracle",
name: "oracle",
type: "address",
},
{
internalType: "enum OffchainOracle.OracleType",
name: "oracleKind",
type: "uint8",
},
],
name: "addOracle",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "connectors",
outputs: [
{
internalType: "contract IERC20[]",
name: "allConnectors",
type: "address[]",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "srcToken",
type: "address",
},
{
internalType: "contract IERC20",
name: "dstToken",
type: "address",
},
{
internalType: "bool",
name: "useWrappers",
type: "bool",
},
],
name: "getRate",
outputs: [
{
internalType: "uint256",
name: "weightedRate",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "srcToken",
type: "address",
},
{
internalType: "bool",
name: "useSrcWrappers",
type: "bool",
},
],
name: "getRateToEth",
outputs: [
{
internalType: "uint256",
name: "weightedRate",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "srcToken",
type: "address",
},
{
internalType: "bool",
name: "useSrcWrappers",
type: "bool",
},
{
internalType: "contract IERC20[]",
name: "customConnectors",
type: "address[]",
},
{
internalType: "uint256",
name: "thresholdFilter",
type: "uint256",
},
],
name: "getRateToEthWithCustomConnectors",
outputs: [
{
internalType: "uint256",
name: "weightedRate",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "srcToken",
type: "address",
},
{
internalType: "bool",
name: "useSrcWrappers",
type: "bool",
},
{
internalType: "uint256",
name: "thresholdFilter",
type: "uint256",
},
],
name: "getRateToEthWithThreshold",
outputs: [
{
internalType: "uint256",
name: "weightedRate",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "srcToken",
type: "address",
},
{
internalType: "contract IERC20",
name: "dstToken",
type: "address",
},
{
internalType: "bool",
name: "useWrappers",
type: "bool",
},
{
internalType: "contract IERC20[]",
name: "customConnectors",
type: "address[]",
},
{
internalType: "uint256",
name: "thresholdFilter",
type: "uint256",
},
],
name: "getRateWithCustomConnectors",
outputs: [
{
internalType: "uint256",
name: "weightedRate",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "srcToken",
type: "address",
},
{
internalType: "contract IERC20",
name: "dstToken",
type: "address",
},
{
internalType: "bool",
name: "useWrappers",
type: "bool",
},
{
internalType: "uint256",
name: "thresholdFilter",
type: "uint256",
},
],
name: "getRateWithThreshold",
outputs: [
{
internalType: "uint256",
name: "weightedRate",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "multiWrapper",
outputs: [
{
internalType: "contract MultiWrapper",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "oracles",
outputs: [
{
internalType: "contract IOracle[]",
name: "allOracles",
type: "address[]",
},
{
internalType: "enum OffchainOracle.OracleType[]",
name: "oracleTypes",
type: "uint8[]",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "owner",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IERC20",
name: "connector",
type: "address",
},
],
name: "removeConnector",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "contract IOracle",
name: "oracle",
type: "address",
},
{
internalType: "enum OffchainOracle.OracleType",
name: "oracleKind",
type: "uint8",
},
],
name: "removeOracle",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "renounceOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "contract MultiWrapper",
name: "_multiWrapper",
type: "address",
},
],
name: "setMultiWrapper",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "newOwner",
type: "address",
},
],
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
];
export class OffchainOracle__factory {
static createInterface() {
return new Interface(_abi);
}
static connect(address, runner) {
return new Contract(address, _abi, runner);
}
}
OffchainOracle__factory.abi = _abi;
//# sourceMappingURL=OffchainOracle__factory.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,312 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, Interface } from "ethers";
const _abi = [
{
inputs: [
{
internalType: "address",
name: "_owner",
type: "address",
},
],
stateMutability: "nonpayable",
type: "constructor",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "DecimalsUpdated",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "GasPriceUpdated",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "L1BaseFeeUpdated",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "OverheadUpdated",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "newOwner",
type: "address",
},
],
name: "OwnershipTransferred",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "ScalarUpdated",
type: "event",
},
{
inputs: [],
name: "decimals",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "gasPrice",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "bytes",
name: "_data",
type: "bytes",
},
],
name: "getL1Fee",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "bytes",
name: "_data",
type: "bytes",
},
],
name: "getL1GasUsed",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "l1BaseFee",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "overhead",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "owner",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "renounceOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "scalar",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "_decimals",
type: "uint256",
},
],
name: "setDecimals",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "_gasPrice",
type: "uint256",
},
],
name: "setGasPrice",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "_baseFee",
type: "uint256",
},
],
name: "setL1BaseFee",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "_overhead",
type: "uint256",
},
],
name: "setOverhead",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "_scalar",
type: "uint256",
},
],
name: "setScalar",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "newOwner",
type: "address",
},
],
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
];
export class OptimismL1FeeOracle__factory {
static createInterface() {
return new Interface(_abi);
}
static connect(address, runner) {
return new Contract(address, _abi, runner);
}
}
OptimismL1FeeOracle__factory.abi = _abi;
//# sourceMappingURL=OptimismL1FeeOracle__factory.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"OptimismL1FeeOracle__factory.js","sourceRoot":"","sources":["../../../../src/contracts/factories/OptimismL1FeeOracle__factory.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAuB,MAAM,QAAQ,CAAC;AAMlE,MAAM,IAAI,GAAG;IACX;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,aAAa;KACpB;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SA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;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,MAAM,OAAO,4BAA4B;IAEvC,MAAM,CAAC,eAAe;QACpB,OAAO,IAAI,SAAS,CAAC,IAAI,CAAiC,CAAC;IAC7D,CAAC;IACD,MAAM,CAAC,OAAO,CACZ,OAAe,EACf,MAA8B;QAE9B,OAAO,IAAI,QAAQ,CACjB,OAAO,EACP,IAAI,EACJ,MAAM,CAC2B,CAAC;IACtC,CAAC;;AAbe,gCAAG,GAAG,IAAI,CAAC"}

View File

@@ -0,0 +1,8 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
export { GasPriceOracle__factory } from "./GasPriceOracle__factory";
export { Multicall__factory } from "./Multicall__factory";
export { OffchainOracle__factory } from "./OffchainOracle__factory";
export { OptimismL1FeeOracle__factory } from "./OptimismL1FeeOracle__factory";
//# sourceMappingURL=index.js.map

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,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC"}

View File

@@ -0,0 +1,7 @@
import * as factories_1 from "./factories";
export { factories_1 as factories };
export { GasPriceOracle__factory } from "./factories/GasPriceOracle__factory";
export { Multicall__factory } from "./factories/Multicall__factory";
export { OffchainOracle__factory } from "./factories/OffchainOracle__factory";
export { OptimismL1FeeOracle__factory } from "./factories/OptimismL1FeeOracle__factory";
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/contracts/index.ts"],"names":[],"mappings":"6BAO2B,aAAa;wBAA5B,SAAS;AACrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC"}

71
lib/esm/feeOracle.js Normal file
View File

@@ -0,0 +1,71 @@
import { Transaction, parseUnits } from 'ethers';
import { OptimismL1FeeOracle__factory } from './contracts';
import { getProvider } from './providers';
import { convertETHToTokenAmount } from './utils';
const DUMMY_ADDRESS = '0x1111111111111111111111111111111111111111';
const DUMMY_NONCE = '0x1111111111111111111111111111111111111111111111111111111111111111';
const DUMMY_WITHDRAW_DATA = '0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111';
export class TornadoFeeOracle {
constructor(netId, rpcUrl, config) {
const { optimismL1FeeOracleAddress } = config;
if (optimismL1FeeOracleAddress) {
const provider = getProvider(netId, rpcUrl, config);
this.optimismL1FeeOracle = OptimismL1FeeOracle__factory.connect(optimismL1FeeOracleAddress, provider);
}
}
/**
* Calculate L1 fee for op-stack chains
*
* This is required since relayers would pay the full transaction fees for users
*/
fetchL1OptimismFee(tx) {
if (!this.optimismL1FeeOracle) {
return new Promise((resolve) => resolve(BigInt(0)));
}
if (!tx) {
// this tx is only used to simulate bytes size of the encoded tx so has nothing to with the accuracy
// inspired by the old style classic-ui calculation
tx = {
type: 0,
gasLimit: 1000000,
nonce: Number(DUMMY_NONCE),
data: DUMMY_WITHDRAW_DATA,
gasPrice: parseUnits('1', 'gwei'),
from: DUMMY_ADDRESS,
to: DUMMY_ADDRESS,
};
}
return this.optimismL1FeeOracle.getL1Fee.staticCall(Transaction.from(tx).unsignedSerialized);
}
/**
* We don't need to distinguish default refunds by tokens since most users interact with other defi protocols after withdrawal
* So we default with 1M gas which is enough for two or three swaps
* Using 30 gwei for default but it is recommended to supply cached gasPrice value from the UI
*/
defaultEthRefund(gasPrice, gasLimit) {
return (gasPrice ? BigInt(gasPrice) : parseUnits('30', 'gwei')) * BigInt(gasLimit || 1000000);
}
/**
* Calculates token amount for required ethRefund purchases required to calculate fees
*/
calculateTokenAmount(ethRefund, tokenPriceInEth, tokenDecimals) {
return convertETHToTokenAmount(ethRefund, tokenPriceInEth, tokenDecimals);
}
/**
* Warning: For tokens you need to check if the fees are above denomination
* (Usually happens for small denomination pool or if the gas price is high)
*/
calculateRelayerFee({ gasPrice, gasLimit = 600000, l1Fee = 0, denomination, ethRefund = BigInt(0), tokenPriceInWei, tokenDecimals = 18, relayerFeePercent = 0.33, isEth = true, premiumPercent = 20, }) {
const gasCosts = BigInt(gasPrice) * BigInt(gasLimit) + BigInt(l1Fee);
const relayerFee = (BigInt(denomination) * BigInt(Math.floor(10000 * relayerFeePercent))) / BigInt(10000 * 100);
if (isEth) {
// Add 20% premium
return ((gasCosts + relayerFee) * BigInt(premiumPercent ? 100 + premiumPercent : 100)) / BigInt(100);
}
const feeInEth = gasCosts + BigInt(ethRefund);
return (((convertETHToTokenAmount(feeInEth, tokenPriceInWei, tokenDecimals) + relayerFee) *
BigInt(premiumPercent ? 100 + premiumPercent : 100)) /
BigInt(100));
}
}
//# sourceMappingURL=feeOracle.js.map

1
lib/esm/feeOracle.js.map Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"feeOracle.js","sourceRoot":"","sources":["../../src/feeOracle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEjD,OAAO,EAAuB,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,aAAa,GAAG,4CAA4C,CAAC;AAEnE,MAAM,WAAW,GAAG,oEAAoE,CAAC;AAEzF,MAAM,mBAAmB,GACvB,4kCAA4kC,CAAC;AAe/kC,MAAM,OAAO,gBAAgB;IAG3B,YAAY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tD,MAAM,CAAC,GAAG,CAAC,CACZ,CAAC;IACJ,CAAC;CACF"}

8
lib/esm/index.js Normal file
View File

@@ -0,0 +1,8 @@
export * from './constants';
export * from './feeOracle';
export * from './multicall';
export * from './providers';
export * from './tokenPriceOracle';
export * from './types';
export * from './utils';
//# sourceMappingURL=index.js.map

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

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}

33
lib/esm/multicall.js Normal file
View File

@@ -0,0 +1,33 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
export function multicall(Multicall, calls) {
return __awaiter(this, void 0, void 0, function* () {
const calldata = calls.map((call) => {
var _a, _b, _c;
const target = (((_a = call.contract) === null || _a === void 0 ? void 0 : _a.target) || call.address);
const callInterface = (((_b = call.contract) === null || _b === void 0 ? void 0 : _b.interface) || call.interface);
return {
target,
callData: callInterface.encodeFunctionData(call.name, call.params),
allowFailure: (_c = call.allowFailure) !== null && _c !== void 0 ? _c : false,
};
});
const returnData = yield Multicall.aggregate3.staticCall(calldata);
const res = returnData.map((call, i) => {
var _a;
const callInterface = (((_a = calls[i].contract) === null || _a === void 0 ? void 0 : _a.interface) || calls[i].interface);
const [result, data] = call;
const decodeResult = result && data && data !== '0x' ? callInterface.decodeFunctionResult(calls[i].name, data) : null;
return !decodeResult ? null : decodeResult.length === 1 ? decodeResult[0] : decodeResult;
});
return res;
});
}
//# sourceMappingURL=multicall.js.map

1
lib/esm/multicall.js.map Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"multicall.js","sourceRoot":"","sources":["../../src/multicall.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,UAAgB,SAAS,CAAC,SAAoB,EAAE,KAAc;;QAClE,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;;YAClC,MAAM,MAAM,GAAG,CAAC,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,MAAM,KAAI,IAAI,CAAC,OAAO,CAAW,CAAC;YACjE,MAAM,aAAa,GAAG,CAAC,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,SAAS,KAAI,IAAI,CAAC,SAAS,CAAc,CAAC;YAEhF,OAAO;gBACL,MAAM;gBACN,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;gBAClE,YAAY,EAAE,MAAA,IAAI,CAAC,YAAY,mCAAI,KAAK;aACzC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,MAAM,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAEnE,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;;YACrC,MAAM,aAAa,GAAG,CAAC,CAAA,MAAA,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,0CAAE,SAAS,KAAI,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAc,CAAC;YACxF,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC;YAC5B,MAAM,YAAY,GAChB,MAAM,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YACnG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;QAC3F,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;IACb,CAAC;CAAA"}

89
lib/esm/providers.js Normal file
View File

@@ -0,0 +1,89 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { JsonRpcProvider, Network, parseUnits, FetchUrlFeeDataNetworkPlugin, EnsPlugin, GasCostPlugin } from 'ethers';
import { GasPriceOracle__factory, Multicall__factory } from './contracts';
import { ENS_CHAINS, multiCallAddress, POLYGON_GAS_STATION } from './constants';
import { multicall } from './multicall';
import { isNode } from './utils';
// caching to improve performance
const oracleMapper = new Map();
const multicallMapper = new Map();
export function getGasOraclePlugin(networkKey, gasOracleOptions) {
const gasStationApi = (gasOracleOptions === null || gasOracleOptions === void 0 ? void 0 : gasOracleOptions.gasStationApi) || POLYGON_GAS_STATION;
return new FetchUrlFeeDataNetworkPlugin(gasStationApi, (fetchFeeData, provider, request) => __awaiter(this, void 0, void 0, function* () {
if (!oracleMapper.has(networkKey)) {
oracleMapper.set(networkKey, GasPriceOracle__factory.connect(gasOracleOptions === null || gasOracleOptions === void 0 ? void 0 : gasOracleOptions.gasPriceOracle, provider));
}
if (!multicallMapper.has(networkKey)) {
multicallMapper.set(networkKey, Multicall__factory.connect(multiCallAddress, provider));
}
const Oracle = oracleMapper.get(networkKey);
const Multicall = multicallMapper.get(networkKey);
const [timestamp, heartbeat, feePerGas, priorityFeePerGas] = yield multicall(Multicall, [
{
contract: Oracle,
name: 'timestamp',
},
{
contract: Oracle,
name: 'heartbeat',
},
{
contract: Oracle,
name: 'maxFeePerGas',
},
{
contract: Oracle,
name: 'maxPriorityFeePerGas',
},
]);
const isOutdated = Number(timestamp) <= Date.now() / 1000 - Number(heartbeat);
if (!isOutdated) {
const maxPriorityFeePerGas = (priorityFeePerGas * BigInt(13)) / BigInt(10);
const maxFeePerGas = feePerGas * BigInt(2) + maxPriorityFeePerGas;
return {
gasPrice: maxFeePerGas,
maxFeePerGas,
maxPriorityFeePerGas,
};
}
if (isNode) {
// Prevent Cloudflare from blocking our request in node.js
request.setHeader('User-Agent', 'ethers');
}
const [{ bodyJson: { fast }, }, { gasPrice },] = yield Promise.all([request.send(), fetchFeeData()]);
return {
gasPrice,
maxFeePerGas: parseUnits(`${fast.maxFee}`, 9),
maxPriorityFeePerGas: parseUnits(`${fast.maxPriorityFee}`, 9),
};
}));
}
export function getProvider(netId, rpcUrl, config) {
const { networkName, gasPriceOracleContract, gasStationApi, pollInterval } = config;
const hasEns = ENS_CHAINS.includes(netId);
const staticNetwork = new Network(networkName, netId);
if (hasEns) {
staticNetwork.attachPlugin(new EnsPlugin(null, Number(netId)));
}
staticNetwork.attachPlugin(new GasCostPlugin());
if (gasPriceOracleContract) {
staticNetwork.attachPlugin(getGasOraclePlugin(`${netId}_${rpcUrl}`, {
gasPriceOracle: gasPriceOracleContract,
gasStationApi,
}));
}
const provider = new JsonRpcProvider(rpcUrl, staticNetwork, {
staticNetwork,
});
provider.pollingInterval = pollInterval * 1000;
return provider;
}
//# sourceMappingURL=providers.js.map

1
lib/esm/providers.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AAE,YAAY,EAAE,CAAC,CAAC,CAAC;QAExD,OAAO;YACL,QAAQ;YACR,YAAY,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YAC7C,oBAAoB,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;SAC9D,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAkB,EAAE,MAAc,EAAE,MAAqB;IACnF,MAAM,EAAE,WAAW,EAAE,sBAAsB,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IACpF,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE1C,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IACtD,IAAI,MAAM,EAAE,CAAC;QACX,aAAa,CAAC,YAAY,CAAC,IAAI,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,aAAa,CAAC,YAAY,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;IAEhD,IAAI,sBAAsB,EAAE,CAAC;QAC3B,aAAa,CAAC,YAAY,CACxB,kBAAkB,CAAC,GAAG,KAAK,IAAI,MAAM,EAAE,EAAE;YACvC,cAAc,EAAE,sBAAsB;YACtC,aAAa;SACd,CAAC,CACH,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE;QAC1D,aAAa;KACd,CAAC,CAAC;IAEH,QAAQ,CAAC,eAAe,GAAG,YAAY,GAAG,IAAI,CAAC;IAE/C,OAAO,QAAQ,CAAC;AAClB,CAAC"}

View File

@@ -0,0 +1,46 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { parseEther } from 'ethers';
import { Multicall__factory, OffchainOracle__factory } from './contracts';
import { multiCallAddress } from './constants';
import { multicall } from './multicall';
import { getProvider } from './providers';
export class TokenPriceOracle {
constructor(netId, rpcUrl, config) {
const { offchainOracleContract } = config;
this.provider = getProvider(netId, rpcUrl, config);
this.multicall = Multicall__factory.connect(multiCallAddress, this.provider);
if (offchainOracleContract) {
this.oracle = OffchainOracle__factory.connect(offchainOracleContract, this.provider);
}
}
fetchPrices(tokens) {
return __awaiter(this, void 0, void 0, function* () {
// setup mock price for testnets
if (!this.oracle) {
return new Promise((resolve) => resolve(tokens.reduce((acc, _, index) => {
acc[tokens[index].symbol] = parseEther('0.0001').toString();
return acc;
}, {})));
}
const prices = (yield multicall(this.multicall, tokens.map(({ tokenAddress }) => ({
contract: this.oracle,
name: 'getRateToEth',
params: [tokenAddress, true],
}))));
return prices.reduce((acc, price, index) => {
const tokenPriceInwei = (price * BigInt(10 ** tokens[index].decimals)) / BigInt(10 ** 18);
acc[tokens[index].symbol] = tokenPriceInwei.toString();
return acc;
}, {});
});
}
}
//# sourceMappingURL=tokenPriceOracle.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"tokenPriceOracle.js","sourceRoot":"","sources":["../../src/tokenPriceOracle.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAY,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAa,kBAAkB,EAAkB,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACrG,OAAO,EAAe,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,SAAS,EAA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CAAC;aAC7B,CAAC,CAAC,CACJ,CAAa,CAAC;YAEf,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;gBACzC,MAAM,eAAe,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;gBAE1F,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC;gBAEvD,OAAO,GAAG,CAAC;YACb,CAAC,EAAE,EAAiB,CAAC,CAAC;QACxB,CAAC;KAAA;CACF"}

2
lib/esm/types.js Normal file
View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.js.map

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

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

17
lib/esm/utils.js Normal file
View File

@@ -0,0 +1,17 @@
export const isNode = !(process.browser
// prettier-ignore
// @ts-ignore
) && typeof globalThis.window === 'undefined';
export function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
/**
* Example:
*
* amountInWei (0.1 ETH) * tokenDecimals (18) * tokenPriceInWei (0.0008) = 125 TOKEN
*/
export function convertETHToTokenAmount(amountInWei, tokenPriceInWei, tokenDecimals = 18) {
const tokenDecimalsMultiplier = BigInt(10 ** Number(tokenDecimals));
return (BigInt(amountInWei) * tokenDecimalsMultiplier) / BigInt(tokenPriceInWei);
}
//# sourceMappingURL=utils.js.map

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

@@ -0,0 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,MAAM,GACjB,CAAC,CAEG,OAGD,CAAC,OAAO;AACT,kBAAkB;AAClB,aAAa;CACd,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,WAAW,CAAC;AAEhD,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAAyB,EACzB,eAA6B,EAC7B,gBAAwB,EAAE;IAE1B,MAAM,uBAAuB,GAAG,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,uBAAuB,CAAC,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AACnF,CAAC"}

161
lib/feeOracle.d.ts vendored
View File

@@ -1,122 +1,41 @@
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>;
import type { BigNumberish, TransactionLike } from 'ethers';
import { OptimismL1FeeOracle } from './contracts';
import { ChainIdType } from './constants';
import { networkConfig } from './types';
export interface RelayerFeeParams {
gasPrice: BigNumberish;
gasLimit?: BigNumberish;
l1Fee?: BigNumberish;
denomination: BigNumberish;
ethRefund: BigNumberish;
tokenPriceInWei: BigNumberish;
tokenDecimals: number;
relayerFeePercent?: number;
isEth?: boolean;
premiumPercent?: number;
}
export declare class TornadoFeeOracle {
optimismL1FeeOracle?: OptimismL1FeeOracle;
constructor(netId: ChainIdType, rpcUrl: string, config: networkConfig);
/**
* Calculate L1 fee for op-stack chains
*
* This is required since relayers would pay the full transaction fees for users
*/
fetchL1OptimismFee(tx?: TransactionLike): Promise<bigint>;
/**
* We don't need to distinguish default refunds by tokens since most users interact with other defi protocols after withdrawal
* So we default with 1M gas which is enough for two or three swaps
* Using 30 gwei for default but it is recommended to supply cached gasPrice value from the UI
*/
defaultEthRefund(gasPrice?: BigNumberish, gasLimit?: BigNumberish): bigint;
/**
* Calculates token amount for required ethRefund purchases required to calculate fees
*/
calculateTokenAmount(ethRefund: BigNumberish, tokenPriceInEth: BigNumberish, tokenDecimals?: number): bigint;
/**
* Warning: For tokens you need to check if the fees are above denomination
* (Usually happens for small denomination pool or if the gas price is high)
*/
calculateRelayerFee({ gasPrice, gasLimit, l1Fee, denomination, ethRefund, tokenPriceInWei, tokenDecimals, relayerFeePercent, isEth, premiumPercent, }: RelayerFeeParams): bigint;
}

View File

@@ -1,374 +1,74 @@
"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);
const ethers_1 = require("ethers");
const contracts_1 = require("./contracts");
const providers_1 = require("./providers");
const utils_1 = require("./utils");
const DUMMY_ADDRESS = '0x1111111111111111111111111111111111111111';
const DUMMY_NONCE = 1024;
const DUMMY_WITHDRAW_DATA = '0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111';
class TornadoFeeOracle {
constructor(netId, rpcUrl, config) {
const { optimismL1FeeOracleAddress } = config;
if (optimismL1FeeOracleAddress) {
const provider = (0, providers_1.getProvider)(netId, rpcUrl, config);
this.optimismL1FeeOracle = contracts_1.OptimismL1FeeOracle__factory.connect(optimismL1FeeOracleAddress, provider);
}
}
/**
* 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.
* Calculate L1 fee for op-stack chains
*
* Refund needed that recipient can use tokens after withdrawal (covers gas fee for send/swap)
* @param {BigNumberish} gasPrice Actual gas price
* @param {InstanceTokenSymbol} tokenSymbol Withdrawal token (currency) symbol - for example, 'dai'
* @returns {HexadecimalStringifiedNumber} Refund amount in WEI (in hex format)
* This is required since relayers would pay the full transaction fees for users
*/
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';
fetchL1OptimismFee(tx) {
if (!this.optimismL1FeeOracle) {
return new Promise((resolve) => resolve(BigInt(0)));
}
// In Tornado we need to calculate refund only on user side, relayer get refund value in proof
var gasLimit = config_1.defaultInstanceTokensGasLimit[tokenSymbol];
return ethers_1.BigNumber.from(gasPrice).mul(gasLimit).mul(2).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: 1000000,
nonce: DUMMY_NONCE,
data: DUMMY_WITHDRAW_DATA,
gasPrice: (0, ethers_1.parseUnits)('1', 'gwei'),
to: DUMMY_ADDRESS,
};
}
return this.optimismL1FeeOracle.getL1Fee.staticCall(ethers_1.Transaction.from(tx).unsignedSerialized);
}
/**
* 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)
* 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
*/
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)];
}
});
});
};
defaultEthRefund(gasPrice, gasLimit) {
return (gasPrice ? BigInt(gasPrice) : (0, ethers_1.parseUnits)('30', 'gwei')) * BigInt(gasLimit || 1000000);
}
/**
* 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)
* Calculates token amount for required ethRefund purchases required to calculate fees
*/
TornadoFeeOracle.prototype.calculateRefundInToken = function (gasPrice, tokenPriceInEth, tokenDecimals, tokenSymbol) {
var refundInEth = this.calculateRefundInETH(gasPrice, tokenSymbol);
return (0, utils_2.convertETHToToken)(refundInEth, tokenDecimals, tokenPriceInEth).toHexString();
};
calculateTokenAmount(ethRefund, tokenPriceInEth, tokenDecimals) {
return (0, utils_1.convertETHToTokenAmount)(ethRefund, tokenPriceInEth, tokenDecimals);
}
/**
* 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)
* 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)
*/
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;
}());
calculateRelayerFee({ gasPrice, gasLimit = 600000, l1Fee = 0, denomination, ethRefund = BigInt(0), tokenPriceInWei, tokenDecimals = 18, relayerFeePercent = 0.33, isEth = true, premiumPercent = 20, }) {
const gasCosts = BigInt(gasPrice) * BigInt(gasLimit) + BigInt(l1Fee);
const relayerFee = (BigInt(denomination) * BigInt(Math.floor(10000 * relayerFeePercent))) / BigInt(10000 * 100);
if (isEth) {
// Add 20% premium
return ((gasCosts + relayerFee) * BigInt(premiumPercent ? 100 + premiumPercent : 100)) / BigInt(100);
}
const feeInEth = gasCosts + BigInt(ethRefund);
return ((((0, utils_1.convertETHToTokenAmount)(feeInEth, tokenPriceInWei, tokenDecimals) + relayerFee) *
BigInt(premiumPercent ? 100 + premiumPercent : 100)) /
BigInt(100));
}
}
exports.TornadoFeeOracle = TornadoFeeOracle;
//# sourceMappingURL=feeOracle.js.map

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More