For the complete documentation index, see llms.txt. This page is also available as Markdown.

Gearbox

This page covers the Gearbox-specific integration flows for KPK Earn Pools: direct ERC-4626 calls with the KPK referral code, the Gearbox TypeScript SDK, and supporting reference material. For the general integrator overview and audience-routing, start at the Integration page.

End-users who simply want to deposit should use the Gearbox UI directly. Pool addresses, supported assets, and current parameters are listed on each pool page.

The guide uses wstETH and the kpkwstETH Earn Pool as the example.

Integration paths

KPK pools on Gearbox are ERC-4626 passive lending pools. Unlike Morpho or Euler, Gearbox pools do not allocate across multiple underlying markets: the pool lends a single asset to Gearbox borrowers through the Credit Account system, and the integrator-facing surface is the pool itself.

Two integration paths:

  • Direct ERC-4626 calls with depositWithReferral. Simple, two transactions, and ensures KPK is correctly attributed via the referral code (4143). This is the recommended path for most integrators.

  • Gearbox TypeScript SDK. Higher-level access to pool data, market discovery, and transaction construction. Useful if you also need market metadata (supply rate, total assets, available liquidity) or plan to support multiple Gearbox pools.

For pool discovery, KPK-curated Earn Pools are listed on the pool directory and can also be retrieved onchain via the Gearbox Market Configurator.

Direct ERC-4626 integration

The recommended deposit path is depositWithReferral, which is the standard ERC-4626 deposit plus a referral code that attributes the deposit to KPK.

Deposit

1

Approve the pool to spend wstETH.

Call approve(address, uint256) on wstETH (0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0):

  • spender(address) = 0xa9d17f6d3285208280a1fd9b94479c62e0aaba64, i.e. kpkwstETH

  • value(amount) = token amount to deposit

2

Deposit with the KPK referral code.

  • assets(uint256) = tokens to be deposited

  • receiver(address) = your address, or the address to which you want the receipt tokens sent

  • referralCode(uint256) = 4143, i.e. the KPK referral code

The plain deposit(assets, receiver) ERC-4626 method also works if you cannot pass a referral code, but depositWithReferral is preferred so KPK is correctly attributed in Gearbox analytics.

Withdraw

1

Withdraw a specific asset amount.

  • assets(uint256) = amount of wstETH to withdraw

  • receiver(address) = the address that should receive the wstETH (or WETH, depending on configuration)

  • owner(address) = the address whose shares should be burned (the depositor, or any address that has approved the caller)

Or by share amount:

1

Redeem a specific share amount.

Call redeem(shares, receiver, owner) on the pool.

TypeScript SDK integration

The @gearbox-protocol/sdk package exposes pool state and transaction helpers. It is the right choice if your integration needs to read live pool metrics (supply rate, total assets, available liquidity) or supports multiple Gearbox pools at once.

Install and instantiate

Read pool state

Find a KPK Earn Pool by its address and read its key metrics:

For deposits and withdrawals, the SDK currently focuses on Credit Account flows for borrowers. For passive lending into a KPK Earn Pool, use the direct ERC-4626 calls described above with the referral code; the SDK is most useful for the surrounding read-side state.

Claim rewards

KPK Earn Pools may distribute additional GEAR or other incentive tokens via Merkl. Claim them with:

The claim is a separate transaction and does not modify the user's deposited position.

Reference

Support

For integration questions, technical reviews, or hands-on help, reach out to sales@karpatkey.com or use the contact form. For protocol-level Gearbox documentation, see docs.gearbox.finance.

Last updated