From 3e4a4720672774b77e5e33e31997b69fa5fe2b37 Mon Sep 17 00:00:00 2001 From: Martin Krung Date: Tue, 6 Apr 2021 10:21:55 +0200 Subject: [PATCH] in the sc no price is used, only tokenOutAmount To have everything as integer, in the fairsale smart contract no price is used (float is not very well-supported by solidity). Only tokenOutAmount is used. --- src/auction-data.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/auction-data.ts b/src/auction-data.ts index 566e48d..65f0745 100644 --- a/src/auction-data.ts +++ b/src/auction-data.ts @@ -5,13 +5,15 @@ interface AuctionBid { addressName: string addressIndex: number tokenInAmount: number + tokenOutAmount: number price: number } -export const fixFieldTypes = ({ addressIndex, addressName, price, tokenInAmount }: AuctionBid): AuctionBid => ({ +export const fixFieldTypes = ({ addressIndex, addressName, price, tokenInAmount, tokenOutAmount}: AuctionBid): AuctionBid => ({ addressName, price: parseFloat(price.toString()), tokenInAmount: parseFloat(tokenInAmount.toString()), + tokenOutAmount: parseFloat(tokenInAmount.toString()) / parseFloat(price.toString()), // may introduce runding error addressIndex: parseFloat(addressIndex.toString()), })