From d05aaf0177cba1bc04da117f9ab116dc1a62681b Mon Sep 17 00:00:00 2001 From: coffee-converter Date: Sat, 5 Dec 2020 07:18:31 -0600 Subject: [PATCH] fixes min max for real --- src/mapping.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mapping.ts b/src/mapping.ts index 872a690..9e734f2 100644 --- a/src/mapping.ts +++ b/src/mapping.ts @@ -24,9 +24,9 @@ let NORMAL_SUPPLY = BigInt.fromI32(5000000).times(BigInt.fromI32(10).pow(18)), MIN_SUPPLY_5 = BigInt.fromI32(2500000).times(BigInt.fromI32(10).pow(18)), MIN_SUPPLY_6 = BigInt.fromI32(1).times(BigInt.fromI32(10).pow(18)) -function getMinSupply (dayStr: string): BigInt { - let dayNum = parseInt(dayStr) - switch (dayNum) { +function getMinSupply (day: BigInt): BigInt { + let dayVal = day.toI32() + switch (dayVal) { case 8: case 10: return MIN_SUPPLY_1 case 14: case 16: case 17: @@ -153,7 +153,7 @@ export function handleWiseReservation(event: WiseReservation): void { if (gResDay == null) { gResDay = new GlobalReservationDay(gResDayID) gResDay.investmentDay = reservation.investmentDay - gResDay.minSupply = getMinSupply(gResDay.investmentDay.toString()) + gResDay.minSupply = getMinSupply(gResDay.investmentDay) gResDay.maxSupply = MAX_SUPPLY.minus(gResDay.minSupply) gResDay.totalAmount = BigInt.fromI32(0) gResDay.totalRealAmount = BigInt.fromI32(0)