Skip to content

Commit

Permalink
Config
Browse files Browse the repository at this point in the history
  • Loading branch information
icyfry committed Apr 3, 2024
1 parent 9ea93c9 commit 9115d91
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 0x....
PUBLIC_KEY_LOCAL=
# Anvil
RPC_URL=http://127.0.0.1:8545
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Sandbox Cryptozombies and Foundry
# Sandbox Foundry

<img src="https://img.shields.io/badge/solidity-0.8.13-005850?style=flat"> <img src="https://img.shields.io/badge/Vue.js-35495E?logo=vuedotjs&logoColor=4FC08D" /> <img src="https://img.shields.io/badge/-Ethereum-005850?style=flat&logo=Ethereum">
[![Build](https://github.com/icyfry/sandbox-cryptozombies-foundry/actions/workflows/build.yml/badge.svg)](https://github.com/icyfry/sandbox-cryptozombies-foundry/actions/workflows/build.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=icyfry_sandbox-cryptozombies-foundry&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=icyfry_sandbox-cryptozombies-foundry)

This repository contains source codes for experimentation of [Cryptozombies](https://cryptozombies.io/en/) with [Foundry](https://github.com/foundry-rs) and [Vue.js](https://vuejs.org/)
This repository contains source codes for experimentation with [Foundry](https://github.com/foundry-rs) and [Vue.js](https://vuejs.org/)

<img src="dapp/public/cryptozombies.png" />
Courses used in the repository
* [Cryptozombies](https://cryptozombies.io/en/)
* [Cyfrin Foundry](https://updraft.cyfrin.io/courses/foundry)

`contracts` folder contain Cryptozombies smart contracts and `dapp` folder contain a Vue.js frontend

Expand All @@ -26,6 +28,14 @@ forge install OpenZeppelin/openzeppelin-contracts
forge remappings > remappings.txt
```

### Add private key to foundry keystore

```bash
cast wallet import defaultKey --interactive
```

then add the password in `contracts/.password` file and `PUBLIC_KEY_LOCAL` public key in `.env`

### VSCode Configuration

* https://book.getfoundry.sh/config/vscode
Expand All @@ -43,15 +53,24 @@ anvil
```
Build and deploy contracts on local testnet
```
task contracts-test contracts-deploy
task contracts-build contracts-deploy-script
or
task contracts-build contracts-deploy
```
Launch frontend
```
task frontend-build frontend-run
```

## Cast

Test call with cast for Cryptozombies
```
cast call 0x... "getZombiesByOwner(address _owner)" "0x..."
```

## Resources

* https://www.cyfrin.io/blog/top-web3-tools-for-developers
* https://github.com/foundry-rs/foundry
* https://docs.soliditylang.org/en/v0.8.23/
* https://docs.soliditylang.org/en/v0.8.23/
19 changes: 11 additions & 8 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,22 @@ tasks:
contracts-deploy-script:
dir: contracts/script
cmds:
- forge script --rpc-url http://127.0.0.1:8545
--private-key {{.PRIVATE_KEY_LOCAL}}
- forge script --rpc-url {{.RPC_URL}}
--account defaultKey
--sender {{.PUBLIC_KEY_LOCAL}}
--broadcast
DeployZombieOwnership
--password-file "../.password"
DeployZombieOwnership

contracts-deploy:
dir: contracts
cmds:
- forge create --rpc-url http://127.0.0.1:8545
--private-key {{.PRIVATE_KEY_LOCAL}}
ZombieOwnership
# -- interactive
# src/zombieownership.sol:ZombieOwnership
- forge create --rpc-url {{.RPC_URL}}
--account defaultKey
--password-file ".password"
src/zombieownership.sol:ZombieOwnership
# --interactive
# --private-key {{.PRIVATE_KEY_LOCAL}}
frontend-build:
dir: dapp
cmds:
Expand Down

0 comments on commit 9115d91

Please sign in to comment.