Overview
All Ankara Chain contracts are written in Solidity^0.8.24 and use OpenZeppelin upgradeable contracts (v5). They follow the UUPS proxy pattern — each deployed token is a lightweight ERC1967Proxy that delegates to a shared implementation.
AnkaraChainBaseToken
Abstract base contract inherited by all six templates. Provides:ERC20Upgradeable— standard fungible tokenERC20PausableUpgradeable— halt transfersERC20BurnableUpgradeable— token burningAccessControlUpgradeable— role-based permissionsUUPSUpgradeable— upgrade authorization
Storage slots (base)
Roles
admin_ at initialization. The admin also holds DEFAULT_ADMIN_ROLE and can delegate roles to other addresses.
Transfer Hook
Every mint, burn, and transfer passes through_update(), which checks the identity verifier for sender and receiver (when set):
UUPS Proxy Pattern
Each token deploy creates a newERC1967Proxy pointing to a shared implementation contract. This means:
- Gas efficient — only one implementation bytecode on-chain, shared across all tokens of the same template
- Upgradeable — the admin can upgrade the implementation to fix bugs without migrating token holders
- Isolated state — each proxy has its own storage (balances, metadata, status)
Upgrade flow
TokenFactory
The factory stores implementation addresses and deploys proxies:deploymentFee in native tokens (covers deployment gas overhead and protocol revenue). The fee is configurable by the factory admin.
Deploy event:
IIdentityVerifier
Pluggable KYC interface:WhitelistVerifier (reference implementation)
A simple on-chain whitelist ships with the contracts for development and testing:Running the Contracts Locally
Security Notes
- All contracts use OpenZeppelin’s audited upgradeable library (v5)
- Storage gaps (
uint256[50] private __gap) are reserved in both the base and each template for future storage additions without slot collisions this.setStatus(...)is never called internally — templates use the internal_setStatus()to avoid RBAC bypass via external self-calls- Protocol fee is collected on deployment only — no ongoing fees on transfers