# Functionality Guide

## Gateway Credits

Gateway Credits are what is used to measure how much gas a user can pay for using Gateway Relay service. For testing and demoing purposes each credit is equal to 10,000 gas **although this is subject to change once testing is over, and Lukso main net is out.** Credits can be earned through both free and paid methods, and will be consumed when making a transaction through the Gateway Relay platform.

## Experience

In the Gateway Relay platform, users have two types experience measurements. One known as **permanent experience** and another known as **volatile experience.** The primary difference between the two is that permanent experience is always active, while volatile experience is only active when the user is subscribed. Experience can be earned by earning credits in any free manner, and can sometimes be dropped when doing a **daily check-in.**&#x20;

### **Permanent Experience**

Permanent experience will always be active. This means that regardless of whether a user is subscribed or not, if they earn experience through earning free-to-earn credits, or if they get experience through daily check-ins, it will be applied to their total permanent experience value. Permanent experience does not passively move up or down, and grows at a slower rate than volatile experience (when it is active). The formula for permanent experience calculation is as follows:&#x20;

$$
permanentExperience = p \* (b+c\*creditAmount)
$$

|     Credit Source     |  p  |  b  |  c  |
| :-------------------: | :-: | :-: | :-: |
|         Offers        |  .5 |  10 | .15 |
|        Surveys        |  .3 |  8  | .12 |
|       Video Ads       |  .2 |  2  | .08 |
| Push Notification Ads |  .1 |  1  | .06 |
|       Check Ins       |  1  |  0  |  0  |
|     Credit % Back     |  1  |  0  |  1  |

### Volatile Experience

Volatile experience is only active when the user is subscribed for any amount. Once volatile experience is active, the user will gain volatile experience at the same times that they would usually gain permanent experience, but at a much faster rate than permanent experience. Volatile experience also increments daily according to the user's current **temporary badge.** Once the user unsubscribes, however, their volatile experience will decrement daily according to their current temporary badge. The formula for permanent experience calculation is as follows (utilizing the same table that permanent experience uses for it's calculation):&#x20;

$$
volatileExperience = b+c\*creditAmount
$$

## Badges

In the Gateway Relay platform, users have two types of badges they have access to. One is a **permanent badge,** and the other is a **temporary badge.** The badge you have depends on a few factors depending on the badge type. For a permanent badge, it is determined by the user's permanent experience. For a temporary badge, it is inactive, unless the user is subscribed. If the user is subscribed, then they will get the badge associated with their current volatile experience. These badges grant a lot of bonuses to the user, such as:&#x20;

* **Percentage boosts to how many credits the user receives from free-to-earn credit sources.** This is on a source by source basis. For instance, a badge could provide a 10% increase to the credits earned with offers, while providing a 5% increase in credits earned through surveys, etc.
* **Bonus daily check-in rewards.** Instead of a user only checking in once, badges will potentially allow them to check in multiple times a day, increasing the amount of credits, experience, and **modifiers** they can get from them.
* **Credit back percentages.** Badges can provide the unique benefit of credits back on transactions. For instance, a user could have a badge that provides 2.5% credits back on transactions. If they were to spend 100 credits on a transaction, they would be refunded 2.5 credits.
* **Acceptable credit debt.** Badges can provide the ability for a user's credit balance to drop under 0 and still perform relay transactions. For instance, if a user has a badge that provides 10 acceptable credit debt, and they have 0 credits, they can still make a transaction that would cost them 10 credits.

All of these boosts stack additively. For instance, if a user has a permanent badge with 10% boost to credits gained from offers, and their temporary badge gives them a 5% boost, and they do an offer with a credit award of 100, the calculation will be as follows:

$$
totalCredits = 100+(100\*.1)+(100\*.05) = 115
$$

## Modifiers

A modifier is a temporary boost to a user's credit source. A modifier lasts either 1 hour, 6 hours, 12 hours, or 24 hours. Depending on where the modifier originates from, it has specific upper and lower bounds on how it can boost each credit source. If a modifier gives a higher boost relative to what is possible, it will usually expire faster, and vice versa. The main source of modifiers is the daily check-in, which has an equal chance of dropping a modifier of any type. An example modifier would be: **1.2% increase to credits earned from video ads, for 6 hours.** This would make it so that for the next 6 hours, the user will have a 1.2% increase in credits earned from video ads. For instance, with this modifier active, watching a video that awards 100 credits, the calculation will be as follows:

$$
totalCredits = 100 + (100\*.012) = 101.2
$$

Modifiers stack additively with themselves, and with badges. For instance, if a user had two modifiers giving them an additional 2.5% each for credits earned from surveys, and a permanent badge that gave them 5% for credits earned from surveys, the calculation for total credits would be as follows:

$$
totalCredits = 100 + (100\*.025) + (100\*.025) + (100\*.05) = 110
$$

## Credit Sources

### Subscriptions

A user can subscribe for any amount (has to be at least $.50) to gain credits monthly. The amount of credits they will gain per month will be proportionate to how much they are subscribing for. **For testing purposes, a user will get one credit per $.025 they are subscribed for. This ratio is subject to change.**

### Offers

Offers are a task or a group of tasks that a user can complete in order to be rewarded Gateway Credits. Common examples of tasks can include, but are not limited to, installing programs, signing up for a service, visiting a website, etc. In the future, Gateway Relay will have an offshoot of a regular offer with Partner Offers, which are offers made by the partners of Gateway Relay. Read more about Partner Offers [here](https://karan-khullar.gitbook.io/gateway/guides/broken-reference).

### Surveys

Surveys can be completed by users as a relatively fast way to earn Gateway Credits. The data collected from the surveys will never be used by Gateway Relay, and instead will be sent back to the third party providing the survey.

### Video Ads

Video Ads are currently the fastest method for a user to gain Gateway Credits, although they usually reward the least amount of credits. By watching a short ad clip, usually no more than 30 to 60 seconds, a user can earn credits.

### Daily Check-In

Daily check-ins are not only a source of credits, but can also provide the user with modifiers and experience. A user can check in multiple times a day, where the amount of times they can check in is determined by their badges. A badge provides a user extra daily check-ins, and the extra check-ins from the permanent and temporary badges stack additively. For example, if a user has a permanent badge that gives 2 bonus daily check-ins, and a temporary badge that gives the user 3 bonus daily check-ins, the total number of daily check-ins would be calculated as follows:

$$
totalDailyCheckIns = 2+3+1 = 6
$$

​The 1 in the above formula is derived from the fact that each user will have at least one daily  check-in, regardless of the badges they have.&#x20;

When a user checks in, a prompt will be displayed for them to either watch a video ad, or complete a very small task. Once they have completed this, they will be rewarded either some amount of credits, some amount of experience, or a modifier. What they receive is determined by their associated **check-in drop table**. Each badge has an associated check-in drop table, and a user's check-in drop table is determined by the check-in drop table associated with their highest level badge. For instance, when checking in, if a user's permanent badge is a higher level than their temporary badge, it will use their permanent badge's check-in drop table to randomly select their reward. Below is a high level visualization of the information in a check-in drop table:

|           Reward Type          | Reward Value |
| :----------------------------: | :----------: |
| Minimum Bonus Video Ad Credits |      0%      |
| Maximum Bonus Video Ad Credits |      .8%     |
|   Minimum Bonus Offer Credits  |       0      |
|   Maximum Bonus Offer Credits  |     1.5%     |
|  Minimum Bonus Survey Credits  |      0%      |
|  Maximum Bonus Survey Credits  |      1%      |
|      Minimum Credits Back      |      0%      |
|      Maximum Credits Back      |      .5%     |
|       Minimum Experience       |       0      |
|       Maximum Experience       |       8      |
|         Minimum Credits        |       1      |
|         Maximum Credits        |       6      |
