Quickstart
Get the BLOK Capital contracts building and testing locally, and know where to go next.
Before you start#
BLOK Capital V1 hasn't been deployed to mainnet yet (see Smart Contract Addresses for the current status), so building today means working against a local checkout, not a live network. Everything below gets you from a fresh clone to a passing test suite.
What you need#
- Foundry (
forge,cast,anvil) - Git
Clone and install#
The contracts live at github.com/BLOKCapital/blokc-v1-core. Dependencies are pulled in as git submodules, not through Foundry's own dependency manager, so clone with --recursive:
git clone --recursive https://github.com/BLOKCapital/blokc-v1-core
cd blokc-v1-coreIf you already cloned without --recursive, pull the submodules in after the fact instead of re-cloning:
git submodule update --init --recursiveBuild and test#
forge build
forge testFacets live under src/garden/facets/: the base facets (ownership, cut, upgrade, loupe) in baseFacets/, and every DeFi integration in utilityFacets/<chain>/, one folder per chain (arbitrumOne, avalanche, ethereum). Tests live under the mirrored path in test/. If you're only working on one facet, run just its tests:
forge test --match-contract OwnershipFacetTestSee the Guide: Creating a New Diamond Facet for the facet folder and file layout convention before you add anything new. Note the guide's test-folder convention is out of date, current tests are organized into unit/, fuzz/, and invariant/ subfolders per facet, not the flat layout the guide describes.
Before touching anything with its own storage library, note that forge test already runs three storage safety guards on every test suite: they catch slot collisions and stop you from accidentally renaming a storage library that's already deployed. If one of those fails, don't override it, see Security Considerations for why it exists.
Testing against a fork#
Some of the protocol's guardrails, like the Index rebalancer's oracle checks, are defined against real deployed addresses on whichever chain a Garden lives on. To exercise that code path faithfully, run your tests against a fork of the relevant chain instead of a clean local one:
forge test --fork-url <rpc-url-for-that-chain>Where to go next#
- Protocol Architecture V1 for how the pieces fit together.
- Smart Contracts for the full reference: entry point, facet registry, storage layout, and a suggested reading order through the repo.
- Security Considerations before you write or review anything that touches funds.
Last updated:
Edit this page (opens in a new tab)