---
# System prepended metadata

title: Seed Module v2

---

# Seed Module v2

This is a proposal for the second iteration of Seed Module implementation.

## Provided requirements



---

### Future ideas

Multiple token support (pre-selected list, caps per each etc)

<b>(Developed spec currently is a joint venture, this one is not a requirement for the current iteration of Seed)</b>

Is the final target denominated in a particular token? 
We can go with token amount, any potential around connecting it to a price oracle? Chainlink? 
How do we convert a basket of tokens into a single token priced target? Using oracle? Fetching prices from Balancer?
Can the seed module be also implemented on Balancer v2 maybe?
What would implementation on Balancer v2 mean? 


---

1. Individual cap for the seed based on the class
Every wallet can contribute x amount in tokens max 

2. Ability to specify different fixed rates, vestings, and individual cap for different stakeholders **(Stakeholders are grouped by specific classes, Idividual cap by class(for everyone in the class) and class cap(total funding from specific class)). Total sum of caps of all classes are > then hard threshold** Specific time for a specific class?


P.S.: Be able to reference to the past seed in the contract(for the future deployments, not required rn), only frontend

## Overview

The new Seed Module will require a lot of rework due to the support of multiple tokens, which this module will need to update in real time because those tokens may change their own price in time. Contract will need to support this functionality:
1. Seed initialization with set of different user classes.
2. Adding whitelisted contributors with specific class.
3. Changing user's class.
4. Possibility for contributor to gradually withdraw tokens after class-specific time goals were reached. 

## Seed Module description


#### Important variables

| Variable     | Type               |
| ------------ | ------------------ |
| hardCap      | <uint256>          |
| softCap      | <uint256>          |
| contributors | {address: uint256} |
| seedClaimed  | <uint256>          |
| feeClaimed   | <uint256>          |
    
#### Contributor class structure:

| Variable           | Type      | Description                                                             |
| ------------------ | --------- | ----------------------------------------------------------------------- |
| classCap           | <uint256> | Max funding this class can receive                                      |
| personalCap        | <uint256> | Max funding single member of the class can send                         |
| fundingCollected   | <uint256> | Current amount of funds collected by class                              |
| price              | <uint256> | Price of seed tokens for this class                                     |
| vesting duration   | <uint256> | Duration of vesting period for thiss class                              |
| vesting start time | <uint256> | Start time of vesting for this class                                    |
| seedAmountRequired | <uint256> | Required amount of seed to fully satisfy the classCap(classCap * price) |
| feeAmountRequired  | <uint256> | Max amount of fee produced by the class                                 |

User's contribution calculation.  
     Contributor $i$, who contributed $v$ amount of tokens with the rate of $r$ will receive:
                $$F_i = vr$$
    
Where $F_i$ is amount of seed tokens.

### Methods
Functions with * are already implemented in Seed v1 but require major changes.    
    
- initialize*. Comparing to the initialize in v1 it also create initial 0 class, which will apply to all of the contributors if the seed is not whitelisted.
- whitelist*. Comparing to the whitelist in v1 it will also receive id of the class, to which the address is related.
- addClass.It will receive all parameters for specific class to create new class with `id = len(classes)`.
- addClassBatch.It will receive arrays all parameters for specific classes to create new classes.
- changeClass. It will receive all parameters for specific class with id $_id$ to update.
- setClass. This function allows to change class for specific contributor.
- whitelistBatch*. Comparing to the whitelist in v1 it will also receive array of classes for all $l$ added contributors {$c_1$, ... $c_l$}. Length of caps array equals to amount of contributors added to the whitelist($l_w$) multiplied by amount of supported tokens($n$): 
    $$L_c = l_wn$$
- buy*. Buy will check the classCap and personalCap amount for sender. Price of the seed and Fee calculation is specific for each contributor based on his class.
- claim*. Claim comparing to it's v1 will also depend on class vesting start time and vesting duration.
- calculateClaim*. calculateClaim comparing to it's v1 will also depend on class vesting start time and vesting duration.
- calculateClaim*. calculateClaim comparing to it's v1 will also depend on class vesting start time and vesting duration.
- feeForFunder and feeClaimedForFunder. This function calculates the amound of feeClaimed and based on total claimed.
- getClass. This function returns class with provided id.


