This repository contains the Chainora ROSCA v1 smart contracts plus a cross-platform JavaScript wizard CLI for deploy and timelock admin operations.
- Control-plane contracts use an upgrade-ready pattern (
ChainoraProtocolRegistry,ChainoraRoscaFactory, timelock-governed upgrades). - Pool instances are deployed via minimal proxies (clones) from
ChainoraRoscaFactory. - Runtime is member-driven: only active pool members can call period transition functions.
- Pool formation does not escrow upfront contributions; members start paying when period 1 opens.
- A missed contribution archives the pool immediately, and contributors from the interrupted period can claim refunds.
- External integrations (device verification, reputation snapshots, staking) are adapter-based.
- Deploy and admin tooling now lives in
tooling/chainora-cli/; Solidity deploy/admin scripts are no longer part of the repo workflow.
src/core/ChainoraProtocolRegistry.solsrc/core/ChainoraRoscaFactory.solsrc/pool/ChainoraRoscaPool.solsrc/governance/ChainoraProtocolTimelock.sol
- Contract build and tests: Foundry (
forge) - Deploy/admin wizard: Node.js CLI at
tooling/chainora-cli/ - CLI entrypoint:
npm run chainora
- Install Foundry dependencies:
git submodule update --init --recursive
- Use Node.js
24+, then install Node dependencies:npm install
- Build artifacts before using the wizard:
forge build --sizes
- Copy
.env.exampleto.envand set at least:RPC_URLETH_RPC_URL- optionally
PRIVATE_KEY
Run the wizard:
npm run chainoraOverride RPC or use dry-run:
npm run chainora -- --rpc-url http://23.94.63.207:8545
npm run chainora -- --dry-runThe CLI contains three branches:
DeployBootstrap Core
Deploy TimelockDeploy RegistryDeploy Device AdapterDeploy Reputation AdapterDeploy Pool ImplementationDeploy FactoryDeploy ChainoraTestUSDAdminRegistry > setStablecoin | setDeviceAdapter | setReputationAdapter | setStakingAdapterFactory > setRegistry | setPoolImplementationDevice Adapter > setTrustVerifier | revokeUserReputation Adapter > setTrustVerifier
Timelock UtilitiesInspect OperationCancel Operation
The wizard is keyboard-first and defaults are sourced from .env, so operators can usually keep pressing Enter.
Keep only long-lived values in .env:
RPC_URLETH_RPC_URLPRIVATE_KEYif you do not want the CLI to prompt at runtimeCHAINORA_MULTISIGCHAINORA_TIMELOCK_DELAYCHAINORA_PROPOSERSCHAINORA_EXECUTORSCHAINORA_CANCELLERSCHAINORA_TIMELOCKCHAINORA_REGISTRYCHAINORA_DEVICE_ADAPTERCHAINORA_REPUTATION_ADAPTERCHAINORA_POOL_IMPLEMENTATIONCHAINORA_FACTORYCHAINORA_TEST_STABLECOINCHAINORA_TEST_STABLECOIN_OWNERCHAINORA_TEST_STABLECOIN_INITIAL_SUPPLY
Successful deploys auto-sync the relevant persistent addresses into .env. Some admin execute flows can optionally sync updated addresses as well.
- Run
forge build --sizes. - Run
npm run chainora. - Choose
Deployand either:- run
Bootstrap Corefor a fresh environment, or - deploy individual contracts one by one.
- run
- Use
Adminto schedule and execute timelock-managed updates such as:- setting the stablecoin
- switching
deviceAdapter - switching
reputationAdapter - switching
poolImplementation
- Use
Timelock Utilitiesto inspect or cancel pending operations when needed.
- Contracts only store and verify reputation scores; they do not calculate score deltas onchain.
- Backend services can discover completed pools from
ChainoraPoolArchived()and backfill that pool's event history to compute final score changes. - After computing final scores offchain, a trusted verifier signs a batch update and a relayer submits it to
ChainoraReputationAdapter.
CreatePoolhas been intentionally removed from repo tooling in this round.- Smart contracts still expose
createPool(Types.PoolConfig), but there is currently no wizard or script wrapper for pool creation in this repository. - If pool creation tooling returns later, it must be added to the JavaScript wizard CLI instead of reintroducing Solidity scripts.
- Foundry contract tests:
forge test -vvv
- Wizard CLI tests:
npm test
forge fmt --check
forge build --sizes
forge test -vvv
forge snapshot
npm run lint
npm run typecheck
npm test