Skip to content

Commit 636fe9f

Browse files
authored
Release v2.11.0: Product Pricing Updates (#1307)
2 parents 3f7718f + 6581163 commit 636fe9f

File tree

82 files changed

+719
-4647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+719
-4647
lines changed

contracts/interfaces/IAssessmentViewer.sol

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ interface IAssessmentViewer {
1010
uint withdrawableUntilIndex;
1111
}
1212

13+
struct AssessmentStakeLockedState {
14+
bool isStakeLocked;
15+
uint stakeLockupExpiry;
16+
}
17+
1318
function getRewards(address user) external view returns (AssessmentRewards memory);
1419

15-
function isStakeLocked(address member) external view returns (bool stakeLocked);
20+
function getStakeLocked(address member) external view returns (AssessmentStakeLockedState memory);
1621
}

contracts/interfaces/ICover.sol

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ interface ICover {
103103

104104
function getGlobalRewardsRatio() external view returns (uint);
105105

106-
function getGlobalMinPriceRatio() external pure returns (uint);
106+
function getDefaultMinPriceRatio() external pure returns (uint);
107107

108108
function getGlobalCapacityAndPriceRatios() external view returns (
109109
uint _globalCapacityRatio,
110-
uint _globalMinPriceRatio
110+
uint _defaultMinPriceRatio
111111
);
112112

113-
function GLOBAL_MIN_PRICE_RATIO() external view returns (uint);
113+
function DEFAULT_MIN_PRICE_RATIO() external view returns (uint);
114114

115115
/* === MUTATIVE FUNCTIONS ==== */
116116

@@ -125,8 +125,6 @@ interface ICover {
125125
uint amount
126126
) external returns (address coverOwner);
127127

128-
function changeStakingPoolFactoryOperator() external;
129-
130128
function coverNFT() external returns (ICoverNFT);
131129

132130
function stakingNFT() external returns (IStakingNFT);

contracts/interfaces/ICoverProducts.sol

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ struct ProductInitializationParams {
1717

1818
struct Product {
1919
uint16 productType;
20-
address yieldTokenAddress;
20+
uint16 minPrice;
21+
// leftover memory gap from the previously used address field yieldTokenAddress
22+
uint144 __gap;
2123
// cover assets bitmap. each bit represents whether the asset with
2224
// the index of that bit is enabled as a cover asset for this product
2325
uint32 coverAssets;
@@ -99,6 +101,8 @@ interface ICoverProducts {
99101

100102
function getInitialPrices(uint[] calldata productIds) external view returns (uint[] memory);
101103

104+
function getMinPrices(uint[] calldata productIds) external view returns (uint[] memory);
105+
102106
function prepareStakingProductsParams(
103107
ProductInitializationParams[] calldata params
104108
) external returns (
@@ -127,7 +131,7 @@ interface ICoverProducts {
127131

128132
// Misc
129133
error UnsupportedCoverAssets();
130-
error InitialPriceRatioBelowGlobalMinPriceRatio();
134+
error InitialPriceRatioBelowMinPriceRatio();
131135
error InitialPriceRatioAbove100Percent();
132136
error CapacityReductionRatioAbove100Percent();
133137

contracts/interfaces/IMasterAwareV2.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ interface IMasterAwareV2 {
1414
SP, // StakingProducts.sol
1515
PS, // LegacyPooledStaking.sol
1616
GV, // Governance.sol
17-
GW, // LegacyGateway.sol - removed
18-
CL, // CoverMigrator.sol - removed
17+
UNUSED_GW, // LegacyGateway.sol - removed
18+
UNUSED_CL, // CoverMigrator.sol - removed
1919
AS, // Assessment.sol
2020
CI, // IndividualClaims.sol - Claims for Individuals
21-
CG, // YieldTokenIncidents.sol - Claims for Groups
21+
UNUSED_CG, // YieldTokenIncidents.sol - Claims for Groups -- removed
2222
RA, // Ramm.sol
2323
ST, // SafeTracker.sol
2424
CP // CoverProducts.sol

contracts/interfaces/INexusViewer.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ interface INexusViewer {
2323
struct StakedNXM {
2424
uint stakingPoolTotalActiveStake; // Total amount of active stake in staking pools in NXM
2525
uint assessmentStake; // Locked assessment stake in NXM
26+
uint assessmentStakeLockupExpiry; // Locked stake expiry timestamp
2627
uint assessmentRewards; // Locked assessment rewards in NXM
2728
}
2829

contracts/interfaces/IStakingPool.sol

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct AllocationRequest {
1717
uint globalCapacityRatio;
1818
uint capacityReductionRatio;
1919
uint rewardRatio;
20-
uint globalMinPrice;
20+
uint productMinPrice;
2121
}
2222

2323
struct BurnStakeParams {
@@ -157,11 +157,6 @@ interface IStakingPool {
157157
uint reductionRatio
158158
) external view returns (uint[] memory trancheCapacities);
159159

160-
function updateRewardsShares(
161-
uint trancheId,
162-
uint[] calldata tokenIds
163-
) external;
164-
165160
/* ========== EVENTS ========== */
166161

167162
event StakeDeposited(address indexed user, uint256 amount, uint256 trancheId, uint256 tokenId);

contracts/interfaces/IStakingProducts.sol

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,10 @@ interface IStakingProducts {
5656
uint productId,
5757
uint period,
5858
uint coverAmount,
59-
uint initialCapacityUsed,
6059
uint totalCapacity,
61-
uint globalMinPrice,
60+
uint productMinPrice,
6261
bool useFixedPrice,
63-
uint nxmPerAllocationUnit,
64-
uint allocationUnitsPerNxm
62+
uint nxmPerAllocationUnit
6563
) external returns (uint premium);
6664

6765
function calculateFixedPricePremium(
@@ -77,32 +75,13 @@ interface IStakingProducts {
7775
StakedProduct memory product,
7876
uint period,
7977
uint coverAmount,
80-
uint initialCapacityUsed,
8178
uint totalCapacity,
8279
uint targetPrice,
8380
uint currentBlockTimestamp,
8481
uint nxmPerAllocationUnit,
85-
uint allocationUnitsPerNxm,
8682
uint targetPriceDenominator
8783
) external pure returns (uint premium, StakedProduct memory);
8884

89-
function calculatePremiumPerYear(
90-
uint basePrice,
91-
uint coverAmount,
92-
uint initialCapacityUsed,
93-
uint totalCapacity,
94-
uint nxmPerAllocationUnit,
95-
uint allocationUnitsPerNxm,
96-
uint targetPriceDenominator
97-
) external pure returns (uint);
98-
99-
// Calculates the premium for a given cover amount starting with the surge point
100-
function calculateSurgePremium(
101-
uint amountOnSurge,
102-
uint totalCapacity,
103-
uint allocationUnitsPerNxm
104-
) external pure returns (uint);
105-
10685
/* ========== STAKING POOL CREATION ========== */
10786

10887
function stakingPool(uint poolId) external view returns (IStakingPool);
@@ -149,7 +128,7 @@ interface IStakingProducts {
149128
// Staking Pool creation
150129
error ProductDoesntExistOrIsDeprecated();
151130
error InvalidProductType();
152-
error TargetPriceBelowGlobalMinPriceRatio();
131+
error TargetPriceBelowMinPriceRatio();
153132

154133
// IPFS
155134
error IpfsHashRequired();

contracts/interfaces/IYieldTokenIncidents.sol

Lines changed: 0 additions & 102 deletions
This file was deleted.

contracts/mocks/generic/CoverGeneric.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import "../../interfaces/ICoverNFT.sol";
77

88
contract CoverGeneric is ICover {
99

10-
uint public constant GLOBAL_MIN_PRICE_RATIO = 100; // 1%
10+
uint public constant DEFAULT_MIN_PRICE_RATIO = 100; // 1%
1111
uint public constant MAX_COMMISSION_RATIO = 3000; // 30%
1212

13-
function getGlobalMinPriceRatio() public virtual pure returns (uint) {
13+
function getDefaultMinPriceRatio() public virtual pure returns (uint) {
1414
revert("Unsupported");
1515
}
1616

contracts/mocks/generic/CoverProductsGeneric.sol

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import "../../interfaces/ICoverProducts.sol";
66

77
contract CoverProductsGeneric is ICoverProducts {
88

9+
uint public constant DEFAULT_MIN_PRICE_RATIO = 100; // 1%
10+
911
/* ========== VIEWS ========== */
1012

1113
function getProductType(uint) external virtual view returns (ProductType memory) {
@@ -85,6 +87,10 @@ contract CoverProductsGeneric is ICoverProducts {
8587
revert("Unsupported");
8688
}
8789

90+
function getMinPrices(uint[] calldata) external view virtual returns (uint[] memory) {
91+
revert("Unsupported");
92+
}
93+
8894
function prepareStakingProductsParams(
8995
ProductInitializationParams[] calldata
9096
) external virtual pure returns (

0 commit comments

Comments
 (0)