Skip to content

Commit

Permalink
update base fee var name
Browse files Browse the repository at this point in the history
  • Loading branch information
fengtality committed Jan 26, 2025
1 parent 0408927 commit a72ea11
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/chains/solana/solana.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface NetworkConfig {
export interface Config {
network: NetworkConfig;
defaultComputeUnits: number;
priorityFeePercentile: number;
basePriorityFeePct: number;
priorityFeeMultiplier: number;
maxPriorityFee: number;
minPriorityFee: number;
Expand Down Expand Up @@ -42,8 +42,8 @@ export function getSolanaConfig(
defaultComputeUnits: ConfigManagerV2.getInstance().get(
chainName + '.defaultComputeUnits'
),
priorityFeePercentile: ConfigManagerV2.getInstance().get(
chainName + '.priorityFeePercentile'
basePriorityFeePct: ConfigManagerV2.getInstance().get(
chainName + '.basePriorityFeePct'
),
priorityFeeMultiplier: ConfigManagerV2.getInstance().get(
chainName + '.priorityFeeMultiplier'
Expand Down
4 changes: 2 additions & 2 deletions src/chains/solana/solana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,14 +470,14 @@ export class Solana {
logger.info(`[SOLANA] Recent priority fees paid: ${minFee.toFixed(4)} - ${maxFee.toFixed(4)} lamports/CU (avg: ${averageFee.toFixed(4)})`);

// Calculate index for percentile
const percentileIndex = Math.ceil(fees.length * this.config.priorityFeePercentile);
const percentileIndex = Math.ceil(fees.length * this.config.basePriorityFeePct / 100);
let basePriorityFee = fees[percentileIndex - 1] / 1_000_000; // Convert to lamports

// Ensure fee is not below minimum (convert SOL to lamports)
const minimumFeeLamports = Math.floor(this.config.minPriorityFee * 1e9 / this.config.defaultComputeUnits);
basePriorityFee = Math.max(basePriorityFee, minimumFeeLamports);

logger.info(`[SOLANA] Base priority fee: ${basePriorityFee.toFixed(4)} lamports/CU (${basePriorityFee === minimumFeeLamports ? 'minimum' : `${this.config.priorityFeePercentile * 100}th percentile`})`);
logger.info(`[SOLANA] Base priority fee: ${basePriorityFee.toFixed(4)} lamports/CU (${basePriorityFee === minimumFeeLamports ? 'minimum' : `${this.config.basePriorityFeePct}th percentile`})`);

// Cache the result
Solana.lastPriorityFeeEstimate = {
Expand Down
2 changes: 1 addition & 1 deletion src/services/schema/solana-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"network": { "type": "string" },
"defaultComputeUnits": { "type": "number" },
"priorityFeePercentile": { "type": "number" },
"basePriorityFeePct": { "type": "number" },
"priorityFeeMultiplier": { "type": "number" },
"maxPriorityFee": { "type": "number" },
"minPriorityFee": { "type": "number" },
Expand Down
2 changes: 1 addition & 1 deletion src/templates/solana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ networks:
defaultComputeUnits: 200000

# Floor percentile of recent priority fee samples used to estimate gasPrice for a transaction
priorityFeePercentile: 0.75
basePriorityFeePct: 75

# Multiplier for increasing priority fee on retry
priorityFeeMultiplier: 2
Expand Down

0 comments on commit a72ea11

Please sign in to comment.