Saverville is a decentralized game based on blockchain technology that simulates farming activities using a financial model akin to certificates of deposit (CDs). Players, known as "Farmers," manage virtual farms, growing crops that represent financial investments with defined maturity periods.
- Purchasing Seeds: Farmers buy seeds from the Market.
- Planting Seeds: Farmers plant their seeds on various plots within their farm.
- Growth Period: Seeds mature over time, with a random variance in growth duration.
- Harvesting: Harvested plants represent the maturity of the CDs, yielding the initial investment plus interest.
- Selling Crops: Farmers can sell their harvested crops at the Market.
- Withdrawing Funds: Funds can be withdrawn, similar to withdrawing from a savings account.
graph TD
Farm[Farm] -->|1. buy seeds| Market[Market]
Farm -->|2. plant seeds| FarmPlot[Farm Plot]
Farm -->|3. harvests crops| FarmPlot
Farm -->|4. sells crops| Market
style Market fill:#f90,stroke:#333,stroke-width:2px
style Farm fill:#303,stroke:#333,stroke-width:2px
style FarmPlot fill:#cf8,stroke:#333,stroke-width:2px
- Buy Seeds: Farmers purchase seeds from the Market.
- Plant Seeds: Farmers plant seeds in their farm plots.
- Harvest Crops: Farmers harvest mature crops from their farm plots.
- Sell Crops: Farmers sell harvested crops at the Market.
Handles all transactions related to buying seeds and selling crops.
- buySeeds(uint quantity)
- Farmers purchase seeds, which are added to their farm.
- sellCrops(uint plotId, uint amount)
- Farmers sell crops from a specific plot for in-game currency.
Manages the individual farmer's entire farming operation, containing multiple farm plots.
address owner
- Owner of the farm.FarmPlot[100] plots
- Array of plots within the farm.uint256 plantableSeeds
- Number of seeds that can be planted.uint256 totalEarnings
- Total earnings in ETH from harvested plants.uint256 totalHarvestedPlants
- Total number of harvested plants.
- plantSeed(uint256 plotId)
- Plants a seed in a specified plot within the farm.
- waterPlant(uint256 plotId)
- Waters the planted seed, setting the harvest time.
- harvestPlant(uint256 plotId)
- Harvests the mature plant from a specified plot.
Tracks the state of each plot and its maturity.
uint state
- State of the plot (0 = free, 1 = seeded, 2 = watered).uint harvestAt
- Timestamp when the plot can be harvested.
- plant()
- Changes the state to seeded.
- water()
- Changes the state to watered and sets the harvest time.
- harvest()
- Changes the state to free after harvest.
- VRFConsumerBaseV2: Used to get random values for the growth period from Chainlink VRF.
- VRFCoordinatorV2Interface: Interface for Chainlink VRF Coordinator.
- SeedPurchased
address buyer, uint quantity
- SeedPlanted
address farmAddress, uint plotId
- PlantWatered
address farmAddress, uint plotId, uint harvestAt
- PlantHarvested
address farmAddress, uint plotId