README.md
1 # ⚔️ Gramr CLI 2 3 > Command-line interface for the Gramr smart contract scaffolding toolkit 4 5 The Gramr CLI provides a powerful command-line interface for rapidly generating smart contracts, libraries, tests, and deployment scripts. Supports both Solidity (Foundry) and Rust/Stylus (Arbitrum) projects with full OpenZeppelin integration. 6 7 ## 🧙♂️ Prefer Interactive? Try Wotan! 8 9 For a guided experience, use the interactive wizard: 10 11 ```bash 12 gramr wizard # Launch interactive wizard 13 # or 14 wotan # Direct wizard command 15 ``` 16 17 ## Installation 18 19 ### From Source (Recommended) 20 21 ```bash 22 # Install from the workspace root 23 cargo install --path cli 24 25 # Or install from GitHub 26 cargo install --git https://github.com/pxlvre/gramr gramr-cli 27 ``` 28 29 ### Using gramrup 30 31 ```bash 32 gramrup install 33 ``` 34 35 ## Usage 36 37 ### Basic Commands 38 39 ```bash 40 # Create a basic contract 41 gramr new contract MyContract --solidity 42 43 # Create an ERC20 token 44 gramr new contract MyToken --solidity --oz-erc20 45 46 # Create an ERC721 with extensions 47 gramr new contract MyNFT --solidity --oz-erc721 --extensions enumerable,burnable 48 49 # Create with test and script 50 gramr new contract MyToken --solidity --oz-erc20 --with-test --with-script 51 52 # Create with organized section markers 53 gramr new contract MyToken --solidity --oz-erc20 --with-section-markers 54 55 # Generate different resource types 56 gramr new library MathUtils --solidity 57 gramr new interface IMyToken --solidity 58 gramr new abstract BaseToken --solidity 59 gramr new test MyTest --solidity 60 gramr new script DeployScript --solidity 61 62 # Generate config files (placeholder) 63 gramr new config slither --solidity 64 ``` 65 66 ### Command Structure 67 68 ```bash 69 gramr new <TYPE> <NAME> [OPTIONS] 70 ``` 71 72 **Arguments:** 73 74 - `TYPE`: Resource type (`contract`, `library`, `interface`, `abstract`, `script`, `test`, `config`) 75 - `NAME`: Name of the resource to generate 76 77 **Global Options:** 78 79 - `--solidity` - Generate Solidity code (required) 80 - `--pragma <VERSION>` - Solidity version (default: 0.8.30) 81 - `--license <LICENSE>` - SPDX license (default: UNLICENSED) 82 83 **Contract Options:** 84 85 - `--oz-erc20` - Inherit from OpenZeppelin ERC20 86 - `--oz-erc721` - Inherit from OpenZeppelin ERC721 87 - `--oz-erc1155` - Inherit from OpenZeppelin ERC1155 88 - `--upgradeable` - Use upgradeable variants 89 - `--extensions <LIST>` - Comma-separated extensions 90 - `--with-test` - Generate test file 91 - `--with-script` - Generate deployment script 92 - `--with-section-markers` - Include organized comment blocks for code sections 93 94 ### Available Extensions 95 96 **ERC20:** `permit`, `burnable`, `capped`, `pausable`, `votes`, `wrapper`, `flashmint`, `temporaryapproval`, `bridgeable`, `erc1363`, `erc4626` 97 98 **ERC721:** `pausable`, `burnable`, `consecutive`, `uristorage`, `votes`, `royalty`, `wrapper`, `enumerable` 99 100 **ERC1155:** `pausable`, `burnable`, `supply`, `uristorage` 101 102 **Cross-compatible:** `burnable` and `pausable` work with any token type 103 104 ## Examples 105 106 ```bash 107 # Complex ERC20 with multiple extensions and section markers 108 gramr new contract GovernanceToken --solidity \ 109 --oz-erc20 \ 110 --extensions permit,votes,pausable \ 111 --with-test --with-script --with-section-markers 112 113 # NFT collection with enumeration and royalties 114 gramr new contract ArtCollection --solidity \ 115 --oz-erc721 \ 116 --extensions enumerable,royalty,uristorage \ 117 --license MIT 118 119 # Multi-token with supply tracking 120 gramr new contract GameAssets --solidity \ 121 --oz-erc1155 \ 122 --extensions supply,pausable \ 123 --pragma 0.8.25 124 125 # Generate supporting files 126 gramr new interface IArtCollection --solidity --license MIT 127 gramr new abstract BaseCollection --solidity --with-section-markers 128 gramr new library CollectionUtils --solidity 129 ``` 130 131 ## Requirements 132 133 - Must be run within a Foundry project directory 134 - Foundry must be installed for OpenZeppelin dependency management 135 136 ## See Also 137 138 - [gramr library](../lib/) - Core functionality 139 - [gramrup installer](../gramrup/) - System installer 140 - [Main README](../README.md) - Full project documentation