Skip to content

Commit e4d192c

Browse files
waynebruce0xgitbook-bot
authored andcommitted
GITBOOK-98: No subject
1 parent 5fa6d9c commit e4d192c

File tree

6 files changed

+129
-0
lines changed

6 files changed

+129
-0
lines changed

.gitbook/assets/patagonia Aug '22.png

1.47 MB
Loading

SUMMARY.md

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
* [Examples](list-your-project/other-dashboards/examples/README.md)
2323
* [Fees adapter](list-your-project/other-dashboards/examples/fees-adapter.md)
2424
* [Dex adapter](list-your-project/other-dashboards/examples/dex-adapter.md)
25+
* [Emissions dashboard](list-your-project/emissions-dashboard/README.md)
26+
* [Protocol Files](list-your-project/emissions-dashboard/protocol-files.md)
27+
* [Emission Sections](list-your-project/emissions-dashboard/emission-sections.md)
28+
* [Testing](list-your-project/emissions-dashboard/testing.md)
2529

2630
## Chainlist
2731

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
description: How to add your favourite projects token emission schedules to DefiLlama
3+
---
4+
5+
# Emissions dashboard
6+
7+
## **Example**
8+
9+
Throughout the pages in this guide we will refer to the [Liquity emissions adapter](https://github.com/DefiLlama/emissions-adapters/blob/master/protocols/liquity.ts).
10+
11+
## **Format**
12+
13+
Once a day we run all of the protocol files in the emissions adapters repo (listed in `protocols/index.ts` ). Protocol files give us a schedule and metadata for a specified token.
14+
15+
When adding a new emissions schedule to DefiLlama, it's vital to test your code before you submit it. If your code doesn't produce an expected result it won't be accepted, so please read the [Testing section](testing.md).
16+
17+
18+
19+
## How To Contribute Your Code
20+
21+
Just like for TVL adapters, if you'd like to add an emissions schedule to DefiLlama:
22+
23+
1. Fork the [emissions-adapters repo](https://github.com/DefiLlama/emissions-adapters) (button towards the top right of the repo page).
24+
2. Add a new [protocol file ](protocol-files.md)to protocols/ .
25+
3. Make a Pull Request with the changes on your fork, to the main DefiLlama emissions-adapters repo, with a brief explanation of what you changed.
26+
4. Wait for someone to either comment on or merge your Pull Request. There is no need to ask for someone to check your PR as there a monitored regularly.
27+
5. Once your PR has been merged, **please give 24 hours** for the team to load your listing onto the UI.
28+
29+
![prayge](https://cdn.discordapp.com/emojis/1011049613186318376.webp?size=48\&quality=lossless)
30+
31+
2
32+
33+
1.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
description: Continuing with the Liquity example...
3+
---
4+
5+
# Emission Sections
6+
7+
## Manual Entry Functions
8+
9+
90% of the time you'll only need the `manual...` functions (imported on line 1). There are 3 of them:
10+
11+
* manualStep(
12+
13+
start: unixTimestamp <- time of the first vest
14+
15+
stepDuration: unixTimestamp <- time period between vests
16+
17+
number: number <- number of discreet unlocks in the vesting schedule
18+
19+
amount: number <- number of coins emitted **in each** discreet unlock
20+
21+
)
22+
* manualCliff(
23+
24+
start: unixTimestamp <- timestamp of the cliff&#x20;
25+
26+
amount: number <- number of coins emitted in the cliff
27+
28+
)
29+
* manualLinear(
30+
31+
start: unixTimestamp <- start of the linear vesting period
32+
33+
end: unixTimestamp <- end of the linear vesting period
34+
35+
amount: number <- number of coins emitted over the period
36+
37+
)
38+
39+
## More Complex Emission Shapes
40+
41+
Sometimes you might need to make more advanced shapes, for example, if the rate of emissions decrease over time. In this example, We created a rewards() function which makes a complex shape out of smaller linear sections (line 9, used on line 33).&#x20;
42+
43+
{% hint style="info" %}
44+
Emissions sections should return real quantities of tokens. Not percentages, and accounting for any token decimals.
45+
{% endhint %}
46+
47+
## On Chain Data
48+
49+
Some protocol files use on-chain data (Aave, Tornado etc). Where possible we like to use on chain data. The time sensitive nature of emissions schedules can make on-chain data more difficult to research and write. If you think using on-chain data is a better option for you, contact us through Discord and we can help out.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
description: Continuing with the Liquity example...
3+
---
4+
5+
# Protocol Files
6+
7+
Protocol files each export a `Protocol` object (line 55) which contains these properties:&#x20;
8+
9+
* Each distinct section of token allocation, function | function\[], required:
10+
11+
These sections can take on whatever keys are required. These keys will be used to label the chart on our UI, so please make them readable and nice to look at. The value for each chart section key will usually either be a `manual....()` or `manual....()[]` (more info [on the next page](emission-sections.md)). For example, the Liquity adapter has:
12+
13+
* Stability Pool rewards
14+
* Uniswap LPs
15+
* Endowment
16+
* Team and advisors
17+
* Service providers
18+
* Investors.&#x20;
19+
* notes, string\[], optional:&#x20;
20+
21+
Anything you think DefiLlama users should know about the emissions data. Maybe you made an assumption somewhere, or have excluded certain allocations because they were impossible to quantify.&#x20;
22+
* token, string, required:&#x20;
23+
24+
The token address, preferably on the chain it was first deployed.&#x20;
25+
* sources, string\[], required:&#x20;
26+
27+
Links to wherever you got the data. Official protocol docs are preferred, but discord servers etc can also be used if needed.&#x20;
28+
* ProtocolIds, string\[], required:
29+
30+
Please leave this as an empty array (`[]`) and the DefiLlama team will complete this for you.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
description: The most important part
3+
---
4+
5+
# Testing
6+
7+
Once you're ready to debug your protocol file, add it to `protocols/index.ts` (preferably in alphabetical order). Run `ts-node utils/test.ts [name of your protocol]` and it should save a `result.png` where you can see the result of your protocol file. Check that the values make sense and it looks like what you expected.&#x20;
8+
9+
Thanks for reading this guide. If you have any further questions, don't hesitate to reach out on our Discord. We are all very responsive and happy to help.&#x20;
10+
11+
We always appreciate feedback on our developer experience. If anything seems unintuitive or complicated, let us know and we'll do our best to improve our processes.&#x20;
12+
13+
<figure><img src="../../.gitbook/assets/patagonia Aug &#x27;22.png" alt=""><figcaption><p>Bentura and Shaman, Patagonia, August 2021</p></figcaption></figure>

0 commit comments

Comments
 (0)