You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(contracts): per-type ContractScope (on-chain/off-chain) as a first-class property
Replaces the scattered `Type == "Boarding"` checks that implicitly decided
whether a contract's funds live on-chain (boarding UTXOs) or off-chain (VTXOs).
- New `[Flags] ContractScope { Onchain = 1, Offchain = 2 }` (Both = Onchain|Offchain).
- `ArkContract.DefaultScope` (abstract — every type must declare its scope, so a
new type can't silently inherit a wrong default): Boarding => Onchain; Payment,
HashLockPayment, Delegate, VHTLC, Note, Unknown, Generic => Offchain.
- Resolved scope persisted on `ArkContractEntity.Scope` / `ArkWalletContractEntity`
(indexed). `ToEntity(scopeOverride:)` is the per-instance escape hatch
(Scope = scopeOverride ?? DefaultScope); nothing sets it yet.
- `IContractStorage.GetContracts(scope:)` filters via the SQL-translatable bitwise
predicate `(Scope & s) == s` (NOT HasFlag, which EF can't translate).
- Consumers migrated off the boarding-type check: BoardingUtxoPollService,
BoardingUtxoSyncService, OnchainSweepService -> scope: Onchain;
WalletRecoveryService -> offchain bitwise filter.
Tests (TDD): per-type DefaultScope, ToEntity override resolution, flags semantics,
and a SQLite-backed GetContracts(scope:) test (real SQLite, not InMemory — InMemory
client-evaluates and would hide a non-translatable query).
Schema note: NArk.Storage.EfCore is provider-agnostic with no migrations history —
the Scope column ships via entity configuration. Consumers that manage their own
schema with EF migrations should add a migration creating the column (default
Offchain) and backfilling existing boarding rows to Onchain.
0 commit comments