Contracts for Compact
OpenZeppelin Contracts for Compact is a library of modules for secure smart contract development on Midnight.
Getting Started
Overview (0.4.x)
Install the library, write a contract from its modules, and compile it.
Extensibility
Compose contracts from modules with the Module/Contract pattern.
ZK Circuits 101
Learn how Compact code compiles to circuits and what drives their cost.
Modules
Ownable
Restrict circuits to a single owner, with a shielded-owner variant.
AccessControl
Grant and enforce permissions with role-based access control.
ShieldedAccessControl
Role-based access control that hides who holds each role.
Security
Initializable, Pausable, Allowlist, and Blocklist modules.
FungibleToken
Fungible tokens, an approximation of EIP-20.
NonFungibleToken
Non-fungible tokens, an approximation of EIP-721.
MultiToken
Multiple token types in one contract, an approximation of EIP-1155.
NativeShieldedToken
Mint and burn Midnight shielded coins of the contract's own color.
ConfidentialFungibleToken
Fungible tokens with ElGamal-encrypted balances on the public ledger.
Crypto
ElGamal and EcdhMask encryption over Jubjub, the ECDSA low-s rule, and the EIP-712 envelope.
Multisig
Signer registry, proposals, treasuries, and threshold-ECDSA presets for contract-held funds.
Utils
Account identifiers, helper circuits, and EVM ABI word encoding.
API Reference
AccessControl API
Circuits, ledger state, and errors of the AccessControl module.
ConfidentialFungibleToken API
Circuits, ledger state, and errors of the ConfidentialFungibleToken module.
Crypto API
Circuits and types of the ElGamal, EcdhMask, Ecdsa, and Eip712 modules.
FungibleToken API
Circuits, ledger state, and errors of the FungibleToken module.
MultiToken API
Circuits, ledger state, and errors of the MultiToken module.
Multisig API
Circuits, ledger state, and errors of the multisig modules.
NativeShieldedToken API
Circuits, ledger state, and errors of the NativeShieldedToken module.
NonFungibleToken API
Circuits, ledger state, and errors of the NonFungibleToken module.
Ownable API
Circuits, ledger state, and errors of the Ownable module.
Security API
Circuits and errors of the Initializable, Pausable, Allowlist, and Blocklist modules.
ShieldedAccessControl API
Circuits, ledger state, and errors of the ShieldedAccessControl module.
Utils API
Circuits of the Utils and EvmAbi modules.