From 6d6a5c9573ec40f961f4c21215cfde2565182ee6 Mon Sep 17 00:00:00 2001 From: Joao Gabriel Carvalho Date: Thu, 9 Dec 2021 17:49:12 -0300 Subject: [PATCH] fix: ER20Like decimals to use `uint8` (SC-4273) (#39) * fix: fix IER20LIke decimals * fix: line on EOF * feat: pas globals to liquidator deplyment --- contracts/DebtLocker.sol | 6 +++--- contracts/interfaces/Interfaces.sol | 2 +- modules/liquidations | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts/DebtLocker.sol b/contracts/DebtLocker.sol index aefbc3a..068bbb0 100644 --- a/contracts/DebtLocker.sol +++ b/contracts/DebtLocker.sol @@ -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" @@ -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(); diff --git a/contracts/interfaces/Interfaces.sol b/contracts/interfaces/Interfaces.sol index f18c8ea..b096246 100644 --- a/contracts/interfaces/Interfaces.sol +++ b/contracts/interfaces/Interfaces.sol @@ -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_); diff --git a/modules/liquidations b/modules/liquidations index bb09e17..c85ad8f 160000 --- a/modules/liquidations +++ b/modules/liquidations @@ -1 +1 @@ -Subproject commit bb09e17b1fac1126ce7734e58c3133be06162590 +Subproject commit c85ad8fba1a2c5e92971a715d5e3410dc2dbf8de