@gearbox-protocol/airdrop
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -5,2 +5,6 @@ export declare class CSVExport { | ||
protected claimed: Record<string, number>; | ||
redirectRewards(from: string, to: string): void; | ||
sumRows(rowA: Record<string, number>, rowB: Record<string, number>): { | ||
[x: string]: number; | ||
}; | ||
additem(address: string, column: string, value: number): void; | ||
@@ -7,0 +11,0 @@ addClaimed(address: string, amount: number): void; |
@@ -8,2 +8,25 @@ "use strict"; | ||
claimed = {}; | ||
redirectRewards(from, to) { | ||
const fromLC = from.toLowerCase(); | ||
const toLC = to.toLowerCase(); | ||
const fromData = this.data[fromLC]; | ||
if (fromData) { | ||
const toData = this.data[toLC] || {}; | ||
this.data[toLC] = this.sumRows(fromData, toData); | ||
delete this.data[fromLC]; | ||
} | ||
const fromClaimed = this.claimed[fromLC]; | ||
if (fromClaimed) { | ||
const toClaimed = this.claimed[toLC] || 0; | ||
this.claimed[toLC] = fromClaimed + toClaimed; | ||
delete this.claimed[fromLC]; | ||
} | ||
} | ||
sumRows(rowA, rowB) { | ||
const commonSum = Object.fromEntries(Object.entries(rowA).map(([key, value]) => [ | ||
key, | ||
(rowB[key] || 0) + value, | ||
])); | ||
return { ...rowA, ...rowB, ...commonSum }; | ||
} | ||
additem(address, column, value) { | ||
@@ -10,0 +33,0 @@ const columnLC = column.toLowerCase(); |
{ | ||
"name": "@gearbox-protocol/airdrop", | ||
"description": "Airdrop center for Gearbox protocol", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"homepage": "https://gearbox.fi", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47986
977