-
Notifications
You must be signed in to change notification settings - Fork 43
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
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should let integrators know about this prior to rolling out. This will change expected fees
api/_utils.ts
Outdated
: DEFAULT_GAS_MARKUP; | ||
return ( | ||
1 + | ||
(sdk.utils.chainIsOPStack(Number(chainId)) |
There was a problem hiding this comment.
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
@@ -1966,13 +1969,12 @@ export function latestGasPriceCache(chainId: number) { | |||
* @returns The gas price in the native currency of the chain | |||
*/ | |||
export async function getMaxFeePerGas(chainId: number): Promise<BigNumber> { | |||
if (sdk.utils.chainIsOPStack(chainId)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important LOC we're removing. We should use gas price oracle for all estimates since it handles OP stack now
Note: because this PR uses the SDK's GasPriceOracle to compute gas prices even for OpStack chains we should NOT MERGE this PR until we set the GAS_PRICE_EIP1559_RAW_ variables equal to true (and probably also the NEW_GAS_PRICE_ORACLE_59144 ). Otherwise the API will give higher gas price estimates than we use currently |
Signed-off-by: nicholaspai <[email protected]>
depends on across-protocol/sdk#801
We can test this by querying
/api/gas-prices
against the same endpoint on the prod deployment. This will show roughly how the gas costs will change with prod.Ultimately, what matters is the
gasFeeTotal
in the/limits
end point and we should compare with prod.Results
{"1": 0.05, "10": 1.0, "137": 2.0, "288": 1.0, "324": 0.01, "480": 1.0, "8453": 0.8, "42161": 1.0, "59144": 0.2, "34443": 1.0, "81457": 1.0, "534352": 1.0, "690": 1.0, "7777777": 1.0}
limits?destinationChainId=137&token=0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
maxFeePerGas
in Preview API is larger than Prod API but the Polygon GAS_MARKUP = 3 and in the preview API its only applied to thebaseFee
where in Prod API its applied to the fulltokenGasCost = gasCost * maxFeePerGas
limits?destinationChainId=1&token=0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
limits?destinationChainId=10&token=0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
limits?destinationChainId=8453&token=0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
limits?destinationChainId=534352&token=0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
limits?destinationChainId=324&token=0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
limits?destinationChainId=59144&token=0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
limits?destinationChainId=1135&token=0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
limits?destinationChainId=42161&token=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
limits?destinationChainId=41455&token=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
limits?destinationChainId=690&token=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2