# SLAY THE MOLOCH

Idle game & shitcoin advanture dedicated to cohort VII of Raid Guild.

## Set up for local DEV

### 1. Run `anvil` to setup local RPC as a fork of base mainnet

`anvil --fork-url <YOUR BASE MAINNET RPC URL> --block-time 10 --chain-id 31337`

You can get a free rpc url by registering with https://alchemy.com and creating an app

Be sure to set --chain-id to 31337 if you are forking mainnet base, otherwise it will deploy with Base chain id and metamask will glitch out.

### 2. Deploy contract

Use `./deploy_contract.sh` script

This will deploy the contract and give you ETH and DAO Token (RGCVII) funds.

1. Make sure to change `DEV_WALLET` var to your own.
2. Make sure you have your private key on `DEV_PRIVATE_KEY` environment variable

Alternatively, check the script and run the steps as you see fit.

### 3. Run dev app

Move to `app` dir, install deps via `npm install` and run `npm run dev` to start the dev server.

#### 3. 1. Point Metamask to Anvil network for local dev

Add network `http://127.0.0.1:8545` with chain id `31337`

#### 3. 2. Change `app/contract_address.ts` to match your program address if needed

#### 3. 3. Reset metamask transaction history between anvil deployments

If u re-run `anvil` and redeploy the contract, do clear your history in Metamask under Advanced Settings, otherwise Metamask glitches because of its cache (?)

### 4. Fork tests

Run `forge test --rpc-url <your base mainnet rpc url>`

You can get a free rpc url by registering with https://alchemy.com and creating an app
