Skip to content

Commit

Permalink
Increase rounding precision (#1786)
Browse files Browse the repository at this point in the history
* Reduce sensitivity of isDust check

* Increase rounding precision instead of reducing dust precision
  • Loading branch information
kadenzipfel authored Mar 29, 2021
1 parent 6a30db3 commit 2a42699
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ const Wrapper = (props: Props) => {
await cpk.redeemPositions({
isConditionResolved,
// Round down in case of precision error
earnedCollateral: earnedCollateral.mul(99999).div(100000),
earnedCollateral: earnedCollateral.mul(99999999).div(100000000),
question,
numOutcomes: balances.length,
oracle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ const MarketSellWrapper: React.FC<Props> = (props: Props) => {
return index !== outcomeIndex
})
const amountToSell = calcSellAmountInCollateral(
// If the transaction incur in some precision error, we need to multiply the amount by some factor, for example amountShares.mul(99999).div(100000) , bigger the factor, less dust
amountShares.mul(99999).div(100000),
// Round down in case of precision error
amountShares.mul(99999999).div(100000000),
holdingsOfSoldOutcome,
holdingsOfOtherOutcomes,
marketFeeWithTwoDecimals,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ export const ScalarMarketSell = (props: Props) => {
})
const marketFeeWithTwoDecimals = Number(formatBigNumber(fee, STANDARD_DECIMALS))
const amountToSell = calcSellAmountInCollateral(
// If the transaction incur in some precision error, we need to multiply the amount by some factor, for example amountShares.mul(99999).div(100000) , bigger the factor, less dust
amountShares.mul(99999).div(100000),
// Round down in case of precision error
amountShares.mul(99999999).div(100000000),
holdingsOfSoldOutcome,
holdingsOfOtherOutcome,
marketFeeWithTwoDecimals,
Expand Down

0 comments on commit 2a42699

Please sign in to comment.