๐พ FlutterFarm - Blockchain Farming Game โ
FlutterFarm์ FlutterDev Chain์์ ์คํ๋๋ ๋ธ๋ก์ฒด์ธ ๊ธฐ๋ฐ ๋์ฅ ์๋ฎฌ๋ ์ด์ ๊ฒ์์ ๋๋ค.
โจ ์ฃผ์ ๊ธฐ๋ฅ โ
- ๊ฐ์ค๋ฆฌ์ค ํธ๋์ญ์ - ๊ฐ์ค๋น ์์ด ํ๋ ์ด
- 100 FARM ์์ด๋๋ - ์ ๊ท ํ๋ ์ด์ด ํ์ ๋ณด๋์ค
- ์๋ฌผ ์ฌ๋ฐฐ - ์๋ฌผ์ ํค์ FARM ํ ํฐ ํ๋
- ์จ์ฒด์ธ ๊ฒ์ ์ํ - ๋ชจ๋ ์งํ์ํฉ์ด ๋ธ๋ก์ฒด์ธ์ ์ ์ฅ
๐ ๋งํฌ โ
| ์๋น์ค | URL |
|---|---|
| ๊ฒ์ | game.flutterdev.online |
| ์ง๊ฐ | wallet.flutterdev.online |
| ์ต์คํ๋ก๋ฌ | scan.flutterdev.online |
๐๏ธ ์์คํ ์ํคํ ์ฒ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Frontend โ โ Gas Relay โ โ Blockchain โ
โ (Next.js) โโโโโโถโ (Express) โโโโโโถโ (FlutterDev) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ
โ โผ
โ โโโโโโโโโโโโโโโโโ
โ โ FarmGame.sol โ
โ โ FARM Token โ
โ โ GameItems โ
โ โโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Backend API โ
โ (Express) โ
โโโโโโโโโโโโโโโโโโโ์ปดํฌ๋ํธ โ
| ์ปดํฌ๋ํธ | ๊ฒฝ๋ก | ์ค๋ช | ๊ธฐ์ |
|---|---|---|---|
| Smart Contracts | contracts/ | FarmGame, FARM Token, GameItems NFT | Solidity, Hardhat |
| Frontend | frontend/ | Next.js ๊ฒ์ ์ธํฐํ์ด์ค | Next.js, TypeScript |
| Backend API | backend/ | ์คํ์ฒด์ธ ๊ธฐ๋ฅ ์๋ฒ | Node.js, Express |
| Gas Relay | faucet/ | ๊ฐ์ค๋ฆฌ์ค ํธ๋์ญ์ ๋ฆด๋ ์ด | Node.js, ethers.js |
๐ ์ค๋งํธ ์ปจํธ๋ํธ โ
๋ฐฐํฌ๋ ์ปจํธ๋ํธ โ
| ์ด๋ฆ | ์ฃผ์ | ์ค๋ช |
|---|---|---|
| FarmGame | 0xd1Fbb0C9403705094d6FBE9007C35c0f811AE93B | ๋ฉ์ธ ๊ฒ์ ๋ก์ง |
| FARM Token | 0xe5a8F6fF531734be23DF8CaCB63aF154730EF777 | ERC20 ๋ณด์ ํ ํฐ |
| GameItems | 0x8708A7399BAb2D118619372349747E4bc1d7aac3 | ERC1155 NFT ์์ดํ |
์ฃผ์ ํจ์ โ
solidity
// ๋์ฅ ์์ฑ (100 FARM ์์ด๋๋)
createFarm()
// ์๋ฌผ ์ฌ๊ธฐ
plant(uint256 plotIndex, uint8 cropType)
// ๋ฌผ ์ฃผ๊ธฐ (์ฑ์ฅ ๊ฐ์)
water(uint256 plotIndex)
// ์ํ
harvest(uint256 plotIndex)
harvestAll()
// ๋ณด์ ์ฒญ๊ตฌ
claimRewards()
// ๋์ฅ ํ์ฅ
buyPlot()์๋ฌผ ์ข ๋ฅ โ
| ์ด๋ชจ์ง | ์ด๋ฆ | ID | ์ฑ์ฅ์๊ฐ | ๋ณด์ |
|---|---|---|---|---|
| ๐พ | Wheat | 1 | 2๋ถ | 10 FARM |
| ๐ฅ | Carrot | 2 | 5๋ถ | 25 FARM |
| ๐ | Tomato | 3 | 10๋ถ | 50 FARM |
| ๐ฝ | Corn | 4 | 15๋ถ | 100 FARM |
๐ฎ ๊ฒ์ ํ๋ ์ด โ
์์ํ๊ธฐ โ
- ์ง๊ฐ ์ฐ๊ฒฐ - FlutterWallet๋ก ์ฐ๊ฒฐ
- ๋์ฅ ์์ฑ - "Create Farm" ๋ฒํผ ํด๋ฆญ
- ์์ด๋๋ ์๋ น - ์๋์ผ๋ก 100 FARM ์ง๊ธ ๐
๋์ฌ์ง๊ธฐ โ
- ๐ Shop ํด๋ฆญ โ ์๋ฌผ ์ ํ
- ๋น ๋ (๐ซ) ํด๋ฆญ โ ์๋ฌผ ์ฌ๊ธฐ
- ์๋ผ๋ ์๋ฌผ ํด๋ฆญ โ ๋ฌผ ์ฃผ๊ธฐ ๐ง
- ๋ค ์๋ ์๋ฌผ ํด๋ฆญ โ ์ํ ๐พ
๋ณด์ ๋ฐ๊ธฐ โ
- ์ํํ ๋๋ง๋ค pending rewards์ ์ถ๊ฐ
- "Claim" ๋ฒํผ ํด๋ฆญ โ FARM ํ ํฐ ์๋ น
- ์ง๊ฐ์์ FARM ์์ก ํ์ธ
UI ๋ฒํผ ๊ฐ์ด๋ โ
| ๋ฒํผ | ๊ธฐ๋ฅ |
|---|---|
| ๐ | ์ธ๋ฒคํ ๋ฆฌ ๋ณด๊ธฐ |
| ๐ | ์๋ฌผ ์ ํ (Shop) |
| ๐ฆ | ์คํ ์ดํน |
| โ๏ธ | ์ ๊ทธ๋ ์ด๋ |
| ๐ | ๊ฐ์ฑ |
| ๐ช | ๋ง์ผํ๋ ์ด์ค |
| ๐ฌ | ์์ |
| โ | ๋์๋ง |
| ๐ช | ๋ก๊ทธ์์ |
โ๏ธ ๊ฐ์ค๋ฆฌ์ค ์์คํ โ
FlutterFarm์ Gas Relay๋ฅผ ํตํด ๊ฐ์ค๋น ์์ด ํ๋ ์ดํ ์ ์์ต๋๋ค.
์๋ ๋ฐฉ์ โ
1. ์ฌ์ฉ์๊ฐ ํธ๋์ญ์
์๋ช
2. ํ๋ก ํธ์๋ โ Gas Relay๋ก ์ ์ก
3. Gas Relay๊ฐ ์๋ช
๊ฒ์ฆ
4. createFarm() โ createFarmFor(player) ๋ณํ
5. Relay ์ง๊ฐ์ด ๊ฐ์ค๋น ๋๋ฉํ์ฌ ์คํRelay ์๋ฒ โ
- URL:
https://faucet.flutterdev.online/api/relay - ์ง์ ํจ์: createFarm, plant, water, harvest, claimRewards
๐ ์ด๋ฒคํธ โ
์ปจํธ๋ํธ์์ ๋ฐ์ํ๋ ์ด๋ฒคํธ:
solidity
event FarmCreated(address indexed player);
event WelcomeAirdrop(address indexed player, uint256 amount);
event CropPlanted(address indexed player, uint256 indexed plotIndex, uint8 cropType);
event CropWatered(address indexed player, uint256 indexed plotIndex);
event CropHarvested(address indexed player, uint256 indexed plotIndex, uint256 reward);
event RewardsClaimed(address indexed player, uint256 amount);
event PlotPurchased(address indexed player, uint8 newPlotCount);๐ ๏ธ ๊ฐ๋ฐ ์ฐธ๊ณ โ
ํ๋ก ํธ์๋ ์ฃผ์ ํ์ผ โ
| ํ์ผ | ์ค๋ช |
|---|---|
frontend/components/GameCanvas.tsx | ๋ฉ์ธ ๊ฒ์ UI |
frontend/config/contracts.ts | ์ปจํธ๋ํธ ์ฃผ์ ๋ฐ ABI |
frontend/context/WalletContext.tsx | ์ง๊ฐ ์ํ ๊ด๋ฆฌ |
frontend/lib/wallet-connector.ts | FlutterWallet ์ฐ๋ |
์ปจํธ๋ํธ ํ์ผ โ
| ํ์ผ | ์ค๋ช |
|---|---|
contracts/contracts/FarmGame.sol | ๋ฉ์ธ ๊ฒ์ ์ปจํธ๋ํธ |
contracts/contracts/FarmToken.sol | FARM ERC20 ํ ํฐ |
contracts/contracts/GameItems.sol | ERC1155 ์์ดํ NFT |
Docker ๋ฐฐํฌ โ
bash
# ํ๋ก ํธ์๋ ๋น๋ ๋ฐ ์ฌ์์
npm run build
docker restart farm-frontend