You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+59-11Lines changed: 59 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,23 +8,71 @@ For your protocol to be included and your users to receive points, you should su
8
8
9
9
1. Make a copy of `.env.example` and name it `.env`.
10
10
2. Run `pip install -r requirements.txt` to install the required packages.
11
+
- If using TypeScript scripts (recommended for L2 delegated integrations), also run `pnpm install` or `npm install` in the root directory.
11
12
3. Add your integration metadata to `integrations/integration_ids.py`.
12
13
4. Create a new summary column in `constants/summary_columns.py`.
13
-
5. Make a copy of [Template](integrations/template.py), naming the file `[protocol name]_integration.py` and place in the `integrations` directory.
14
-
6. Your integration must be a class that inherits from `CachedBalancesIntegration` and implements the `get_block_balances` method.
15
-
7. The `get_block_balances` method should return a dict of block numbers to a dict of user addresses to balances at that block. (Note: Not all blocks are queried by this service in production- only a sampling, but your code should be capable of handling any block number.)
16
-
8. Write some basic tests at the bottom of the file to ensure your integration is working correctly.
17
-
9. Submit a PR to this repo with your integration and ping the Ethena team in Telegram.
14
+
5. Choose your integration type:
15
+
- For EVM compatible chains: Copy [CachedBalancesTemplate](integrations/template.py)
16
+
- For non-EVM chains (e.g. Solana): Copy [L2DelegationTemplate](integrations/l2_delegation_template.py)
17
+
- We strongly recommend using a TypeScript script or similar to fetch balances for better reliability and maintainability
18
+
- See [KaminoL2DelegationExampleIntegration](integrations/kamino_l2_delegation_example_integration.py) for the recommended TypeScript approach
19
+
- Create your TypeScript script in the `ts/` directory
20
+
- Use the Kamino example as a reference for calling your script from Python
21
+
- API integration is also supported but less preferred (see [RatexL2DelegationExampleIntegration](integrations/ratex_l2_delegation_example_integration.py))
22
+
6. Name your file `[protocol name]_integration.py` and place it in the `integrations` directory.
23
+
7. Your integration must inherit from either:
24
+
-`CachedBalancesIntegration` and implement the `get_block_balances` method
25
+
-`L2DelegationIntegration` and implement the `get_l2_block_balances` and `get_participants_data` methods
26
+
8. The integration should return user balances:
27
+
- For CachedBalances: Return a dict of {block_number: {checksum_address: balance}}
28
+
- For L2Delegation: Return a dict of {block_number: {address: balance}}
29
+
9. Write some basic tests at the bottom of the file to ensure your integration is working correctly.
30
+
10. Submit a PR to this repo with your integration and ping the Ethena team in Telegram.
18
31
19
32
# Guidelines
20
33
21
34
- Integrations must follow this architecture and be written in python.
22
-
- Pendle integrations are included as examples of functioning integrations. Run `python -m integrations.pendle_lpt_integration` to see the output.
23
35
- The `get_block_balances` method should be as efficient as possible. So the use of the cached data from previous blocks if possible is highly encouraged.
24
36
- We prefer that on chain RPC calls are used to get information as much as possible due to reliability and trustlessness. Off chain calls to apis or subgraphs are acceptable if necessary. If usage is not reasonable or the external service is not reliable, users may not receive their points.
25
37
26
-
# Example Integrations
27
-
-[ClaimedEnaIntegration](integrations/claimed_ena_example_integration.py): This integration demonstrates how to track ENA token claims using cached balance snapshots for improved performance. It reads from previous balance snapshots to efficiently track user claim history.
28
-
-[BeefyCachedBalanceExampleIntegration](integrations/beefy_cached_balance_example_integration.py): This integration is an example of a cached balance integration that is based on API calls.
29
-
-[PendleLPTIntegration](integrations/pendle_lpt_integration.py): (Legacy Example) A basic integration showing Pendle LPT staking tracking. Note: This is a non-cached implementation included only for reference - new integrations should use the cached approach for better efficiency.
30
-
-[PendleYTIntegration](integrations/pendle_yt_integration.py): (Legacy Example) A basic integration showing Pendle YT staking tracking. Note: This is a non-cached implementation included only for reference - new integrations should use the cached approach for better efficiency.
38
+
# L2 Delegation Setup Requirements
39
+
40
+
For non-EVM chain integrations (like Solana) or users that don't control the same addresses in the L2 and Ethereum, your users must complete an additional delegation step to receive points. This process links their L2 wallet to their Ethereum address:
41
+
42
+
1. Visit the [Ethena UI](https://app.ethena.fi) and connect your Ethereum wallet
43
+
2. Navigate to [Ethena Delegation Section](https://app.ethena.fi/delegation)
5. Connect your wallet and sign a message to prove ownership
51
+
6. Once delegated, your L2 balances will be attributed to your Ethereum address for points calculation
52
+
53
+
**Important Notes:**
54
+
- Users can delegate at any moment and they won't miss any past points.
55
+
56
+
# Examples
57
+
## Cached Balances Integrations (Default)
58
+
-[ClaimedEnaIntegration](integrations/claimed_ena_example_integration.py): This integration demonstrates how to track ENA token claims using cached balance
59
+
snapshots for improved performance. It reads from previous balance snapshots to efficiently track user claim history.
60
+
-[BeefyCachedBalanceExampleIntegration](integrations/beefy_cached_balance_example_integration.py): This integration is an example of a cached balance integration
- Shows how to integrate external API data sources
72
+
- Demonstrates proper API response handling
73
+
74
+
## Legacy Integrations (Don't use, just for reference)
75
+
-[PendleLPTIntegration](integrations/pendle_lpt_integration.py): (Legacy Example) A basic integration showing Pendle LPT staking tracking. Note: This is a
76
+
non-cached implementation included only for reference - new integrations should use the cached approach for better efficiency.
77
+
-[PendleYTIntegration](integrations/pendle_yt_integration.py): (Legacy Example) A basic integration showing Pendle YT staking tracking. Note: This is a non-cached
78
+
implementation included only for reference - new integrations should use the cached approach for better efficiency.
0 commit comments