@mixerx/oracles 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/factory.d.ts +6 -4
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +5 -4
- package/dist/factory.js.map +1 -1
- package/dist/infrastructure/tornado/TornadoFeeOracle.d.ts +43 -38
- package/dist/infrastructure/tornado/TornadoFeeOracle.d.ts.map +1 -1
- package/dist/infrastructure/tornado/TornadoFeeOracle.js +91 -95
- package/dist/infrastructure/tornado/TornadoFeeOracle.js.map +1 -1
- package/package.json +2 -2
package/dist/factory.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GasPriceOracle } from './infrastructure/gas/GasPriceOracle';
|
|
2
2
|
import { TokenPriceOracle } from './infrastructure/token-price/TokenPriceOracle';
|
|
3
|
-
import {
|
|
3
|
+
import { MixerXFeeOracle } from './infrastructure/tornado/TornadoFeeOracle';
|
|
4
4
|
import { ITokenPriceRepository } from './domain/repositories';
|
|
5
5
|
import { ChainId } from './infrastructure/config/gasOracleConfigs';
|
|
6
6
|
import { TokenPrices } from './types';
|
|
@@ -43,8 +43,10 @@ export interface IMixerxOraclesModule {
|
|
|
43
43
|
gasPriceOracle: GasPriceOracle;
|
|
44
44
|
/** Token price oracle (Multicall + OffchainOracle) */
|
|
45
45
|
tokenPriceOracle: TokenPriceOracle;
|
|
46
|
-
/**
|
|
47
|
-
|
|
46
|
+
/** MixerX fee oracle - calculates withdrawal fees and protocol gas policy. */
|
|
47
|
+
mixerXFeeOracle: MixerXFeeOracle;
|
|
48
|
+
/** @deprecated Use mixerXFeeOracle. */
|
|
49
|
+
tornadoFeeOracle: MixerXFeeOracle;
|
|
48
50
|
/** Convenience method to fetch token prices */
|
|
49
51
|
fetchPrices(): Promise<TokenPrices>;
|
|
50
52
|
/** Chain ID */
|
|
@@ -56,7 +58,7 @@ export interface IMixerxOraclesModule {
|
|
|
56
58
|
* This creates a complete oracle module with:
|
|
57
59
|
* - GasPriceOracle: Fetches EIP-1559 and Legacy gas prices from multiple sources
|
|
58
60
|
* - TokenPriceOracle: Fetches token prices using Multicall to OffchainOracle
|
|
59
|
-
* -
|
|
61
|
+
* - MixerXFeeOracle: Calculates MixerX withdrawal fees and protocol gas policy
|
|
60
62
|
*/
|
|
61
63
|
export declare function createMixerxOraclesModule(config: MixerxOraclesConfig): IMixerxOraclesModule;
|
|
62
64
|
//# sourceMappingURL=factory.d.ts.map
|
package/dist/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,0CAA0C,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,eAAe;IACf,OAAO,EAAE,OAAO,CAAC;IAEjB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IAEf,oDAAoD;IACpD,iBAAiB,EAAE,MAAM,CAAC;IAE1B,8EAA8E;IAC9E,eAAe,CAAC,EAAE,qBAAqB,CAAC;IAExC,0DAA0D;IAC1D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,yFAAyF;IACzF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,qCAAqC;IACrC,iBAAiB,CAAC,EAAE;QAClB,MAAM,CAAC,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;QAC1E,OAAO,CAAC,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,YAAY,EAAE,MAAM,CAAC;YAAC,oBAAoB,EAAE,MAAM,CAAA;SAAE,CAAC;KACnF,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,cAAc,EAAE,cAAc,CAAC;IAE/B,sDAAsD;IACtD,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,8EAA8E;IAC9E,eAAe,EAAE,eAAe,CAAC;IAEjC,uCAAuC;IACvC,gBAAgB,EAAE,eAAe,CAAC;IAElC,+CAA+C;IAC/C,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IAEpC,eAAe;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,mBAAmB,GAC1B,oBAAoB,CA8CtB"}
|
package/dist/factory.js
CHANGED
|
@@ -11,7 +11,7 @@ const ProtocolTokenConfig_1 = require("./infrastructure/config/ProtocolTokenConf
|
|
|
11
11
|
* This creates a complete oracle module with:
|
|
12
12
|
* - GasPriceOracle: Fetches EIP-1559 and Legacy gas prices from multiple sources
|
|
13
13
|
* - TokenPriceOracle: Fetches token prices using Multicall to OffchainOracle
|
|
14
|
-
* -
|
|
14
|
+
* - MixerXFeeOracle: Calculates MixerX withdrawal fees and protocol gas policy
|
|
15
15
|
*/
|
|
16
16
|
function createMixerxOraclesModule(config) {
|
|
17
17
|
// Multicall remains explicit/hardcoded-compatible by design
|
|
@@ -26,8 +26,8 @@ function createMixerxOraclesModule(config) {
|
|
|
26
26
|
});
|
|
27
27
|
// Create token price oracle
|
|
28
28
|
const tokenPriceOracle = new TokenPriceOracle_1.TokenPriceOracle(config.rpcUrl, config.chainId, offchainOracleAddress, multicallAddress, defaultTokens);
|
|
29
|
-
// Create
|
|
30
|
-
const
|
|
29
|
+
// Create MixerX fee oracle
|
|
30
|
+
const mixerXFeeOracle = new TornadoFeeOracle_1.MixerXFeeOracle({
|
|
31
31
|
chainId: config.chainId,
|
|
32
32
|
rpcUrl: config.rpcUrl,
|
|
33
33
|
relayerFeePercent: config.relayerFeePercent,
|
|
@@ -40,7 +40,8 @@ function createMixerxOraclesModule(config) {
|
|
|
40
40
|
return {
|
|
41
41
|
gasPriceOracle,
|
|
42
42
|
tokenPriceOracle,
|
|
43
|
-
|
|
43
|
+
mixerXFeeOracle,
|
|
44
|
+
tornadoFeeOracle: mixerXFeeOracle,
|
|
44
45
|
chainId: config.chainId,
|
|
45
46
|
// Convenience method
|
|
46
47
|
async fetchPrices() {
|
package/dist/factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":";;AAoEA,8DAgDC;AApHD,wEAAqE;AACrE,oFAAiF;AACjF,gFAA4E;AAG5E,qFAAiH;AAuDjH;;;;;;;GAOG;AACH,SAAgB,yBAAyB,CACvC,MAA2B;IAE3B,4DAA4D;IAC5D,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,IAAI,4CAA4C,CAAC;IACjG,MAAM,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,IAAI,IAAA,kDAA4B,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3G,MAAM,aAAa,GAAG,IAAA,0CAAoB,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE3D,0BAA0B;IAC1B,MAAM,cAAc,GAAG,IAAI,+BAAc,CAAC;QACxC,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;KAC5C,CAAC,CAAC;IAEH,4BAA4B;IAC5B,MAAM,gBAAgB,GAAG,IAAI,mCAAgB,CAC3C,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,OAAO,EACd,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,CACd,CAAC;IAEF,2BAA2B;IAC3B,MAAM,eAAe,GAAG,IAAI,kCAAe,CAAC;QAC1C,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,cAAc;QACd,gBAAgB;QAChB,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,gBAAgB;QAChB,qBAAqB;KACtB,CAAC,CAAC;IAEH,OAAO;QACL,cAAc;QACd,gBAAgB;QAChB,eAAe;QACf,gBAAgB,EAAE,eAAe;QACjC,OAAO,EAAE,MAAM,CAAC,OAAO;QAEvB,qBAAqB;QACrB,KAAK,CAAC,WAAW;YACf,OAAO,gBAAgB,CAAC,WAAW,EAAE,CAAC;QACxC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -3,7 +3,9 @@ import { TokenPriceOracle } from '../token-price/TokenPriceOracle';
|
|
|
3
3
|
import { ITokenPriceRepository } from '../../domain/repositories';
|
|
4
4
|
import { ChainId } from '../config/gasOracleConfigs';
|
|
5
5
|
import { ILogger } from '../../application/ports/ILogger';
|
|
6
|
-
export
|
|
6
|
+
export type MixerXTxType = 'relayer_withdrawal' | 'user_withdrawal' | 'relayer_withdrawal_check_v4';
|
|
7
|
+
export type MixerXGasPurpose = 'fee_quote' | 'fee_validation' | 'send' | 'replacement';
|
|
8
|
+
export interface MixerXFeeOracleOptions {
|
|
7
9
|
chainId: ChainId;
|
|
8
10
|
rpcUrl: string;
|
|
9
11
|
relayerFeePercent: number;
|
|
@@ -14,77 +16,80 @@ export interface TornadoFeeOracleOptions {
|
|
|
14
16
|
multicallAddress?: string;
|
|
15
17
|
offchainOracleAddress?: string;
|
|
16
18
|
}
|
|
17
|
-
export interface
|
|
19
|
+
export interface MixerXWithdrawalFeeInput {
|
|
18
20
|
currency: string;
|
|
19
21
|
amount: bigint;
|
|
20
22
|
decimals: number;
|
|
21
23
|
refund?: string;
|
|
22
|
-
txType?:
|
|
24
|
+
txType?: MixerXTxType;
|
|
25
|
+
purpose?: Extract<MixerXGasPurpose, 'fee_quote' | 'fee_validation'>;
|
|
23
26
|
}
|
|
24
|
-
export interface
|
|
27
|
+
export interface MixerXGasParametersForTxInput {
|
|
28
|
+
txType?: MixerXTxType;
|
|
29
|
+
purpose?: MixerXGasPurpose;
|
|
30
|
+
isLegacy?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface MixerXGasParametersForTxResult extends GasPriceParams {
|
|
33
|
+
txType: MixerXTxType;
|
|
34
|
+
purpose: MixerXGasPurpose;
|
|
35
|
+
bumpPercent: number;
|
|
36
|
+
}
|
|
37
|
+
export interface MixerXFeeCalculationResult {
|
|
25
38
|
gasCost: bigint;
|
|
26
39
|
relayerFee: bigint;
|
|
27
40
|
refundAmount: bigint;
|
|
28
41
|
totalFee: bigint;
|
|
29
42
|
currency: string;
|
|
43
|
+
gasLimit: number;
|
|
44
|
+
gasPriceWei: bigint;
|
|
45
|
+
maxFeePerGas?: string;
|
|
46
|
+
maxPriorityFeePerGas?: string;
|
|
47
|
+
gasPrice?: string;
|
|
48
|
+
bumpPercent: number;
|
|
49
|
+
txType: MixerXTxType;
|
|
50
|
+
gasPurpose: Extract<MixerXGasPurpose, 'fee_quote' | 'fee_validation'>;
|
|
30
51
|
}
|
|
52
|
+
export type TornadoFeeOracleOptions = MixerXFeeOracleOptions;
|
|
53
|
+
export type WithdrawalFeeInput = MixerXWithdrawalFeeInput;
|
|
54
|
+
export type FeeCalculationResult = MixerXFeeCalculationResult;
|
|
31
55
|
/**
|
|
32
|
-
*
|
|
33
|
-
* Calculates fees
|
|
34
|
-
* Based on @tornado/tornado-oracles TornadoFeeOracleV5
|
|
56
|
+
* MixerXFeeOracle
|
|
57
|
+
* Calculates protocol withdrawal fees and transaction gas parameters.
|
|
35
58
|
*
|
|
36
59
|
* Features:
|
|
37
|
-
* -
|
|
38
|
-
* - Token price conversion (ETH
|
|
60
|
+
* - Explicit gas policy by purpose (quote/validation/send/replacement)
|
|
61
|
+
* - Token price conversion (ETH <-> Token)
|
|
39
62
|
* - Refund calculation for non-ETH tokens
|
|
40
|
-
* - EIP-1559 and
|
|
63
|
+
* - EIP-1559 and legacy support
|
|
41
64
|
*/
|
|
42
|
-
export declare class
|
|
65
|
+
export declare class MixerXFeeOracle {
|
|
43
66
|
private chainId;
|
|
44
67
|
private relayerFeePercent;
|
|
45
68
|
private gasPriceOracle;
|
|
46
69
|
private tokenPriceOracle?;
|
|
47
70
|
private priceRepository?;
|
|
48
71
|
private logger;
|
|
49
|
-
constructor(options:
|
|
50
|
-
/**
|
|
51
|
-
* Calculate withdrawal fee
|
|
52
|
-
* Main method matching TornadoFeeOracleV5.calculateWithdrawalFeeViaRelayer
|
|
53
|
-
*/
|
|
54
|
-
calculateWithdrawalFee(input: WithdrawalFeeInput): Promise<FeeCalculationResult>;
|
|
72
|
+
constructor(options: MixerXFeeOracleOptions);
|
|
55
73
|
/**
|
|
56
|
-
*
|
|
74
|
+
* Calculate withdrawal fee using the fee quote/validation gas policy.
|
|
57
75
|
*/
|
|
58
|
-
|
|
76
|
+
calculateWithdrawalFee(input: MixerXWithdrawalFeeInput): Promise<MixerXFeeCalculationResult>;
|
|
59
77
|
/**
|
|
60
|
-
*
|
|
78
|
+
* Get gas parameters for a protocol transaction and purpose.
|
|
61
79
|
*/
|
|
80
|
+
getGasParametersForTx(input?: MixerXGasParametersForTxInput): Promise<MixerXGasParametersForTxResult>;
|
|
62
81
|
private calculateGasCost;
|
|
63
|
-
/**
|
|
64
|
-
* Calculate relayer fee
|
|
65
|
-
*/
|
|
66
82
|
private calculateRelayerFee;
|
|
67
|
-
/**
|
|
68
|
-
* Get gas limit for operation and token
|
|
69
|
-
* Uses centralized TokenDefaults to eliminate duplication
|
|
70
|
-
*/
|
|
71
83
|
private getGasLimit;
|
|
72
|
-
/**
|
|
73
|
-
* Get bump percent based on transaction type (V5 smart bumping)
|
|
74
|
-
* Uses centralized TokenDefaults to eliminate duplication
|
|
75
|
-
*/
|
|
76
84
|
private getBumpPercent;
|
|
77
|
-
|
|
78
|
-
* Get token price in ETH (wei per token unit)
|
|
79
|
-
*/
|
|
85
|
+
private extractGasPriceWei;
|
|
80
86
|
private getTokenPrice;
|
|
87
|
+
private withGasDetails;
|
|
81
88
|
/**
|
|
82
|
-
* Get gas parameters for
|
|
89
|
+
* Get gas parameters without protocol policy. Prefer getGasParametersForTx for relayer operations.
|
|
83
90
|
*/
|
|
84
91
|
getGasParameters(isLegacy?: boolean): Promise<GasPriceParams>;
|
|
85
|
-
/**
|
|
86
|
-
* Get chain ID
|
|
87
|
-
*/
|
|
88
92
|
getChainId(): ChainId;
|
|
89
93
|
}
|
|
94
|
+
export { MixerXFeeOracle as TornadoFeeOracle };
|
|
90
95
|
//# sourceMappingURL=TornadoFeeOracle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TornadoFeeOracle.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/tornado/TornadoFeeOracle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"TornadoFeeOracle.d.ts","sourceRoot":"","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O,CAAC,8BAA8B,CAAC;IAmB/G,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,kBAAkB;YAYZ,aAAa;IAmB3B,OAAO,CAAC,cAAc;IA6BtB;;OAEG;IACG,gBAAgB,CAAC,QAAQ,GAAE,OAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAI1E,UAAU,IAAI,OAAO;CAGtB;AAED,OAAO,EAAE,eAAe,IAAI,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TornadoFeeOracle = void 0;
|
|
3
|
+
exports.TornadoFeeOracle = exports.MixerXFeeOracle = void 0;
|
|
4
4
|
const GasPriceOracle_1 = require("../gas/GasPriceOracle");
|
|
5
5
|
const TokenPriceOracle_1 = require("../token-price/TokenPriceOracle");
|
|
6
6
|
const ILogger_1 = require("../../application/ports/ILogger");
|
|
7
7
|
const TokenDefaults_1 = require("../../domain/config/TokenDefaults");
|
|
8
|
-
// NOTE: Gas limits now imported from TokenDefaults (centralized configuration)
|
|
9
|
-
// This eliminates duplication between TornadoFeeOracle, ChainConfigs, and FeeCalculator
|
|
10
8
|
/**
|
|
11
|
-
*
|
|
12
|
-
* Calculates fees
|
|
13
|
-
* Based on @tornado/tornado-oracles TornadoFeeOracleV5
|
|
9
|
+
* MixerXFeeOracle
|
|
10
|
+
* Calculates protocol withdrawal fees and transaction gas parameters.
|
|
14
11
|
*
|
|
15
12
|
* Features:
|
|
16
|
-
* -
|
|
17
|
-
* - Token price conversion (ETH
|
|
13
|
+
* - Explicit gas policy by purpose (quote/validation/send/replacement)
|
|
14
|
+
* - Token price conversion (ETH <-> Token)
|
|
18
15
|
* - Refund calculation for non-ETH tokens
|
|
19
|
-
* - EIP-1559 and
|
|
16
|
+
* - EIP-1559 and legacy support
|
|
20
17
|
*/
|
|
21
|
-
class
|
|
18
|
+
class MixerXFeeOracle {
|
|
22
19
|
chainId;
|
|
23
20
|
relayerFeePercent;
|
|
24
21
|
gasPriceOracle;
|
|
@@ -28,13 +25,13 @@ class TornadoFeeOracle {
|
|
|
28
25
|
constructor(options) {
|
|
29
26
|
this.chainId = options.chainId;
|
|
30
27
|
this.relayerFeePercent = options.relayerFeePercent;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
this.gasPriceOracle =
|
|
29
|
+
options.gasPriceOracle ??
|
|
30
|
+
new GasPriceOracle_1.GasPriceOracle({
|
|
31
|
+
chainId: options.chainId,
|
|
32
|
+
rpcUrl: options.rpcUrl,
|
|
33
|
+
logger: options.logger ?? new ILogger_1.ConsoleLogger('MixerXGasOracle'),
|
|
34
|
+
});
|
|
38
35
|
if (options.tokenPriceOracle) {
|
|
39
36
|
this.tokenPriceOracle = options.tokenPriceOracle;
|
|
40
37
|
}
|
|
@@ -42,28 +39,20 @@ class TornadoFeeOracle {
|
|
|
42
39
|
this.tokenPriceOracle = new TokenPriceOracle_1.TokenPriceOracle(options.rpcUrl, options.chainId, options.offchainOracleAddress, options.multicallAddress);
|
|
43
40
|
}
|
|
44
41
|
this.priceRepository = options.priceRepository;
|
|
45
|
-
this.logger = options.logger ?? new ILogger_1.ConsoleLogger('
|
|
42
|
+
this.logger = options.logger ?? new ILogger_1.ConsoleLogger('MixerXFeeOracle');
|
|
46
43
|
}
|
|
47
44
|
/**
|
|
48
|
-
* Calculate withdrawal fee
|
|
49
|
-
* Main method matching TornadoFeeOracleV5.calculateWithdrawalFeeViaRelayer
|
|
45
|
+
* Calculate withdrawal fee using the fee quote/validation gas policy.
|
|
50
46
|
*/
|
|
51
47
|
async calculateWithdrawalFee(input) {
|
|
52
|
-
const { currency, amount, decimals, refund, txType = 'relayer_withdrawal' } = input;
|
|
48
|
+
const { currency, amount, decimals, refund, txType = 'relayer_withdrawal', purpose = 'fee_validation', } = input;
|
|
53
49
|
const currencyLower = currency.toLowerCase();
|
|
54
|
-
|
|
55
|
-
const gasParams = await this.getGasParams(txType);
|
|
50
|
+
const gasParams = await this.getGasParametersForTx({ txType, purpose, isLegacy: false });
|
|
56
51
|
const gasLimit = this.getGasLimit(currencyLower, txType);
|
|
57
|
-
const gasPriceWei = gasParams
|
|
58
|
-
? BigInt(gasParams.maxFeePerGas)
|
|
59
|
-
: gasParams.gasPrice
|
|
60
|
-
? BigInt(gasParams.gasPrice)
|
|
61
|
-
: 0n;
|
|
62
|
-
// 2. Calculate gas cost in wei
|
|
52
|
+
const gasPriceWei = this.extractGasPriceWei(gasParams);
|
|
63
53
|
const gasCostWei = this.calculateGasCost(gasParams, currencyLower, txType);
|
|
64
|
-
// 3. Calculate relayer fee
|
|
65
54
|
const relayerFee = this.calculateRelayerFee(amount);
|
|
66
|
-
this.logger.debug('
|
|
55
|
+
this.logger.debug('MixerXFeeOracle fee inputs', {
|
|
67
56
|
chainId: this.chainId,
|
|
68
57
|
currency: currencyLower,
|
|
69
58
|
amount: amount.toString(),
|
|
@@ -76,130 +65,122 @@ class TornadoFeeOracle {
|
|
|
76
65
|
maxPriorityFeePerGas: gasParams.maxPriorityFeePerGas,
|
|
77
66
|
gasPrice: gasParams.gasPrice,
|
|
78
67
|
relayerFeePercent: this.relayerFeePercent,
|
|
68
|
+
bumpPercent: gasParams.bumpPercent,
|
|
69
|
+
gasPurpose: purpose,
|
|
79
70
|
});
|
|
80
|
-
// 4. For ETH, calculation is simple
|
|
81
71
|
if (currencyLower === 'eth') {
|
|
82
72
|
const totalFee = gasCostWei + relayerFee;
|
|
83
|
-
this.logger.debug('
|
|
73
|
+
this.logger.debug('MixerXFeeOracle fee breakdown', {
|
|
84
74
|
gasCost: gasCostWei.toString(),
|
|
85
75
|
relayerFee: relayerFee.toString(),
|
|
86
76
|
totalFee: totalFee.toString(),
|
|
87
77
|
currency: 'eth',
|
|
88
78
|
});
|
|
89
|
-
return {
|
|
79
|
+
return this.withGasDetails({
|
|
90
80
|
gasCost: gasCostWei,
|
|
91
81
|
relayerFee,
|
|
92
82
|
refundAmount: 0n,
|
|
93
83
|
totalFee,
|
|
94
84
|
currency: 'eth',
|
|
95
|
-
|
|
85
|
+
gasLimit,
|
|
86
|
+
gasPriceWei,
|
|
87
|
+
gasParams,
|
|
88
|
+
txType,
|
|
89
|
+
gasPurpose: purpose,
|
|
90
|
+
});
|
|
96
91
|
}
|
|
97
|
-
// 5. For tokens, convert ETH costs to token
|
|
98
92
|
const tokenPriceInEth = await this.getTokenPrice(currencyLower);
|
|
99
93
|
if (!tokenPriceInEth) {
|
|
100
94
|
throw new Error(`No price available for ${currency}`);
|
|
101
95
|
}
|
|
102
|
-
// Convert gas cost from ETH to token
|
|
103
|
-
// Formula: (ethAmount * 10^decimals) / price
|
|
104
96
|
const decimalsFactor = BigInt(10 ** decimals);
|
|
105
97
|
const gasCostInToken = (gasCostWei * decimalsFactor) / tokenPriceInEth;
|
|
106
|
-
// Relayer fee is already in token units
|
|
107
98
|
const relayerFeeInToken = relayerFee;
|
|
108
|
-
// Calculate refund in token if provided
|
|
109
99
|
let refundInToken = 0n;
|
|
110
100
|
if (refund && BigInt(refund) > 0) {
|
|
111
101
|
const refundWei = BigInt(refund);
|
|
112
102
|
refundInToken = (refundWei * decimalsFactor) / tokenPriceInEth;
|
|
113
103
|
}
|
|
114
|
-
// Total fee
|
|
115
104
|
const totalFee = gasCostInToken + relayerFeeInToken + refundInToken;
|
|
116
|
-
this.logger.debug('
|
|
105
|
+
this.logger.debug('MixerXFeeOracle fee breakdown', {
|
|
117
106
|
tokenPriceInEth: tokenPriceInEth.toString(),
|
|
118
107
|
gasCostInToken: gasCostInToken.toString(),
|
|
119
108
|
relayerFeeInToken: relayerFeeInToken.toString(),
|
|
120
109
|
refundInToken: refundInToken.toString(),
|
|
121
110
|
totalFee: totalFee.toString(),
|
|
122
111
|
});
|
|
123
|
-
return {
|
|
112
|
+
return this.withGasDetails({
|
|
124
113
|
gasCost: gasCostInToken,
|
|
125
114
|
relayerFee: relayerFeeInToken,
|
|
126
115
|
refundAmount: refundInToken,
|
|
127
116
|
totalFee,
|
|
128
117
|
currency: currencyLower,
|
|
129
|
-
|
|
118
|
+
gasLimit,
|
|
119
|
+
gasPriceWei,
|
|
120
|
+
gasParams,
|
|
121
|
+
txType,
|
|
122
|
+
gasPurpose: purpose,
|
|
123
|
+
});
|
|
130
124
|
}
|
|
131
125
|
/**
|
|
132
|
-
* Get gas parameters for transaction
|
|
126
|
+
* Get gas parameters for a protocol transaction and purpose.
|
|
133
127
|
*/
|
|
134
|
-
async
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
128
|
+
async getGasParametersForTx(input = {}) {
|
|
129
|
+
const txType = input.txType ?? 'relayer_withdrawal';
|
|
130
|
+
const purpose = input.purpose ?? 'send';
|
|
131
|
+
const bumpPercent = this.getBumpPercent(txType, purpose);
|
|
132
|
+
const gasParams = await this.gasPriceOracle.getTxGasParams({
|
|
133
|
+
isLegacy: input.isLegacy ?? false,
|
|
138
134
|
bumpPercent,
|
|
139
135
|
legacySpeed: 'fast',
|
|
140
136
|
});
|
|
137
|
+
return {
|
|
138
|
+
...gasParams,
|
|
139
|
+
txType,
|
|
140
|
+
purpose,
|
|
141
|
+
bumpPercent,
|
|
142
|
+
};
|
|
141
143
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Calculate gas cost in wei
|
|
144
|
-
*/
|
|
145
144
|
calculateGasCost(gasParams, currency, txType) {
|
|
146
145
|
const gasLimit = this.getGasLimit(currency, txType);
|
|
147
|
-
|
|
148
|
-
let gasPriceWei;
|
|
149
|
-
if (gasParams.maxFeePerGas) {
|
|
150
|
-
// EIP-1559: use maxFeePerGas
|
|
151
|
-
gasPriceWei = BigInt(gasParams.maxFeePerGas);
|
|
152
|
-
}
|
|
153
|
-
else if (gasParams.gasPrice) {
|
|
154
|
-
// Legacy: use gasPrice
|
|
155
|
-
gasPriceWei = BigInt(gasParams.gasPrice);
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
throw new Error('Invalid gas parameters');
|
|
159
|
-
}
|
|
146
|
+
const gasPriceWei = this.extractGasPriceWei(gasParams);
|
|
160
147
|
return gasPriceWei * BigInt(gasLimit);
|
|
161
148
|
}
|
|
162
|
-
/**
|
|
163
|
-
* Calculate relayer fee
|
|
164
|
-
*/
|
|
165
149
|
calculateRelayerFee(amount) {
|
|
166
150
|
const percent = this.relayerFeePercent;
|
|
167
|
-
|
|
168
|
-
// Formula: amount * percent (where percent is 0.004 for 0.4%)
|
|
169
|
-
const fee = (amount * BigInt(Math.round(percent * 1e6))) / BigInt(1e6);
|
|
170
|
-
return fee;
|
|
151
|
+
return (amount * BigInt(Math.round(percent * 1e6))) / BigInt(1e6);
|
|
171
152
|
}
|
|
172
|
-
/**
|
|
173
|
-
* Get gas limit for operation and token
|
|
174
|
-
* Uses centralized TokenDefaults to eliminate duplication
|
|
175
|
-
*/
|
|
176
153
|
getGasLimit(currency, txType) {
|
|
177
|
-
// Check if it's a mining operation
|
|
178
154
|
if (txType.includes('mining')) {
|
|
179
155
|
const operation = txType.includes('reward') ? 'reward' : 'withdraw';
|
|
180
156
|
return (0, TokenDefaults_1.getMiningGasLimit)(operation);
|
|
181
157
|
}
|
|
182
|
-
// Regular Tornado withdraw
|
|
183
158
|
return (0, TokenDefaults_1.getTornadoGasLimit)(currency);
|
|
184
159
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
160
|
+
getBumpPercent(txType, purpose) {
|
|
161
|
+
if (purpose === 'fee_quote' || purpose === 'fee_validation') {
|
|
162
|
+
return (0, TokenDefaults_1.getBumpPercent)(txType);
|
|
163
|
+
}
|
|
164
|
+
if (purpose === 'replacement') {
|
|
165
|
+
return (0, TokenDefaults_1.getBumpPercent)(txType);
|
|
166
|
+
}
|
|
167
|
+
return 0;
|
|
168
|
+
}
|
|
169
|
+
extractGasPriceWei(gasParams) {
|
|
170
|
+
if (gasParams.maxFeePerGas) {
|
|
171
|
+
return BigInt(gasParams.maxFeePerGas);
|
|
172
|
+
}
|
|
173
|
+
if (gasParams.gasPrice) {
|
|
174
|
+
return BigInt(gasParams.gasPrice);
|
|
175
|
+
}
|
|
176
|
+
throw new Error('Invalid gas parameters');
|
|
191
177
|
}
|
|
192
|
-
/**
|
|
193
|
-
* Get token price in ETH (wei per token unit)
|
|
194
|
-
*/
|
|
195
178
|
async getTokenPrice(symbol) {
|
|
196
|
-
// Try price repository first (Redis)
|
|
197
179
|
if (this.priceRepository) {
|
|
198
180
|
const price = await this.priceRepository.getPrice(symbol);
|
|
199
181
|
if (price)
|
|
200
182
|
return price;
|
|
201
183
|
}
|
|
202
|
-
// Fallback to token price oracle
|
|
203
184
|
if (this.tokenPriceOracle) {
|
|
204
185
|
try {
|
|
205
186
|
const prices = await this.tokenPriceOracle.fetchPrices();
|
|
@@ -208,23 +189,38 @@ class TornadoFeeOracle {
|
|
|
208
189
|
return BigInt(price);
|
|
209
190
|
}
|
|
210
191
|
catch {
|
|
211
|
-
// Ignore error, will return null
|
|
192
|
+
// Ignore error, will return null.
|
|
212
193
|
}
|
|
213
194
|
}
|
|
214
195
|
return null;
|
|
215
196
|
}
|
|
197
|
+
withGasDetails(input) {
|
|
198
|
+
return {
|
|
199
|
+
gasCost: input.gasCost,
|
|
200
|
+
relayerFee: input.relayerFee,
|
|
201
|
+
refundAmount: input.refundAmount,
|
|
202
|
+
totalFee: input.totalFee,
|
|
203
|
+
currency: input.currency,
|
|
204
|
+
gasLimit: input.gasLimit,
|
|
205
|
+
gasPriceWei: input.gasPriceWei,
|
|
206
|
+
maxFeePerGas: input.gasParams.maxFeePerGas,
|
|
207
|
+
maxPriorityFeePerGas: input.gasParams.maxPriorityFeePerGas,
|
|
208
|
+
gasPrice: input.gasParams.gasPrice,
|
|
209
|
+
bumpPercent: input.gasParams.bumpPercent,
|
|
210
|
+
txType: input.txType,
|
|
211
|
+
gasPurpose: input.gasPurpose,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
216
214
|
/**
|
|
217
|
-
* Get gas parameters for
|
|
215
|
+
* Get gas parameters without protocol policy. Prefer getGasParametersForTx for relayer operations.
|
|
218
216
|
*/
|
|
219
217
|
async getGasParameters(isLegacy = false) {
|
|
220
218
|
return this.gasPriceOracle.getTxGasParams({ isLegacy });
|
|
221
219
|
}
|
|
222
|
-
/**
|
|
223
|
-
* Get chain ID
|
|
224
|
-
*/
|
|
225
220
|
getChainId() {
|
|
226
221
|
return this.chainId;
|
|
227
222
|
}
|
|
228
223
|
}
|
|
229
|
-
exports.
|
|
224
|
+
exports.MixerXFeeOracle = MixerXFeeOracle;
|
|
225
|
+
exports.TornadoFeeOracle = MixerXFeeOracle;
|
|
230
226
|
//# sourceMappingURL=TornadoFeeOracle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TornadoFeeOracle.js","sourceRoot":"","sources":["../../../src/infrastructure/tornado/TornadoFeeOracle.ts"],"names":[],"mappings":";;;AAAA,0DAAuE;AACvE,sEAAmE;AAGnE,6DAAyE;AACzE,
|
|
1
|
+
{"version":3,"file":"TornadoFeeOracle.js","sourceRoot":"","sources":["../../../src/infrastructure/tornado/TornadoFeeOracle.ts"],"names":[],"mappings":";;;AAAA,0DAAuE;AACvE,sEAAmE;AAGnE,6DAAyE;AACzE,qEAI2C;AA2D3C;;;;;;;;;GASG;AACH,MAAa,eAAe;IAClB,OAAO,CAAU;IACjB,iBAAiB,CAAS;IAC1B,cAAc,CAAiB;IAC/B,gBAAgB,CAAoB;IACpC,eAAe,CAAyB;IACxC,MAAM,CAAU;IAExB,YAAY,OAA+B;QACzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;QAEnD,IAAI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CAAC;YAAC,MAAM,CAAC;gBACP,kCAAkC;YACpC,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,cAAc,CAAC,KAWtB;QACC,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,YAAY;YAC1C,oBAAoB,EAAE,KAAK,CAAC,SAAS,CAAC,oBAAoB;YAC1D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ;YAClC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW;YACxC,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,UAAU,EAAE,KAAK,CAAC,UAAU;SAC7B,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CAAC,WAAoB,KAAK;QAC9C,OAAO,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAnQD,0CAmQC;AAE2B,2CAAgB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mixerx/oracles",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Complete oracle library for MixerX - gas prices (EIP-1559 + Legacy), token prices, and Tornado fee calculations",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@mixerx/config": "npm:^0.2.0",
|
|
30
|
-
"axios": "^1.
|
|
30
|
+
"axios": "^1.16.1",
|
|
31
31
|
"ethers": "^6.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|