|
@@ -42,10 +42,16 @@
|
|
|
42
42
|
function decimals() external pure returns (uint8) {
|
|
43
43
|
return 18;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/// @notice Address of underlying asset
|
|
47
|
+
function underlyingAsset() external view returns (address) {
|
|
48
|
+
(address underlying,,,) = CALLER();
|
|
49
|
+
return underlying;
|
|
50
|
+
}
|
|
46
51
|
|
|
47
52
|
|
|
53
|
+
|
|
48
54
|
/// @notice Sum of all balances, in internal book-keeping units (non-increasing)
|
|
49
55
|
function totalSupply() external view returns (uint) {
|
|
50
56
|
(address underlying, AssetStorage storage assetStorage,,) = CALLER();
|
|
51
57
|
AssetCache memory assetCache = loadAssetCacheRO(underlying, assetStorage);
|
|
@@ -160,8 +166,10 @@
|
|
|
160
166
|
}
|
|
161
167
|
|
|
162
168
|
increaseBalance(assetStorage, assetCache, proxyAddr, account, amountInternal);
|
|
163
169
|
|
|
170
|
+
if (assetStorage.users[account].owed != 0) checkLiquidity(account);
|
|
171
|
+
|
|
164
172
|
logAssetStatus(assetCache);
|
|
165
173
|
}
|
|
166
174
|
|
|
167
175
|
/// @notice Transfer underlying tokens from Euler pool to sender, and decrease account's eTokens
|
|
@@ -332,8 +340,10 @@
|
|
|
332
340
|
|
|
333
341
|
transferBalance(assetStorage, assetCache, proxyAddr, from, to, amount);
|
|
334
342
|
|
|
335
343
|
checkLiquidity(from);
|
|
344
|
+
if (assetStorage.users[to].owed != 0) checkLiquidity(to);
|
|
345
|
+
|
|
336
346
|
logAssetStatus(assetCache);
|
|
337
347
|
|
|
338
348
|
return true;
|
|
339
349
|
}
|
|
@@ -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 {
|