Euler diff: contracts/modules/Swap.sol

Before: contract 0xA9B11f86aEDB82309846C98d92Ef258988a84c8E
After: git 07b78228505390b960d8b818d343005f00fb185f
Files changed (2) hide show
  1. contracts/modules/Swap.sol +2 -1
  2. contracts/BaseLogic.sol +2 -2
contracts/modules/Swap.sol CHANGED
@@ -398,9 +398,8 @@
398
398
  processWithdraw(eTokenLookup[swap.eTokenIn], swap.assetCacheIn, swap.eTokenIn, swap.accountIn, swap.amountInternalIn, balanceIn);
399
399
 
400
400
  processDeposit(eTokenLookup[swap.eTokenOut], swap.assetCacheOut, swap.eTokenOut, swap.accountOut, swap.amountOut);
401
401
 
402
- // only checking outgoing account, deposit can't lower health score
403
402
  checkLiquidity(swap.accountIn);
404
403
  }
405
404
 
406
405
  function finalizeSwapAndRepay(SwapCache memory swap) private {
@@ -429,8 +428,10 @@
429
428
  assetCache.poolSize += amountDecoded;
430
429
 
431
430
  increaseBalance(assetStorage, assetCache, eTokenAddress, account, amountInternal);
432
431
 
432
+ if (assetStorage.users[account].owed != 0) checkLiquidity(account);
433
+
433
434
  logAssetStatus(assetCache);
434
435
  }
435
436
 
436
437
  function processRepay(AssetStorage storage assetStorage, AssetCache memory assetCache, address account, uint amount) private {
contracts/BaseLogic.sol CHANGED
@@ -441,13 +441,13 @@
441
441
 
442
442
  if (owed > prevOwed) {
443
443
  uint change = owed - prevOwed;
444
444
  emit Borrow(assetCache.underlying, account, change);
445
- emitViaProxy_Transfer(dTokenAddress, address(0), account, change);
445
+ emitViaProxy_Transfer(dTokenAddress, address(0), account, change / assetCache.underlyingDecimalsScaler);
446
446
  } else if (prevOwed > owed) {
447
447
  uint change = prevOwed - owed;
448
448
  emit Repay(assetCache.underlying, account, change);
449
- emitViaProxy_Transfer(dTokenAddress, account, address(0), change);
449
+ emitViaProxy_Transfer(dTokenAddress, account, address(0), change / assetCache.underlyingDecimalsScaler);
450
450
  }
451
451
  }
452
452
 
453
453
  function increaseBorrow(AssetStorage storage assetStorage, AssetCache memory assetCache, address dTokenAddress, address account, uint amount) internal {