https://github.com/rainlanguage/rain.sol.codegen
Solidity that writes solidity.
https://github.com/rainlanguage/rain.sol.codegen
Last synced: 19 days ago
JSON representation
Solidity that writes solidity.
- Host: GitHub
- URL: https://github.com/rainlanguage/rain.sol.codegen
- Owner: rainlanguage
- License: other
- Created: 2024-06-09T09:21:00.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-07T12:11:48.000Z (over 1 year ago)
- Last Synced: 2025-01-09T11:45:59.994Z (over 1 year ago)
- Language: Solidity
- Size: 49.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rain.sol.codegen
Solidity-native tooling to generate Solidity source. Builds a valid `.sol` file
(pragma + foundry-clean formatting) that hosts the constant caches for prebuilt
function-pointer tables — needed for runtime gas efficiency in the Rain
interpreter.
Also exposes interfaces (interpreter, sub-parsers, externs) for Rain contracts
to implement against the generated code.
`script/BuildPointers.sol` is an example implementation;
`.github/workflows/git-clean.yaml` is an example CI guard that fails when the
committed pointer artifacts drift from a fresh regeneration.
Generated code is imported downstream by contracts that themselves expose
pointers, which pointers feed back into the generation. This cycle means
pointers may need to be regenerated several times until they reach a fixed point
where neither pointer values nor the codehash of any consuming contract shift.
## Install
Via [soldeer](https://soldeer.xyz):
```sh
forge soldeer install rain-sol-codegen~
```
## Develop
This repo uses [nix](https://nixos.org/download.html). The default shell is the
slim `sol-shell` from [rainix](https://github.com/rainlanguage/rainix).
```sh
nix develop # enter the shell
forge soldeer install # install deps declared in foundry.toml
forge build
```
Tasks:
- `rainix-sol-static` — slither
- `rainix-sol-legal` — `reuse lint`
This repo has no `forge test` suite — the code is tooling exercised by
downstream consumers' generated artifacts.
Use the nix-pinned `forge` for all development.
## Publish
Tag `v` on `main`. The
[`Publish to Soldeer`](.github/workflows/publish-soldeer.yaml) wrapper delegates
to rainix's reusable workflow, which derives the package name from the repo name
(`rain.sol.codegen` → `rain-sol-codegen`).
## License
DecentraLicense 1.0 (DCL-1.0) — full text in
[`LICENSES/`](LICENSES/LicenseRef-DCL-1.0.txt). Roughly `CAL-1.0`
([opensource.org](https://opensource.org/license/cal-1-0)) plus user-data
disclosure obligations consistent with permissionless-blockchain assumptions.
This repo is [REUSE 3.2](https://reuse.software/spec-3.2/) compliant. Verify
locally:
```sh
nix develop -c rainix-sol-legal
```