feat(contracts): scaffold Soroban smart contracts workspace#235
Conversation
Installs eslint and @typescript-eslint plugins as devDependencies, adds tsconfig.eslint.json to include test files, suppresses intentional control-char regex in sanitizer, and fixes Function type in metrics test.
Literal control bytes in the regex were corrupting the source file, causing tsc to fail with 'not a module'. charCodeAt filter avoids any regex and keeps the file clean ASCII.
|
resolve conflicts |
|
just wanted to say working on this codebase has been a genuinely great experience. The project architecture is clean and well thought out, and it made it straightforward to figure out where the Soroban contracts layer should live and how it should connect to the rest of the backend. |
|
Really impressive work on this, @pitah23! 🎉
|
closes #216
Summary
This PR introduces the Soroban/Stellar smart contracts layer to the Scout-Off backend. The workspace is structured as a Rust Cargo workspace under
contracts/with four contracts and a shared utility crate. All public interfaces and auth guards are in place; business logic is left as explicitly-tracked TODOs so each contract can be implemented, tested, and audited in its own follow-up issue.Contracts
registerinitialize,register_player,update_profileprogressinitialize,submit_milestone,approve_milestonesubscriptioninitialize,subscribe,pay_to_contact,is_subscribedconnectioninitialize,log_trial_offer,get_connectionShared crate (
scout-off-shared)errors.rs— unifiedErrorenum (AlreadyInitialized,NotInitialized,Unauthorized,NotFound,InvalidInput,ContractPaused) via#[contracterror], compatible with Soroban's XDR error encodingstorage.rs— instance-storage helpers (is_initialized,set_initialized,is_paused,set_paused,bump_instance) with 30-day TTL / 25-day threshold constantsevents.rs— shared event emitters (emit_initialized,emit_paused)Design decisions
#![no_std]on all contracts — required for WASM targets;soroban-sdkbrings its own allocatorrequire_auth()before every state-mutating call — enforces on-chain authorization for all signersNotInitializedif called beforeinitialize, preventing accidental use of an undeployed contractCI
Added a
contractsjob to.github/workflows/ci.ymlthat:wasm32-unknown-unknowntargetCargo.lockcargo build --release)Test plan
Soroban Contractsjob passes (WASM build succeeds)build,lint,test) are unaffectedscout-off-sharederror codes align with the indexer's event parsing expectations