Skip to content

Commit

Permalink
fix parse allowlist csv tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jipperism committed Nov 6, 2023
1 parent c8f73a5 commit 14f29d3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions frontend/lib/parsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,19 @@ export function parseAllowlistCsv(
const csvTotalPercentage = 1.0 - addTotalPercentage;

// 75
const percentageBigInt = BigInt(Math.floor(csvTotalPercentage * 100)); // convert percentage to BigInt
const creatorSupply = (csvTotalSupply * 100n) / percentageBigInt; // calculate total supply
const csvTotalPercentageBigInt = BigInt(Math.floor(csvTotalPercentage * 100)); // convert percentage to BigInt
const addTotalPercentageBigInt = BigInt(Math.floor(addTotalPercentage * 100)); // convert percentage to BigInt
const creatorSupply =
(((csvTotalSupply * 100n) / csvTotalPercentageBigInt) *
addTotalPercentageBigInt) /
100n;
const totalSupply = csvTotalSupply + creatorSupply; // calculate total supply

// TODO risk over overflow on units - casting bigint to number
const data = csvData.concat(
add.map((x) => ({
address: x.address.trim().toLowerCase(),
units: creatorSupply,
units: (totalSupply * BigInt(Math.floor(x.percentage * 100))) / 100n,
})),
);

Expand Down

0 comments on commit 14f29d3

Please sign in to comment.