git clone https://github.com/damianmarti/fruit-market2
cd fruit-market
yarn install
Configure Burner Address: copy
packages/hardhat/.env.exampleto the name.envand editBURNER_ADDRESSto the public address of your main orchestrating wallet (we usually use a punkwallet for this)
⚙️ bring up the chain and deploy your contracts
yarn chain
yarn deploy
yarn start
🖨 copy
packages/nextjs/.env.exampleto the name.envand 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
targetNetworkvar 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
/checkedInroute to drop tokens and gas to players:
📝 edit
packages/hardhat/deploy/00_deploy_your_contract.tsand 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:
💵 Buy Land and Grow Strawberries!
📱 very ugly buttons for each land tile:
🗺 check out the land contract in packages/hardhat/contracts/Land.sol
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 fluctuate you need to run bots with a bunch of liquidity and trade them through a target price.
✏️ copy the
.env.exampleto the.envfile in thepackages/trading-botsdir. Fill in the DEPLOYER_PRIVATE_KEY and change the RPC value if you want. (you can get this private key from the local storage. it's calledscaffoldEth2.burnerWallet.sk)
✏️ You can find the bots config file at
packages/trading-bots/config.ts.
✏️ You can fill in the token's target price at
packages/trading-bots/data.json. These are the values that the bots will try to reach doing some swaps.
⛽️ if this address is loaded up with local funds, you should be good to run:
yarn trading:setup⚙️ this is going to generate a bunch of trader accounts, send them tokens, and save the private keys 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:
yarn trading:trade AppleOR
you can run all the bots with one command at once:
yarn trading:botsIf you want GPT to create assets with prices based on some vibe you can set the vibe with:
yarn oracleThis generates a packages/oracle/prompt.txt file
(If you ever want to start fresh, remove the prompt.txt and run yarn oracle again)
You will need an OpenAI API key in your packages/oracle/.env file:
OPENAI_API_KEY=sk-xxxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxxBehind the scenes, the oracle will run these commands for you:
node generateRawAssetList.js 12
node cleanRawAssets.js 6
node generatePriceData.js
node setTokens.jsThen go deploy your contracts normally and hopefully it works 🫡
⚖️ to have GPT update the prices:
yarn oracle:update⚙️ running yarn commands as a pm2 service example:
pm2 start yarn --name yarnStart -- start
pm2 start yarn --name yarnChain -- chain
pm2 start yarn --name yarnBots -- trading:bots
pm2 start yarn --name yarnOracle -- oracle:updateCode | Documentation | Website
🧪 An open-source, up-to-date toolkit for building decentralized applications (dapps) on the Ethereum blockchain. It's designed to make it easier for developers to create and deploy smart contracts and build user interfaces that interact with those contracts.
⚙️ Built using NextJS, RainbowKit, Hardhat, Wagmi, and Typescript.
- ✅ Contract Hot Reload: Your frontend auto-adapts to your smart contract as you edit it.
- 🔥 Burner Wallet & Local Faucet: Quickly test your application with a burner wallet and local faucet.
- 🔐 Integration with Wallet Providers: Connect to different wallet providers and interact with the Ethereum network.




