Skip to content

PinkDiamond1/dapp-slaps

 
 

Repository files navigation

What's included

A monorepo with:

  • Svelte frontend
    • Auto-generated and fully-typed ABI's from wagmi-generate and Foundry plugin
    • Web3modal connect button using wagmi core
  • Foundry backend
    • Configurations for easy multi-chain deployments
  • Automated Fleek (IPFS) deployments

Quickstart

  1. Click "Use this template" > "Create a new repository" > "Create repository from template"
  2. Clone repo (eg. git clone https://github.com/repo_name) and cd <repo_name>
  3. Execute the setup script sh setup.sh (installs foundry deps, node deps, copies env files)
  4. Obtain a mnemonic for test accounts. a. Set mnemonic phrase in packages/app.env
  5. Obtain a project id for web3modal. a. Set web3modal project id in packages/app/.env
  6. Load environment files: source .env && source packages/app/.env

Your environment is ready to go! Use these commands to get started deploying a contract and start buidling.

  1. Start local chain: anvil -m $MNEMONIC
  2. Start ABI generation in separate window: pnpm wagmi generate --watch ../contracts/broadcast/
  3. Deploy the Foo contract: forge script Deploy --broadcast --rpc-url $ANVIL
  4. Start app: pnpm -F app dev

Deploy to Fleek

This will automatically deploy previews on branches as well.

  1. Sign up for fleek and connect GitHub repo
  2. Copy all packages/app/.env into Fleek project
  3. Enable preview deploys

Common commands

Start local anvil chain

anvil -m "$MNEMONIC"

Get current block number with cast

cast block-number

Deploy contracts to some chain

Note: some L2s require a --legacy flag if EIP-1559 is not yet supported.

forge script Deploy --broadcast --rpc-url "$SEPOLIA"

Automatically generate ABIs from contract deployments

pnpm wagmi generate --watch ../contracts/broadcast/

Install a foundry package

Example insalling openzeppelin:

forge install OpenZeppelin/openzeppelin-contracts

Regenerate remappings importing in the contracts (from the project root):

forge remappings > remappings.txt

Troubleshooting

  • Reset account on Metamask
  • Clear all browser storage
  • Disconnect account and re-connect

About

this dapp slaps

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Svelte 39.6%
  • TypeScript 33.1%
  • Solidity 13.5%
  • Shell 6.8%
  • HTML 4.0%
  • JavaScript 3.0%