Storage Terms - joint currency and pricing configuration
Maintainers usually reply within 1 day
@Kubuxu is already working on this.
Since Oct 19, 2026.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 8/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- solidity
- Domain
- authorization, blockchain, payments
Research direction
This is a design proposal with open questions, not a task with a defined edit. Start by reading the feat/storage-terms branch and the proposal's open question on whether CreateDataSetWithStorageTerms needs its own SessionKeyRegistry scope. Done means the design decisions are settled by maintainers before any code is written.
Written by the indexing model from the issue text.
Description
Supersedes #618 and #619.
Aim
Allow contract owners to add different currency and pricing terms without introducing the complexity of full configurability.
How
This proposal combines currency and pricing configuration into Storage Terms.
Storage Terms can be added by the contract owner and allow for creation of new datasets under these terms.
The terms currently consist of:
struct StorageTerms {
address token; // address of the token to be used
uint8 tokenDecimals; // decimals of the token used by these terms
uint256 pricePerTiBPerMonth; // price per TiB per month in the token's smallest units
bytes32 salt; // additional salt allowing for separation of terms
}
The salt exists so StorageTerms with identical pricing can be differentiated. A client can specify them in their dataset creation request and a storage provider can accept or refuse them.
They are identified by their hash:
bytes32 storageTermsId = keccak256(
abi.encode(
keccak256("filecoin.FWSS.StorageTerms.v1"),
terms.token,
terms.tokenDecimals,
terms.pricePerTiBPerMonth,
terms.salt
)
);
For now, the system design considers USD stablecoins. This narrowing of scope exists because the fees are not configurable. Token decimals are verified during registration.
The definition is immutable. The owner can disable terms for new datasets and re-enable them by registering the same terms again.
Disabling only prevents new datasets from selecting the terms. It does not interrupt payments or other operations on existing datasets. A dataset cannot switch terms after creation.
After the contract owner registers terms using registerStorageTerms(StorageTerms) returns (bytes32 storageTermsId),
new datasets can be created using them via a new variant of signed extraData:
abi.encode(payer, clientDataSetId, keys, values, signature, storageTermsId)
The new EIP-712 type is:
CreateDataSetWithStorageTerms(uint256 clientDataSetId,address payee,MetadataEntry[] metadata,bytes32 storageTermsId)MetadataEntry(string key,string value)
Storage Terms are stored in the ERC-7201 namespace filecoin.FWSS.StorageTerms, rooted at:
// keccak256(abi.encode(uint256(keccak256("filecoin.FWSS.StorageTerms")) - 1)) & ~bytes32(uint256(0xff))
bytes32 constant STORAGE_TERMS_STORAGE_LOCATION =
0xffe2107a587f9a58b0aaa87110a43c1dc6de9e3d39b63f9be37b80538b60ff00;
It stores a map of:
mapping(bytes32 storageTermsId => StorageTermsRecord) storageTerms;
struct StorageTermsRecord {
address token;
uint8 tokenDecimals;
uint8 version;
bool enabled;
uint256 pricePerTiBPerMonth;
bytes32 salt;
}
Each record occupies three consecutive slots. version is the terms schema version, not a revision of an individual definition. It is currently 1 for registered terms; 0 marks an unregistered entry.
In the current prototype datasets requesting FilBeam and a non-default currency are rejected.
This prototype uses an additional SessionKeyRegistry scope for CreateDataSetWithStorageTerms, although I'm still not sure about introducing it.
Backwards compatibility
The storageTermsId of each dataset is stored in DataSetInfo at relative slot 11, added to the end.
For existing datasets it will be zero, defaulting to the terms identified by legacyStorageTermsId().
This ID uses the hash formula above with (address(usdfcTokenAddress), uint8(18), uint256(2.5e18), bytes32(0)),
corresponding to the existing configuration: USDFC, 18 decimals, 2.5 USDFC/TiB/month, and zero salt.
The literal ID depends on the deployment's USDFC token address.
The old extraData format also selects these legacy terms. The new format requires an explicit, nonzero terms ID.
Legacy terms can be explicitly registered, but cannot be disabled in the current prototype.
Open questions
Should the new request require a separate SessionKeyRegistry scope, or reuse the existing creation scope? A separate scope avoids expanding existing grants to additional currencies and prices, but requires clients to grant another permission.
Branch feat/storage-terms contains a very early draft of the idea.
- Dominant language
- Solidity
- Stars
- 8
- Forks
- 27
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 12
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FilOzone/filecoin-services
-
release
Difficulty 5/5 Over a week Newbie friendliness 15/100
FilOzone/filecoin-services#679 · 10 comments ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 22/100
FilOzone/filecoin-services#675 · 2 comments ·
Maintainers usually reply within 1 day
-
Gather docs for IPNI regarding ACLsPossibly taken @snadrus claimed this 15 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
FilOzone/filecoin-services#671 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
enhancement fwss
Difficulty 5/5 Over a week Newbie friendliness 35/100
FilOzone/filecoin-services#666 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
FilOzone/filecoin-services#663 ·
Maintainers usually reply within 1 day
All issues in FilOzone/filecoin-services
Similar issues
-
area::control effort::xs impact::medium priority::medium source::auto status::review type::bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
-
area:api wave wave:trivial
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Jstar269/nakagawa-recomp#3746 ·
Maintainers usually reply within 1 day
-
bug P2 server
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
dependencies good first issue javascript
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day