Build and authorize a bank contract
Use the governed evaluation release for a synthetic PKR claim or instrument. Use a new application contract only when the standard operations cannot express the product. New bytecode requires a separate security, accounting and governance review. The framework is a LIQUID sandbox profile. Institutional bylaws, signatory mandates, customer terms and any required regulatory authority must be agreed separately.
Developer materials
The controlled release 0.1.0-rc.1 contains ABIs and compiled creation/runtime templates for ParticipantRegistry, DepositClaimFactory, ProgrammableDepositClaim, BankInstrumentFactory, BankInstrumentBook and ConditionalPayment. Request it under the evaluation agreement. Its reproducible ZIP SHA-256 is f0b76fb0d53f26ba73ee842310fbd531b14a5b108c69aca2c73fed7d1e0ec533. This candidate is unsigned. Its compiler is Solidity 0.8.30, Shanghai EVM, optimizer enabled at 10,000 runs. The ZIP does not confer shared-network authority.
For a bank application, start with the Solidity position-reader template and deployment dossier template. The reader exposes a snapshot of one holder’s balance and issuer supply. Its constructor pins the expected chain, claim, institution and issuer. It is an integration example. Before deploying it, independently compare genesis, the factory mapping, runtime and registry against the approved network handover. Any contract can claim a name, symbol or issuer address.
- In your local Foundry evaluation project, save the example under src/DepositPositionReader.sol. Run the following command from the project directory.
- Obtain the approved claim address and issuer from the factory receipt. Use a compiler-compatible wallet or local test harness to deploy the reader with the four constructor arguments in source order. Start on an isolated test chain.
- Call position(holder) at a recorded finalized block and compare the two integers with balanceOf(holder) and totalSupply() on the same claim and block. Repeat with a second holder. A wrong chain, issuer or institution must reject deployment. The reader has no write or signing method.
forge build --use 0.8.30 --evm-version shanghai --optimize --optimizer-runs 10000
To run the supplied example tests, put the test fixture and DepositPositionReader.sol together under the test directory of an empty Foundry project. Run forge test --use 0.8.30 --evm-version shanghai --match-contract DepositPositionReaderTest. Expect five tests to pass. The fixture supplies two holder balances and exercises rejection of a wrong chain, issuer, institution and missing claim. It does not issue a deposit.
Local and shared deployment ceremony
| Decision | Local evaluation ledger | Shared interoperability ledger |
|---|---|---|
| Admission | Bank controls its test environment and assigns separate test governance and issuer keys. | Network governance registers an admitted bank and its institution code. Bank and operator verify the target genesis, chain ID and finalized hashes. |
| Authority | Bank approves test product, limited amounts and backing accounts. | Bank approves liability, signer and backing mandate. Network governance authorizes the precise contract release and scope. |
| Data and balances | Synthetic holds are unique to this environment. | Fresh traceable backing or an explicitly reconciled migration. Copying the local balances could issue twice against the same deposit. |
| Audit | Record local factory, signer roles, receipt, runtime, zero initial supply and test evidence. | Both readers verify the named deployment. Retain independent approval, dossier digest, membership epoch, factory receipt, key reference and reconciled close. |
- Prepare. Fill out the dossier. Pin chain ID, genesis, registry, factory, bank code, issuer, metadata, release and hashes. Keep mandates and customer evidence off-chain. Agree the exact dossier bytes with both approvers, freeze the bytes, compute the agreed digest and record the digest algorithm. A subsequent change needs a new approval.
- Authorize. Read depositFactory.releaseDigest(issuer, name, symbol, dossier). The digest binds the chain, factory, registry, institution and membership epoch as well as the issuer and inputs. The distinct governance signer calls setApproval(issuer, digest). Revoking an unused approval sets it to zero.
- Deploy. The registered bank issuer calls deploy(name, symbol, dossier) on the pinned deposit factory. It consumes the approval and emits ClaimDeployed. Verify the receipt status, emitter, claimOf(institutionCode), claim.issuer(), claim.registry(), issuingInstitution(), decimals and zero initial supply. Check actual runtime with constructor-patched immutables against the release template and verify those immutable values. Record actual deployed code hash and finalized block hash.
- Admit instruments. Governance approves the factory-created claim on the instrument factory. The issuer calls deploy(claim). Verify bookOf(claim), book.bank(), book.claim() and book.admission(). Allowlist the book and approved holders with finite limits. A zero holder cap is uncapped.
- Operate. An authorized issuer issues a positive amount against a fresh CBS hold digest. The named holder calls the reference-bearing transfer. Redemption burns supply under issuer authorization. Inspect the matching event, bank posting and backing. This claim uses a custom transfer with a reference. Applications assuming ERC-20 allowances or unrestricted transfer require adaptation.
- Change or exit. Revoke unused approvals, reconcile outstanding and funded obligations, agree the redemptions and offboarding sequence and retire credentials. Check pause semantics before acting. A network or local pause also blocks ordinary redemption. A new factory or chart release needs its own migration plan for outstanding claims.
Instruments and accounting
| Instrument | Funding and authority | Success test |
|---|---|---|
| Escrow | Issuer offers terms naming payer, beneficiary, independent certifier, deadline, amount and agreement. Payer calls fundInstrument for the exact amount. Certifier attests before deadline. Beneficiary collects. | Book balance covers lockedTotal. Payout credits the named beneficiary. An expired uncertified tranche can be refunded to its payer. |
| Milestone | One escrow entry per tranche sharing an opaque agreement ID. Each entry has its own evidence and funding reference. | Fund PKR 400 and PKR 600. Certify and collect the first. Let the second expire uncertified and refund it. Total supply stays constant. |
| Fixed-maturity bank note | Issuing bank treasury prefunds the face amount in its own claims. The named beneficiary collects at or after maturity. | Early collection fails. Collection pays once. This synthetic obligation has no interest, bearer rights or transfer market. |
| Demand note | Treasury prefunds a named beneficiary; no fixed maturity or certifier. | Beneficiary can collect the funded face amount immediately. Repeated collection fails. |
| CBS-held conditional payment | ConditionalPayment tracks conditions attached to a bank-held amount. CBS hold and release evidence belong to that workflow. | Reconcile actual bank release/refund and recorded condition. A token-funded book uses an on-chain reserve instead. |
For the funded book, the issuer calls offer(id,terms), the named payer calls claim.fundInstrument(book,id,amount,ref) and the beneficiary inspects book.entry(id). For escrow the certifier calls certify(id,evidenceDigest); the beneficiary calls collect(id,payoutRef). A refund after an uncertified expiry uses refund(id,refundRef) by the original payer. A direct transfer to the book creates unallocated funds. It does not reserve the instrument. Keep names, account numbers, unredacted documents and guessable identifiers off the shared ledger.
Rules for a bank pilot
Proposed network rules should name the issuer liable for each claim, eligible holders, settlement participant or agent, permitted instruments, privacy, key custody, authorizers, limits, outage and dispute process, and orderly exit. Identify who can pause, who can restore operations and who can close an evidence exception. The smart contracts enforce specific caller, membership, reference and amount checks. Human independence, legal capacity, backing outside the ledger, legal finality and operating mandates require institutional evidence. A second address controlled by one individual does not demonstrate independent review.
Separate the contract qualification, integrated synthetic cash test, and production release. A synthetic run can demonstrate the code's behavior. Institutional acceptance also needs the exact bank deployment, authorities, posting interface and settlement evidence. Treasury acceptance walkthrough
Read a real claim with an approved RPC reader
Use Foundry's cast on an authorized workstation once the bank has supplied a private reader, a claim address and a finalized block number. Obtain the genesis and factory address through the approved handover. Set RPC_URL, CLAIM and BLOCK locally. Request credentials through the bank’s secret manager if the reader requires them. Do not publish an authenticated URL in a terminal recording.
cast chain-id --rpc-url "$RPC_URL"
cast block 0 --field hash --rpc-url "$RPC_URL"
cast code "$CLAIM" --block "$BLOCK" --rpc-url "$RPC_URL"
cast call "$CLAIM" 'issuer()(address)' --block "$BLOCK" --rpc-url "$RPC_URL"
cast call "$CLAIM" 'issuingInstitution()(bytes32)' --block "$BLOCK" --rpc-url "$RPC_URL"
cast call "$CLAIM" 'totalSupply()(uint256)' --block "$BLOCK" --rpc-url "$RPC_URL"
Record the actual block hash as well as height. A missing contract returns empty code. A wrong chain or issuer invalidates the test. Save only the receipt hash, block hash, approved public addresses and opaque references in the external report. Keep the account-to-wallet mapping with the bank. Read-only queries leave balances unchanged.
Propose a new contract family
Write the product terms in one page first. Specify who owes whom, the asset and units, whose balance is encumbered, who signs, what releases it and how a claimant exits after an outage. Draw the allowed states and failure transitions. Define an invariant such as “the book's available issuer claims cover every payable reserved balance”. Assign one owner to each off-chain fact, including evidence of performance and the authoritative cash decision.
Build against the published ABI in an isolated development project. Test unauthorized callers, wrong chains, duplicate references, caps, pauses, revoked membership, partial funding and recovery after an ambiguous receipt. Require a reproducible compile, an independent code review, bytecode and ABI digests and a complete local accounting run. Submit the dossier for product, custody and network review. The existing factories instantiate their specific compiled templates. An entirely new family needs a separately reviewed factory or registry extension and an approved migration policy. No arbitrary contract upload facility was qualified in the bank console.