Compare commits

..

2 Commits

Author SHA1 Message Date
08635da692
Add built files for test 2024-11-21 13:03:30 +00:00
bef587cc1a
Remove broken external oracle and fixed EIP-1559 gasPrice calculation
* Updated 1inch Oracle link and use multicall3 ( because this is the only contract supported on sepolia )
* Simplify EIP-1559 gasPrice calculation ( EIP-1559 removes necessity of using external oracles, just enough premium of basefee will ensure transaction being mined )
* Apply respective premium for fees ( Only applied on V6 Oracle class )
* Removed @tornado/gas-price-oracle oracle
2024-11-21 13:01:45 +00:00
4 changed files with 15 additions and 4 deletions

@ -7,7 +7,8 @@ import { ITornadoFeeOracle, TransactionData, TxType, LegacyGasPriceKey, GasPrice
*/
export declare class TornadoFeeOracleV6 extends TornadoFeeOracle implements ITornadoFeeOracle {
private fallbackFeeOracle;
constructor(chainId: number, rpcUrl: string);
overrideGasPrice?: GasPriceParams;
constructor(chainId: number, rpcUrl: string, overrideGasPrice?: GasPriceParams);
/**
* Apply static 10% gasLimit premium as it wouldn't change across nodes or relayers
*/

@ -63,9 +63,10 @@ var feeOracleV5_1 = require("./feeOracleV5");
*/
var TornadoFeeOracleV6 = /** @class */ (function (_super) {
__extends(TornadoFeeOracleV6, _super);
function TornadoFeeOracleV6(chainId, rpcUrl) {
function TornadoFeeOracleV6(chainId, rpcUrl, overrideGasPrice) {
var _this = _super.call(this, 6, chainId, rpcUrl) || this;
_this.fallbackFeeOracle = new feeOracleV5_1.TornadoFeeOracleV5(chainId, rpcUrl);
_this.overrideGasPrice = overrideGasPrice;
return _this;
}
/**
@ -101,6 +102,9 @@ var TornadoFeeOracleV6 = /** @class */ (function (_super) {
TornadoFeeOracleV6.prototype.getGasPriceParams = function (speed, bumpPercent) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
if (this.overrideGasPrice) {
return [2 /*return*/, this.overrideGasPrice];
}
if (typeof bumpPercent === 'undefined') {
bumpPercent = this.chainId === config_1.ChainId.BSC ? undefined : 30;
}

@ -1 +1 @@
{"version":3,"file":"feeOracleV6.js","s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AAC;wBAElF,qBAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,EAAA;;wBAArD,eAAe,GAAG,SAAmC;wBAC3D,sBAAO,IAAA,YAAI,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC,QAAQ,EAAE,EAAC;;;;KACtD;IAED;;;;;;;;OAQG;IACG,8CAAiB,GAAvB,UAAwB,KAAyB,EAAE,WAAoB;;;gBACrE,IAAI,IAAI,CAAC,gBAAgB,EAAE;oBACzB,sBAAO,IAAI,CAAC,gBAAgB,EAAC;iBAC9B;gBACD,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE;oBACtC,WAAW,GAAG,IAAI,CAAC,OAAO,KAAK,gBAAO,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;iBAC7D;gBACD,sBAAO,iBAAM,iBAAiB,YAAC,KAAK,EAAE,WAAW,CAAC,EAAC;;;KACpD;IAED;;OAEG;IACG,6DAAgC,GAAtC,UACE,MAA8D;;;;;4BAEjD,qBAAM,iBAAM,gCAAgC,YAAC,MAAM,CAAC,EAAA;;wBAA3D,IAAI,GAAG,SAAoD;wBAE3D,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;wBAEjF,sBAAO,IAAA,YAAI,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,EAAC;;;;KAC1C;IACH,yBAAC;AAAD,CAAC,AArDD,CAAwC,4BAAgB,GAqDvD;AArDY,gDAAkB"}

@ -19,11 +19,14 @@ import { TornadoFeeOracleV5 } from './feeOracleV5';
*/
export class TornadoFeeOracleV6 extends TornadoFeeOracle implements ITornadoFeeOracle {
private fallbackFeeOracle: TornadoFeeOracleV5;
// Override value for BSC (Since old relayers use static value of 3.3 gwei)
public overrideGasPrice?: GasPriceParams;
public constructor(chainId: number, rpcUrl: string) {
public constructor(chainId: number, rpcUrl: string, overrideGasPrice?: GasPriceParams) {
super(6, chainId, rpcUrl);
this.fallbackFeeOracle = new TornadoFeeOracleV5(chainId, rpcUrl);
this.overrideGasPrice = overrideGasPrice;
}
/**
@ -46,6 +49,9 @@ export class TornadoFeeOracleV6 extends TornadoFeeOracle implements ITornadoFeeO
* (Can spike 12.5% per block accoring to the EIP-1559 metrics https://metamask.io/1559/)
*/
async getGasPriceParams(speed?: LegacyGasPriceKey, bumpPercent?: number): Promise<GasPriceParams> {
if (this.overrideGasPrice) {
return this.overrideGasPrice;
}
if (typeof bumpPercent === 'undefined') {
bumpPercent = this.chainId === ChainId.BSC ? undefined : 30;
}