1 Star 0 Fork 0

ProjectOpenSea / shipyard

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

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
Copyright 2023 Ozone Networks, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Template Repo for OpenSea smart contract development 展开 收起
Solidity 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/ProjectOpenSea/shipyard.git
git@gitee.com:ProjectOpenSea/shipyard.git
ProjectOpenSea
shipyard
shipyard
main

搜索帮助