Simplified reimplementation of sstore2:
write arbitrary bytes (≤24KB) into a deployable contract and read it back.
Differences from sstore2:
- No internal ABI-encoding allocations.
- Optimised for the 1:1 data-to-contract case.
- Assembly hot path for less gas.
- No unrelated code shipped — single library.
- Fuzzed with foundry.
- Reverts on out-of-range slices instead of silently truncating.
start/lengthslicing rather thanstart/end.
Output is creation code byte-equivalent to what Solidity would emit for
type(Foo).creationCode. Deployment is left to the caller — direct create,
Zoltu deterministic proxy, etc.
Two read functions: read returns the entire deployed bytes; readSlice
returns a start/length slice.
Via soldeer:
forge soldeer install rain-datacontract~<version>This repo uses nix. The default shell is the
slim sol-shell from rainix.
nix develop # enter the shell
forge soldeer install # install deps declared in foundry.toml
forge testTasks:
rainix-sol-test—forge testrainix-sol-static— slitherrainix-sol-legal—reuse lint
Use the nix-pinned forge for all development.
Tag v<x.y.z> on main. The
Publish to Soldeer wrapper delegates
to rainix's reusable workflow, which derives the package name from the repo name
(rain.datacontract → rain-datacontract).
DecentraLicense 1.0 (DCL-1.0) — full text in
LICENSES/. Roughly CAL-1.0
(opensource.org) plus user-data
disclosure obligations consistent with permissionless-blockchain assumptions.
This repo is REUSE 3.2 compliant. Verify locally:
nix develop -c rainix-sol-legalWelcome under the same license. Contributors warrant that their contributions are compliant.