---
# System prepended metadata

title: Farm.tech Notes
tags: [PΞACHES]

---

# Farm Tycoon
aka ***Farmer Wang's Acres***
aka ***Acre Maker***

## Overview
Decentralized farmer's market. Buy and sell crop shares. Redeem shares for real vegetables.

## Implementation notes
**Flow**
- Farmer creates crop w/ max share limit
- Anyone can buy and sell shares
- Price determined with bonding curve
- Shares can be redeemed for a shipment of the crop
  - Shopify order flow, user pays shipping
  - Shares are burnt, but supply remains the same
- Unredeemed crop shares will be usable in the next season for that crop

**Contracts**
- Friend.tech contract fork
  - sharesSupbject === cropSubject
  - max shares per supply
  - basement price
  - cropSupply only created by contract owner
  - cropSupply address is the cropDao (any address)
  - Adjust price functions for curve shape

**App**
- Gamified UI
- PWA?
- How much account abstraction do we want to explore?
  - informs onboarding
  - Kind of reluctant due to security issues already seen around FT (ie. sim swaps)

## Questions/Todo
- Identify and test bonding curve shapes
  - Need to set basement price
  - Need to set max shares
  - Can we limit curve adjustment for each cropSupply to max + base price?
- How will we handle crop expiration
  - Existing cropSupply max shares can be adjusted and redeemed supply from previous season is removed to adjust supply/price ratio
    - the cropDao/cropSubject would sell excess at beginning of new season
    - can keep buying and selling out of season
  - or, Airdop to a new cropSupply
- Explore purchase with eth vs. stable coin


## Resources

[Bonding curve modeling tool](https://bondingplayground.netlify.app/)
- 100/(1+e^(-0.002(sqrt(x)-2000)))

(100/(1+e^(-0.005(sqrt(x)-2000)))) + 100

[Bonding curve resources](https://github.com/systems-explained/awesome-bonding)

[Friend.tech basescan contract](https://basescan.org/address/0xcf205808ed36593aa40a44f10c7f7c2f67d4a4d4#code)



### Contract fork tech notes
- ownable and context are all good
- protocol fee recipient and fee splits are the same
  - subject fee percent global for all cropSubjects
  - keep update functions for these
- prices functions
  - mostly all the same
  - adjust getPrice for our curve shape
- buyShares
  - currently this is where sharesSubjects are created
- owner only creates cropSubject
  - should we move create to it's own function?
  - in FT this is open, but the 1st one must be the msg.sender
  - adjust require that cropSubject must exist and if not owner must be sender
  - does this give 1st share to crop dao or is that necessary?


redemption unknowns
- thinking we send shares to the cropSubject
- crop subject can sell at some point to recoup costs
- need an enforced farmer sell time?
- how deos this play with a multi-season situation on the same cropSubject

- do we need to track trader redemptions in the contract to verify in the shopify flow?

![](https://hackmd.io/_uploads/rkeLEV7Wa.png)


## UI tech notes

try a squid:
https://docs.subsquid.io/quickstart/
https://app.subsquid.io/squids

https://nextjs.org/docs/pages/building-your-application/routing/api-routes
https://github.com/vercel/next.js/tree/canary/examples/api-routes

## 10.16 week todos

- contract crop elements
  - [x] naming
  - [x] track initial price - propsubjectconfig
  - [x] add to initial price/floor in buy/sell functions
  - [x] redemption transfer to merchant and sell
  - [x] new redemption mapping on address
  - [x] redeem more than one at once

no for now
  - [ ] cropsubject gets a beneficiary address?
  - [ ] open ended redemption end time?
  - [x] do we allow sell after redemption end?
  - [x] do we take a fee on redemption sell?
  - [ ] require on the last sale necessary? max supply might need to add one to account for 1st pop going to seller - test this in interface
    - could change the create require to look at the config?
    - might allow for new drops of the same pop - GOOD exploration for v2

https://goerli.etherscan.io/address/0x7007b0e366436370FA27479Fe0D331a8C156222C#code

- 1st subject: 0x962E624dCfA8CfB220015A5292C15d4006c42a85

https://thegraph.com/hosted-service/subgraph/odyssy-automaton/cropshare


## Redemption Options

