Skip to main content

Your contract and its deployment

Once your environment is ready and the local network is running, the next step depends on the modality you have chosen for your use case.

If you have not yet chosen a modality, read Deployment modalities first.


Modality 1: Diamond Proxy with ISBE library

The recommended path for most use cases. Your contract is deployed as a facet of the ISBE Governance Diamond, automatically inheriting the network's pause, RBAC, and compliance mechanisms.

Adapt the template to your use case

The template repository includes contracts/project-contracts/ as a starting point. You must adapt it following the 4-file pattern:

IProject.sol          → IMyUseCase.sol        (public interface: types, events, errors, signatures)
ProjectInternal.sol → MyUseCaseInternal.sol (Diamond storage + internal _ functions)
Project.sol → MyUseCase.sol (external layer: whenNotPaused + onlyRole guards)
ProjectFacet.sol → MyUseCaseFacet.sol (deployable facet: IEIP2535Introspection)

The specific requirements for each layer are in the Modality 1 documentation.

Adaptation steps:

  1. Rename the files and update all internal references.
  2. Define your constants in contracts/constants/constants.sol using the pattern isbe.customers.{client}.{useCase}.{thing}.
  3. Implement your logic — storage in Internal, external functions with guards in the main contract.
  4. Fill in selectorsIntrospection() in the Facet with all external functions. If any are missing, that function will not be routable through the proxy.
  5. Compile and verify: npx hardhat compile

Deploy with the included script

For Modality 1, deployment is not a standard Hardhat deploy — the contract is registered in the Diamond via 3 specific transactions. The template includes a script that handles this process automatically.

Update scripts/project/deployContracts.ts with your constants' hashes:

// Calculate the values with Node.js:
// node -e "const { ethers } = require('ethers'); console.log(ethers.id('isbe.customers.acme.invoicing.resolver.key'))"

const PROJECT_RESOLVER_KEY = '0x...' // keccak256 of your resolver key
const PROJECT_CONFIG_ID = '0x...' // keccak256 of your config ID

And update the facet name:

const projectArtifact = await artifacts.readArtifact('MyUseCaseFacet')

Then run:

npx hardhat run scripts/project/deployContracts.ts --network isbe

The script runs the 3 steps automatically:

  1. deploy — registers your facet bytecode in the Diamond with the resolver key
  2. setConfiguration — links the resolver key to the config ID
  3. deployUseCase — deploys the proxy that routes calls to the facet

When finished it prints the proxy address. That is the address your clients interact with.


Modality 2: Own homologated contract

For cases where the business logic does not fit the ISBE library. Before deployment, the ISBE team reviews the contract.

Meet the requirements

Your contract must expose:

  • hasRole(bytes32 role, address account) external view returns (bool) — access control compatible with IAccessControl
  • pause() and unpause()IPause implementation
  • PAUSER_ROLE assigned to the ISBE governance address

Full requirements and the homologation process are in Modality 2: Homologated contract.

Deploy in the standard way

Once the contract meets the requirements, deployment is done the usual Hardhat way — without the 3 Diamond steps. Use a standard deploy script:

import { ethers } from 'hardhat'

async function main() {
const factory = await ethers.getContractFactory('MyContract')
const contract = await factory.deploy(/* constructor args */)
await contract.waitForDeployment()
console.log('Deployed at:', await contract.getAddress())
}

main().catch(console.error)
npx hardhat run scripts/deploy.ts --network isbe

Deliver the deployed contract and the required documentation to the ISBE team to complete the homologation process.


Modality 3: Direct deployment

For PoCs, test environments, or use cases without institutional compliance requirements.

No architecture requirements

Develop your contract freely with any stack (Hardhat, Foundry, Remix). You do not need to follow the Diamond pattern or implement IPause or IAccessControl.

Deploy in the standard way

Deployment is the same as Modality 2 — a standard Hardhat script or any other usual mechanism.

Be aware of the control implications this entails: see Modality 3: Direct deployment.