An open API service indexing awesome lists of open source software.

https://github.com/austintgriffith/fruit-market-land


https://github.com/austintgriffith/fruit-market-land

Last synced: 11 months ago
JSON representation

Awesome Lists containing this project

README

          

# ๐Ÿ“ Fruit Market Land

๐Ÿงช this is forked from the fruit market repo [here](https://github.com/BuidlGuidl/fruit-market)

๐Ÿ’ต Buy Land and Grow Strawberries!

image

๐Ÿ“ฑ very ugly buttons for each land tile:

image

๐Ÿ—บ check out the land contract in `packages/hardhat/contracts/Land.sol`

```bash

git clone https://github.com/BuidlGuidl/fruit-market-land

cd /fruit-market-land

yarn install

```

> โš™๏ธ bring up the chain and deploy your contracts

```bash

yarn chain

yarn deploy

yarn start

```

> ๐Ÿ–จ copy `packages/nextjs/.env.example` to the name `.env` and edit your frontend env:

> ๐Ÿ’ฟ you'll need to spin up a KV (key value storage) in vercel and copy/paste in the env.local fields:

```
NEXT_PUBLIC_DEPLOY_BLOCK=0
NEXT_PUBLIC_LIVE_URL=https://event-wallet.vercel.app
KV_URL=
KV_REST_API_URL=
KV_REST_API_TOKEN=
KV_REST_API_READ_ONLY_TOKEN=
```

> ๐Ÿ“ฑ hit the frontend at `http://localhost:3000`

> ๐Ÿ“ next, inspect the `targetNetwork` var in `packages/nextjs/scaffold.config.ts`

(if you are deploying locally it needs to be `chains.hardhat` or `chains.gnosis` out in prod)

> ๐Ÿ’โ€โ™‚๏ธ login as with your nickname:

![image](https://github.com/BuidlGuidl/event-wallet/assets/2653167/bfbbe1a3-8fee-4b73-8ff9-12954827a962)

> ๐Ÿท now you can use the browser to navigate to the `/checkedIn` route to drop tokens and gas to players:

![image](https://github.com/BuidlGuidl/event-wallet/assets/2653167/1d1e19e1-35fb-4302-9bd6-780fed7af7cf)

โš ๏ธ your frontend address will need to be an admin to drop tokens to players

> ๐Ÿ“ edit `packages/hardhat/deploy/00_deploy_your_contract.ts` and add your address to `dexPausers`

> โš™๏ธ redeploy the whole stack with `yarn deploy --reset`

๐Ÿค” try visiting [http://localhost:3000](http://localhost:3000) from an incognito window or another browser to have a fresh burner to play with

(check in with a burner and drop some funds to it using your other account and the `/checkedIn` page)

โš–๏ธ at this point, player should be able to trade credits for resources on the dexes:

![image](https://github.com/BuidlGuidl/event-wallet/assets/2653167/09a019de-8112-4912-9889-d1fa47cb0d4d)

---

## Charts and Leaderboard

If you want to keep the charts and leaderboard updated you have to run a cron job requesting /api/admin/track-prices:

```
* * * * * /usr/bin/curl https://domain/api/admin/track-prices >> prices.log
```

Or you can set the cron job at Vercel using the /packages/nextjs/vercel.json config file.

(On localhost you can just use the browser to hit `http://localhost:3000/api/admin/track-prices` manually)

---

## Trading Bots

If you want prices to randomly fluctuate you need to run bots that have a bunch of liquidity and trade randomly:

```bash
git clone https://github.com/BuidlGuidl/fruit-market-trader

cd fruit-market-trader

yarn install
```

> ๐Ÿ’พ you will need to copy your `fruit-market` `packages/nextjs/generated/deployedContracts.ts` into this `fruit-market-trader/deployedContracts.js`

โš ๏ธ notice it changes from `.ts` to `.js` - you will also have to remove the `as const` from the end

(this tells your bots about the new contracts you've deployed)

โ˜ข๏ธ Notice: any time you need to redeploy, do `yarn deploy --reset` and recopy over your `deployedContracts.js`

> โœ๏ธ copy the `.env.example` to `.env` file in the `fruit-market-trader` dir with the following info filled in:

```
DEPLOYER_PRIVATE_KEY=0xYOUR_PRIVATE_KEY_FROM_YOUR_LOCAL_STORAGE
GNOSIS_RPC=http://127.0.0.1:8545
GNOSIS_NETWORK_ID=31337
```

(you can get this private key from the local storage. it's called `scaffoldEth2.burnerWallet.sk`)

โ›ฝ๏ธ if your this address is loaded up with local funds, you should be good to run:

```bash
node batchPrep.js
```

โš™๏ธ this is going to generate a bunch of trader accounts, send them tokens, and save the private keys up in your `.env` file:

![image](https://github.com/BuidlGuidl/event-wallet/assets/2653167/d59b9c72-0a6d-4029-8257-0f4d0b8212dd)

(if anything fails here it probably means your burner is not correctly funded with credits and assets and you can debug balances using http://localhost:3000/debug)

> ๐ŸŽ now you can start a trading bot for each resource like:

```bash
node tradeDex.js Apple
```