From 2315856bc351a94fd123541975258bf5c7f6d0fc Mon Sep 17 00:00:00 2001 From: jbamlee Date: Wed, 21 Feb 2024 14:55:56 +0900 Subject: [PATCH] fix: apply BASE token fee to a limited pair --- src/collector/log-finder/nonnativeTransferLF.ts | 1 + src/lib/terraswap/classic.consts.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/collector/log-finder/nonnativeTransferLF.ts b/src/collector/log-finder/nonnativeTransferLF.ts index 2830f5c..fbf710f 100644 --- a/src/collector/log-finder/nonnativeTransferLF.ts +++ b/src/collector/log-finder/nonnativeTransferLF.ts @@ -40,6 +40,7 @@ function createClassicLogFinder(height?: number) { const oddTokenHandlingInfo = ClassicOddTokenHandlerMap.get(transformed.assets.token) if ( + oddTokenHandlingInfo?.pair(transformed.addresses.to) && oddTokenHandlingInfo?.action(match?.find(m => m.key === "action")?.value) && height && height >= oddTokenHandlingInfo?.appliedHeight ) { diff --git a/src/lib/terraswap/classic.consts.ts b/src/lib/terraswap/classic.consts.ts index fc08e6a..9654367 100644 --- a/src/lib/terraswap/classic.consts.ts +++ b/src/lib/terraswap/classic.consts.ts @@ -12,13 +12,19 @@ export const ClassicReceiverFeeAppliedPairSet: Set = new Set([ interface OddTokenHandlingInfo { feeRate: string appliedHeight: number - action: (a: string)=> boolean + action: (a: string) => boolean + pair: (p: string) => boolean } +const oddTokenAppliedPair: Set = new Set([ + "terra1ggjadsdn285f4ae9wykle5lnawna7gdk32g6dfgpev8j0hx5jkpsc7u4gn", // uluna - BASE +]) + const CLASSIC_BASE_TOKEN = "terra1uewxz67jhhhs2tj97pfm2egtk7zqxuhenm4y4m" const APPLIED_HEIGHT = 16746830 export const ClassicOddTokenHandlerMap: Map = new Map([[CLASSIC_BASE_TOKEN, { feeRate: "0.048", appliedHeight: APPLIED_HEIGHT, - action: (a: string) => a === "send" -}]]) \ No newline at end of file + action: (a: string) => a === "send", + pair: (p: string) => oddTokenAppliedPair.has(p) +}]])