Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ER20Like decimals to use uint8 (SC-4273) #39

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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