Skip to content

Commit

Permalink
fix: ER20Like decimals to use uint8 (SC-4273) (#39)
Browse files Browse the repository at this point in the history
* fix: fix IER20LIke decimals

* fix: line on EOF

* feat: pas globals to liquidator deplyment
  • Loading branch information
JGcarv authored Dec 9, 2021
1 parent 81f5590 commit 6d6a5c9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions contracts/DebtLocker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ contract DebtLocker is IDebtLocker, DebtLockerStorage, MapleProxied {
require(
ERC20Helper.transfer(
collateralAsset,
_liquidator = address(new Liquidator(address(this), collateralAsset, fundsAsset, address(this), address(this))),
_liquidator = address(new Liquidator(address(this), collateralAsset, fundsAsset, address(this), address(this),_getGlobals())),
collateralAssetAmount
),
"DL:TD:TRANSFER"
Expand Down Expand Up @@ -241,10 +241,10 @@ contract DebtLocker is IDebtLocker, DebtLockerStorage, MapleProxied {
uint256 oracleAmount =
swapAmount_
* IMapleGlobalsLike(_getGlobals()).getLatestPrice(collateralAsset) // Convert from `fromAsset` value.
* 10 ** IERC20Like(fundsAsset).decimals() // Convert to `toAsset` decimal precision.
* 10 ** uint256(IERC20Like(fundsAsset).decimals()) // Convert to `toAsset` decimal precision.
* (10_000 - _allowedSlippage) // Multiply by allowed slippage basis points
/ IMapleGlobalsLike(_getGlobals()).getLatestPrice(fundsAsset) // Convert to `toAsset` value.
/ 10 ** IERC20Like(collateralAsset).decimals() // Convert from `fromAsset` decimal precision.
/ 10 ** uint256(IERC20Like(collateralAsset).decimals()) // Convert from `fromAsset` decimal precision.
/ 10_000; // Divide basis points for slippage

uint256 minRatioAmount = swapAmount_ * _minRatio / 10 ** IERC20Like(collateralAsset).decimals();
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/Interfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.7;

interface IERC20Like {

function decimals() external view returns (uint256 decimals_);
function decimals() external view returns (uint8 decimals_);

function balanceOf(address account_) external view returns (uint256 balanceOf_);

Expand Down
2 changes: 1 addition & 1 deletion modules/liquidations

0 comments on commit 6d6a5c9

Please sign in to comment.