@xspswap/smart-order-router
Version:
XSwap Protocol V3 Smart Order Router
31 lines (30 loc) • 1.02 kB
TypeScript
import { BigNumber } from '@ethersproject/bignumber';
/**
* Provider for getting gas constants on L2s.
*
* @export
* @interface IL2GasDataProvider
*/
export interface IL2GasDataProvider<T> {
/**
* Gets the data constants needed to calculate the l1 security fee on L2s like arbitrum and optimism.
* @returns An object that includes the data necessary for the off chain estimations.
*/
getGasData(): Promise<T>;
}
export type OptimismGasData = {
l1BaseFee: BigNumber;
scalar: BigNumber;
decimals: BigNumber;
overhead: BigNumber;
};
/**
* perL2TxFee is the base fee in wei for an l2 transaction.
* perL2CalldataFee is the fee in wei per byte of calldata the swap uses. Multiply by the total bytes of the calldata.
* perArbGasTotal is the fee in wei per unit of arbgas. Multiply this by the estimate we calculate based on ticks/hops in the gasModel.
*/
export type ArbitrumGasData = {
perL2TxFee: BigNumber;
perL1CalldataFee: BigNumber;
perArbGasTotal: BigNumber;
};