Skip to content

Commit

Permalink
Use arith_uint256 instead of MultiplyAmounts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jouzo committed Jan 19, 2022
1 parent 97c819b commit 621b8f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/masternodes/mn_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2541,7 +2541,7 @@ class CCustomTxApplyVisitor : public CCustomTxVisitor
if (totalDFI < collateralsLoans.val->totalCollaterals / 2)
return Res::Err("At least 50%% of the collateral must be in DFI");
} else {
if (MultiplyAmounts(totalDFI, 100) < MultiplyAmounts(collateralsLoans.val->totalLoans, scheme->ratio) / 2)
if (arith_uint256(totalDFI) * 100 < arith_uint256(collateralsLoans.val->totalLoans) * scheme->ratio / 2)
return Res::Err("At least 50%% of the collateral must be in DFI");
}

Expand Down Expand Up @@ -2652,7 +2652,7 @@ class CCustomTxApplyVisitor : public CCustomTxVisitor
if (totalDFI < collateralsLoans.val->totalCollaterals / 2)
return Res::Err("At least 50%% of the collateral must be in DFI when taking a loan.");
} else {
if (MultiplyAmounts(totalDFI, 100) < MultiplyAmounts(collateralsLoans.val->totalLoans, scheme->ratio) / 2)
if (arith_uint256(totalDFI) * 100 < arith_uint256(collateralsLoans.val->totalLoans) * scheme->ratio / 2)
return Res::Err("At least 50%% of the collateral must be in DFI when taking a loan.");
}

Expand Down

0 comments on commit 621b8f8

Please sign in to comment.