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

Add sturgeon and refactor code #10784

Merged
merged 4 commits into from
Jul 5, 2024
Merged

Add sturgeon and refactor code #10784

merged 4 commits into from
Jul 5, 2024

Conversation

g1nt0ki
Copy link
Member

@g1nt0ki g1nt0ki commented Jun 26, 2024

No description provided.

@g1nt0ki g1nt0ki self-assigned this Jun 26, 2024
@llamatester
Copy link

The adapter at projects/sturgeon exports TVL:

real                      0

total                    0.32333489729074066 

@g1nt0ki g1nt0ki mentioned this pull request Jun 26, 2024
Copy link
Contributor

@a17 a17 left a comment

Choose a reason for hiding this comment

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

While reviewing I found two problems:

  • need to use getTotalAmounts, i requested changes
  • arcUSD. as example, has price on coingecko (coingeckoId: 'arcana-2'), but not show price by this URL https://coins.llama.fi/prices/current/real:0xb08f026f8a096e6d92eb5bcbe102c273a7a2d51c,real:0x4644066f535ead0cde82d209df78d94572fcbf14,real:0x90c6e93849e06ec7478ba24522329d14a5954df4,real:0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd,real:0xaec9e50e3397f9ddc635c6c429c8c7eca418a143,real:0x25ea98ac87a38142561ea70143fd44c4772a16b6,real:0x75d0cbf342060b14c2fc756fd6e717dfeb5b1b70,real:0xce1581d7b4ba40176f0e219b2cac30088ad50c7a,real:0x835d3e1c0aa079c6164aad21dcb23e60eb71af48

const tridents = await api.multiCall({ abi: 'address:asset', calls: harvesterVaults })
const tridentBalances = await api.multiCall({ abi: 'uint256:totalAssets', calls: harvesterVaults })
const token0s = await api.multiCall({ abi: 'address:token0', calls: tridents })
const token0Bals = await api.multiCall({ abi: 'uint256:getBalance0', calls: tridents })
Copy link
Contributor

Choose a reason for hiding this comment

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

The getBalance0/1 methods return only the balance of the ALM contract minus protocol commissions, but to calculate TVL we need the sum of ALM's balance in the POOL and ALM contract balance. There is a method for this in Trident LiquidBox ALM:

/**
 * @notice Calculates the vault's total holdings of token0 and token1 - in
 * other words, how much of each token the vault would hold if it withdrew
 * all its liquidity from Uniswap.
 */
function getTotalAmounts() external view returns (uint total0, uint total1, uint128 liquidity);

This method need to be used instead getBalance0/1.

@a17
Copy link
Contributor

a17 commented Jun 28, 2024

@g1nt0ki As I understand it, the test script uses a deployed API, which does not know about Coingeco ID for arcUSD and others tokens.
That is, the second problem can be solved by itself.

@llamatester
Copy link

The adapter at projects/sturgeon exports TVL:

real                      7.82 k

total                    7.82 k 

@g1nt0ki
Copy link
Member Author

g1nt0ki commented Jul 5, 2024

@a17 thanks for the review, fixed based on your comments

@g1nt0ki g1nt0ki merged commit f22f500 into main Jul 5, 2024
1 check failed
@g1nt0ki g1nt0ki deleted the sturgeon branch July 5, 2024 16:49
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