Add Makina adapter#2756
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds the Makina adaptor with strategy types, snapshot batching, and APY pool assembly. The adaptor fetches supported strategies, reads on-chain totals, computes TVL and APY, and exports the protocol metadata. ChangesMakina Adaptor
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The makina adapter exports pools: Test Suites: 1 passed, 1 total |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/adaptors/makina/index.ts`:
- Around line 45-47: The code accesses CHAIN_ID_TO_CHAIN_KEY without validating
that the chainId from s.accountingToken.chainId is a supported key, which can
result in undefined values that break utils.formatChain() at runtime. Add a
guard check before constructing the price key string to verify that the chainId
exists in CHAIN_ID_TO_CHAIN_KEY, and handle unsupported chain IDs appropriately
(either skip processing that record or throw a descriptive error). Apply this
same validation guard at all locations where CHAIN_ID_TO_CHAIN_KEY is indexed,
including the lines around 45 and the additional occurrences around lines 64-67.
- Line 71: The truthy check on strategy.apy7d at the apyBase assignment
incorrectly treats a zero value as falsy and returns null instead of preserving
it. Replace the truthy check with an explicit null/undefined check (using !==
null and !== undefined, or the nullish coalescing operator) so that valid zero
APY values are properly preserved and multiplied by 100 rather than being
converted to null.
- Line 58: The conversion of the aum string to a JavaScript Number using
Number(aum) causes precision loss for large integer values due to JavaScript's
floating-point limitations, which can corrupt TVL calculations. Replace the
Number(aum) conversion and division operation with a big number library utility
(such as ethers formatUnits or equivalent big number handling) that safely
converts base-unit token amounts to human-readable decimal values without losing
precision. Ensure the aumInTokens variable receives the correctly formatted
result using proper big number arithmetic instead of floating-point operations.
- Around line 60-74: The tvlUsd field in the apys.push() call is being set to
null when price is null, but the Pool type definition requires tvlUsd to be a
number type. Instead of assigning null, provide a default numeric value (such as
0) as a fallback when price is unavailable. Update the conditional assignment
for tvlUsd to ensure it always resolves to a number rather than null.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4a6a2cd2-9a3d-46a4-a82f-36f4c0ecd851
📒 Files selected for processing (2)
src/adaptors/makina/index.tssrc/adaptors/makina/types.ts
|
The makina adapter exports pools: Test Suites: 1 passed, 1 total |
feel free to checkout other adapters, can use price per share and compare with historical block e.g. 7d vs now |
|
The makina adapter exports pools: Test Suites: 1 passed, 1 total |
|
I updated the code @0xkr3p ;) looks good! You can also see the numbers here: https://operator.makina.finance/dashboard/strategies I still load the machines from our indexer API because getting this list relies on listening to events |
Add yield adapter for Makina:
https://defillama.com/protocol/makina
https://makina.finance/
Summary by CodeRabbit