Giter VIP home page Giter VIP logo

shipyard's Introduction

Shipyard

Shipyard is a Forge template for smart contract development. See the tutorial for detailed instructions on using Shipyard or jump down to the usage section below for more info on how it works.

Overview

Shipyard comes with some batteries included

  • OpenZeppelin, Solady, and Shipyard-core smart contracts as dependencies, ready with solc remappings so you can jump into writing your own contracts right away
  • forge fmt configured as the default formatter for VSCode projects
  • Github Actions workflows that run forge fmt --check and forge test on every push and PR
    • A separate action to automatically fix formatting issues on PRs by commenting !fix on the PR
  • A pre-configured, but still minimal foundry.toml
    • high optimizer settings by default for gas-efficient smart contracts
    • an explicit solc compiler version for reproducible builds
    • no extra injected solc metadata for simpler Etherscan verification and deterministic cross-chain deploys via CREATE2.
    • a separate build profile for CI with increased fuzz runs for quicker local iteration, while still ensuring your contracts are well-tested

Usage

Shipyard can be used as a starting point or a toolkit in a wide variety of circumstances. In general, if you're building something NFT related, you're likely to find something useful here. For the sake of exploring some of what Shipyard has to offer in concrete terms, here's a guide on how to deploy an NFT contract.

Quick Deploy Guide

To deploy an NFT contract to the Goerli testnet, fund an address with 0.1 Goerli ETH, open a terminal window, and run the following commands:

Create a directory and cd into it:

mkdir my-shipyard-based-project &&
cd my-shipyard-based-project

Install the foundryup up command and run it, which in turn installs forge, cast, anvil, and chisel:

curl -L https://foundry.paradigm.xyz | bash

Follow the onscreen instructions output by the previous command to make Foundryup available in your CLI (or else restart your CLI).

Install forge, cast, anvil, and chisel by running:

foundryup

Create a new Foundry project based on Shipyard, which also initializes a new git repository, in the working directory.

forge init --template projectopensea/shipyard

Install dependencies and compile the contracts:

forge build

Set up your environment variables (make sure to swap in the appropriate value for <your_pk>):

export GOERLI_RPC_URL='https://eth-goerli.g.alchemy.com/v2/demo' &&
export MY_ACTUAL_PK_BE_CAREFUL='<your_pk>'

Run the script that deploys the example contract and mints an NFT:

forge script script/DeployAndMint.s.sol --private-key \
    $MY_ACTUAL_PK_BE_CAREFUL --fork-url $GOERLI_RPC_URL --broadcast

Verify the contract on Etherscan:

forge verify-contract <the_target_contract> Dockmaster --watch \ 
    --constructor-args $(cast abi-encode "constructor(string,string,address)" \ 
    "Dockmaster NFT" "DM" "0x0000000000000000000000000000000000000000") --chain 5

Running this command merely deploys the unchanged example NFT contract to a testnet, but it's a good way to check for a properly functioning dev environment.

See the tutorial for more detail on modifying the example contract, writing tests, deploying, and more.

Reinitialize Submodules

When working across branches with different dependencies, submodules may need to be reinitialized. Run

./reinit-submodules

Coverage Reports

If you plan on generating coverage reports, you'll need to install lcov as well.

On macOS, you can do this with the following command:

brew install lcov

To generate reports, run

./coverage-report

shipyard's People

Contributors

jameswenzel avatar emo-eth avatar djviau avatar cterech avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.