├── .gitignore ├── .gitmodules ├── src └── Contract.sol ├── foundry.toml ├── test └── Contract.t.sol ├── script └── Contract.s.sol ├── package.json ├── .github └── workflows │ └── test.yml └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | cache/ 2 | out/ 3 | /node_modules 4 | yarn.lock -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/forge-std"] 2 | path = lib/forge-std 3 | url = https://github.com/foundry-rs/forge-std 4 | -------------------------------------------------------------------------------- /src/Contract.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity ^0.8.13; 3 | 4 | contract Contract { 5 | constructor() {} 6 | } 7 | -------------------------------------------------------------------------------- /foundry.toml: -------------------------------------------------------------------------------- 1 | [default] 2 | src = 'src' 3 | out = 'out' 4 | libs = ['lib'] 5 | remappings = [ 6 | '@thirdweb-dev/=node_modules/@thirdweb-dev/', 7 | ] 8 | 9 | 10 | # See more config options https://github.com/foundry-rs/foundry/tree/master/config -------------------------------------------------------------------------------- /test/Contract.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity ^0.8.13; 3 | 4 | import "forge-std/Test.sol"; 5 | 6 | contract ContractTest is Test { 7 | function setUp() public {} 8 | 9 | function testExample() public { 10 | assertTrue(true); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /script/Contract.s.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity ^0.8.13; 3 | 4 | import "forge-std/Script.sol"; 5 | 6 | import {Contract} from "src/Contract.sol"; 7 | 8 | contract ContractScript is Script { 9 | function setUp() public {} 10 | 11 | function run() public { 12 | vm.broadcast(); 13 | new Contract(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "forge-starter", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "repository": "https://github.com/thirdweb-example/forge-starter.git", 6 | "author": "thirdweb ", 7 | "license": "MIT", 8 | "dependencies": { 9 | "@thirdweb-dev/contracts": "^3" 10 | }, 11 | "scripts": { 12 | "build": "npx thirdweb@latest detect", 13 | "deploy": "npx thirdweb@latest deploy", 14 | "release": "npx thirdweb@latest release" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | on: workflow_dispatch 4 | 5 | env: 6 | FOUNDRY_PROFILE: ci 7 | 8 | jobs: 9 | check: 10 | strategy: 11 | fail-fast: true 12 | 13 | name: Foundry project 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v3 17 | with: 18 | submodules: recursive 19 | 20 | - name: Install Foundry 21 | uses: foundry-rs/foundry-toolchain@v1 22 | with: 23 | version: nightly 24 | 25 | - name: Run Forge build 26 | run: | 27 | forge --version 28 | forge build --sizes 29 | id: build 30 | 31 | - name: Run Forge tests 32 | run: | 33 | forge test -vvv 34 | id: test 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Getting Started 2 | 3 | Create a project using this example: 4 | 5 | ```bash 6 | npx thirdweb create --contract --template forge-starter 7 | ``` 8 | 9 | You can start editing the page by modifying `contracts/Contract.sol`. 10 | 11 | To add functionality to your contracts, you can use the `@thirdweb-dev/contracts` package which provides base contracts and extensions to inherit. The package is already installed with this project. Head to our [Contracts Extensions Docs](https://portal.thirdweb.com/thirdweb-deploy/contract-extensions) to learn more. 12 | 13 | ## Building the project 14 | 15 | After any changes to the contract, run: 16 | 17 | ```bash 18 | npm run build 19 | # or 20 | yarn build 21 | ``` 22 | 23 | to compile your contracts. This will also detect the [Contracts Extensions Docs](https://portal.thirdweb.com/thirdweb-deploy/contract-extensions) detected on your contract. 24 | 25 | ## Deploying Contracts 26 | 27 | When you're ready to deploy your contracts, just run one of the following command to deploy you're contracts: 28 | 29 | ```bash 30 | npm run deploy 31 | # or 32 | yarn deploy 33 | ``` 34 | 35 | ## Releasing Contracts 36 | 37 | If you want to release a version of your contracts publicly, you can use one of the followings command: 38 | 39 | ```bash 40 | npm run release 41 | # or 42 | yarn release 43 | ``` 44 | 45 | ## Join our Discord! 46 | 47 | For any questions, suggestions, join our discord at [https://discord.gg/thirdweb](https://discord.gg/thirdweb). 48 | --------------------------------------------------------------------------------