Compare commits

...

6 Commits

135 changed files with 10904 additions and 3134 deletions

1
.gitignore vendored

@ -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

@ -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"
}
]

@ -1,38 +0,0 @@
[
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"internalType": "struct MultiCall.Call[]",
"name": "calls",
"type": "tuple[]"
}
],
"name": "multicall",
"outputs": [
{
"internalType": "bytes[]",
"name": "results",
"type": "bytes[]"
},
{
"internalType": "bool[]",
"name": "success",
"type": "bool[]"
}
],
"stateMutability": "view",
"type": "function"
}
]

440
abis/Multicall.json Normal 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"
}
]

@ -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

@ -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"
}
]

14
lib/constants.d.ts vendored Normal 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

@ -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

@ -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

@ -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: {};
}

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

@ -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

@ -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: {};
}

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

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

304
lib/contracts/OffchainOracle.d.ts vendored Normal 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>;
};
}

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

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

188
lib/contracts/OptimismL1FeeOracle.d.ts vendored Normal 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>;
};
}

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

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

50
lib/contracts/common.d.ts vendored Normal file

@ -0,0 +1,50 @@
import type { FunctionFragment, Typed, EventFragment, ContractTransaction, ContractTransactionResponse, DeferredTopicFilter, EventLog, TransactionRequest, LogDescription } from "ethers";
export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> extends DeferredTopicFilter {
}
export interface TypedContractEvent<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;
}
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>;
}
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 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 {};

3
lib/contracts/common.js Normal file

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

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

@ -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;
}

@ -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

@ -0,0 +1 @@
{"version":3,"file":"GasPriceOracle__factory.js","sourceRoot":"","sources":["../../../src/contracts/factories/GasPriceOracle__factory.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;;;AAEpB,mCAAkE;AAMlE,MAAM,IAAI,GAAG;IACX;QACE,MAAM,EAAE,EAAE;QACV,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,aAAa;KACpB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,QAAQ;gBACtB,IAAI,EAAE,qBAAqB;gBAC3B,IAAI,EAAE,QAAQ;aACf;SACF;QACD,IAAI,EAAE,0BAA0B;QAChC,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,QAAQ;gBACtB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;aACf;SACF;QACD,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,QAAQ;gBACtB,IAAI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AAQ,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAA8B,CAAC;IAC1E,CAAC;;AAVH,0DAWC;AAViB,2BAAG,GAAG,IAAI,CAAC"}

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

@ -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

@ -0,0 +1,404 @@
import { type ContractRunner } from "ethers";
import type { OffchainOracle, OffchainOracleInterface } from "../OffchainOracle";
export declare class OffchainOracle__factory {
static readonly abi: readonly [{
readonly inputs: readonly [{
readonly internalType: "contract MultiWrapper";
readonly name: "_multiWrapper";
readonly type: "address";
}, {
readonly internalType: "contract IOracle[]";
readonly name: "existingOracles";
readonly type: "address[]";
}, {
readonly internalType: "enum OffchainOracle.OracleType[]";
readonly name: "oracleTypes";
readonly type: "uint8[]";
}, {
readonly internalType: "contract IERC20[]";
readonly name: "existingConnectors";
readonly type: "address[]";
}, {
readonly internalType: "contract IERC20";
readonly name: "wBase";
readonly type: "address";
}, {
readonly internalType: "address";
readonly name: "owner";
readonly type: "address";
}];
readonly stateMutability: "nonpayable";
readonly type: "constructor";
}, {
readonly inputs: readonly [];
readonly name: "ArraysLengthMismatch";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "ConnectorAlreadyAdded";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "InvalidOracleTokenKind";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "OracleAlreadyAdded";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "SameTokens";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "TooBigThreshold";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "UnknownConnector";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "UnknownOracle";
readonly type: "error";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "contract IERC20";
readonly name: "connector";
readonly type: "address";
}];
readonly name: "ConnectorAdded";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "contract IERC20";
readonly name: "connector";
readonly type: "address";
}];
readonly name: "ConnectorRemoved";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "contract MultiWrapper";
readonly name: "multiWrapper";
readonly type: "address";
}];
readonly name: "MultiWrapperUpdated";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "contract IOracle";
readonly name: "oracle";
readonly type: "address";
}, {
readonly indexed: false;
readonly internalType: "enum OffchainOracle.OracleType";
readonly name: "oracleType";
readonly type: "uint8";
}];
readonly name: "OracleAdded";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "contract IOracle";
readonly name: "oracle";
readonly type: "address";
}, {
readonly indexed: false;
readonly internalType: "enum OffchainOracle.OracleType";
readonly name: "oracleType";
readonly type: "uint8";
}];
readonly name: "OracleRemoved";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly internalType: "address";
readonly name: "previousOwner";
readonly type: "address";
}, {
readonly indexed: true;
readonly internalType: "address";
readonly name: "newOwner";
readonly type: "address";
}];
readonly name: "OwnershipTransferred";
readonly type: "event";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "connector";
readonly type: "address";
}];
readonly name: "addConnector";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IOracle";
readonly name: "oracle";
readonly type: "address";
}, {
readonly internalType: "enum OffchainOracle.OracleType";
readonly name: "oracleKind";
readonly type: "uint8";
}];
readonly name: "addOracle";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "connectors";
readonly outputs: readonly [{
readonly internalType: "contract IERC20[]";
readonly name: "allConnectors";
readonly type: "address[]";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "srcToken";
readonly type: "address";
}, {
readonly internalType: "contract IERC20";
readonly name: "dstToken";
readonly type: "address";
}, {
readonly internalType: "bool";
readonly name: "useWrappers";
readonly type: "bool";
}];
readonly name: "getRate";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "weightedRate";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "srcToken";
readonly type: "address";
}, {
readonly internalType: "bool";
readonly name: "useSrcWrappers";
readonly type: "bool";
}];
readonly name: "getRateToEth";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "weightedRate";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "srcToken";
readonly type: "address";
}, {
readonly internalType: "bool";
readonly name: "useSrcWrappers";
readonly type: "bool";
}, {
readonly internalType: "contract IERC20[]";
readonly name: "customConnectors";
readonly type: "address[]";
}, {
readonly internalType: "uint256";
readonly name: "thresholdFilter";
readonly type: "uint256";
}];
readonly name: "getRateToEthWithCustomConnectors";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "weightedRate";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "srcToken";
readonly type: "address";
}, {
readonly internalType: "bool";
readonly name: "useSrcWrappers";
readonly type: "bool";
}, {
readonly internalType: "uint256";
readonly name: "thresholdFilter";
readonly type: "uint256";
}];
readonly name: "getRateToEthWithThreshold";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "weightedRate";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "srcToken";
readonly type: "address";
}, {
readonly internalType: "contract IERC20";
readonly name: "dstToken";
readonly type: "address";
}, {
readonly internalType: "bool";
readonly name: "useWrappers";
readonly type: "bool";
}, {
readonly internalType: "contract IERC20[]";
readonly name: "customConnectors";
readonly type: "address[]";
}, {
readonly internalType: "uint256";
readonly name: "thresholdFilter";
readonly type: "uint256";
}];
readonly name: "getRateWithCustomConnectors";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "weightedRate";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "srcToken";
readonly type: "address";
}, {
readonly internalType: "contract IERC20";
readonly name: "dstToken";
readonly type: "address";
}, {
readonly internalType: "bool";
readonly name: "useWrappers";
readonly type: "bool";
}, {
readonly internalType: "uint256";
readonly name: "thresholdFilter";
readonly type: "uint256";
}];
readonly name: "getRateWithThreshold";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "weightedRate";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "multiWrapper";
readonly outputs: readonly [{
readonly internalType: "contract MultiWrapper";
readonly name: "";
readonly type: "address";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "oracles";
readonly outputs: readonly [{
readonly internalType: "contract IOracle[]";
readonly name: "allOracles";
readonly type: "address[]";
}, {
readonly internalType: "enum OffchainOracle.OracleType[]";
readonly name: "oracleTypes";
readonly type: "uint8[]";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "owner";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "";
readonly type: "address";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IERC20";
readonly name: "connector";
readonly type: "address";
}];
readonly name: "removeConnector";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract IOracle";
readonly name: "oracle";
readonly type: "address";
}, {
readonly internalType: "enum OffchainOracle.OracleType";
readonly name: "oracleKind";
readonly type: "uint8";
}];
readonly name: "removeOracle";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "renounceOwnership";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract MultiWrapper";
readonly name: "_multiWrapper";
readonly type: "address";
}];
readonly name: "setMultiWrapper";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "address";
readonly name: "newOwner";
readonly type: "address";
}];
readonly name: "transferOwnership";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}];
static createInterface(): OffchainOracleInterface;
static connect(address: string, runner?: ContractRunner | null): OffchainOracle;
}

@ -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

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

@ -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

@ -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;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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,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"}

4
lib/contracts/factories/index.d.ts vendored Normal file

@ -0,0 +1,4 @@
export { GasPriceOracle__factory } from "./GasPriceOracle__factory";
export { Multicall__factory } from "./Multicall__factory";
export { OffchainOracle__factory } from "./OffchainOracle__factory";
export { OptimismL1FeeOracle__factory } from "./OptimismL1FeeOracle__factory";

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

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

9
lib/contracts/index.d.ts vendored Normal file

@ -0,0 +1,9 @@
export type { GasPriceOracle } from "./GasPriceOracle";
export type { Multicall } from "./Multicall";
export type { OffchainOracle } from "./OffchainOracle";
export type { OptimismL1FeeOracle } from "./OptimismL1FeeOracle";
export * as factories from "./factories";
export { GasPriceOracle__factory } from "./factories/GasPriceOracle__factory";
export { Multicall__factory } from "./factories/Multicall__factory";
export { OffchainOracle__factory } from "./factories/OffchainOracle__factory";
export { OptimismL1FeeOracle__factory } from "./factories/OptimismL1FeeOracle__factory";

36
lib/contracts/index.js Normal file

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

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

15
lib/esm/constants.js Normal 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

@ -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"}

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

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

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

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

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

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

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

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

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

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

@ -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

@ -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,SAAS;aAChB;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,QAAQ;gBACtB,IAAI,EAAE,qBAAqB;gBAC3B,IAAI,EAAE,QAAQ;aACf;SACF;QACD,IAAI,EAAE,0BAA0B;QAChC,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,QAAQ;gBACtB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;aACf;SACF;QACD,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,QAAQ;gBACtB,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;aACf;SACF;QACD,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE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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

@ -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

@ -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

@ -0,0 +1 @@
{"version":3,"file":"OptimismL1FeeOracle__factory.js","sourceRoot":"","sources":["../../../../src/contracts/factories/OptimismL1FeeOracle__factory.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAuB,MAAM,QAAQ,CAAC;AAMlE,MAAM,IAAI,GAAG;IACX;QACE,MAAM,EAAE;YACN;gBACE,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,aAAa;KACpB;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EA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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"}

@ -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

@ -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"}

@ -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

@ -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

@ -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/fe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AC;YACV,kBAAkB;YAClB,OAAO,CAAC,CAAC,QAAQ,GAAG,UAAU,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACvG,CAAC;QAED,MAAM,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;QAE9C,OAAO,CACL,CAAC,CAAC,uBAAuB,CAAC,QAAQ,EAAE,eAAe,EAAE,aAAa,CAAC,GAAG,UAAU,CAAC;YAC/E,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACtD,MAAM,CAAC,GAAG,CAAC,CACZ,CAAC;IACJ,CAAC;CACF"}

8
lib/esm/index.js Normal 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

@ -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

@ -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

@ -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

@ -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.js.map Normal file

@ -0,0 +1 @@
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../src/providers.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,4BAA4B,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACtH,OAAO,EAAkB,uBAAuB,EAAa,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACrG,OAAO,EAAE,UAAU,EAAe,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,iCAAiC;AACjC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;AAC/B,MAAM,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;AAElC,MAAM,UAAU,kBAAkB,CAAC,UAAkB,EAAE,gBAAmC;IACxF,MAAM,aAAa,GAAG,CAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,aAAa,KAAI,mBAAmB,CAAC;IAE7E,OAAO,IAAI,4BAA4B,CAAC,aAAa,EAAE,CAAO,YAAY,EA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,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"}

@ -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

@ -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,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,MAAM,OAAO,gBAAgB;IAK3B,YAAY,KAAkB,EAAE,MAAc,EAAE,MAAqB;QACnE,MAAM,EAAE,sBAAsB,EAAE,GAAG,MAAM,CAAC;QAE1C,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,GAAG,kBAAkB,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE7E,IAAI,sBAAsB,EAAE,CAAC;YAC3B,IAAI,CAAC,MAAM,GAAG,uBAAuB,CAAC,OAAO,CAAC,sBAAsB,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;IAEK,WAAW,CAAC,MAAe;;YAC/B,gCAAgC;YAChC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACjB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC7B,OAAO,CACL,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;oBAC9B,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;oBAC5D,OAAO,GAAG,CAAC;gBACb,CAAC,EAAE,EAAiB,CAAC,CACtB,CACF,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,GAAG,CAAC,MAAM,SAAS,CAC7B,IAAI,CAAC,SAAS,EACd,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;gBAChC,QAAQ,EAAE,IAAI,CAAC,MAAM;gBACrB,IAAI,EAAE,cAAc;gBACpB,MAAM,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC;aAC7B,CAAC,CAAC,CACJ,CAAa,CAAC;YAEf,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;gBACzC,MAAM,eAAe,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;gBAE1F,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC;gBAEvD,OAAO,GAAG,CAAC;YACb,CAAC,EAAE,EAAiB,CAAC,CAAC;QACxB,CAAC;KAAA;CACF"}

2
lib/esm/types.js Normal file

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

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

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

17
lib/esm/utils.js Normal 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

@ -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"}

41
lib/feeOracle.d.ts vendored Normal file

@ -0,0 +1,41 @@
import type { BigNumberish, TransactionLike } from 'ethers';
import { OptimismL1FeeOracle } from './contracts';
import { ChainIdType } from './constants';
import { networkConfig } from './types';
export interface RelayerFeeParams {
gasPrice: BigNumberish;
gasLimit?: BigNumberish;
l1Fee?: BigNumberish;
denomination: BigNumberish;
ethRefund: BigNumberish;
tokenPriceInWei: BigNumberish;
tokenDecimals: number;
relayerFeePercent?: number;
isEth?: boolean;
premiumPercent?: number;
}
export declare class TornadoFeeOracle {
optimismL1FeeOracle?: OptimismL1FeeOracle;
constructor(netId: ChainIdType, rpcUrl: string, config: networkConfig);
/**
* Calculate L1 fee for op-stack chains
*
* This is required since relayers would pay the full transaction fees for users
*/
fetchL1OptimismFee(tx?: TransactionLike): Promise<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;
}

74
lib/feeOracle.js Normal file

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

1
lib/feeOracle.js.map Normal file

@ -0,0 +1 @@
{"version":3,"file":"feeOracle.js","sourceRoot":"","sources":["../src/feeOracle.ts"],"names":[],"mappings":";;;AAAA,mCAAiD;AAEjD,2CAAgF;AAEhF,2CAA0C;AAE1C,mCAAkD;AAElD,MAAM,aAAa,GAAG,4CAA4C,CAAC;AAEnE,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB,MAAM,mBAAmB,GACvB,4kCAA4kC,CAAC;AAe/kC,MAAa,gBAAgB;IAG3B,YAAY,KAAkB,EAAE,MAAc,EAAE,MAAqB;QACnE,MAAM,EAAE,0BAA0B,EAAE,GAAG,MAAM,CAAC;QAE9C,IAAI,0BAA0B,EAAE,CAAC;YAC/B,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;YACpD,IAAI,CAAC,mBAAmB,GAAG,wCAA4B,CAAC,OAAO,CAAC,0BAA0B,EAAE,QAAQ,CAAC,CAAC;QACxG,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,kBAAkB,CAAC,EAAoB;QACrC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC9B,OAAO,IAAI,OAAO,CAAC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AAC,QAAQ,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAErE,MAAM,UAAU,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;QAEhH,IAAI,KAAK,EAAE,CAAC;YACV,kBAAkB;YAClB,OAAO,CAAC,CAAC,QAAQ,GAAG,UAAU,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACvG,CAAC;QAED,MAAM,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;QAE9C,OAAO,CACL,CAAC,CAAC,IAAA,+BAAuB,EAAC,QAAQ,EAAE,eAAe,EAAE,aAAa,CAAC,GAAG,UAAU,CAAC;YAC/E,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACtD,MAAM,CAAC,GAAG,CAAC,CACZ,CAAC;IACJ,CAAC;CACF;AAvFD,4CAuFC"}

7
lib/index.d.ts vendored Normal file

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

24
lib/index.js Normal file

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

1
lib/index.js.map Normal file

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,8CAA4B;AAC5B,8CAA4B;AAC5B,8CAA4B;AAC5B,qDAAmC;AACnC,0CAAwB;AACxB,0CAAwB"}

3
lib/multicall.d.ts vendored Normal file

@ -0,0 +1,3 @@
import { Multicall } from './contracts';
import type { Call3 } from './types';
export declare function multicall(Multicall: Multicall, calls: Call3[]): Promise<any[]>;

37
lib/multicall.js Normal file

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

1
lib/multicall.js.map Normal file

@ -0,0 +1 @@
{"version":3,"file":"multicall.js","sourceRoot":"","sources":["../src/multicall.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,SAAsB,SAAS,CAAC,SAAoB,EAAE,KAAc;;QAClE,MAAM,QAAQ,GAAG,KAAK,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;AAvBD,8BAuBC"}

5
lib/providers.d.ts vendored Normal file

@ -0,0 +1,5 @@
import { JsonRpcProvider, FetchUrlFeeDataNetworkPlugin } from 'ethers';
import { ChainIdType } from './constants';
import type { networkConfig, gasOracleOptions } from './types';
export declare function getGasOraclePlugin(networkKey: string, gasOracleOptions?: gasOracleOptions): FetchUrlFeeDataNetworkPlugin;
export declare function getProvider(netId: ChainIdType, rpcUrl: string, config: networkConfig): JsonRpcProvider;

94
lib/providers.js Normal file

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

1
lib/providers.js.map Normal file

@ -0,0 +1 @@
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAsH;AACtH,2CAAqG;AACrG,2CAA6F;AAC7F,2CAAwC;AAExC,mCAAiC;AAEjC,iCAAiC;AACjC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;AAC/B,MAAM,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;AAElC,SAAgB,kBAAkB,CAAC,UAAkB,EAAE,gBAAmC;IACxF,MAAM,aAAa,GAAG,CAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,aAAa,KAAI,+BAAmB,CAAC;IAE7E,OAAO,IAAI,qCAA4B,CAAC,aAAa,EAAE,CAAO,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;QAC/F,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,E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AC,GAAG,KAAK,IAAI,MAAM,EAAE,EAAE;YACvC,cAAc,EAAE,sBAAsB;YACtC,aAAa;SACd,CAAC,CACH,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,wBAAe,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;AA3BD,kCA2BC"}

11
lib/tokenPriceOracle.d.ts vendored Normal file

@ -0,0 +1,11 @@
import { Provider } from 'ethers';
import { Multicall, OffchainOracle } from './contracts';
import { ChainIdType } from './constants';
import { Token, TokenPrices, networkConfig } from './types';
export declare class TokenPriceOracle {
oracle?: OffchainOracle;
multicall: Multicall;
provider: Provider;
constructor(netId: ChainIdType, rpcUrl: string, config: networkConfig);
fetchPrices(tokens: Token[]): Promise<TokenPrices>;
}

50
lib/tokenPriceOracle.js Normal file

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

@ -0,0 +1 @@
{"version":3,"file":"tokenPriceOracle.js","sourceRoot":"","sources":["../src/tokenPriceOracle.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAA8C;AAC9C,2CAAqG;AACrG,2CAA4D;AAC5D,2CAAwC;AACxC,2CAA0C;AAG1C,MAAa,gBAAgB;IAK3B,YAAY,KAAkB,EAAE,MAAc,EAAE,MAAqB;QACnE,MAAM,EAAE,sBAAsB,EAAE,GAAG,MAAM,CAAC;QAE1C,IAAI,CAAC,QAAQ,GAAG,IAAA,uBAAW,EAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,GAAG,8BAAkB,CAAC,OAAO,CAAC,4BAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE7E,IAAI,sBAAsB,EAAE,CAAC;YAC3B,IAAI,CAAC,MAAM,GAAG,mCAAuB,CAAC,OAAO,CAAC,sBAAsB,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;IAEK,WAAW,CAAC,MAAe;;YAC/B,gCAAgC;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} from 'ethers';
export type Token = {
tokenAddress: string;
symbol: string;
decimals: number;
};
export type TokenPrices = {
[tokenSymbol in string]?: string;
};
export interface Call3 {
contract?: BaseContract;
address?: string;
interface?: Interface;
name: string;
params?: any[];
allowFailure?: boolean;
}
export interface gasOracleOptions {
gasPriceOracle?: string;
gasStationApi?: string;
}
export interface networkConfig {
networkName: string;
offchainOracleContract?: string;
optimismL1FeeOracleAddress?: string;
gasPriceOracleContract?: string;
gasStationApi?: string;
pollInterval: number;
}

3
lib/types.js Normal file

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

1
lib/types.js.map Normal file

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

9
lib/utils.d.ts vendored Normal file

@ -0,0 +1,9 @@
import type { BigNumberish } from 'ethers';
export declare const isNode: boolean;
export declare function sleep(ms: number): Promise<unknown>;
/**
* Example:
*
* amountInWei (0.1 ETH) * tokenDecimals (18) * tokenPriceInWei (0.0008) = 125 TOKEN
*/
export declare function convertETHToTokenAmount(amountInWei: BigNumberish, tokenPriceInWei: BigNumberish, tokenDecimals?: number): bigint;

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