diff --git a/contracts/core/delegates/VaultDelegateBase.sol b/contracts/core/delegates/VaultDelegateBase.sol
index 22c94815..d5204e8c 100644
--- a/contracts/core/delegates/VaultDelegateBase.sol
+++ b/contracts/core/delegates/VaultDelegateBase.sol
@@ -13,7 +13,7 @@ import "../../libraries/StrategyLibV1.sol";
/**
* @title Vault POD (Proof of Deposit)
- * @dev The VaultPod has `_mintPods` and `_redeemPods` features which enables
+ * @dev The VaultPod has `_mintPods` and `_redeemPodCalculation` features which enables
* POD minting and burning on demand.
*
* **How Does This Work?**
diff --git a/contracts/libraries/CoverUtilV1.sol b/contracts/libraries/CoverUtilV1.sol
index 60222a51..2db1c1c7 100644
--- a/contracts/libraries/CoverUtilV1.sol
+++ b/contracts/libraries/CoverUtilV1.sol
@@ -145,10 +145,6 @@ library CoverUtilV1 {
return keccak256(abi.encodePacked(ProtoUtilV1.NS_COVER_STATUS, key, incidentDate));
}
- function getCoverLiquidityAddedKey(bytes32 coverKey, address account) external pure returns (bytes32) {
- return keccak256(abi.encodePacked(ProtoUtilV1.NS_COVER_LIQUIDITY_ADDED, coverKey, account));
- }
-
function getCoverLiquidityStakeKey(bytes32 coverKey) external pure returns (bytes32) {
return keccak256(abi.encodePacked(ProtoUtilV1.NS_COVER_LIQUIDITY_STAKE, coverKey));
}
diff --git a/contracts/libraries/ProtoUtilV1.sol b/contracts/libraries/ProtoUtilV1.sol
index 3db61fbb..27fd4566 100644
--- a/contracts/libraries/ProtoUtilV1.sol
+++ b/contracts/libraries/ProtoUtilV1.sol
@@ -85,8 +85,6 @@ library ProtoUtilV1 {
bytes32 public constant NS_COVER_LIQUIDITY_WITHDRAWAL_WINDOW = "ns:cover:liquidity:ww";
bytes32 public constant NS_COVER_LIQUIDITY_MIN_STAKE = "ns:cover:liquidity:min:stake";
bytes32 public constant NS_COVER_LIQUIDITY_STAKE = "ns:cover:liquidity:stake";
- bytes32 public constant NS_COVER_LIQUIDITY_ADDED = "ns:cover:liquidity:add";
- bytes32 public constant NS_COVER_LIQUIDITY_REMOVED = "ns:cover:liquidity:rem";
bytes32 public constant NS_COVER_LIQUIDITY_COMMITTED = "ns:cover:liquidity:committed";
bytes32 public constant NS_COVER_LIQUIDITY_NAME = "ns:cover:liquidityName";
bytes32 public constant NS_COVER_REQUIRES_WHITELIST = "ns:cover:requires:whitelist";
diff --git a/contracts/libraries/VaultLibV1.sol b/contracts/libraries/VaultLibV1.sol
index 8479bc7a..2aace58c 100644
--- a/contracts/libraries/VaultLibV1.sol
+++ b/contracts/libraries/VaultLibV1.sol
@@ -83,11 +83,9 @@ library VaultLibV1 {
* @param values[2] extendedBalance --> Stablecoins lent outside of the protocol
* @param values[3] totalReassurance -- > Total reassurance for this cover
* @param values[4] myPodBalance --> Your POD Balance
- * @param values[5] myDeposits --> Sum of your deposits (in stablecoin)
- * @param values[6] myWithdrawals --> Sum of your withdrawals (in stablecoin)
- * @param values[7] myShare --> My share of the liquidity pool (in stablecoin)
- * @param values[8] withdrawalOpen --> The timestamp when withdrawals are opened
- * @param values[9] withdrawalClose --> The timestamp when withdrawals are closed again
+ * @param values[5] myShare --> My share of the liquidity pool (in stablecoin)
+ * @param values[6] withdrawalOpen --> The timestamp when withdrawals are opened
+ * @param values[7] withdrawalClose --> The timestamp when withdrawals are closed again
*/
function getInfoInternal(
IStore s,
@@ -102,27 +100,9 @@ library VaultLibV1 {
values[2] = s.getAmountInStrategies(coverKey, s.getStablecoin()); // Stablecoins lent outside of the protocol
values[3] = s.getReassuranceAmountInternal(coverKey); // Total reassurance for this cover
values[4] = IERC20(pod).balanceOf(you); // Your POD Balance
- values[5] = _getCoverLiquidityAddedInternal(s, coverKey, you); // Sum of your deposits (in stablecoin)
- values[6] = _getCoverLiquidityRemovedInternal(s, coverKey, you); // Sum of your withdrawals (in stablecoin)
- values[7] = calculateLiquidityInternal(s, coverKey, pod, values[5]); // My share of the liquidity pool (in stablecoin)
- values[8] = s.getUintByKey(RoutineInvokerLibV1.getNextWithdrawalStartKey(coverKey));
- values[9] = s.getUintByKey(RoutineInvokerLibV1.getNextWithdrawalEndKey(coverKey));
- }
-
- function _getCoverLiquidityAddedInternal(
- IStore s,
- bytes32 coverKey,
- address you
- ) private view returns (uint256) {
- return s.getUintByKey(CoverUtilV1.getCoverLiquidityAddedKey(coverKey, you));
- }
-
- function _getCoverLiquidityRemovedInternal(
- IStore s,
- bytes32 coverKey,
- address you
- ) private view returns (uint256) {
- return s.getUintByKeys(ProtoUtilV1.NS_COVER_LIQUIDITY_REMOVED, coverKey, you);
+ values[5] = calculateLiquidityInternal(s, coverKey, pod, values[5]); // My share of the liquidity pool (in stablecoin)
+ values[6] = s.getUintByKey(RoutineInvokerLibV1.getNextWithdrawalStartKey(coverKey));
+ values[7] = s.getUintByKey(RoutineInvokerLibV1.getNextWithdrawalEndKey(coverKey));
}
/**
@@ -146,8 +126,6 @@ library VaultLibV1 {
// Update values
myPreviousStake = _updateNpmStake(s, coverKey, account, npmStakeToAdd);
- _updateCoverLiquidity(s, coverKey, account, amount);
-
podsToMint = calculatePodsInternal(s, coverKey, pod, amount);
}
@@ -166,15 +144,6 @@ library VaultLibV1 {
}
}
- function _updateCoverLiquidity(
- IStore s,
- bytes32 coverKey,
- address account,
- uint256 amount
- ) private {
- s.addUintByKey(CoverUtilV1.getCoverLiquidityAddedKey(coverKey, account), amount); // Your liquidity
- }
-
function _getMyNpmStake(
IStore s,
bytes32 coverKey,
@@ -218,9 +187,9 @@ library VaultLibV1 {
// @suppress-address-trust-issue, @suppress-malicious-erc20 The address `pod` although can only
// come from VaultBase, we still need to ensure if it is a protocol member.
- // Check `_redeemPods` for more info.
+ // Check `_redeemPodCalculation` for more info.
// Redeem the PODs and receive DAI
- releaseAmount = _redeemPods(s, account, coverKey, pod, podsToRedeem);
+ releaseAmount = _redeemPodCalculation(s, coverKey, pod, podsToRedeem);
// Unstake NPM tokens
if (npmStakeToRemove > 0) {
@@ -244,13 +213,12 @@ library VaultLibV1 {
s.subtractUintByKey(CoverUtilV1.getCoverLiquidityStakeIndividualKey(coverKey, account), amount); // Your stake
}
- function _redeemPods(
+ function _redeemPodCalculation(
IStore s,
- address account,
bytes32 coverKey,
address pod,
uint256 podsToRedeem
- ) private returns (uint256) {
+ ) private view returns (uint256) {
if (podsToRedeem == 0) {
return 0;
}
@@ -266,9 +234,6 @@ library VaultLibV1 {
// You may need to wait till active policies expire
require(available >= releaseAmount, "Insufficient balance. Lower the amount or wait till policy expiry."); // solhint-disable-line
- // Update values
- s.addUintByKeys(ProtoUtilV1.NS_COVER_LIQUIDITY_REMOVED, coverKey, account, releaseAmount);
-
return releaseAmount;
}