calculateEffectiveRate
calculateEffectiveRate(
params):OutputType
Defined in: packages/synapse-core/src/warm-storage/calculate-effective-rate.ts:65
Mirror the contract’s _calculateStorageRate with floor pricing.
Returns two rates for different use cases:
ratePerEpoch— matches the on-chain rail rate (use for lockup math)ratePerMonth— higher precision, linearly scalable (use for display)
The contract multiplies totalBytes * pricePerTiBPerMonth before dividing
by TiB * EPOCHS_PER_MONTH in a single step, so ratePerEpoch depends on
the total size and cannot be scaled to estimate other sizes. ratePerMonth
avoids the epoch division, preserving that scalability.
On-chain reference:
_calculateStorageRate: https://github.com/FilOzone/filecoin-services/blob/053885eba807ed40a0e834c080606f4286ab4ef2/service_contracts/src/FilecoinWarmStorageService.sol#L1388-L1397calculateStorageSizeBasedRatePerEpoch: https://github.com/FilOzone/filecoin-services/blob/053885eba807ed40a0e834c080606f4286ab4ef2/service_contracts/src/FilecoinWarmStorageService.sol#L1349-L1370
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
params | ParamsType | calculateEffectiveRate.ParamsType |