Skip to content

Commit

Permalink
update matic oracle & temp remove knownAccounts check
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSulpiride committed Aug 20, 2024
1 parent 2ab3514 commit b997256
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
35 changes: 17 additions & 18 deletions packages/executor/src/services/BundlingService/relayers/fastlane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,23 @@ export class FastlaneRelayer extends BaseRelayer {
maxFeePerGas: bundle.maxFeePerGas,
};

if (this.networkConfig.eip2930) {
const { storageMap } = bundle;
const addresses = Object.keys(storageMap);
if (addresses.length) {
const accessList: AccessList = [];
for (const address of addresses) {
const storageKeys = storageMap[address];
if (typeof storageKeys == "object") {
accessList.push({
address,
storageKeys: Object.keys(storageKeys),
});
}
}
transactionRequest.accessList = accessList;
}
}
// if (this.networkConfig.eip2930) {
// const { storageMap } = bundle;
// const addresses = Object.keys(storageMap);
// if (addresses.length) {
// const accessList: AccessList = [];
// for (const address of addresses) {
// const storageKeys = storageMap[address];
// if (typeof storageKeys == "object") {
// accessList.push({
// address,
// storageKeys: Object.keys(storageKeys),
// });
// }
// }
// transactionRequest.accessList = accessList;
// }
// }

if (
chainsWithoutEIP1559.some((chainId: number) => chainId === this.chainId)
Expand Down Expand Up @@ -206,7 +206,6 @@ export class FastlaneRelayer extends BaseRelayer {
const params = [
signedRawTx,
{
knownAccounts: storageMap,
blockNumberMin: block.number,
blockNumberMax: block.number + 180, // ~10 minutes
timestampMin: block.timestamp,
Expand Down
16 changes: 11 additions & 5 deletions packages/params/src/gas-price-oracles/oracles/matic.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { IGetGasFeeResult, IOracle } from "./interfaces";
import { parseGwei } from "./utils";

export const getMaticGasFee: IOracle = async (): Promise<IGetGasFeeResult> => {
const oracle = "https://gasstation.polygon.technology/v2";
export const getMaticGasFee: IOracle = async (
apiKey: string
): Promise<IGetGasFeeResult> => {
let oracle =
"https://api.polygonscan.com/api?module=gastracker&action=gasoracle";
if (apiKey) {
oracle += `&apikey=${apiKey}`;
}
const data = await (await fetch(oracle)).json();
return {
maxPriorityFeePerGas: parseGwei(data.fast.maxPriorityFee),
maxFeePerGas: parseGwei(data.fast.maxFee),
gasPrice: parseGwei(data.fast.maxFee),
maxPriorityFeePerGas: parseGwei(data.result.FastGasPrice),
maxFeePerGas: parseGwei(data.result.FastGasPrice),
gasPrice: parseGwei(data.result.FastGasPrice),
};
};

0 comments on commit b997256

Please sign in to comment.