Skip to content

Commit 27bdb9e

Browse files
committed
linter
1 parent 76696fd commit 27bdb9e

File tree

2 files changed

+12
-80
lines changed

2 files changed

+12
-80
lines changed

src/config/test-detection.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { TestDetectionConfig } from '../services/StatisticsService';
22

33
/**
44
* Configuration for detecting test vs production transactions
5-
*
5+
*
66
* Separate thresholds for claims and funding:
77
* - Claims: Individual token amounts claimed by users
88
* - Funding: Total amounts funded to the contract for distribution
@@ -47,7 +47,7 @@ export const networkSpecificConfigs: Record<string, TestDetectionConfig> = {
4747
/**
4848
* Get the appropriate test detection config for a network
4949
*/
50-
export function getTestDetectionConfig(networkName?: string): TestDetectionConfig {
50+
export function getTestDetectionConfig (networkName?: string): TestDetectionConfig {
5151
if (networkName && networkSpecificConfigs[networkName]) {
5252
return networkSpecificConfigs[networkName];
5353
}

src/services/StatisticsService.ts

Lines changed: 10 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class StatisticsService {
104104
/**
105105
* Determine if a CLAIM transaction is a test based on amount
106106
*/
107-
private static isTestClaim(
107+
private static isTestClaim (
108108
amountInTokens: number,
109109
config: TestDetectionConfig = this.DEFAULT_TEST_CONFIG,
110110
): boolean {
@@ -123,7 +123,7 @@ export class StatisticsService {
123123
/**
124124
* Determine if a FUNDING transaction is a test based on amount
125125
*/
126-
private static isTestFunding(
126+
private static isTestFunding (
127127
amountInTokens: number,
128128
config: TestDetectionConfig = this.DEFAULT_TEST_CONFIG,
129129
): boolean {
@@ -674,8 +674,8 @@ export class StatisticsService {
674674
events: (ethers.EventLog | ethers.Log)[],
675675
decimals: number,
676676
config: TestDetectionConfig,
677-
): {
678-
count: number;
677+
): {
678+
count: number;
679679
totalAmount: string;
680680
testCount: number;
681681
testAmount: string;
@@ -715,36 +715,15 @@ export class StatisticsService {
715715
};
716716
}
717717

718-
/**
719-
* Aggregate claim data from outgoing transfer events (legacy method for compatibility)
720-
*/
721-
private static aggregateClaimData (
722-
events: (ethers.EventLog | ethers.Log)[],
723-
decimals: number,
724-
): { count: number; totalAmount: string } {
725-
let totalAmount = BigInt(0);
726-
727-
for (const event of events) {
728-
if ('args' in event && event.args && event.args.value) {
729-
totalAmount += BigInt(event.args.value.toString());
730-
}
731-
}
732-
733-
return {
734-
count: events.length,
735-
totalAmount: ethers.formatUnits(totalAmount.toString(), decimals),
736-
};
737-
}
738-
739718
/**
740719
* Aggregate funding data from incoming transfer events with test/production classification
741720
*/
742721
private static aggregateFundingDataWithClassification (
743722
events: (ethers.EventLog | ethers.Log)[],
744723
decimals: number,
745724
config: TestDetectionConfig,
746-
): {
747-
totalAmount: string;
725+
): {
726+
totalAmount: string;
748727
topFunders: FundingTransaction[];
749728
testCount: number;
750729
testAmount: string;
@@ -843,53 +822,6 @@ export class StatisticsService {
843822
};
844823
}
845824

846-
/**
847-
* Aggregate funding data from incoming transfer events (legacy method for compatibility)
848-
*/
849-
private static aggregateFundingData (
850-
events: (ethers.EventLog | ethers.Log)[],
851-
decimals: number,
852-
): { totalAmount: string; topFunders: FundingTransaction[] } {
853-
let totalAmount = BigInt(0);
854-
const fundingTransfers: Array<{
855-
from: string;
856-
amount: bigint;
857-
blockNumber: number;
858-
}> = [];
859-
860-
for (const event of events) {
861-
if ('args' in event && event.args && event.args.value) {
862-
const amount = BigInt(event.args.value.toString());
863-
totalAmount += amount;
864-
865-
fundingTransfers.push({
866-
from: event.args.from,
867-
amount,
868-
blockNumber: event.blockNumber || 0,
869-
});
870-
}
871-
}
872-
873-
// Sort and get top 5 funders
874-
const topFunders = fundingTransfers
875-
.sort((a, b) => {
876-
if (a.amount > b.amount) return -1;
877-
if (a.amount < b.amount) return 1;
878-
return 0;
879-
})
880-
.slice(0, 5)
881-
.map(f => ({
882-
from: f.from,
883-
amount: ethers.formatUnits(f.amount.toString(), decimals),
884-
blockNumber: f.blockNumber,
885-
}));
886-
887-
return {
888-
totalAmount: ethers.formatUnits(totalAmount.toString(), decimals),
889-
topFunders,
890-
};
891-
}
892-
893825
/**
894826
* Aggregate rescue data from rescue transfer events
895827
*/
@@ -1022,13 +954,13 @@ export class StatisticsService {
1022954
const totalClaimed = `${fmt(stats.totalClaimed)} (${stats.claimedPercentage}%)`;
1023955

1024956
// Create the table
1025-
output.push(` ┌────────────────┬─────────────────┬─────────────────┬─────────────────┐`);
1026-
output.push(` │ Parameter │ Test 🧪 │ Production 🚀 │ Total │`);
1027-
output.push(` ├────────────────┼─────────────────┼─────────────────┼─────────────────┤`);
957+
output.push(' ┌────────────────┬─────────────────┬─────────────────┬─────────────────┐');
958+
output.push(' │ Parameter │ Test 🧪 │ Production 🚀 │ Total │');
959+
output.push(' ├────────────────┼─────────────────┼─────────────────┼─────────────────┤');
1028960
output.push(` │ Funded │ ${testFunded.padEnd(15)}${prodFunded.padEnd(15)}${totalFunded.padEnd(15)} │`);
1029961
output.push(` │ Claims │ ${testClaims.padEnd(15)}${prodClaims.padEnd(15)}${totalClaims.padEnd(15)} │`);
1030962
output.push(` │ Amount Claimed │ ${testClaimed.padEnd(15)}${prodClaimed.padEnd(15)}${totalClaimed.padEnd(15)} │`);
1031-
output.push(` └────────────────┴─────────────────┴─────────────────┴─────────────────┘`);
963+
output.push(' └────────────────┴─────────────────┴─────────────────┴─────────────────┘');
1032964

1033965
// Add remaining balance info
1034966
output.push('');

0 commit comments

Comments
 (0)