# VLM ERC 20 Contract

## Variables:

| preSalePrice      | The preSale price in Matic.                        | constant |
| ----------------- | -------------------------------------------------- | -------- |
| pubSalePrice      | The Public Sale price in Matic.                    | constant |
| SaleSupply        | The supply available for sale.                     | constant |
| PreSale           | True if the presale stage is active.               | Contract |
| PublicSale        | True if the public sale stage is active.           | Contract |
| SeedMinting       | True if the Seed distribution is active.           | Contract |
| SaleStart         | The blocktime of the deployment of the contract.   | constant |
| Factory           | The factory contract address.                      | Factory  |
| DevFunds          | The Development funds address.                     | constant |
| LiquidityFunds    | The liquidity funds address.                       | constant |
| MarketingFunds    | The marketing funds address.                       | constant |
| \_paymentsMatches | How many matches is required to mint seed payment. | constant |
| \_matchPayment    | A counter for match payments since the last reset. | Contract |
| \_seedIds         | A counter for how many seeders we have.            | contract |
| \_payments        | A counter for how many seed payments we released.  | contract |
| SeederList        | A list of seeders accounts                         | Contract |
| SeederBalance     | A list of seeders balances                         | contract |

## Functions:

### **buyToken**

Access: public, accept payments.

Arguments: amount of tokens, referral address

Usage: Allow users to buy Locked Seed VLM tokens to fund the project.

#### Requirements:

1. an active Presale or Public sale.
2. The sale end deadline didn't pass.
3. The amount of token is less than or equal the seed supply.
4. The payment amount equals the number of tokens multiplied by the price.<br>

#### Conditions:

1. The referral address must be in the seeder list to count.
2. At the 100 seeder, the stage changes from PreSale to Public sale.
3. The price changes according to the active stage.
4. If the supply is 0 the sale ends.

#### Outputs:

1. add the token amount to the seeder balance
2. remove the token amount from the seed supply
3. transfer 50% of the payment to liquidity funds
4. mint 50% of the token amount to liquidity funds
5. transfer 25% of the payment to devFunds
6. transfer 25% of the payment to marketing Funds.

<br>

### matchMint

Access: public, external. access limited to the factory contract

Arguments: list of players' addresses, list of players' reward amounts

Usage: Used by the factory contract to distribute rewards to the server and players and trigger the seed payments.

#### Requirements:

The sender must be the factory contract.

#### Conditions:

1. 1\. triggers Seed payments if the seedMinting is true

### seederPayments

Access: internal

Usage: Distribute 1% of the total amount of the seeders, if the seeder balance is less than 10000 VLM the function release all the balance and marks the seeder as paid.\
If the payments reach 100%, this function won't be executed anymore.

#### Requirements:

1. The seeder must have an unpaid state.

#### Output:

1. Mint the 1% to the seeder balance.

### getSaleInfo

Access: public, view.

Returns the list of useful information about the sale price, state, and available amount.

### GetVestedBalance

Access: public, view

Returns the current vested balance of the sender.

### SetFactory

Access: external, access limited to the factory contract

set the factory address to a new contract in case of an update.
