Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve(API): Apply gas mark up to base fee rather than gas cost #1339

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1a21394
improve(API): Apply gas mark up to base fee rather than gas cost
nicholaspai Dec 19, 2024
eaf7fd8
Update _utils.ts
nicholaspai Dec 27, 2024
ed22e76
Update _utils.ts
nicholaspai Jan 2, 2025
00a4557
Update _utils.ts
nicholaspai Jan 2, 2025
cb6b690
Update limits.ts
nicholaspai Jan 2, 2025
cdde913
Update _utils.ts
nicholaspai Jan 3, 2025
396d62b
3.4.1 sdk
nicholaspai Jan 3, 2025
8cf8072
Merge branch 'master' into gas-markup-fee
nicholaspai Jan 3, 2025
99b5da2
Update _utils.ts
nicholaspai Jan 3, 2025
eb77db9
Update _utils.ts
nicholaspai Jan 3, 2025
ea0a94d
Merge branch 'master' into gas-markup-fee
nicholaspai Jan 3, 2025
ed05490
3.4.3
nicholaspai Jan 3, 2025
769296d
Update _utils.ts
nicholaspai Jan 3, 2025
6a524ac
improve(API): Add gas costs to /gas-prices endpoint
nicholaspai Jan 3, 2025
0113ac5
Merge branch 'gas-costs' into gas-markup-fee
nicholaspai Jan 3, 2025
3044ca9
Add gas costs to api
nicholaspai Jan 3, 2025
099d72b
Merge branch 'gas-costs' into gas-markup-fee
nicholaspai Jan 3, 2025
18c3641
Update _utils.ts
nicholaspai Jan 4, 2025
c9a3481
Update gas-prices.ts
nicholaspai Jan 4, 2025
75254f6
Update _utils.ts
nicholaspai Jan 4, 2025
6f2bcf3
Update gas-prices.ts
nicholaspai Jan 4, 2025
051be80
Remove reading from cache
nicholaspai Jan 4, 2025
7f4f2a8
Update gas-prices.ts
nicholaspai Jan 4, 2025
bbfbe1b
Merge branch 'gas-costs' into gas-markup-fee
nicholaspai Jan 4, 2025
5fb79b9
Update gas-prices.ts
nicholaspai Jan 4, 2025
6948d14
Update gas-prices.ts
nicholaspai Jan 4, 2025
752704c
Allow caller to set token symbol
nicholaspai Jan 4, 2025
868d76b
Update gas-prices.ts
nicholaspai Jan 4, 2025
7d91801
Update gas-prices.ts
nicholaspai Jan 4, 2025
47fa488
Update gas-prices.ts
nicholaspai Jan 4, 2025
5f6a1c5
Return full gas price broken down
nicholaspai Jan 4, 2025
2ffb6a6
Update gas-prices.ts
nicholaspai Jan 4, 2025
f10a8e9
Update gas-prices.ts
nicholaspai Jan 4, 2025
fc08217
Update gas-prices.ts
nicholaspai Jan 4, 2025
9fe1b31
Update gas-prices.ts
nicholaspai Jan 4, 2025
24c2bbd
Add op stack gas cost
nicholaspai Jan 4, 2025
207397d
refactor
nicholaspai Jan 4, 2025
ca704ea
Revert "refactor"
nicholaspai Jan 4, 2025
e48b4f9
Revert "Add op stack gas cost"
nicholaspai Jan 4, 2025
894c141
Reapply "Add op stack gas cost"
nicholaspai Jan 4, 2025
0f3d4f2
Try op stack l1 gas cost again
nicholaspai Jan 4, 2025
cd4dd7e
Update gas-prices.ts
nicholaspai Jan 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions api/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,9 +594,12 @@ export const getGasMarkup = (chainId: string | number) => {
return gasMarkup[chainId];
}

return sdk.utils.chainIsOPStack(Number(chainId))
? gasMarkup[CHAIN_IDs.OPTIMISM] ?? DEFAULT_GAS_MARKUP
: DEFAULT_GAS_MARKUP;
return (
1 +
(sdk.utils.chainIsOPStack(Number(chainId))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One difference here. In the current multiplier use case, the SDK adds the gasMarkup to 1 here.

Whereas, the new SDK change I propose assumes that the passed in multiplier is complete already and doesn't need to be added to anything

? gasMarkup[CHAIN_IDs.OPTIMISM] ?? DEFAULT_GAS_MARKUP
: DEFAULT_GAS_MARKUP)
);
};

/**
Expand Down Expand Up @@ -641,8 +644,7 @@ const getRelayerFeeCalculatorQueries = (
overrides.spokePoolAddress || getSpokePoolAddress(destinationChainId),
overrides.relayerAddress,
REACT_APP_COINGECKO_PRO_API_KEY,
getLogger(),
getGasMarkup(destinationChainId)
getLogger()
);
};

Expand Down Expand Up @@ -1972,7 +1974,8 @@ export async function getMaxFeePerGas(chainId: number): Promise<BigNumber> {
}
const { maxFeePerGas } = await sdk.gasPriceOracle.getGasPriceEstimate(
nicholaspai marked this conversation as resolved.
Show resolved Hide resolved
getProvider(chainId),
chainId
chainId,
getGasMarkup(chainId)
);
return maxFeePerGas;
}
Expand Down
Loading