@@ -158,6 +158,7 @@ contract FilecoinWarmStorageService is
158158 uint256 pricePerTiBPerMonthWithCDN; // Price with CDN add-on (3 USDFC per TiB per month)
159159 IERC20 tokenAddress; // Address of the USDFC token
160160 uint256 epochsPerMonth; // Number of epochs in a month
161+ uint256 minimumPricePerMonth; // Minimum monthly charge for any dataset size (0.06 USDFC)
161162 }
162163
163164 // Used for announcing upgrades, packed into one slot
@@ -196,6 +197,7 @@ contract FilecoinWarmStorageService is
196197 uint256 private immutable STORAGE_PRICE_PER_TIB_PER_MONTH; // 2.5 USDFC per TiB per month without CDN with correct decimals
197198 uint256 private immutable CACHE_MISS_PRICE_PER_TIB_PER_MONTH; // .5 USDFC per TiB per month for CDN with correct decimals
198199 uint256 private immutable CDN_PRICE_PER_TIB_PER_MONTH; // .5 USDFC per TiB per month for CDN with correct decimals
200+ uint256 private immutable MINIMUM_STORAGE_RATE_PER_MONTH; // 0.06 USDFC per month minimum pricing floor
199201
200202 // Fixed lockup amounts for CDN rails
201203 uint256 private immutable DEFAULT_CDN_LOCKUP_AMOUNT; // 0.7 USDFC
@@ -330,6 +332,7 @@ contract FilecoinWarmStorageService is
330332 STORAGE_PRICE_PER_TIB_PER_MONTH = (5 * 10 ** TOKEN_DECIMALS) / 2 ; // 2.5 USDFC
331333 CACHE_MISS_PRICE_PER_TIB_PER_MONTH = (1 * 10 ** TOKEN_DECIMALS) / 2 ; // 0.5 USDFC
332334 CDN_PRICE_PER_TIB_PER_MONTH = (1 * 10 ** TOKEN_DECIMALS) / 2 ; // 0.5 USDFC
335+ MINIMUM_STORAGE_RATE_PER_MONTH = (6 * 10 ** TOKEN_DECIMALS) / 100 ; // 0.06 USDFC minimum
333336
334337 // Initialize the lockup constants based on the actual token decimals
335338 DEFAULT_CDN_LOCKUP_AMOUNT = (7 * 10 ** TOKEN_DECIMALS) / 10 ; // 0.7 USDFC
@@ -1189,7 +1192,8 @@ contract FilecoinWarmStorageService is
11891192
11901193 /**
11911194 * @notice Calculate all per-epoch rates based on total storage size
1192- * @dev Returns storage, cache miss, and CDN rates per TiB per month
1195+ * @dev Returns storage, cache miss, and CDN rates per TiB per month.
1196+ * Storage rate includes minimum pricing floor.
11931197 * @param totalBytes Total size of the stored data in bytes
11941198 * @return storageRate The PDP storage rate per epoch
11951199 * @return cacheMissRate The cache miss rate per epoch
@@ -1200,18 +1204,26 @@ contract FilecoinWarmStorageService is
12001204 view
12011205 returns (uint256 storageRate , uint256 cacheMissRate , uint256 cdnRate )
12021206 {
1203- storageRate = calculateStorageSizeBasedRatePerEpoch (totalBytes, STORAGE_PRICE_PER_TIB_PER_MONTH );
1207+ storageRate = _calculateStorageRate (totalBytes);
12041208 cacheMissRate = calculateStorageSizeBasedRatePerEpoch (totalBytes, CACHE_MISS_PRICE_PER_TIB_PER_MONTH);
12051209 cdnRate = calculateStorageSizeBasedRatePerEpoch (totalBytes, CDN_PRICE_PER_TIB_PER_MONTH);
12061210 }
12071211
12081212 /**
12091213 * @notice Calculate the storage rate per epoch (internal use)
1214+ * @dev Implements minimum pricing floor and returns the higher of the natural size-based rate or the minimum rate.
12101215 * @param totalBytes Total size of the stored data in bytes
12111216 * @return The storage rate per epoch
12121217 */
12131218 function _calculateStorageRate (uint256 totalBytes ) internal view returns (uint256 ) {
1214- return calculateStorageSizeBasedRatePerEpoch (totalBytes, STORAGE_PRICE_PER_TIB_PER_MONTH);
1219+ // Calculate natural size-based rate
1220+ uint256 naturalRate = calculateStorageSizeBasedRatePerEpoch (totalBytes, STORAGE_PRICE_PER_TIB_PER_MONTH);
1221+
1222+ // Calculate minimum rate (floor price converted to per-epoch)
1223+ uint256 minimumRate = MINIMUM_STORAGE_RATE_PER_MONTH / EPOCHS_PER_MONTH;
1224+
1225+ // Return whichever is higher: natural rate or minimum rate
1226+ return naturalRate > minimumRate ? naturalRate : minimumRate;
12151227 }
12161228
12171229 /**
@@ -1319,7 +1331,8 @@ contract FilecoinWarmStorageService is
13191331 pricePerTiBPerMonthNoCDN: STORAGE_PRICE_PER_TIB_PER_MONTH,
13201332 pricePerTiBPerMonthWithCDN: STORAGE_PRICE_PER_TIB_PER_MONTH + CDN_PRICE_PER_TIB_PER_MONTH,
13211333 tokenAddress: usdfcTokenAddress,
1322- epochsPerMonth: EPOCHS_PER_MONTH
1334+ epochsPerMonth: EPOCHS_PER_MONTH,
1335+ minimumPricePerMonth: MINIMUM_STORAGE_RATE_PER_MONTH
13231336 });
13241337 }
13251338
0 commit comments