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
6 changes: 6 additions & 0 deletions .github/workflows/git-clean.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: Git is clean
on: [push]
jobs:
copy-artifacts:
uses: rainlanguage/rainix/.github/workflows/rainix-copy-artifacts.yaml@main
secrets: inherit
34 changes: 7 additions & 27 deletions .github/workflows/manual-sol-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,15 @@ name: Manual sol artifacts
on:
workflow_dispatch:
inputs:
network:
description: 'Network to deploy to'
suite:
description: "The suite to deploy"
required: true
type: choice
options:
- polygon
- songbird
- flare
- base

- flow
jobs:
deploy:
runs-on: ubuntu-latest
env:
DEPLOYMENT_KEY: ${{ secrets.PRIVATE_KEY }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2

- run: nix develop --command rainix-sol-prelude
- run: nix develop --command rainix-sol-artifacts
env:
ETH_RPC_URL: ${{ inputs.network == 'polygon' && secrets.CI_DEPLOY_POLYGON_RPC_URL || inputs.network == 'songbird' && secrets.CI_DEPLOY_SONGBIRD_RPC_URL || inputs.network == 'flare' && secrets.CI_DEPLOY_FLARE_RPC_URL || inputs.network == 'base' && secrets.CI_DEPLOY_BASE_RPC_URL || '' }}
# Flare has hardcoded api key https://flarescan.com/documentation/recipes/foundry-verification
ETHERSCAN_API_KEY: ${{ inputs.network == 'flare' && 'verifyContract' || secrets.EXPLORER_VERIFICATION_KEY }}
DEPLOY_VERIFIER: ${{ inputs.network == 'songbird' && 'blockscout' || inputs.network == 'polygon' && 'etherscan' || '' }}
DEPLOY_VERIFIER_URL: ${{ inputs.network == 'songbird' && 'https://songbird-explorer.flare.network/api' || inputs.network == 'flare' && 'https://api.routescan.io/v2/network/mainnet/evm/14/etherscan' || '' }}
uses: rainlanguage/rainix/.github/workflows/rainix-manual-sol-artifacts.yaml@main
with:
suite: ${{ inputs.suite }}
secrets: inherit
47 changes: 4 additions & 43 deletions .github/workflows/rainix.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,6 @@
name: Rainix CI
name: rainix-sol
on: [push]

jobs:
standard-tests:
strategy:
matrix:
os: [ubuntu-latest]
task: [rainix-sol-test, rainix-sol-static, rainix-sol-legal]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
DEPLOYMENT_KEY: ${{ secrets.PRIVATE_KEY }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- uses: nixbuild/nix-quick-install-action@v30
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- uses: cachix/cachix-action@v15
continue-on-error: true
with:
name: rainlanguage
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
useDaemon: false
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
gc-max-store-size-linux: 1G

- run: nix develop --command rainix-sol-prelude

- name: Run ${{ matrix.task }}
env:
ETH_RPC_URL: ${{ secrets.CI_DEPLOY_RPC_URL }}
ETHERSCAN_API_KEY: ${{ secrets.EXPLORER_VERIFICATION_KEY }}
DEPLOY_VERIFIER: 'etherscan'
run: nix develop --command ${{ matrix.task }}
rainix-sol:
uses: rainlanguage/rainix/.github/workflows/rainix-sol.yaml@main
secrets: inherit
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

out
cache

.pre-commit-config.yaml
dependencies
node_modules
.pre-commit-config.yaml
18 changes: 0 additions & 18 deletions .gitmodules

This file was deleted.

3 changes: 3 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ path = [
"foundry.lock",
"foundry.toml",
"slither.config.json",
"soldeer.lock",
"remappings.txt",
"src/generated/**",
]
SPDX-FileCopyrightText = "Copyright (c) 2020 Rain Open Source Software Ltd"
SPDX-License-Identifier = "LicenseRef-DCL-1.0"
48 changes: 46 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[profile.default]
src = 'src'
out = 'out'
libs = ['lib']
libs = ['dependencies']

# See more config options https://github.com/foundry-rs/foundry/tree/master/config

Expand All @@ -18,7 +18,51 @@ optimizer_runs = 1000000

bytecode_hash = "none"
cbor_metadata = false
fs_permissions = [{ access = "read-write", path = "./src/generated"}]
remappings = [
"forge-std/=dependencies/forge-std-1.16.1/src/",
"rain.factory/=dependencies/rain-factory-0.1.1/",
"rain.interpreter.interface/=dependencies/rain-interpreter-interface-0.1.0/src/",
"rain.solmem/=dependencies/rain-solmem-0.1.3/src/",
"openzeppelin-contracts-upgradeable/contracts/=dependencies/@openzeppelin-contracts-upgradeable-5.6.1/",
"openzeppelin-contracts/contracts/=dependencies/@openzeppelin-contracts-5.6.1/",
"openzeppelin/=dependencies/@openzeppelin-contracts-upgradeable-5.6.1/",
"@openzeppelin/contracts-upgradeable/=dependencies/@openzeppelin-contracts-upgradeable-5.6.1/",
"@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-5.6.1/",
]

[fuzz]
runs = 2048
seed = "0xdeadbeef"
seed = "0xdeadbeef"

[dependencies]
forge-std = "1.16.1"
"@openzeppelin-contracts" = "5.6.1"
"@openzeppelin-contracts-upgradeable" = "5.6.1"
rain-factory = "0.1.1"
rain-interpreter-interface = "0.1.0"
rain-math-fixedpoint = "0.2.0"
rain-solmem = "0.1.3"
rain-lib-hash = "0.1.0"
rain-math-float = "0.1.1"
rain-metadata = "0.1.0"
rain-lib-typecast = "0.1.0"
rain-deploy = "0.1.2"
rain-sol-codegen = "0.1.0"

[soldeer]
recursive_deps = false

[rpc_endpoints]
arbitrum = "${ARBITRUM_RPC_URL}"
base = "${BASE_RPC_URL}"
base_sepolia = "${BASE_SEPOLIA_RPC_URL}"
flare = "${FLARE_RPC_URL}"
polygon = "${POLYGON_RPC_URL}"

[etherscan]
arbitrum = { key = "${CI_DEPLOY_ARBITRUM_ETHERSCAN_API_KEY}" }
base = { key = "${CI_DEPLOY_BASE_ETHERSCAN_API_KEY}" }
base_sepolia = { key = "${CI_DEPLOY_BASE_SEPOLIA_ETHERSCAN_API_KEY}" }
flare = { key = "${CI_DEPLOY_FLARE_ETHERSCAN_API_KEY}" }
polygon = { key = "${CI_DEPLOY_POLYGON_ETHERSCAN_API_KEY}" }
1 change: 0 additions & 1 deletion lib/forge-std
Submodule forge-std deleted from 1d9650
1 change: 0 additions & 1 deletion lib/openzeppelin-contracts-upgradeable
Submodule openzeppelin-contracts-upgradeable deleted from 3d4c0d
1 change: 0 additions & 1 deletion lib/rain.factory
Submodule rain.factory deleted from 0b55d7
1 change: 0 additions & 1 deletion lib/rain.interpreter.interface
Submodule rain.interpreter.interface deleted from dab8e3
1 change: 0 additions & 1 deletion lib/rain.math.fixedpoint
Submodule rain.math.fixedpoint deleted from 65df07
1 change: 0 additions & 1 deletion lib/rain.solmem
Submodule rain.solmem deleted from 6414ab
13 changes: 13 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@openzeppelin-contracts-5.6.1/=dependencies/@openzeppelin-contracts-5.6.1/
@openzeppelin-contracts-upgradeable-5.6.1/=dependencies/@openzeppelin-contracts-upgradeable-5.6.1/
forge-std-1.16.1/=dependencies/forge-std-1.16.1/
rain-deploy-0.1.2/=dependencies/rain-deploy-0.1.2/
rain-factory-0.1.1/=dependencies/rain-factory-0.1.1/
rain-interpreter-interface-0.1.0/=dependencies/rain-interpreter-interface-0.1.0/
rain-lib-hash-0.1.0/=dependencies/rain-lib-hash-0.1.0/
rain-lib-typecast-0.1.0/=dependencies/rain-lib-typecast-0.1.0/
rain-math-fixedpoint-0.2.0/=dependencies/rain-math-fixedpoint-0.2.0/
rain-math-float-0.1.1/=dependencies/rain-math-float-0.1.1/
rain-metadata-0.1.0/=dependencies/rain-metadata-0.1.0/
rain-sol-codegen-0.1.0/=dependencies/rain-sol-codegen-0.1.0/
rain-solmem-0.1.3/=dependencies/rain-solmem-0.1.3/
42 changes: 42 additions & 0 deletions script/BuildPointers.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: LicenseRef-DCL-1.0
// SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd
pragma solidity =0.8.25;

import {Script} from "forge-std/Script.sol";
import {LibRainDeploy} from "rain-deploy-0.1.2/src/lib/LibRainDeploy.sol";
import {LibCodeGen} from "rain-sol-codegen-0.1.0/src/lib/LibCodeGen.sol";
import {LibFs} from "rain-sol-codegen-0.1.0/src/lib/LibFs.sol";
import {Flow} from "../src/concrete/Flow.sol";

/// @title BuildPointers
/// @notice Deploys the Flow implementation via the Zoltu factory in a local
/// environment and generates `Flow.pointers.sol` with the deterministic deploy
/// address and bytecode hash.
contract BuildPointers is Script {
function addressConstantString(address addr) internal pure returns (string memory) {
return string.concat(
"\n",
"/// @dev The deterministic deploy address of the contract when deployed via\n",
"/// the Zoltu factory.\n",
"address constant DEPLOYED_ADDRESS = address(",
vm.toString(addr),
");\n"
);
}

function run() external {
LibRainDeploy.etchZoltuFactory(vm);
address deployed = LibRainDeploy.deployZoltu(type(Flow).creationCode);
LibFs.buildFileForContract(
vm,
deployed,
"Flow",
string.concat(
addressConstantString(deployed),
LibCodeGen.bytesConstantString(
vm, "/// @dev The creation bytecode of the contract.", "CREATION_CODE", type(Flow).creationCode
)
)
);
}
}
42 changes: 42 additions & 0 deletions script/Deploy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: LicenseRef-DCL-1.0
// SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd
pragma solidity =0.8.25;

import {Script} from "forge-std/Script.sol";
import {LibRainDeploy} from "rain-deploy-0.1.2/src/lib/LibRainDeploy.sol";
import {Flow} from "../src/concrete/Flow.sol";
import {
DEPLOYED_ADDRESS as FLOW_DEPLOYED_ADDRESS,
BYTECODE_HASH as FLOW_BYTECODE_HASH
} from "../src/generated/Flow.pointers.sol";

bytes32 constant DEPLOYMENT_SUITE_FLOW = keccak256("flow");

/// @title Deploy
/// @notice Deterministic deployment of the Flow implementation via the Zoltu
/// factory across all supported networks. Requires DEPLOYMENT_KEY +
/// DEPLOYMENT_SUITE=flow.
contract Deploy is Script {
mapping(string => mapping(address => bytes32)) internal sDepCodeHashes;

function run() external {
uint256 deployerPrivateKey = vm.envUint("DEPLOYMENT_KEY");
bytes32 suite = keccak256(bytes(vm.envString("DEPLOYMENT_SUITE")));

if (suite == DEPLOYMENT_SUITE_FLOW) {
LibRainDeploy.deployAndBroadcast(
vm,
LibRainDeploy.supportedNetworks(),
deployerPrivateKey,
type(Flow).creationCode,
"src/concrete/Flow.sol:Flow",
FLOW_DEPLOYED_ADDRESS,
FLOW_BYTECODE_HASH,
new address[](0),
sDepCodeHashes
);
} else {
revert("Unknown deployment suite");
}
}
}
76 changes: 76 additions & 0 deletions soldeer.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[[dependencies]]
name = "@openzeppelin-contracts"
version = "5.6.1"
url = "https://soldeer-revisions.s3.amazonaws.com/@openzeppelin-contracts/5_6_1_15-03-2026_09:19:50_contracts.zip"
checksum = "a3b6bc661be858c7c27f60a1708cbebe8c71034b4cc1e9fe270d0a05b069352f"
integrity = "bce03af7ada1eee21a7fff393f238bcd7cd75a022a4db55ffb6b0dbb32433d35"

[[dependencies]]
name = "@openzeppelin-contracts-upgradeable"
version = "5.6.1"
url = "https://soldeer-revisions.s3.amazonaws.com/@openzeppelin-contracts-upgradeable/5_6_1_15-03-2026_09:19:56_contracts-upgradeable.zip"
checksum = "f6257dbc993c2499fe08fdc93f66e12459fe3458ee62ce716b92e1d95ee0b504"
integrity = "2f539b6241258fc3c127c97225b3cb1b5e9225e422d2c1cb233c52a6f5c29002"

[[dependencies]]
name = "forge-std"
version = "1.16.1"
url = "https://soldeer-revisions.s3.amazonaws.com/forge-std/1_16_1_08-05-2026_08:51:16_forge-std-1.16.zip"
checksum = "839b61832925c7152c7b6dffbfa4998d9e606211179bd8f604733124e8a7cb57"
integrity = "60e55d10150354ca4a1e2985c5456c834b92b82ef85ab0e1d92a7786cddbd219"

[[dependencies]]
name = "rain-factory"
version = "0.1.1"
url = "https://soldeer-revisions.s3.amazonaws.com/rain-factory/0_1_1_20-05-2026_13:02:17_rain.zip"
checksum = "6b02e2b87983e196bc88cb8fb802a2720b252783429567864cd13336167c369d"
integrity = "be6a3343d0ea247d8b495b584cd21c3bf64f0a1396ca21aaa8ce31715df29842"

[[dependencies]]
name = "rain-interpreter-interface"
version = "0.1.0"
url = "https://soldeer-revisions.s3.amazonaws.com/rain-interpreter-interface/0_1_0_12-05-2026_18:43:02_rain.interpreter.zip"
checksum = "887c4d5f1a87713c49f015b3fcdb295defbb495b126d15f9850c0ce72ef79639"
integrity = "c1b89f8a7ad02507ceb051b6c0f2750f6abe1ba99ffdfe1c9ac93905db90e75d"

[[dependencies]]
name = "rain-lib-hash"
version = "0.1.0"
url = "https://soldeer-revisions.s3.amazonaws.com/rain-lib-hash/0_1_0_12-05-2026_16:24:56_rain.lib.zip"
checksum = "648f3e38b297dbd3ecb32b82c8b24c322f484e1734eb50fd393bc547c72b59b0"
integrity = "91f5f679a0a27f096fdbc1e41195dd9f42cacfab15735efeb1101cc1b9215b47"

[[dependencies]]
name = "rain-lib-typecast"
version = "0.1.0"
url = "https://soldeer-revisions.s3.amazonaws.com/rain-lib-typecast/0_1_0_12-05-2026_16:31:39_rain.lib.zip"
checksum = "5c0419501e4c763ef161a3489934af192219f994cb2c9187699bc4dee0b4e2bb"
integrity = "092781f87fd9227c4c95aafde59300c503d6a9a355beaeb5c5732fe6e36676d6"

[[dependencies]]
name = "rain-math-fixedpoint"
version = "0.2.0"
url = "https://soldeer-revisions.s3.amazonaws.com/rain-math-fixedpoint/0_2_0_09-05-2026_21:16:31_rain.math.zip"
checksum = "dd24665a7c3bc82878fdbcfe5ea8efe8471ec9c8546615dc94debc38529117d9"
integrity = "81a144050f76b662c91f1611ec18f41dce0994208617123cde80aad2fc9b441c"

[[dependencies]]
name = "rain-math-float"
version = "0.1.1"
url = "https://soldeer-revisions.s3.amazonaws.com/rain-math-float/0_1_1_13-05-2026_13:48:34_rain.math.zip"
checksum = "322956f272ae3073ee02b0e7301b8834f08f2de62bcd6c309c44e946d7cd7056"
integrity = "dccdd4406a37db6af690872b805084a7dbe5211c57961a61ef083a7912ddbdc9"

[[dependencies]]
name = "rain-metadata"
version = "0.1.0"
url = "https://soldeer-revisions.s3.amazonaws.com/rain-metadata/0_1_0_12-05-2026_20:20:51_rain.zip"
checksum = "801d2b97b393d346c19a2f4f454d0279ba8f7d0f81fa3eb4fe8609da7291203d"
integrity = "f17f10aa50e9e2b254c689c83f41b3cabab81c95bad06424b9b3e9c92d02e577"

[[dependencies]]
name = "rain-solmem"
version = "0.1.3"
url = "https://soldeer-revisions.s3.amazonaws.com/rain-solmem/0_1_3_09-05-2026_19:49:33_rain.zip"
checksum = "1d405bb81f7c9e56d1717de0d60da918d2fc2fa4db083efd2abe9906378d019f"
integrity = "e879d2743f9d884f647b9dd489889a83f2cea5f76eb69409a113e1baa69d3643"
Loading
Loading