Skip to content

Commit

Permalink
refactor: asset -> token in markets
Browse files Browse the repository at this point in the history
  • Loading branch information
MerlinEgalite committed Aug 11, 2023
1 parent b15d37e commit 60f917f
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 109 deletions.
16 changes: 8 additions & 8 deletions src/Blue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ contract Blue is IBlue {

if (data.length > 0) IBlueSupplyCallback(msg.sender).onBlueSupply(assets, data);

IERC20(market.borrowableAsset).safeTransferFrom(msg.sender, address(this), assets);
IERC20(market.borrowableToken).safeTransferFrom(msg.sender, address(this), assets);
}

/// @inheritdoc IBlue
Expand All @@ -203,7 +203,7 @@ contract Blue is IBlue {

require(totalBorrow[id] <= totalSupply[id], ErrorsLib.INSUFFICIENT_LIQUIDITY);

IERC20(market.borrowableAsset).safeTransfer(receiver, assets);
IERC20(market.borrowableToken).safeTransfer(receiver, assets);
}

/* BORROW MANAGEMENT */
Expand Down Expand Up @@ -233,7 +233,7 @@ contract Blue is IBlue {
require(_isHealthy(market, id, onBehalf), ErrorsLib.INSUFFICIENT_COLLATERAL);
require(totalBorrow[id] <= totalSupply[id], ErrorsLib.INSUFFICIENT_LIQUIDITY);

IERC20(market.borrowableAsset).safeTransfer(receiver, assets);
IERC20(market.borrowableToken).safeTransfer(receiver, assets);
}

/// @inheritdoc IBlue
Expand All @@ -258,7 +258,7 @@ contract Blue is IBlue {

if (data.length > 0) IBlueRepayCallback(msg.sender).onBlueRepay(assets, data);

IERC20(market.borrowableAsset).safeTransferFrom(msg.sender, address(this), assets);
IERC20(market.borrowableToken).safeTransferFrom(msg.sender, address(this), assets);
}

/* COLLATERAL MANAGEMENT */
Expand All @@ -278,7 +278,7 @@ contract Blue is IBlue {

if (data.length > 0) IBlueSupplyCollateralCallback(msg.sender).onBlueSupplyCollateral(assets, data);

IERC20(market.collateralAsset).safeTransferFrom(msg.sender, address(this), assets);
IERC20(market.collateralToken).safeTransferFrom(msg.sender, address(this), assets);
}

/// @inheritdoc IBlue
Expand All @@ -298,7 +298,7 @@ contract Blue is IBlue {

require(_isHealthy(market, id, onBehalf), ErrorsLib.INSUFFICIENT_COLLATERAL);

IERC20(market.collateralAsset).safeTransfer(receiver, assets);
IERC20(market.collateralToken).safeTransfer(receiver, assets);
}

/* LIQUIDATION */
Expand Down Expand Up @@ -337,13 +337,13 @@ contract Blue is IBlue {
borrowShares[id][borrower] = 0;
}

IERC20(market.collateralAsset).safeTransfer(msg.sender, seized);
IERC20(market.collateralToken).safeTransfer(msg.sender, seized);

emit EventsLib.Liquidate(id, msg.sender, borrower, repaid, repaidShares, seized, badDebtShares);

if (data.length > 0) IBlueLiquidateCallback(msg.sender).onBlueLiquidate(repaid, data);

IERC20(market.borrowableAsset).safeTransferFrom(msg.sender, address(this), repaid);
IERC20(market.borrowableToken).safeTransferFrom(msg.sender, address(this), repaid);
}

/* FLASH LOANS */
Expand Down
8 changes: 4 additions & 4 deletions src/interfaces/IBlue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import {IFlashLender} from "./IFlashLender.sol";
type Id is bytes32;

/// @notice Contains the parameters defining market.
/// @param borrowableAsset The address of the borrowable asset.
/// @param collateralAsset The address of the collateral asset.
/// @param borrowableToken The address of the borrowable token.
/// @param collateralToken The address of the collateral token.
/// @param oracle The address of the oracle.
/// @param irm The address of the interest rate model.
/// @param lltv The Liquidation LTV.
struct Market {
address borrowableAsset;
address collateralAsset;
address borrowableToken;
address collateralToken;
address oracle;
address irm;
uint256 lltv;
Expand Down
Loading

0 comments on commit 60f917f

Please sign in to comment.