Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,51 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Fixed
- Fixed a lifecycle reserve underflow in `Rails.updateStorageRates()` that could cause `nextProvingPeriod` to fail ([#521](https://github.com/FilOzone/filecoin-services/pull/521)).
- Fixed `abandonRails` to handle underfunded payers: when zeroing the lockup period is blocked by FilecoinPay, the lifecycle reserve is still released immediately but the PDP rail retains its default 30-day lockup period rather than finalizing at once ([#520](https://github.com/FilOzone/filecoin-services/pull/520)).
## [1.4.0] - Unreleased - Multi-token payments (axlUSDC) + network value-accrual fee

This FWSS contract upgrade adds bridged USDC (axlUSDC, 6 decimals) as a second payment token and
introduces a network value-accrual fee (NVAF) on USDC rails: a small operator commission, accrued to
the FilecoinPay contract itself, sold for FIL through its recurring Dutch fee auction (`burnForFees`),
and burned to the burn actor (f099). USDFC data sets are unchanged and remain commission-free.

### Added
- Per-data-set payment token selection via the payer-signed `paymentToken` metadata key (`"USDC"` or
`"USDFC"`; absent means USDFC). The choice is covered by the existing `CreateDataSet` EIP-712
signature — no signature-format changes.
- `PriceListUSDC` (6-decimal price catalogue), exposed via
`FilecoinWarmStorageServiceStateView.getPriceListUSDC()`. Storage is priced from a `$5.00/TiB/month`
base (double the USDFC list) so providers net $5 per TiB-month on USDC rails; all other amounts keep
the USDFC-equivalent base. SP-bound amounts are grossed up by 1/(1 − 2%) so the SP nets the base
after the NVAF. The per-dataset fee is set at the 6-decimal per-epoch quantization floor
(`0.0864 USDC/month`).
- NVAF on USDC rails as the FilecoinPay per-rail operator commission (default 200 bps), locked into the
rails of each USDC data set at creation with the FilecoinPay contract itself as
`serviceFeeRecipient` — the commission joins FilecoinPay's own fee account and is sold and burned
through its existing `burnForFees` rolling Dutch auction; no new contract is involved.
Owner-stageable for future data sets via `setUSDCCommissionBps` (capped at 200 bps — the cap
equals the price gross-up so the SP-parity guarantee holds for every permitted setting), with
the `USDCCommissionBpsUpdated` event and `getUSDCCommissionBps()` view.
- `PaymentTokenSelected` event at data set creation, and
`FilecoinWarmStorageServiceStateView.getDataSetPaymentToken(dataSetId)` (pre-upgrade data sets
resolve to USDFC).

### Changed
- `FilecoinWarmStorageService` constructor takes one new parameter after the USDFC token: the USDC
token address (zero address disables USDC data sets).
- `Rails.createRails` resolves per-token pricing and now also returns the creation fee and lifecycle
reserve target; `Rails` gained `priceListFor`, `resolvePaymentToken`, `oneTimeFees`, and
`replenishReserve` entry points. Token-independent size/time constants moved from `PriceListUSDFC`
to `PriceList` (re-exported for compatibility).
- Deployment scripts pass the new constructor argument; mainnet defaults the USDC token to axlUSDC
(`0xEB466342C4d449BC9f53A865D5Cb90586f405215`), calibration defaults to disabled.

### Upgrade Notes
- Storage layout is append-only (two new slots); existing data sets are unaffected and continue to
resolve as USDFC for all fee paths.
- Payers funding USDC data sets must deposit USDC into FilecoinPay and approve FWSS as operator for
the USDC token (operator approvals are token-scoped).
- The NVAF applies only to rails created after the upgrade; FilecoinPay fixes a rail's commission at
creation.

## [1.3.0] - FWSS Upgrade

Expand Down
22 changes: 22 additions & 0 deletions service_contracts/abi/Errors.abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,28 @@
}
]
},
{
"type": "error",
"name": "UnknownRailToken",
"inputs": [
{
"name": "token",
"type": "address",
"internalType": "address"
}
]
},
{
"type": "error",
"name": "UnsupportedPaymentToken",
"inputs": [
{
"name": "paymentToken",
"type": "string",
"internalType": "string"
}
]
},
{
"type": "error",
"name": "UnsupportedSignatureV",
Expand Down
107 changes: 107 additions & 0 deletions service_contracts/abi/FilecoinWarmStorageService.abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
"type": "address",
"internalType": "contract IERC20Metadata"
},
{
"name": "_usdc",
"type": "address",
"internalType": "contract IERC20Metadata"
},
{
"name": "_filBeamBeneficiaryAddress",
"type": "address",
Expand Down Expand Up @@ -658,6 +663,19 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "setUSDCCommissionBps",
"inputs": [
{
"name": "newCommissionBps",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "setViewContract",
Expand Down Expand Up @@ -851,6 +869,19 @@
"outputs": [],
"stateMutability": "payable"
},
{
"type": "function",
"name": "usdcTokenAddress",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "contract IERC20Metadata"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "usdfcTokenAddress",
Expand Down Expand Up @@ -1201,6 +1232,31 @@
],
"anonymous": false
},
{
"type": "event",
"name": "PaymentTokenSelected",
"inputs": [
{
"name": "dataSetId",
"type": "uint256",
"indexed": true,
"internalType": "uint256"
},
{
"name": "token",
"type": "address",
"indexed": false,
"internalType": "contract IERC20"
},
{
"name": "commissionBps",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "event",
"name": "PieceAdded",
Expand Down Expand Up @@ -1308,6 +1364,25 @@
],
"anonymous": false
},
{
"type": "event",
"name": "USDCCommissionBpsUpdated",
"inputs": [
{
"name": "oldCommissionBps",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "newCommissionBps",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "event",
"name": "UpgradeAnnounced",
Expand Down Expand Up @@ -1486,6 +1561,27 @@
}
]
},
{
"type": "error",
"name": "CommissionExceedsMaximum",
"inputs": [
{
"name": "commissionType",
"type": "uint8",
"internalType": "enum Errors.CommissionType"
},
{
"name": "max",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "actual",
"type": "uint256",
"internalType": "uint256"
}
]
},
{
"type": "error",
"name": "DataSetNotAbandoned",
Expand Down Expand Up @@ -2088,6 +2184,17 @@
}
]
},
{
"type": "error",
"name": "UnknownRailToken",
"inputs": [
{
"name": "token",
"type": "address",
"internalType": "address"
}
]
},
{
"type": "error",
"name": "ZeroAddress",
Expand Down
Loading