Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lulo tvl adapter with timetravel #11333

Merged
merged 1 commit into from
Aug 17, 2024
Merged

Conversation

0xBraunGuy
Copy link
Contributor

NOTE

Please enable "Allow edits by maintainers" while putting up the PR.


  • If you would like to add a volume adapter please submit the PR here.
  • If you would like to add a liquidations adapter, please refer to this readme document for details.
  1. Once your adapter has been merged, it takes time to show on the UI. If more than 24 hours have passed, please let us know in Discord.
  2. Sorry, We no longer accept fetch adapter for new projects, we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you.
  3. Please fill the form below only if the PR is for listing a new protocol else it can be ignored/replaced with reason/details about the PR
  4. For updating listing info It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data2.ts, you can edit it there and put up a PR
  5. Do not edit/push package-lock.json file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CI
  6. No need to go to our discord and announce that you've created a PR, we monitor all PRs and will review it asap

Name (to be shown on DefiLlama):

Lulo

Twitter Link:

https://x.com/uselulo

List of audit links if any:

https://docs.lulo.fi/audits

Website Link:

https://lulo.fi/

Logo (High resolution, will be shown with rounded borders):

image

Current TVL:

$30M

Treasury Addresses (if the protocol has treasury)
Chain:

Solana

Coingecko ID (so your TVL can appear on Coingecko, leave empty if not listed): (https://api.coingecko.com/api/v3/coins/list)
Coinmarketcap ID (so your TVL can appear on Coinmarketcap, leave empty if not listed): (https://api.coinmarketcap.com/data-api/v3/map/all?listing_status=active,inactive,untracked&start=1&limit=10000)
Short Description (to be shown on DefiLlama):

Lulo is a decentralized lending aggregator, which automatically optimizes users deposits by migrating their deposits to the lending pool with the best yield, while allowing for personalized risk settings

Token address and ticker if any:
Category (full list at https://defillama.com/categories) *Please choose only one:

Yield Aggregator

Oracle Provider(s): Specify the oracle(s) used (e.g., Chainlink, Band, API3, TWAP, etc.):
Implementation Details: Briefly describe how the oracle is integrated into your project:
Documentation/Proof: Provide links to documentation or any other resources that verify the oracle's usage:
forkedFrom (Does your project originate from another project):
methodology (what is being counted as tvl, how is tvl being calculated):

TVL is calculated by summing the total USD value of deposited funds in Lulo across all tokens

Github org/user (Optional, if your code is open source, we can track activity):

@llamatester
Copy link

The adapter at projects/lulo exports TVL:

solana                    29.96 M

total                    29.96 M 

Copy link
Member

@g1nt0ki g1nt0ki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xBraunGuy thanks for the PR

But please compute tvl using on chain data

@g1nt0ki g1nt0ki self-assigned this Aug 16, 2024
@0xBraunGuy
Copy link
Contributor Author

@0xBraunGuy thanks for the PR

But please compute tvl using on chain data

We don't store our specific deposits on-chain, It's not possible without adding the SDK's for all 5 different protocols which we integrate.

And doing so, we would still have to fetch ~10k users at 5 different protocols == ~50k on-chain fetches using the 5 different SDK's.

And we would lose historical data doing it that way.

@g1nt0ki
Copy link
Member

g1nt0ki commented Aug 16, 2024

do users interact with contracts deployed by lulo? right now, the adapter is a blackbox, there is no way for us/our users to verify the data

@0xBraunGuy
Copy link
Contributor Author

do users interact with contracts deployed by lulo? right now, the adapter is a blackbox, there is no way for us/our users to verify the data

The smart contracts are just boilerplate deposit and withdraw transactions. There is no state that we maintain on-chain.

It's the same dataset we use to support the app itself, and manage user transactions:
https://docs.lulo.fi/api-docs

@g1nt0ki
Copy link
Member

g1nt0ki commented Aug 16, 2024

but for a given token, interaction of all users and all platforms go through the same account controlled by Lulo? like https://solscan.io/account/91vPdPvYZ2W8VgUkQ28r2nePyE7V6qMq1ZyNRB9RrJ1k for PYUSD

but end of (lets say) a transaction where user deposits 100k PYUSD into drift, where is the state recorded? in user controlled account or 91vPdPvYZ2W8VgUkQ28r2nePyE7V6qMq1ZyNRB9RrJ1k? i.e can the user directly interact with drift and withdraw?

@0xBraunGuy
Copy link
Contributor Author

but for a given token, interaction of all users and all platforms go through the same account controlled by Lulo? like https://solscan.io/account/91vPdPvYZ2W8VgUkQ28r2nePyE7V6qMq1ZyNRB9RrJ1k for PYUSD

but end of (lets say) a transaction where user deposits 100k PYUSD into drift, where is the state recorded? in user controlled account or 91vPdPvYZ2W8VgUkQ28r2nePyE7V6qMq1ZyNRB9RrJ1k? i.e can the user directly interact with drift and withdraw?

Yep that's the user controlled account (authority) in the Lulo smart contract. But the deposited state is kept at Drift/Kamino/Marginfi,etc. It's just the authority to deposit/withdraw that lives inside Lulo. The user needs to directly interact with Lulo to withdraw from Drift (wallet -> authority -> Drift), but the tokens/deposited amount are not kept in Lulo.

So in order to fetch TVL on-chain, you would need to query each user / mint / protocol combo, and that requires each protocol's SDK (and thousands of RPC calls). Which is exactly what our backend does and persists it behind the API.

@0xBraunGuy
Copy link
Contributor Author

0xBraunGuy commented Aug 16, 2024

but for a given token, interaction of all users and all platforms go through the same account controlled by Lulo? like https://solscan.io/account/91vPdPvYZ2W8VgUkQ28r2nePyE7V6qMq1ZyNRB9RrJ1k for PYUSD
but end of (lets say) a transaction where user deposits 100k PYUSD into drift, where is the state recorded? in user controlled account or 91vPdPvYZ2W8VgUkQ28r2nePyE7V6qMq1ZyNRB9RrJ1k? i.e can the user directly interact with drift and withdraw?

Yep that's the user controlled account (authority) in the Lulo smart contract. But the deposited state is kept at Drift/Kamino/Marginfi,etc. It's just the authority to deposit/withdraw that lives inside Lulo. The user needs to directly interact with Lulo to withdraw from Drift (wallet -> authority -> Drift), but the tokens/deposited amount are not kept in Lulo.

So in order to fetch TVL on-chain, you would need to query each user / mint / protocol combo, and that requires each protocol's SDK (and thousands of RPC calls). Which is exactly what our backend does and persists it behind the API.

Also, a few portfolio trackers have us integrated. If you plug the wallet for the above account into Sonar.Watch, you should see the Lulo deposits.

Or similarly for the Lulo authority above:
https://sonar.watch/portfolio/91vPdPvYZ2W8VgUkQ28r2nePyE7V6qMq1ZyNRB9RrJ1k

@g1nt0ki g1nt0ki merged commit 88221ee into DefiLlama:main Aug 17, 2024
1 check passed
0xIvan pushed a commit to 0xIvan/DefiLlama-Adapters that referenced this pull request Sep 11, 2024
tlatkdgus1 pushed a commit to bifrost-platform/DefiLlama-Adapters that referenced this pull request Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants