controller/hosts lending logic with integration suites undercontroller/tests/.liquidity_layer/manages pool accounting;price_aggregator/aggregates feeds; mocks live inflash_mock/andswap_mock/.- Shared crates reside in
common/*; update them before duplicating structs, math, or errors. - Tooling sits in
configs/withdeploy-*.jsonandscript.sh; artifacts emit to*/output/andoutput-docker/. - Proxies in
proxy/andcommon/proxiesare auto-generated; ignore manual edits and regenerate via the build pipeline.
make build– reproducible WASM builds inside Docker.cargo test– full workspace run; narrow with filters likecargo test liquidations.cargo fmt --all && cargo clippy --workspace -- -D warnings– mandatory hygiene before commits.make devnet <action>/make mainnet <action>– scripted flows viaconfigs/script.sh; agents never deploy—hand configs to protocol ops.
- Run
cargo fmt --all;rustfmt.tomlenforces 4-space indents, 100-character lines, and trailing commas. - Follow idiomatic casing (
snake_casemodules,CamelCasetypes,SCREAMING_SNAKE_CASEconstants) and keepsrc/lib.rsentrypoints thin. - Reuse enums from
common/errors, guard state withrequire!, and add///docs for non-obvious parameters.
- Co-locate tests with their code (e.g.,
controller/tests/borrow.rs,common/math/tests/) and reuse fixtures fromcontroller/tests/setup/. - Run
cargo testplus the suites you touched; hold coverage near ~90% and refreshcoverage.mdwhen risk flows move. - For script or CLI tweaks, dry-run against mocks (
make devnet <command>) and note key diffs in the PR.
- Consult
ORACLE.mdbefore feed or tolerance changes and keepnetworks.jsonaligned with deployments. - Recheck invariants—health factor ≥ 1, liquidity conservation, borrow caps, pause flags, access control—and add regression tests when adjusting guards.
- Validate finance math: RAY/WAD/BPS scaling, interest slopes, Taylor approximations, and rounding edges; share numeric examples for new formulas.
- Prefer templated JSON in
configs/for new markets and document rollback steps in PRs.
- Use short, present-tense commits; prefixes such as
feat:orfix:match existing history. - Before pushing, confirm
cargo fmt,cargo clippy -- -D warnings,cargo test, andmake buildsucceed; attach logs or screenshots for behavior changes. - PRs must summarize impact, list affected markets/configs, link issues, and flag migrations, security notes, and manual test results. Follow
SECURITY.mdand keep secrets out of version control.