Skip to content

Add Beracana Protocol TVL on Berachain #14520

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

Merged
merged 2 commits into from
May 9, 2025

Conversation

prasenjit-26
Copy link
Contributor

@prasenjit-26 prasenjit-26 commented May 2, 2025

Name (to be shown on DefiLlama): Beracana
Twitter Link: https://x.com/beracana
List of audit links if any: https://app.beracana.com/beracana-audit.pdf
Website Link: https://beracana.com/
Logo (High resolution, will be shown with rounded borders): https://app.beracana.com/beracana.png
Current TVL: 16.36 k
Treasury Addresses (if the protocol has treasury)
Chain: Berachain
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):Beracana focuses on providing users with a way to amplify their gains while participating in the Berachain ecosystem. At its core, Beracana facilitates undercollateralized lending, meaning users can deposit assets and borrow more than the value of their initial deposit, up to 5x the leverage.
Token address and ticker if any:
Category (full list at https://defillama.com/categories) *Please choose only one: Leveraged Farming
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):
Github org/user (Optional, if your code is open source, we can track activity): AuroBlocks-Studios

@llamabutler
Copy link

The adapter at projects/beracana exports TVL:

berachain                 16.37 k

total                    16.37 k 

@prasenjit-26 prasenjit-26 changed the title beracana adapter for tvl Add Beracana Protocol TVL on Berachain May 2, 2025
const { banks, vaults } = await getContracts();
const tokens = banks.map(i => i.token)
const bankAddresses = banks.map(i => i.bank)
const currentFunds = await api.multiCall({ abi: 'function currentFunds() view returns (uint256)', calls: bankAddresses })
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we use erc20:balanceOf rather than currentFunds() and totalFunds() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey we can't use erc20:balanceOf directly because

currentFunds() returns the amount of funds available to borrow in the bank, while totalFunds() returns the total amount the bank controls: both the available funds plus the amount already lent out as debt.

Since funds are distributed across different vaults and not just held in the contract itself, there's no single balanceOf function that can accurately reflect the true total value locked (TVL). That’s why we need these custom functions—to get the full picture across all assets, not just what’s sitting in the contract.

Copy link
Collaborator

Choose a reason for hiding this comment

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

please export currentFunds() as tvl and the difference between totalFunds() and currentFunds() as borrowed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey Our protocol has a utilization of 98% so the TVL would not be reflective of the actual value locked in the protocol.

There is way to do looping in our protocol because we only allow borrows that go into vaults within our own protocol.

We can either add the borrowed value to the TVL, or if you prefer, we can include the vaults in the TVL where the entirety of the borrowed amount resides.

Copy link
Collaborator

Choose a reason for hiding this comment

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

do the tokens sit in the vault contracts? what do the vaults do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the vaults convert tokens to lp for farming and auto compound the earned rewards

Copy link
Collaborator

Choose a reason for hiding this comment

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

okay lets try counting the vault assets instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey , sorry for the delay , pushed the changes let me know if this works .
Thanks

@waynebruce0x waynebruce0x self-assigned this May 5, 2025
@llamabutler
Copy link

The adapter at projects/beracana exports TVL:

berachain                 16.37 k

total                    16.37 k 

@waynebruce0x waynebruce0x merged commit 9a66a20 into DefiLlama:main May 9, 2025
1 check passed
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