Security Checklist
Run through this checklist before deploying any ink! contract to a live network. Items marked with code are mechanical checks; the rest require reading the contract.
Pre-Audit Preparation
-
cargo contract buildcompletes without warnings -
cargo test --allpasses -
cargo fmt --checkpasses -
cargo clippy --all-targets -- -D warningspasses - No secrets, keys, or credentials in the repository history
Access Control
- Owner is set explicitly in the constructor
- Every admin function validates the caller (
ensure_owner/ensure_role) - Ownership transfer validates the new owner and rejects the zero address
-
OwnershipTransferredevents are emitted - Roles are defined as constants; each role has a defined admin
- Role holders can renounce their own roles only
Arithmetic Safety
- No plain
+,-,*on user-influenced values — usesaturating_*orchecked_* - Divisions handle a zero divisor (
checked_div(...).ok_or(...)) - No unchecked casts that can truncate balances
Token Standards (PSP22 / PSP34 / PSP37)
- All required functions of the standard are implemented
- Transfers to the zero address are rejected
-
approve/transfer_from/allowanceflows behave correctly -
TransferandApprovalevents fire on all state changes - Total supply accounting is atomic with mint/burn
State and Calls
- Cross-contract calls cannot re-enter unguarded state
- Critical functions respect pause state where applicable
- Storage growth is bounded — large payloads go to Pakit with content IDs referenced on-chain
Events and Observability
- Every state transition emits an event
- Events carry enough context to reconstruct state transitions off-chain
Deployment
- ABI and metadata regenerated from the audited commit
- Constructor arguments double-checked (owner, initial supply)
- Contract deployed to testnet and exercised end-to-end before mainnet
- Deployed code hash recorded for verification