Skip to content
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b13668d
Modify payment rails and add methods for usage-based payments
pyropy Sep 25, 2025
8b8acd8
Merge branch 'main' of github.com:FilOzone/filecoin-services into fea…
pyropy Sep 26, 2025
874f75d
Merge branch 'main' of github.com:FilOzone/filecoin-services into fea…
pyropy Sep 29, 2025
a605965
Update CDN payment rail configuration to use absolute lockup values
pyropy Sep 29, 2025
95e7c49
Merge settleCDNPaymentRail and settleCacheMissPaymentRail into single…
pyropy Sep 29, 2025
f420cd2
Update ABI
pyropy Sep 29, 2025
89dd069
Check cdn lockup numeric values instead of stings
pyropy Sep 29, 2025
39a3d02
Remove CDN lockup metadata keys and set default lockup to 0
pyropy Sep 30, 2025
854ea19
Merge branch 'main' of github.com:FilOzone/filecoin-services into fea…
pyropy Sep 30, 2025
3d0d0e8
Remove foundry.lock
pyropy Sep 30, 2025
138bd28
Don't track package-lock.json
pyropy Sep 30, 2025
2d47ba1
refactor: replace _getCDNMetadataKV with _getSingleMetadataKV
pyropy Sep 30, 2025
1261123
Rollback tests related to data set metadata
pyropy Oct 1, 2025
e6c9446
Cleanup tests
pyropy Oct 1, 2025
2b3029c
Rename test back from testCreateDataSetCreatesRailAndChargesFee to te…
pyropy Oct 1, 2025
1268de7
chore: Emit CDNPaymentRailsToppedUp when CDN payment rail is topped up
pyropy Oct 1, 2025
1681be1
chore: Enable cdn rail settlement after termination
pyropy Oct 1, 2025
5c92d57
chore: Add CallerNotPayer error
pyropy Oct 1, 2025
2c8918a
fix: prevent top-up for terminated cdn rails
pyropy Oct 1, 2025
1521147
feat: Set initial lockup to CDN payment rails equal to 1 USDFC
pyropy Oct 2, 2025
f548006
chore: emit total lockup amount
pyropy Oct 3, 2025
e0d8f68
chore: rename default lockup variables in test
pyropy Oct 3, 2025
2042693
refactor: allow top up only if both cdn rails are active
pyropy Oct 3, 2025
8a53789
chore: update abi
pyropy Oct 3, 2025
19fdfa5
refactor: remove conditional blocks from topUpCDNPaymentRails
pyropy Oct 3, 2025
c5ac495
chore: reshuffle tests
pyropy Oct 3, 2025
74a38db
feat: emit CDNPaymentRailsToppedUp after rail creation
pyropy Oct 6, 2025
47be0af
Update service_contracts/src/FilecoinWarmStorageService.sol
pyropy Oct 6, 2025
644f4bf
Update service_contracts/src/FilecoinWarmStorageService.sol
pyropy Oct 6, 2025
962dfcc
Update service_contracts/src/FilecoinWarmStorageService.sol
pyropy Oct 6, 2025
f832caa
Update service_contracts/src/FilecoinWarmStorageService.sol
pyropy Oct 6, 2025
dc783b0
Merge branch 'main' of github.com:FilOzone/filecoin-services into fea…
pyropy Oct 6, 2025
a49b223
fix: failing test
pyropy Oct 6, 2025
0968f4e
chore: Rename settleCNDPaymentRails to settleFilBeamPaymentRails
pyropy Oct 6, 2025
2d596c6
chore: Rename tests from testSettleCNDPaymentRails_* to testSettleFil…
pyropy Oct 6, 2025
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
141 changes: 125 additions & 16 deletions service_contracts/abi/FilecoinWarmStorageService.abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,29 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "settleCDNPaymentRails",
"inputs": [
{
"name": "dataSetId",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "cdnAmount",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "cacheMissAmount",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "storageProviderChanged",
Expand Down Expand Up @@ -733,6 +756,29 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "topUpCDNPaymentRails",
"inputs": [
{
"name": "dataSetId",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "cdnAmountToAdd",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "cacheMissAmountToAdd",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "transferFilBeamController",
Expand Down Expand Up @@ -872,6 +918,31 @@
],
"stateMutability": "view"
},
{
"type": "event",
"name": "CDNPaymentRailsToppedUp",
"inputs": [
{
"name": "dataSetId",
"type": "uint256",
"indexed": true,
"internalType": "uint256"
},
{
"name": "totalCdnLockup",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "totalCacheMissLockup",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "event",
"name": "CDNPaymentTerminated",
Expand Down Expand Up @@ -1377,6 +1448,49 @@
}
]
},
{
"type": "error",
"name": "CDNPaymentAlreadyTerminated",
"inputs": [
{
"name": "dataSetId",
"type": "uint256",
"internalType": "uint256"
}
]
},
{
"type": "error",
"name": "CacheMissPaymentAlreadyTerminated",
"inputs": [
{
"name": "dataSetId",
"type": "uint256",
"internalType": "uint256"
}
]
},
{
"type": "error",
"name": "CallerNotPayer",
"inputs": [
{
"name": "dataSetId",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "expectedPayer",
"type": "address",
"internalType": "address"
},
{
"name": "caller",
"type": "address",
"internalType": "address"
}
]
},
{
"type": "error",
"name": "CallerNotPayerOrPayee",
Expand Down Expand Up @@ -1562,17 +1676,6 @@
"name": "FailedCall",
"inputs": []
},
{
"type": "error",
"name": "FilBeamPaymentAlreadyTerminated",
"inputs": [
{
"name": "dataSetId",
"type": "uint256",
"internalType": "uint256"
}
]
},
{
"type": "error",
"name": "FilBeamServiceNotConfigured",
Expand Down Expand Up @@ -1711,6 +1814,17 @@
}
]
},
{
"type": "error",
"name": "InvalidTopUpAmount",
"inputs": [
{
"name": "dataSetId",
"type": "uint256",
"internalType": "uint256"
}
]
},
{
"type": "error",
"name": "MaxProvingPeriodZero",
Expand Down Expand Up @@ -1931,11 +2045,6 @@
"name": "pdpEndEpoch",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "cdnEndEpoch",
"type": "uint256",
"internalType": "uint256"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,6 @@
"type": "uint256",
"internalType": "uint256"
},
{
"name": "cdnEndEpoch",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "dataSetId",
"type": "uint256",
Expand Down Expand Up @@ -366,11 +361,6 @@
"type": "uint256",
"internalType": "uint256"
},
{
"name": "cdnEndEpoch",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "dataSetId",
"type": "uint256",
Expand Down
10 changes: 0 additions & 10 deletions service_contracts/abi/FilecoinWarmStorageServiceStateView.abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,6 @@
"type": "uint256",
"internalType": "uint256"
},
{
"name": "cdnEndEpoch",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "dataSetId",
"type": "uint256",
Expand Down Expand Up @@ -324,11 +319,6 @@
"type": "uint256",
"internalType": "uint256"
},
{
"name": "cdnEndEpoch",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "dataSetId",
"type": "uint256",
Expand Down
25 changes: 19 additions & 6 deletions service_contracts/src/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ library Errors {
/// @param dataSetId The data set ID
error DataSetPaymentAlreadyTerminated(uint256 dataSetId);

/// @notice CDN payment is already terminated
/// @param dataSetId The data set ID
error CDNPaymentAlreadyTerminated(uint256 dataSetId);

/// @notice Cache-miss payment is already terminated
/// @param dataSetId The data set ID
error CacheMissPaymentAlreadyTerminated(uint256 dataSetId);

/// @notice Invalid top-up amount - both CDN and cache miss amounts are zero
/// @param dataSetId The data set ID
error InvalidTopUpAmount(uint256 dataSetId);

/// @notice The specified data set does not exist or is not valid
/// @param dataSetId The data set ID that was invalid or unregistered
error InvalidDataSetId(uint256 dataSetId);
Expand All @@ -139,6 +151,12 @@ library Errors {
/// @param caller The actual caller
error CallerNotPayerOrPayee(uint256 dataSetId, address expectedPayer, address expectedPayee, address caller);

/// @notice Only payer can top-up CDN payment rail balance
/// @param dataSetId The data set ID
/// @param expectedPayer The payer address
/// @param caller The actual caller
error CallerNotPayer(uint256 dataSetId, address expectedPayer, address caller);

/// @notice Data set is beyond its payment end epoch
/// @param dataSetId The data set ID
/// @param pdpEndEpoch The payment end epoch for the data set
Expand Down Expand Up @@ -246,13 +264,8 @@ library Errors {
/// @param actual The caller address
error OnlyFilBeamControllerAllowed(address expected, address actual);

/// @notice CDN payment is already terminated
/// @param dataSetId The data set ID
error FilBeamPaymentAlreadyTerminated(uint256 dataSetId);

/// @notice Payment rails have not finalized yet, so the data set can't be deleted
/// @param dataSetId The data set ID
/// @param pdpEndEpoch The end epoch when the PDP payment rail will finalize
/// @param cdnEndEpoch The end epoch when the CDN payment rail will finalize (0 if no CDN)
error PaymentRailsNotFinalized(uint256 dataSetId, uint256 pdpEndEpoch, uint256 cdnEndEpoch);
error PaymentRailsNotFinalized(uint256 dataSetId, uint256 pdpEndEpoch);
}
Loading
Loading