-
Notifications
You must be signed in to change notification settings - Fork 6k
Add LA Exchange Adapter #14596
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
Draft
laexchange
wants to merge
5
commits into
DefiLlama:main
Choose a base branch
from
laexchange:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add LA Exchange Adapter #14596
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f67724d
add laexchange
1007ee2
Merge branch 'DefiLlama:main' into main
laexchange d9440b0
Merge branch 'DefiLlama:main' into main
laexchange 3b4c29d
add misrepresentedTokens: true
844b083
Merge branch 'main' of github.com:laexchange/DefiLlama-Adapters
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
async function tvl(api) { | ||
const LAUNCHPOOL_CONTRACT = "0x82Bcfb5695a7E5c3cE2a9f49bFAf6e28BB23F486" | ||
const CURRENCY_ADDRESS = "0xdAC17F958D2ee523a2206206994597C13D831ec7" // USDT | ||
|
||
const {currV, TVL } = await api.call({ | ||
target: LAUNCHPOOL_CONTRACT, | ||
abi: 'function calcTVL(address currency) view returns (uint256 currV, uint256 TVL)', | ||
params: [CURRENCY_ADDRESS] | ||
}) | ||
api.addToken(CURRENCY_ADDRESS, TVL) | ||
return { | ||
'ethereum': TVL | ||
} | ||
} | ||
|
||
module.exports = { | ||
methodology: 'Calculates the total amount of ETH, USDT, USDC, and USDX deposited across various pools', | ||
misrepresentedTokens: true, | ||
ethereum: { | ||
tvl | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can use erc20:balanceOf or getBalance instead please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The contract will create many sub-contracts, and the assets will be stored in the sub-contracts respectively. There is a function dedicated to calculating TVL, which can be obtained directly. The specific contract logic is open source, and you can refer to https://etherscan.io/address/0xf94342d9eb0f42ea6bb6901170db7479e3e88e52#code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we fetch a list of subcontracts from an API and then use erc20:balanceOf?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course we can, but using the server's API will make it more centralized. We prefer an open source and decentralized approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cant use calcTVL()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it doesnt give us a breakdown of assets held
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
totalCurrencyLast is just for the convenience of making a statistical calculation of funds. Its underlying change logic is deposit and withdraw. We will update it at a reasonable position.
If this is unacceptable, do I need to write a set of APIs to return a bunch of addresses and then balanceOf?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we would use balanceOf across a list of holder addresses yeah