-
Notifications
You must be signed in to change notification settings - Fork 0
Templates
Brandon Brooks edited this page Jan 22, 2026
·
1 revision
ContractKit includes four production-ready templates, each with OpenZeppelin-based implementations.
A fungible token with role-based access control for minting.
/contractkit:new erc20 MyToken MTKFeatures:
- ERC20 standard implementation
- AccessControl for role management
- MINTER_ROLE for controlled minting
- Admin can grant/revoke minting rights
Contract: Token.sol
contract Token is ERC20, AccessControl {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
function mint(address to, uint256 amount) external onlyRole(MINTER_ROLE);
}An NFT collection with role-based minting and metadata support.
/contractkit:new erc721 MyNFT MNFTFeatures:
- ERC721 standard implementation
- AccessControl for role management
- Auto-incrementing token IDs
- Configurable base URI for metadata
- totalSupply tracking
Contract: NFT.sol
contract NFT is ERC721, AccessControl {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
function mint(address to) external onlyRole(MINTER_ROLE) returns (uint256);
function setBaseURI(string memory baseURI_) external onlyRole(DEFAULT_ADMIN_ROLE);
}A three-party escrow contract for secure payments.
/contractkit:new escrow MyEscrowFeatures:
- Three parties: payer, payee, arbiter
- State machine: Created → Funded → Released/Refunded/Disputed
- ReentrancyGuard protection
- Dispute resolution by arbiter
Contract: Escrow.sol
contract Escrow is ReentrancyGuard {
function fund() external payable onlyPayer;
function release() external onlyPayer;
function refund() external onlyPayee;
function dispute() external onlyParty;
function resolve(address winner) external onlyArbiter;
}Flow:
- Payer creates escrow with payee, arbiter, and amount
- Payer funds the escrow
- On completion: payer releases funds to payee
- On cancellation: payee refunds to payer
- On dispute: arbiter resolves to either party
A simple ETH vault with deposit/withdraw and pause functionality.
/contractkit:new vault MyVaultFeatures:
- Deposit and withdraw ETH
- Balance tracking per user
- Pausable by PAUSER_ROLE
- ReentrancyGuard protection
- AccessControl for admin operations
Contract: Vault.sol
contract Vault is ReentrancyGuard, AccessControl {
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
function deposit() external payable whenNotPaused;
function withdraw(uint256 amount) external nonReentrant whenNotPaused;
function withdrawAll() external nonReentrant whenNotPaused;
function pause() external onlyRole(PAUSER_ROLE);
function unpause() external onlyRole(PAUSER_ROLE);
}Each template includes:
myproject/
├── src/
│ └── Contract.sol # Main contract
├── test/
│ └── Contract.t.sol # Foundry tests
├── script/
│ ├── Deploy.s.sol # Deployment script
│ └── Interact.s.sol # Interaction script
├── foundry.toml # Foundry config
├── README.md # Project readme
├── SECURITY.md # Security considerations
└── THREAT_MODEL.md # Threat analysis
All templates are starting points, not audited production code. Before mainnet deployment:
- Get an independent security audit
- Review and customize for your needs
- Test thoroughly on testnet
- Consider bug bounty programs
ContractKit
Reference
Help