Skip to content

Add Makina adapter#2756

Open
Hugoo wants to merge 1 commit into
DefiLlama:masterfrom
MakinaHQ:master
Open

Add Makina adapter#2756
Hugoo wants to merge 1 commit into
DefiLlama:masterfrom
MakinaHQ:master

Conversation

@Hugoo

@Hugoo Hugoo commented Jun 23, 2026

Copy link
Copy Markdown

Add yield adapter for Makina:

https://defillama.com/protocol/makina

https://makina.finance/

Summary by CodeRabbit

  • New Features
    • Added Makina protocol integration to surface strategy pools across multiple chains, including share price–based APY, TVL/valuation in USD, and related pool details and links.
  • Documentation
    • Added TypeScript type definitions for Makina strategy and token responses to improve consistency of returned data.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f9c42f59-ccf4-4ec1-8202-f662a5be9464

📥 Commits

Reviewing files that changed from the base of the PR and between 9a078a3 and 977da63.

📒 Files selected for processing (2)
  • src/adaptors/makina/index.ts
  • src/adaptors/makina/types.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/adaptors/makina/types.ts
  • src/adaptors/makina/index.ts

📝 Walkthrough

Walkthrough

Adds 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.

Changes

Makina Adaptor

Layer / File(s) Summary
Strategy response types
src/adaptors/makina/types.ts
Defines the Token interface and MakinaStrategiesResponse type for the strategies API payload.
Snapshot batching helper
src/adaptors/makina/index.ts
Adds readSnapshots, which batches lastTotalAum and totalSupply multicalls with permitFailure and returns aligned snapshot results.
APY calculation and export
src/adaptors/makina/index.ts
Fetches strategies, filters supported chains, resolves accounting-token prices, groups strategies by hub chain, reads current and prior snapshots, computes sharePrice, tvlUsd, and annualized apyBase, and exports the adaptor configuration.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • 0xkr3p

Poem

🐰 Makina hops through chains so bright,
Counts the vaults by day and night,
Shares and AUM start to sing,
APY blooms in rabbit spring,
With prices found, the pools take flight 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a new Makina adapter.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

The makina adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 50 passed, 50 total
Snapshots: 0 total
Time: 0.239 s
Ran all test suites.

Nb of pools: 5
 

Sample pools:
┌─────────┬──────────────────────────────────────────────────────────────┬────────────┬──────────┬──────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────────┬────────────────────┬────────────────────┬────────────────────┬──────────────────────────────────────────────────────────────────────────────┐
│ (index) │ pool                                                         │ chain      │ project  │ symbol           │ token                                        │ underlyingTokens                                 │ apyBase            │ pricePerShare      │ tvlUsd             │ url                                                                          │
├─────────┼──────────────────────────────────────────────────────────────┼────────────┼──────────┼──────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────────┼────────────────────┼────────────────────┼────────────────────┼──────────────────────────────────────────────────────────────────────────────┤
│ 0       │ 'makina-0x733aBb32544f4D3053a58eD747538c060f559108-ethereum' │ 'Ethereum' │ 'makina' │ 'usdSHFmk'       │ '0xaC499adf00A54044b988a59B19016655C3494b06' │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 5.527858653380029  │ 1.019062           │ 24310447.489142913 │ 'https://makina.finance/strategy/0x733aBb32544f4D3053a58eD747538c060f559108' │
│ 1       │ 'makina-0xFa097420f0e2C72456B361a1eD85172B9ccd8c38-ethereum' │ 'Ethereum' │ 'makina' │ 'intMkSrRoyUSDC' │ '0x1004D230aCA4b781d0049AFD6D0b1ee8ed3A6787' │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 3.3629610884825127 │ 1.010025           │ 12991821.168828605 │ 'https://makina.finance/strategy/0xFa097420f0e2C72456B361a1eD85172B9ccd8c38' │
│ 2       │ 'makina-0x6b006870C83b1Cd49E766Ac9209f8d68763Df721-ethereum' │ 'Ethereum' │ 'makina' │ 'DUSD'           │ '0x1e33E98aF620F1D563fcD3cfd3C75acE841204ef' │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 3.57501928038626   │ 1.030557           │ 6964688.343907856  │ 'https://makina.finance/strategy/0x6b006870C83b1Cd49E766Ac9209f8d68763Df721' │
│ 3       │ 'makina-0x0447D0aD7FD6a3409B48Ecbb9DDB075C1e11D735-ethereum' │ 'Ethereum' │ 'makina' │ 'DETH'           │ '0x871aB8E36CaE9AF35c6A3488B049965233DeB7ed' │ [ '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' ] │ 2.7919166143763485 │ 1.0135730661287976 │ 4407856.222796927  │ 'https://makina.finance/strategy/0x0447D0aD7FD6a3409B48Ecbb9DDB075C1e11D735' │
│ 4       │ 'makina-0xFCbE132452B6CAA32AdDd4768Db8fA02aF73d841-ethereum' │ 'Ethereum' │ 'makina' │ 'DBIT'           │ '0x972966bCC17f7d818De4F27Dc146Ef539c231BdF' │ [ '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599' ] │ 0.3177927779869732 │ 1.00348291         │ 657238.8490584744  │ 'https://makina.finance/strategy/0xFCbE132452B6CAA32AdDd4768Db8fA02aF73d841' │
└─────────┴──────────────────────────────────────────────────────────────┴────────────┴──────────┴──────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────────┴────────────────────┴────────────────────┴────────────────────┴──────────────────────────────────────────────────────────────────────────────┘

@Hugoo Hugoo changed the title feat: add makina adapter Add makina adapter Jun 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3cff94a and c0f9bc2.

📒 Files selected for processing (2)
  • src/adaptors/makina/index.ts
  • src/adaptors/makina/types.ts

Comment thread src/adaptors/makina/index.ts
Comment thread src/adaptors/makina/index.ts Outdated
Comment thread src/adaptors/makina/index.ts Outdated
Comment thread src/adaptors/makina/index.ts Outdated
@Hugoo Hugoo changed the title Add makina adapter Add Makina adapter Jun 23, 2026
@github-actions

Copy link
Copy Markdown

The makina adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 50 passed, 50 total
Snapshots: 0 total
Time: 0.306 s
Ran all test suites.

Nb of pools: 5
 

Sample pools:
┌─────────┬──────────────────────────────────────────────────────────────┬────────────┬──────────┬──────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────────┬────────────────────┬────────────────────┬────────────────────┬──────────────────────────────────────────────────────────────────────────────┐
│ (index) │ pool                                                         │ chain      │ project  │ symbol           │ token                                        │ underlyingTokens                                 │ apyBase            │ pricePerShare      │ tvlUsd             │ url                                                                          │
├─────────┼──────────────────────────────────────────────────────────────┼────────────┼──────────┼──────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────────┼────────────────────┼────────────────────┼────────────────────┼──────────────────────────────────────────────────────────────────────────────┤
│ 0       │ 'makina-0x733aBb32544f4D3053a58eD747538c060f559108-ethereum' │ 'Ethereum' │ 'makina' │ 'usdSHFmk'       │ '0xaC499adf00A54044b988a59B19016655C3494b06' │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 5.527858653380029  │ 1.019062           │ 24311068.177296415 │ 'https://makina.finance/strategy/0x733aBb32544f4D3053a58eD747538c060f559108' │
│ 1       │ 'makina-0xFa097420f0e2C72456B361a1eD85172B9ccd8c38-ethereum' │ 'Ethereum' │ 'makina' │ 'intMkSrRoyUSDC' │ '0x1004D230aCA4b781d0049AFD6D0b1ee8ed3A6787' │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 3.3629610884825127 │ 1.010025           │ 12992152.872697713 │ 'https://makina.finance/strategy/0xFa097420f0e2C72456B361a1eD85172B9ccd8c38' │
│ 2       │ 'makina-0x6b006870C83b1Cd49E766Ac9209f8d68763Df721-ethereum' │ 'Ethereum' │ 'makina' │ 'DUSD'           │ '0x1e33E98aF620F1D563fcD3cfd3C75acE841204ef' │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 3.57501928038626   │ 1.030557           │ 6964866.16455677   │ 'https://makina.finance/strategy/0x6b006870C83b1Cd49E766Ac9209f8d68763Df721' │
│ 3       │ 'makina-0x0447D0aD7FD6a3409B48Ecbb9DDB075C1e11D735-ethereum' │ 'Ethereum' │ 'makina' │ 'DETH'           │ '0x871aB8E36CaE9AF35c6A3488B049965233DeB7ed' │ [ '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' ] │ 2.7919166143763485 │ 1.0135730661287976 │ 4430707.082267307  │ 'https://makina.finance/strategy/0x0447D0aD7FD6a3409B48Ecbb9DDB075C1e11D735' │
│ 4       │ 'makina-0xFCbE132452B6CAA32AdDd4768Db8fA02aF73d841-ethereum' │ 'Ethereum' │ 'makina' │ 'DBIT'           │ '0x972966bCC17f7d818De4F27Dc146Ef539c231BdF' │ [ '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599' ] │ 0.3177927779869732 │ 1.00348291         │ 661324.2081628155  │ 'https://makina.finance/strategy/0xFCbE132452B6CAA32AdDd4768Db8fA02aF73d841' │
└─────────┴──────────────────────────────────────────────────────────────┴────────────┴──────────┴──────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────────┴────────────────────┴────────────────────┴────────────────────┴──────────────────────────────────────────────────────────────────────────────┘

@0xkr3p 0xkr3p left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hey @Hugoo thanks for the PR, please can you calculate APY and TVL on chain? we have the defillama sdk and helpers such as erc4626

@Hugoo

Hugoo commented Jun 24, 2026

Copy link
Copy Markdown
Author

hey @Hugoo thanks for the PR, please can you calculate APY and TVL on chain? we have the defillama sdk and helpers such as erc4626

thanks @0xkr3p - let me try. For TVL I can do but for the APY it might be a bit tricky. will send an update

@0xkr3p

0xkr3p commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

hey @Hugoo thanks for the PR, please can you calculate APY and TVL on chain? we have the defillama sdk and helpers such as erc4626

thanks @0xkr3p - let me try. For TVL I can do but for the APY it might be a bit tricky. will send an update

feel free to checkout other adapters, can use price per share and compare with historical block e.g. 7d vs now

@github-actions

Copy link
Copy Markdown

The makina adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 50 passed, 50 total
Snapshots: 0 total
Time: 0.292 s
Ran all test suites.

Nb of pools: 5
 

Sample pools:
┌─────────┬──────────────────────────────────────────────────────────────┬────────────┬──────────┬──────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────────┬──────────────────────┬────────────────────┬────────────────────┬──────────────────────────────────────────────────────────────────────────────┐
│ (index) │ pool                                                         │ chain      │ project  │ symbol           │ token                                        │ underlyingTokens                                 │ apyBase              │ pricePerShare      │ tvlUsd             │ url                                                                          │
├─────────┼──────────────────────────────────────────────────────────────┼────────────┼──────────┼──────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────────┼──────────────────────┼────────────────────┼────────────────────┼──────────────────────────────────────────────────────────────────────────────┤
│ 0       │ 'makina-0x733aBb32544f4D3053a58eD747538c060f559108-ethereum' │ 'Ethereum' │ 'makina' │ 'usdSHFmk'       │ '0xaC499adf00A54044b988a59B19016655C3494b06' │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 5.518384967442724    │ 1.0192258705747859 │ 24336075.397687964 │ 'https://makina.finance/strategy/0x733aBb32544f4D3053a58eD747538c060f559108' │
│ 1       │ 'makina-0xFa097420f0e2C72456B361a1eD85172B9ccd8c38-ethereum' │ 'Ethereum' │ 'makina' │ 'intMkSrRoyUSDC' │ '0x1004D230aCA4b781d0049AFD6D0b1ee8ed3A6787' │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 3.015612219994801    │ 1.0101672879941888 │ 12994390.382582815 │ 'https://makina.finance/strategy/0xFa097420f0e2C72456B361a1eD85172B9ccd8c38' │
│ 2       │ 'makina-0x6b006870C83b1Cd49E766Ac9209f8d68763Df721-ethereum' │ 'Ethereum' │ 'makina' │ 'DUSD'           │ '0x1e33E98aF620F1D563fcD3cfd3C75acE841204ef' │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 3.0783186539169227   │ 1.0308308710842902 │ 6966233.105655325  │ 'https://makina.finance/strategy/0x6b006870C83b1Cd49E766Ac9209f8d68763Df721' │
│ 3       │ 'makina-0x0447D0aD7FD6a3409B48Ecbb9DDB075C1e11D735-ethereum' │ 'Ethereum' │ 'makina' │ 'DETH'           │ '0x871aB8E36CaE9AF35c6A3488B049965233DeB7ed' │ [ '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' ] │ 2.7862652249687647   │ 1.0137275902005498 │ 4323668.848429421  │ 'https://makina.finance/strategy/0x0447D0aD7FD6a3409B48Ecbb9DDB075C1e11D735' │
│ 4       │ 'makina-0xFCbE132452B6CAA32AdDd4768Db8fA02aF73d841-ethereum' │ 'Ethereum' │ 'makina' │ 'DBIT'           │ '0x972966bCC17f7d818De4F27Dc146Ef539c231BdF' │ [ '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599' ] │ 0.008192369334736327 │ 1.003482916758648  │ 640585.587690135   │ 'https://makina.finance/strategy/0xFCbE132452B6CAA32AdDd4768Db8fA02aF73d841' │
└─────────┴──────────────────────────────────────────────────────────────┴────────────┴──────────┴──────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────────┴──────────────────────┴────────────────────┴────────────────────┴──────────────────────────────────────────────────────────────────────────────┘

@Hugoo

Hugoo commented Jun 24, 2026

Copy link
Copy Markdown
Author

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 MachineCreated and this is not as easy to do as simply calling a contract.

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.

2 participants