@ensuro/core 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/contracts/ERC4626AssetManager.sol/ERC4626AssetManager.json +2 -2
- package/build/contracts/EToken.sol/EToken.json +2 -2
- package/build/contracts/PremiumsAccount.sol/PremiumsAccount.json +2 -2
- package/build/contracts/TimeScaled.sol/TimeScaled.json +2 -2
- package/build/contracts/mocks/FixedRateVault.sol/FixedRateVault.json +2 -2
- package/build/contracts/mocks/InterfaceIdCalculator.sol/InterfaceIdCalculator.json +2 -2
- package/contracts/ERC4626AssetManager.sol +1 -1
- package/contracts/LiquidityThresholdAssetManager.sol +7 -0
- package/contracts/Reserve.sol +5 -0
- package/contracts/TimeScaled.sol +4 -0
- package/contracts/interfaces/IAssetManager.sol +5 -0
- package/package.json +1 -1
package/contracts/Reserve.sol
CHANGED
|
@@ -152,6 +152,11 @@ abstract contract Reserve is PolicyPoolComponent {
|
|
|
152
152
|
} else {
|
|
153
153
|
_assetEarnings(abi.decode(result, (int256)));
|
|
154
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* WARNING: if you are doing a forced replacement of the AM and you want the new AM
|
|
157
|
+
* to inherit the storage (just fixing the code), make sure the code of the new AM doesn't clean
|
|
158
|
+
* the storage in the connect() method (as it is the recommended practice in normal changes of AM).
|
|
159
|
+
*/
|
|
155
160
|
} else {
|
|
156
161
|
bytes memory result = am.functionDelegateCall(
|
|
157
162
|
abi.encodeWithSelector(IAssetManager.deinvestAll.selector)
|
package/contracts/TimeScaled.sol
CHANGED
|
@@ -116,6 +116,10 @@ library TimeScaled {
|
|
|
116
116
|
int256 amount,
|
|
117
117
|
uint256 interestRate
|
|
118
118
|
) internal {
|
|
119
|
+
if (scaledAmount.amount == 0) {
|
|
120
|
+
add(scaledAmount, uint256(amount), interestRate);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
119
123
|
updateScale(scaledAmount, interestRate);
|
|
120
124
|
uint256 newScaledAmount = uint256(int256(getScaledAmount(scaledAmount, interestRate)) + amount);
|
|
121
125
|
scaledAmount.scale = newScaledAmount
|
|
@@ -38,6 +38,11 @@ interface IAssetManager is IERC165 {
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* @dev Function called when an asset manager is plugged into a reserve. Useful for initialization tasks
|
|
41
|
+
*
|
|
42
|
+
* Since the asset manager for a reserve can be changed and they use the stoage of the reserve contract, you
|
|
43
|
+
* can't assume the storage starts clean (all zeros). This is because a previous AM, using the same hash for the
|
|
44
|
+
* diamondStorage might have left some data. So, in the connect method you should initialize the state setting to
|
|
45
|
+
* zero what's expected to be zero.
|
|
41
46
|
*/
|
|
42
47
|
function connect() external;
|
|
43
48
|
|