Skip to content

chore: add registry smart contract#19

Merged
matteojug-stacks merged 8 commits intomainfrom
feat/add-registry-contract
Apr 16, 2026
Merged

chore: add registry smart contract#19
matteojug-stacks merged 8 commits intomainfrom
feat/add-registry-contract

Conversation

@matteojug-stacks
Copy link
Copy Markdown
Contributor

Add the initial registry smart contract.

Most of the scaffolding is from clarinet, the interesting bits are the contract and the test file.

In the current design, we don't use events (to avoid requiring an event observer) but instead we active poll the contract for new addresses. It also doesn't perform any validation on the deposit and reclaim script, nor any dedup on the deposit inputs; the owner of an entry is the one that registered it, and they (or the deployer) can remove an entry. Happy to revisit any decision.

Also bump the action pin to latest.

Testing information

Add contract unit tests, the whole flow was also tested locally with spox registry aware + front end (coming soon™)

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an initial Clarity “registry” smart contract (plus local Clarinet/Vitest scaffolding) to register and query sBTC deposit/reclaim scripts, with CI updated to run the new contract unit tests.

Changes:

  • Introduce registry.clar with register/query/remove functionality backed by an incrementing ID and a map.
  • Add Vitest + Clarinet-SDK test harness and unit tests covering the basic flow and authorization.
  • Update CI workflow action pins and run the new contracts test suite on push/PR.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
contracts/contracts/registry.clar New registry contract implementing address registration, batch reads, and owner/admin removal.
contracts/tests/registry.test.ts New Vitest/Clarinet unit tests for register/get/remove flows and auth checks.
contracts/vitest.config.ts Vitest configuration for clarinet simnet environment + setup hooks.
contracts/tsconfig.json TypeScript config for the contracts test workspace.
contracts/package.json Node test workspace definition and scripts for running contract tests.
contracts/pnpm-lock.yaml Lockfile for the new contracts test workspace dependencies.
contracts/Clarinet.toml Clarinet project manifest defining the registry contract (Clarity v4, epoch 3.3).
contracts/deployments/default.simnet-plan.yaml Simnet deployment plan to publish the registry contract.
contracts/settings/Devnet.toml Devnet configuration and pre-funded accounts for local runs.
contracts/README.md Minimal setup/run instructions for contract tests.
contracts/.gitignore Ignores caches, logs, coverage/cost reports, and node_modules in contracts workspace.
contracts/.gitattributes Linguist attributes for contracts workspace files.
.github/workflows/on-push.yaml Bump pinned action SHAs; add Node/pnpm setup and run contracts tests in CI.
Files not reviewed (1)
  • contracts/pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/on-push.yaml
Comment thread .github/workflows/on-push.yaml Outdated
Comment thread contracts/package.json Outdated
Comment thread contracts/package.json
Comment thread contracts/contracts/registry.clar
Comment thread contracts/settings/Devnet.toml
Copy link
Copy Markdown

@djordon-stacks djordon-stacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still thinking about some of this, but it looks good overall.

Comment thread contracts/package.json Outdated
Comment thread contracts/Clarinet.toml Outdated
Comment thread contracts/contracts/registry.clar Outdated
Copy link
Copy Markdown

@djordon-stacks djordon-stacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I think we should make the get-single-address function read-only, because why not? I also have a few nits/suggestions about the naming.

Comment thread contracts/contracts/registry.clar Outdated
Comment thread contracts/contracts/registry.clar Outdated
Copy link
Copy Markdown

@djordon-stacks djordon-stacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@matteojug-stacks matteojug-stacks added this pull request to the merge queue Apr 16, 2026
Merged via the queue into main with commit acbbf21 Apr 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants