forked from tornado-packages/tornado-oracles
Compare commits
2 Commits
ab8af5fd91
...
build
| Author | SHA1 | Date | |
|---|---|---|---|
|
16ffc1e491
|
|||
|
c9f43ff292
|
2
lib/feeOracle.d.ts
vendored
2
lib/feeOracle.d.ts
vendored
@@ -118,5 +118,5 @@ export declare abstract class TornadoFeeOracle implements ITornadoFeeOracle {
|
|||||||
*
|
*
|
||||||
* @returns {Promise<HexadecimalStringifiedNumber>} Fee in WEI (hexed string)
|
* @returns {Promise<HexadecimalStringifiedNumber>} Fee in WEI (hexed string)
|
||||||
*/
|
*/
|
||||||
calculateWithdrawalFeeViaRelayer({ tx, txType, relayerFeePercent, currency, amount, decimals, refundInEth, tokenPriceInEth, predefinedGasLimit, predefinedGasPrice, }: GetWithdrawalFeeViaRelayerInput): Promise<HexadecimalStringifiedNumber>;
|
calculateWithdrawalFeeViaRelayer({ tx, txType, relayerFeePercent, currency, amount, decimals, refundInEth, tokenPriceInEth, predefinedGasLimit, predefinedGasPrice, bumpGasLimitPercent, bumpGasPricePercent, }: GetWithdrawalFeeViaRelayerInput): Promise<HexadecimalStringifiedNumber>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -341,14 +341,21 @@ var TornadoFeeOracle = /** @class */ (function () {
|
|||||||
* @returns {Promise<HexadecimalStringifiedNumber>} Fee in WEI (hexed string)
|
* @returns {Promise<HexadecimalStringifiedNumber>} Fee in WEI (hexed string)
|
||||||
*/
|
*/
|
||||||
TornadoFeeOracle.prototype.calculateWithdrawalFeeViaRelayer = function (_a) {
|
TornadoFeeOracle.prototype.calculateWithdrawalFeeViaRelayer = function (_a) {
|
||||||
var tx = _a.tx, txType = _a.txType, relayerFeePercent = _a.relayerFeePercent, currency = _a.currency, amount = _a.amount, decimals = _a.decimals, refundInEth = _a.refundInEth, tokenPriceInEth = _a.tokenPriceInEth, predefinedGasLimit = _a.predefinedGasLimit, predefinedGasPrice = _a.predefinedGasPrice;
|
var tx = _a.tx, txType = _a.txType, relayerFeePercent = _a.relayerFeePercent, currency = _a.currency, amount = _a.amount, decimals = _a.decimals, refundInEth = _a.refundInEth, tokenPriceInEth = _a.tokenPriceInEth, predefinedGasLimit = _a.predefinedGasLimit, predefinedGasPrice = _a.predefinedGasPrice, bumpGasLimitPercent = _a.bumpGasLimitPercent, bumpGasPricePercent = _a.bumpGasPricePercent;
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
return __awaiter(this, void 0, void 0, function () {
|
||||||
var relayerFee, _b, gasPrice, gasLimit, gasCosts, hasTokenPrice, feeInEth;
|
var relayerFee, _b, gasPrice, gasLimit, gasCosts, hasTokenPrice, feeInEth;
|
||||||
return __generator(this, function (_c) {
|
return __generator(this, function (_c) {
|
||||||
switch (_c.label) {
|
switch (_c.label) {
|
||||||
case 0:
|
case 0:
|
||||||
relayerFee = this.calculateRelayerFeeInWei(relayerFeePercent, amount, decimals);
|
relayerFee = this.calculateRelayerFeeInWei(relayerFeePercent, amount, decimals);
|
||||||
return [4 /*yield*/, this.getGasParams({ tx: tx, txType: txType, predefinedGasLimit: predefinedGasLimit, predefinedGasPrice: predefinedGasPrice })];
|
return [4 /*yield*/, this.getGasParams({
|
||||||
|
tx: tx,
|
||||||
|
txType: txType,
|
||||||
|
predefinedGasLimit: predefinedGasLimit,
|
||||||
|
predefinedGasPrice: predefinedGasPrice,
|
||||||
|
bumpGasLimitPercent: bumpGasLimitPercent,
|
||||||
|
bumpGasPricePercent: bumpGasPricePercent,
|
||||||
|
})];
|
||||||
case 1:
|
case 1:
|
||||||
_b = _c.sent(), gasPrice = _b.gasPrice, gasLimit = _b.gasLimit;
|
_b = _c.sent(), gasPrice = _b.gasPrice, gasLimit = _b.gasLimit;
|
||||||
gasCosts = ethers_1.BigNumber.from(gasPrice).mul(gasLimit);
|
gasCosts = ethers_1.BigNumber.from(gasPrice).mul(gasLimit);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
7
lib/feeOracleV6.d.ts
vendored
7
lib/feeOracleV6.d.ts
vendored
@@ -7,18 +7,19 @@ import { ITornadoFeeOracle, TransactionData, TxType, LegacyGasPriceKey, GasPrice
|
|||||||
*/
|
*/
|
||||||
export declare class TornadoFeeOracleV6 extends TornadoFeeOracle implements ITornadoFeeOracle {
|
export declare class TornadoFeeOracleV6 extends TornadoFeeOracle implements ITornadoFeeOracle {
|
||||||
private fallbackFeeOracle;
|
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
|
* Apply static 10% gasLimit premium as it wouldn't change across nodes or relayers
|
||||||
*/
|
*/
|
||||||
getGasLimit(tx?: TransactionData, type?: TxType, bumpPercent?: number): Promise<number>;
|
getGasLimit(tx?: TransactionData, type?: TxType, bumpPercent?: number): Promise<number>;
|
||||||
/**
|
/**
|
||||||
* Apply static 30% gasPrice premium for EIP-1559 enabled networks
|
* Apply static 50% gasPrice premium for EIP-1559 enabled networks
|
||||||
*
|
*
|
||||||
* Because Tornado Transactions are censored from block builders
|
* Because Tornado Transactions are censored from block builders
|
||||||
* it would take some time to be confirmed after when the transaction is broadcasted.
|
* it would take some time to be confirmed after when the transaction is broadcasted.
|
||||||
*
|
*
|
||||||
* We apply 30% premium and 56% overall premium to combat basefee spike
|
* We apply 50% premium to combat basefee spike (ethers.js uses 100% premium by default)
|
||||||
* (Can spike 12.5% per block accoring to the EIP-1559 metrics https://metamask.io/1559/)
|
* (Can spike 12.5% per block accoring to the EIP-1559 metrics https://metamask.io/1559/)
|
||||||
*/
|
*/
|
||||||
getGasPriceParams(speed?: LegacyGasPriceKey, bumpPercent?: number): Promise<GasPriceParams>;
|
getGasPriceParams(speed?: LegacyGasPriceKey, bumpPercent?: number): Promise<GasPriceParams>;
|
||||||
|
|||||||
@@ -63,9 +63,10 @@ var feeOracleV5_1 = require("./feeOracleV5");
|
|||||||
*/
|
*/
|
||||||
var TornadoFeeOracleV6 = /** @class */ (function (_super) {
|
var TornadoFeeOracleV6 = /** @class */ (function (_super) {
|
||||||
__extends(TornadoFeeOracleV6, _super);
|
__extends(TornadoFeeOracleV6, _super);
|
||||||
function TornadoFeeOracleV6(chainId, rpcUrl) {
|
function TornadoFeeOracleV6(chainId, rpcUrl, overrideGasPrice) {
|
||||||
var _this = _super.call(this, 6, chainId, rpcUrl) || this;
|
var _this = _super.call(this, 6, chainId, rpcUrl) || this;
|
||||||
_this.fallbackFeeOracle = new feeOracleV5_1.TornadoFeeOracleV5(chainId, rpcUrl);
|
_this.fallbackFeeOracle = new feeOracleV5_1.TornadoFeeOracleV5(chainId, rpcUrl);
|
||||||
|
_this.overrideGasPrice = overrideGasPrice;
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -90,19 +91,22 @@ var TornadoFeeOracleV6 = /** @class */ (function (_super) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Apply static 30% gasPrice premium for EIP-1559 enabled networks
|
* Apply static 50% gasPrice premium for EIP-1559 enabled networks
|
||||||
*
|
*
|
||||||
* Because Tornado Transactions are censored from block builders
|
* Because Tornado Transactions are censored from block builders
|
||||||
* it would take some time to be confirmed after when the transaction is broadcasted.
|
* it would take some time to be confirmed after when the transaction is broadcasted.
|
||||||
*
|
*
|
||||||
* We apply 30% premium and 56% overall premium to combat basefee spike
|
* We apply 50% premium to combat basefee spike (ethers.js uses 100% premium by default)
|
||||||
* (Can spike 12.5% per block accoring to the EIP-1559 metrics https://metamask.io/1559/)
|
* (Can spike 12.5% per block accoring to the EIP-1559 metrics https://metamask.io/1559/)
|
||||||
*/
|
*/
|
||||||
TornadoFeeOracleV6.prototype.getGasPriceParams = function (speed, bumpPercent) {
|
TornadoFeeOracleV6.prototype.getGasPriceParams = function (speed, bumpPercent) {
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
return __awaiter(this, void 0, void 0, function () {
|
||||||
return __generator(this, function (_a) {
|
return __generator(this, function (_a) {
|
||||||
|
if (this.overrideGasPrice) {
|
||||||
|
return [2 /*return*/, this.overrideGasPrice];
|
||||||
|
}
|
||||||
if (typeof bumpPercent === 'undefined') {
|
if (typeof bumpPercent === 'undefined') {
|
||||||
bumpPercent = this.chainId === config_1.ChainId.BSC ? undefined : 30;
|
bumpPercent = this.chainId === config_1.ChainId.BSC ? undefined : 50;
|
||||||
}
|
}
|
||||||
return [2 /*return*/, _super.prototype.getGasPriceParams.call(this, speed, bumpPercent)];
|
return [2 /*return*/, _super.prototype.getGasPriceParams.call(this, speed, bumpPercent)];
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"feeOracleV6.js","sourceRoot":"","sources":["../src/feeOracleV6.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAmC;AACnC,yCAA+C;AAU/C,iCAA+B;AAC/B,6CAAmD;AAEnD;;;;GAIG;AACH;IAAwC,sCAAgB;IAGtD,4BAAmB,OAAe,EAAE,MAAc;QAAlD,YACE,kBAAM,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,SAG1B;QADC,KAAI,CAAC,iBAAiB,GAAG,IAAI,gCAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;;IACnE,CAAC;IAED;;OAEG;IACG,wCAAW,GAAjB,UAAkB,EAAoB,EAAE,IAAsB,EAAE,WAAwB;QAAhD,qBAAA,EAAA,cAAsB;QAAE,4BAAA,EAAA,gBAAwB;;;;;;wBACtF,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC;4BAAE,sBAAO,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,EAAC;wBAElF,qBAAM,IAA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D,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"}
|
||||||
1
lib/index.d.ts
vendored
1
lib/index.d.ts
vendored
@@ -1,3 +1,4 @@
|
|||||||
export * from './feeOracleV4';
|
export * from './feeOracleV4';
|
||||||
export * from './feeOracleV5';
|
export * from './feeOracleV5';
|
||||||
|
export * from './feeOracleV6';
|
||||||
export * from './tokenPriceOracle';
|
export * from './tokenPriceOracle';
|
||||||
|
|||||||
@@ -16,5 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
__exportStar(require("./feeOracleV4"), exports);
|
__exportStar(require("./feeOracleV4"), exports);
|
||||||
__exportStar(require("./feeOracleV5"), exports);
|
__exportStar(require("./feeOracleV5"), exports);
|
||||||
|
__exportStar(require("./feeOracleV6"), exports);
|
||||||
__exportStar(require("./tokenPriceOracle"), exports);
|
__exportStar(require("./tokenPriceOracle"), exports);
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,gDAA8B;AAC9B,qDAAmC"}
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,qDAAmC"}
|
||||||
2
lib/types.d.ts
vendored
2
lib/types.d.ts
vendored
@@ -89,4 +89,6 @@ export type GetWithdrawalFeeViaRelayerInput = {
|
|||||||
tokenPriceInEth?: HexadecimalStringifiedNumber | string;
|
tokenPriceInEth?: HexadecimalStringifiedNumber | string;
|
||||||
predefinedGasPrice?: HexadecimalStringifiedNumber;
|
predefinedGasPrice?: HexadecimalStringifiedNumber;
|
||||||
predefinedGasLimit?: number;
|
predefinedGasLimit?: number;
|
||||||
|
bumpGasLimitPercent?: number;
|
||||||
|
bumpGasPricePercent?: number;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -283,9 +283,18 @@ export abstract class TornadoFeeOracle implements ITornadoFeeOracle {
|
|||||||
tokenPriceInEth,
|
tokenPriceInEth,
|
||||||
predefinedGasLimit,
|
predefinedGasLimit,
|
||||||
predefinedGasPrice,
|
predefinedGasPrice,
|
||||||
|
bumpGasLimitPercent,
|
||||||
|
bumpGasPricePercent,
|
||||||
}: GetWithdrawalFeeViaRelayerInput): Promise<HexadecimalStringifiedNumber> {
|
}: GetWithdrawalFeeViaRelayerInput): Promise<HexadecimalStringifiedNumber> {
|
||||||
const relayerFee = this.calculateRelayerFeeInWei(relayerFeePercent, amount, decimals);
|
const relayerFee = this.calculateRelayerFeeInWei(relayerFeePercent, amount, decimals);
|
||||||
const { gasPrice, gasLimit } = await this.getGasParams({ tx, txType, predefinedGasLimit, predefinedGasPrice });
|
const { gasPrice, gasLimit } = await this.getGasParams({
|
||||||
|
tx,
|
||||||
|
txType,
|
||||||
|
predefinedGasLimit,
|
||||||
|
predefinedGasPrice,
|
||||||
|
bumpGasLimitPercent,
|
||||||
|
bumpGasPricePercent,
|
||||||
|
});
|
||||||
const gasCosts = BigNumber.from(gasPrice).mul(gasLimit);
|
const gasCosts = BigNumber.from(gasPrice).mul(gasLimit);
|
||||||
|
|
||||||
const hasTokenPrice =
|
const hasTokenPrice =
|
||||||
|
|||||||
@@ -19,11 +19,14 @@ import { TornadoFeeOracleV5 } from './feeOracleV5';
|
|||||||
*/
|
*/
|
||||||
export class TornadoFeeOracleV6 extends TornadoFeeOracle implements ITornadoFeeOracle {
|
export class TornadoFeeOracleV6 extends TornadoFeeOracle implements ITornadoFeeOracle {
|
||||||
private fallbackFeeOracle: TornadoFeeOracleV5;
|
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);
|
super(6, chainId, rpcUrl);
|
||||||
|
|
||||||
this.fallbackFeeOracle = new TornadoFeeOracleV5(chainId, rpcUrl);
|
this.fallbackFeeOracle = new TornadoFeeOracleV5(chainId, rpcUrl);
|
||||||
|
this.overrideGasPrice = overrideGasPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,17 +40,20 @@ export class TornadoFeeOracleV6 extends TornadoFeeOracle implements ITornadoFeeO
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply static 30% gasPrice premium for EIP-1559 enabled networks
|
* Apply static 50% gasPrice premium for EIP-1559 enabled networks
|
||||||
*
|
*
|
||||||
* Because Tornado Transactions are censored from block builders
|
* Because Tornado Transactions are censored from block builders
|
||||||
* it would take some time to be confirmed after when the transaction is broadcasted.
|
* it would take some time to be confirmed after when the transaction is broadcasted.
|
||||||
*
|
*
|
||||||
* We apply 30% premium and 56% overall premium to combat basefee spike
|
* We apply 50% premium to combat basefee spike (ethers.js uses 100% premium by default)
|
||||||
* (Can spike 12.5% per block accoring to the EIP-1559 metrics https://metamask.io/1559/)
|
* (Can spike 12.5% per block accoring to the EIP-1559 metrics https://metamask.io/1559/)
|
||||||
*/
|
*/
|
||||||
async getGasPriceParams(speed?: LegacyGasPriceKey, bumpPercent?: number): Promise<GasPriceParams> {
|
async getGasPriceParams(speed?: LegacyGasPriceKey, bumpPercent?: number): Promise<GasPriceParams> {
|
||||||
|
if (this.overrideGasPrice) {
|
||||||
|
return this.overrideGasPrice;
|
||||||
|
}
|
||||||
if (typeof bumpPercent === 'undefined') {
|
if (typeof bumpPercent === 'undefined') {
|
||||||
bumpPercent = this.chainId === ChainId.BSC ? undefined : 30;
|
bumpPercent = this.chainId === ChainId.BSC ? undefined : 50;
|
||||||
}
|
}
|
||||||
return super.getGasPriceParams(speed, bumpPercent);
|
return super.getGasPriceParams(speed, bumpPercent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
export * from './feeOracleV4';
|
export * from './feeOracleV4';
|
||||||
export * from './feeOracleV5';
|
export * from './feeOracleV5';
|
||||||
|
export * from './feeOracleV6';
|
||||||
export * from './tokenPriceOracle';
|
export * from './tokenPriceOracle';
|
||||||
|
|||||||
@@ -117,4 +117,6 @@ export type GetWithdrawalFeeViaRelayerInput = {
|
|||||||
tokenPriceInEth?: HexadecimalStringifiedNumber | string; // Token (currency) price in ETH wei, if withdrawing non-native currency
|
tokenPriceInEth?: HexadecimalStringifiedNumber | string; // Token (currency) price in ETH wei, if withdrawing non-native currency
|
||||||
predefinedGasPrice?: HexadecimalStringifiedNumber; // Predefined gas price for withdrawal tx (wont be calculated again in function)
|
predefinedGasPrice?: HexadecimalStringifiedNumber; // Predefined gas price for withdrawal tx (wont be calculated again in function)
|
||||||
predefinedGasLimit?: number; // Predefined gas limit for withdrawal tx (wont be calculated again in function)
|
predefinedGasLimit?: number; // Predefined gas limit for withdrawal tx (wont be calculated again in function)
|
||||||
|
bumpGasLimitPercent?: number; // Gas limit bump percent to prioritize transaction (recenlty used)
|
||||||
|
bumpGasPricePercent?: number; // Gas price bump percent to prioritize transaction (rarely used)
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user