Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

Commit

Permalink
Update logic to prevent potential overflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
bweick committed Apr 29, 2020
1 parent afcfa2e commit e30298e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contracts/core/liquidators/utils/LiquidatorUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ library LiquidatorUtils {
currentSetAllocation.sub(nextSetAllocation) :
nextSetAllocation.sub(currentSetAllocation);

// Return rebalance volume by multiplying allocationChange by Set market cap
return currentSetValue.mul(_currentSetQuantity).mul(allocationChange).deScale().deScale();
// Return rebalance volume by multiplying allocationChange by Set market cap, deScaling to avoid
// overflow potential, still have 18 decimals of precision
return currentSetValue.mul(_currentSetQuantity).deScale().mul(allocationChange).deScale();
}

/**
Expand Down

0 comments on commit e30298e

Please sign in to comment.