π§ͺ this is forked from the fruit market repo here
π΅ Buy Land and Grow Strawberries!

π± very ugly buttons for each land tile:

πΊ check out the land contract in packages/hardhat/contracts/Land.sol
git clone https://github.com/BuidlGuidl/fruit-market-land
cd /fruit-market-land
yarn install
βοΈ bring up the chain and deploy your contracts
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 inpackages/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:
π· now you can use the browser to navigate to the
/checkedIn
route to drop tokens and gas to players:
π edit
packages/hardhat/deploy/00_deploy_your_contract.ts
and add your address todexPausers
βοΈ redeploy the whole stack with
yarn deploy --reset
π€ try visiting 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:
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)
If you want prices to randomly fluctuate you need to run bots that have a bunch of liquidity and trade randomly:
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 thisfruit-market-trader/deployedContracts.js
.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 thefruit-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:
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:
(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:
node tradeDex.js Apple