Closed pedroyan closed 7 months ago
Let me know if we can provide any more information that can be useful in the investigation here!
I'm getting the same symptom. Using version @uniswap/smart-order-router@3.17.4 in a browser. (tried to upgrade to latest but couldn't get it to work in the browser, but that's a different issue)
The point of failure for me is in OptimismGasDataProvider.getGasData
, where it's making making these calls:
'l1BaseFee', 'scalar', 'decimals', 'overhead'
The tx.results
show failures for 'scalar' and 'overhead'
[
{
"success": true,
"result": [
{
"type": "BigNumber",
"hex": "0x05b619715f"
}
]
},
{
"success": false,
"returnData": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002647617350726963654f7261636c653a207363616c6172282920697320646570726563617465640000000000000000000000000000000000000000000000000000"
},
{
"success": true,
"result": [
{
"type": "BigNumber",
"hex": "0x06"
}
]
},
{
"success": false,
"returnData": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002847617350726963654f7261636c653a206f7665726865616428292069732064657072656361746564000000000000000000000000000000000000000000000000"
}
]
I'm seeing this same thing, is there a way around this?
Confirmed for us as well!
also confirming seeing this too
I solved this by using the v2 version of swap router: 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45 Found here: https://docs.uniswap.org/contracts/v3/reference/deployments under SwapRouter02
i believe the error is related to the deprecation of L1 calldata fees and transition to blob fees. the data returned by the errors decoded are revert messages: "GasPriceOracle: scalar() is deprecated" and "GasPriceOracle: overhead() is deprecated"
i'm not sure what the equivalent of overhead is in blobspace, but the patch below fixes the issue. it replaces the L1 fee variables with blob equivalents where available (everything except overhead) and updates the gas oracle ABI with the one from the latest deployment https://optimistic.etherscan.io/address/0xb528d11cc114e026f138fe568744c6d45ce6da7a#code
diff --git a/node_modules/@uniswap/smart-order-router/build/module/providers/v3/gas-data-provider.js b/node_modules/@uniswap/smart-order-router/build/module/providers/v3/gas-data-provider.js
index 700e514..939c775 100644
--- a/node_modules/@uniswap/smart-order-router/build/module/providers/v3/gas-data-provider.js
+++ b/node_modules/@uniswap/smart-order-router/build/module/providers/v3/gas-data-provider.js
@@ -2,6 +2,7 @@ import { ChainId } from '@uniswap/sdk-core';
import { GasDataArbitrum__factory } from '../../types/other/factories/GasDataArbitrum__factory';
import { GasPriceOracle__factory } from '../../types/other/factories/GasPriceOracle__factory';
import { ARB_GASINFO_ADDRESS, log, OVM_GASPRICE_ADDRESS } from '../../util';
+import { BigNumber } from 'ethers';
export class OptimismGasDataProvider {
constructor(chainId, multicall2Provider, gasPriceAddress) {
this.chainId = chainId;
@@ -18,23 +19,25 @@ export class OptimismGasDataProvider {
*/
async getGasData() {
var _a, _b, _c, _d;
- const funcNames = ['l1BaseFee', 'scalar', 'decimals', 'overhead'];
+ const funcNames = ['blobBaseFee', 'blobBaseFeeScalar', 'decimals', 'overhead'];
const tx = await this.multicall2Provider.callMultipleFunctionsOnSameContract({
address: this.gasOracleAddress,
contractInterface: GasPriceOracle__factory.createInterface(),
functionNames: funcNames,
});
+
if (!((_a = tx.results[0]) === null || _a === void 0 ? void 0 : _a.success) ||
!((_b = tx.results[1]) === null || _b === void 0 ? void 0 : _b.success) ||
- !((_c = tx.results[2]) === null || _c === void 0 ? void 0 : _c.success) ||
- !((_d = tx.results[3]) === null || _d === void 0 ? void 0 : _d.success)) {
+ !((_c = tx.results[2]) === null || _c === void 0 ? void 0 : _c.success)
+ // || !((_d = tx.results[3]) === null || _d === void 0 ? void 0 : _d.success)
+ ) {
log.info({ results: tx.results }, 'Failed to get gas constants data from the optimism gas oracle');
throw new Error('Failed to get gas constants data from the optimism gas oracle');
}
const { result: l1BaseFee } = tx.results[0];
const { result: scalar } = tx.results[1];
const { result: decimals } = tx.results[2];
- const { result: overhead } = tx.results[3];
+ const { result: overhead } = tx.results[3].success ? tx.results[3] : {result: [BigNumber.from(0)]};
return {
l1BaseFee: l1BaseFee[0],
scalar: scalar[0],
diff --git a/node_modules/@uniswap/smart-order-router/build/module/types/other/factories/GasPriceOracle__factory.js b/node_modules/@uniswap/smart-order-router/build/module/types/other/factories/GasPriceOracle__factory.js
index a893e46..c41f77e 100644
--- a/node_modules/@uniswap/smart-order-router/build/module/types/other/factories/GasPriceOracle__factory.js
+++ b/node_modules/@uniswap/smart-order-router/build/module/types/other/factories/GasPriceOracle__factory.js
@@ -4,302 +4,207 @@
import { Contract, utils } 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",
- },
-];
+ "inputs": [],
+ "name": "DECIMALS",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "baseFee",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "baseFeeScalar",
+ "outputs": [
+ {
+ "internalType": "uint32",
+ "name": "",
+ "type": "uint32"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "blobBaseFee",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "blobBaseFeeScalar",
+ "outputs": [
+ {
+ "internalType": "uint32",
+ "name": "",
+ "type": "uint32"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "decimals",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "pure",
+ "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": "isEcotone",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "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": "scalar",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "setEcotone",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "version",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ }
+ ];
export class GasPriceOracle__factory {
static createInterface() {
return new utils.Interface(_abi);
Same here. Can anyone please help me?
I was facing the same problem and it was resolved after I update to 3.26.1!!
we were able to get rid of the error of Failed to get gas constants data from the optimism gas oracle
by upgrading to :
"@uniswap/sdk-core": "^4.2.0",
"@uniswap/smart-order-router": "^3.26.0",
"@uniswap/v3-periphery": "^1.4.4",
"@uniswap/v3-sdk": "^3.11.0",
which caused Browser is not defined
- solution : Adding fallback script as mentioned in comments in #484
after which we ran into -
so we moved the L:6 variables - _SEPOLIA
of github.com/Uniswap/smart-order-router/blob/main/src/routers/alpha-router/functions/get-candidate-pools.ts
i.e.
USDC_ARBITRUM_SEPOLIA, DAI_OPTIMISM_SEPOLIA, USDC_OPTIMISM_SEPOLIA, USDT_OPTIMISM_SEPOLIA, WBTC_OPTIMISM_SEPOLIA
to already existing import on L:16
import { USDC_ARBITRUM_SEPOLIA, DAI_OPTIMISM_SEPOLIA, USDC_OPTIMISM_SEPOLIA, USDT_OPTIMISM_SEPOLIA, WBTC_OPTIMISM_SEPOLIA, CELO,
CELO_ALFAJORES, ...} from '../../../providers/token-provider';
It seems to have worked for me. I was able to get a quote for ETH/ other tokens .. on Optimism chain using Alpha router & do a successful swap. So I would request uniswap team @jsy1218 to update the imports perhaps? not sure why there are two different imports when they use the same token-provider
file.
Sorry for the trouble. The original issue happened after OP Ecotone upgrade, same day as Dencun. Proper fix was in since 3.26.0.
For the minor import issue in https://github.com/Uniswap/smart-order-router/issues/518#issuecomment-2034291988, will find a time to fix.
@jsy1218 It seems the import fix to https://github.com/Uniswap/smart-order-router/issues/518#issuecomment-2034291988 was never merged upstream
I'm submitting a ...
[x] bug report [ ] feature request [ ] question about the decisions made in the repository [ ] question about how to use this project
Summary
Hi there! I work for Endaoment and we are currently unable to process donations on L2's due to an error we are getting with the AutoRouter.
Every time we try to compute swaps on
Optimism
orBase
on their respective Mainnets, the AutoRouter throws the following error:"Error: Failed to get gas constants data from the optimism gas oracle"
The problem seems to have started alongside the Dencun Update, so may be related?
Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)
Stack trace:
Arguments for failed
WETH/USDbC
Swap Quote onBase
Arguments for failed
WETH/USDC
Swap Quote onOptimism