Skip to content

Commit

Permalink
Updated README and AVALANCHE-L1 instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
luloxi committed Dec 9, 2024
1 parent 7e29467 commit dbf2fd8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 21 deletions.
10 changes: 9 additions & 1 deletion AVALANCHE-L1.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
This guide is for deploying your own Avalanche L1 and use USDC as native gas token.

The intention is also for the [Avalanche L1](https://github.com/ava-labs/avalanche-starter-kit) to bridge [ERC20](https://ethereum.org/en/developers/docs/standards/tokens/erc-20/) and [ERC721](https://ethereum.org/en/developers/docs/standards/tokens/erc-721/) using [Avalanche Interchain Token Transfer](https://github.com/ava-labs/avalanche-interchain-token-transfer) and [Chainlink CCIP Transfer Tokens](https://docs.chain.link/ccip/tutorials/cross-chain-tokens) with [EVM compatible chains](https://ethereum.org/en/developers/docs/scaling/sidechains/#evm-compatibility).

It'd be ideal to run it with one command like `yarn subnet` with a config file, but for now, we'll have to do it manually. You'll start a local Avalanche L1 using [Ava Labs avalanche-starter-kit](https://github.com/ava-labs/avalanche-starter-kit). The network runs on your local machine and can be used for testing and development.

# How to run a local Avalanche L1

General avalanche instructions: `avalanche -h`
Expand Down Expand Up @@ -27,7 +33,9 @@ It'll take some time to load, go take a walk or do something else while it loads
## 2. Load RPC URL into your scaffold-eth

Add the rpc url on `packages/foundry/.env` and on `packages/nextjs/.env` variable called `PUNKSOCIETY_RPC_URL` and `NEXT_PUBLIC_PUNKSOCIETY_RPC_URL` respectively
Add the rpc url on `packages/foundry/.env` and on `packages/nextjs/.env` variable called `PUNKSOCIETY_RPC_URL` and `NEXT_PUBLIC_PUNKSOCIETY_RPC_URL` respectively.

Go to `packages/nextjs/scaffold.config.ts` and change the `targetNetworks` to `[punksociety]`.

> NOTE: When using codespace on github, load the global URL, NOT the local (127.0.0.1) one
Expand Down
42 changes: 23 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ Social protocol where interactions are monetized 💰 allowing users to earn thr

## 🛠️ Technical details

⚙️ Currently built using [Scaffold-ETH 2](https://scaffoldeth.io/), [Foundry](https://book.getfoundry.sh/), [OnchainKit](https://onchainkit.xyz/), [Pinata](https://pinata.cloud/), [Vercel](https://vercel.com/), [NextJS](https://nextjs.org/), [RainbowKit](https://rainbowkit.com/), [Wagmi](https://wagmi.sh/), [Viem](https://viem.sh/), and [Typescript](https://www.typescriptlang.org/).
⚙️ Currently built using [Scaffold-ETH 2](https://scaffoldeth.io/), [Foundry](https://book.getfoundry.sh/), [Pinata](https://pinata.cloud/), [Vercel](https://vercel.com/), [NextJS](https://nextjs.org/), [RainbowKit](https://rainbowkit.com/), [Wagmi](https://wagmi.sh/), [Viem](https://viem.sh/), and [Typescript](https://www.typescriptlang.org/).

🏦 Considering using protocols: [Circle USDC](https://www.circle.com/) as native gas, [The Graph](https://thegraph.com/) for indexing events, [AAVE](https://aave.com/) for earning interest on USDC, [Chainlink](https://chain.link/) for cross-chain NFT bridging.
🏦 Considering using protocols: [Circle USDC](https://www.circle.com/), [The Graph](https://thegraph.com/), [Chainlink](https://chain.link/).

📜 Considering using contracts: ERC721, [Ownable](https://docs.openzeppelin.com/contracts/2.x/access-control) and [Upgradeable](https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable) from [Solady](https://github.com/Vectorized/solady) for contract ownership. And maybe [EIP712 Signatures](https://eips.ethereum.org/EIPS/eip-712) for some gasless activity.
📜 Considering using contracts: ERC721, [Ownable](https://docs.openzeppelin.com/contracts/2.x/access-control) and [Upgradeable](https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable) from [Solady](https://github.com/Vectorized/solady) for contract ownership.

🔗 To be deployed on [Avalanche L1](https://github.com/ava-labs/avalanche-starter-kit) and Bridge [ERC20](https://ethereum.org/en/developers/docs/standards/tokens/erc-20/) and [ERC721](https://ethereum.org/en/developers/docs/standards/tokens/erc-721/) using [Avalanche Interchain Token Transfer](https://github.com/ava-labs/avalanche-interchain-token-transfer) and [Chainlink CCIP Transfer Tokens](https://docs.chain.link/ccip/tutorials/cross-chain-tokens) with [EVM compatible chains](https://ethereum.org/en/developers/docs/scaling/sidechains/#evm-compatibility).
🔗 To be deployed on EVM compatible chains.

## 📚 Prerequisites

Expand All @@ -35,36 +35,40 @@ cd PunkSociety
yarn install
```

2. Duplicate and rename `packages/foundry/.env.example` to `packages/foundry/.env`
2. Rename the `.env.example` to `.env` in the `packages/nextjs` folder. For each variable, follow the instructions above the variable.

> NOTE: `ETHERSCAN_API_KEY` and `ALCHEMY_API_KEY` are not required until you deploy to a live EVM like Avalanche, Base, Ethereum, etc.
3. Run this command to start your NextJS app:

3. Rename the `.env.example` to `.env` in the `packages/nextjs` folder. For each variable, follow the instructions above the variable.
```
yarn start
```

4. Start a local Avalanche L1:
Visit your app on: `http://localhost:3000`.

It'd be ideal to run it with one command like `yarn subnet` with a config file, but so far, you gotta **[follow this instructions](./AVALANCHE-L1.md)**.
> NOTE: You can interact with your smart contracts on `http://localhost:3000/debug` and see a local block explorer on `http://localhost:3000/blockexplorer`
You'll start a local Avalanche L1 using [Ava Labs avalanche-starter-kit](https://github.com/ava-labs/avalanche-starter-kit). The network runs on your local machine and can be used for testing and development.
### 🚀 Testing on a local network

5. Open a terminal, navigate to `PunkSociety` and run this command to deploy the contracts:
1. Open a second terminal, navigate to `PunkSociety` and run this command to start a local chain:

```
yarn deploy
yarn chain
```

This command deploys a PunkSociety contracts to your Avalanche L1.
> NOTE: To test using your own Avalanche L1, **[follow this instructions](./AVALANCHE-L1.md)**.
> NOTE: Contracts are located in `packages/foundry/contracts` and can be modified to suit your needs. The `yarn deploy` command uses the deploy script located in `packages/foundry/script/Deploy.s.sol` to deploy the contract to the network. You can also customize the deploy script.
2. Duplicate and rename `packages/foundry/.env.example` to `packages/foundry/.env`. Fill the `DEPLOYER_PRIVATE_KEY` with the private key of the account you want to use to deploy the contracts.

> NOTE 2: To deploy to a different network, you can run `yarn deploy --network <network-name>`. For example, to deploy to the Ethereum network, you can run `yarn deploy --network ethereum`.
> NOTE: `ETHERSCAN_API_KEY` and `ALCHEMY_API_KEY` are not required until you deploy to a live EVM like Avalanche, Base, Ethereum, etc.
6. Open a second terminal, navigate to `PunkSociety` and run this command to start your NextJS app:
3. Open a terminal, navigate to `PunkSociety` and run this command to deploy the contracts:

```
yarn start
yarn deploy
```

Visit your app on: `http://localhost:3000`.
> NOTE: Contracts are located in `packages/foundry/contracts` and can be modified to suit your needs. The `yarn deploy` command uses the deploy script located in `packages/foundry/script/Deploy.s.sol` to deploy the contract to the network. You can also customize the deploy script.
> NOTE 2: To deploy to a different network, you can run `yarn deploy --network <network-name>`. For example, to deploy to the Ethereum network, you can run `yarn deploy --network ethereum`.
> NOTE: You can interact with your smart contract on `http://localhost:3000/debug` and see a local block explorer on `http://localhost:3000/blockexplorer`
4. Go to `packages/nextjs/scaffold.config.ts` and change the `targetNetworks` to `[chains.foundry]`.
1 change: 0 additions & 1 deletion packages/nextjs/scaffold.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const scaffoldConfig = {

// For working locally, comment out chains.sepolia or chains.arbitrum
// and uncomment chains.foundry
// targetNetworks: [punksociety, chains.baseSepolia, chains.avalancheFuji],
// targetNetworks: [punksociety],
targetNetworks: [chains.baseSepolia],
// targetNetworks: [chains.foundry],
Expand Down

0 comments on commit dbf2fd8

Please sign in to comment.