Skip to main content
This recipe shows how to offer yield on wARS and wBRL inside your product by integrating the Morpho vaults that KPK curates on Ethereum. Your users deposit wFiat, the vault lends it to over-collateralized borrowers on Morpho markets, and returns accrue in local currency stablecoins: no conversion to USD at any step.
Ripio doesn’t operate, curate or guarantee these vaults. They are permissionless smart contracts on Morpho, and KPK acts as their curator. Read the risks before you offer them to your users.

How it works

1

The user deposits wFiat in the vault

The vault is an ERC-4626 token: it takes wARS or wBRL and mints vault shares to the depositor.
2

The curator allocates to Morpho markets

KPK decides which Morpho markets the vault supplies to and how much goes to each, within the limits of its risk policy. Borrowers post collateral such as WETH, wstETH, WBTC or USDC and borrow wFiat, paying interest.
3

Returns accrue to the shares

Shares don’t rebase: each share is worth more wFiat over time. The user gets the principal plus yield back when they redeem the shares, depending on the vault’s results.
Both vaults are Morpho Vault V2 contracts with these roles:
  • Owner and sentinel: a 5-of-8 security council multisig. As sentinel it can veto pending timelocked changes.
  • Curator and allocator: a 2-of-5 KPK multisig per vault, which KPK’s automated agents act through. Moving funds between enabled markets is not timelocked, and adding allocators isn’t either.
  • Timelocks: 3 days to enable a new adapter or raise a cap, 7 days to remove an adapter, set the sendAssetsGate or lengthen a timelock, and 14 days to change fees.
On-chain caps are currently set to the maximum on every market, so KPK’s per-market limits (for example, a maximum share of the vault in a given market) are a policy KPK enforces, not a constraint in the contract. See KPK’s Morpho vaults page for roles and governance, and read the live caps from the Morpho API (caps on vaultV2ByAddress).

Vaults

Both vaults have 18 decimals, like the underlying wFiat, and currently charge no performance or management fee. Fee changes have a 14-day timelock. The curator changes allocations over time. Read the live list from the Morpho API or the vault pages above instead of hardcoding it.

Choose your integration

Link out

Send users to the vault page on the Morpho app or KPK’s app. No code, but users leave your product.

Direct contract calls

Call the vault’s ERC-4626 functions from your app or backend. Full control; this recipe shows it with viem.

Morpho SDK and Bundles

One-transaction approve and deposit with a signed permit, built with Morpho’s SDK.

Recipe

The examples below use viem on Ethereum mainnet, but any EVM tooling works.

0. Setup, constants and ABI

The snippets in the next steps import from these files.

1. Get wFiat on Ethereum

The vaults live on Ethereum mainnet, so the user needs wARS or wBRL there:
  • Buy them: with Ramps or Crypto as a Service, deliver wFiat to the user’s wallet on Ethereum.
  • Swap them: on Uniswap or any aggregator.
  • Bridge them: if the user holds wFiat on Base, Polygon, World Chain or any other supported chain, move it to Ethereum (chain id 1) with the Ripio Bridge. The route fee and the daily mint capacity apply as on any other route.

2. Show the APY and the vault size

Read the APY from the Morpho API instead of computing it yourself:
Incentive campaigns are temporary and can make up almost all of netApy. Show netApyExcludingRewards as the default yield, label rewards as a temporary incentive, and never present netApy as guaranteed. Values are decimals: 0.05 means 5%.

3. Approve and deposit

The user approves the vault on the wFiat token and calls deposit. Vault shares are minted to receiver.
deposit.ts
ERC-4626 deposit and redeem have no on-chain minimum-out parameter. The check above runs off-chain, right before sending. If you credit users from an internal ledger, always record the assets and shares from the Deposit and Withdraw events in the receipt, never the simulated or previewed values.
One transaction instead of two. wARS and wBRL support EIP-2612 permit, so the user can sign the approval off-chain. Morpho’s Bundles take that signature and run approve and deposit in a single transaction. The Morpho SDK builds these transactions for you. Morpho’s previous Bundler3 and GeneralAdapter1 are deprecated: don’t build new integrations on them.

4. Track the position

Shares don’t rebase, so convert them to wFiat to show the balance:
position.ts
To show earnings, store what the user deposited (from the Deposit events you recorded) and subtract it from assets.

5. Withdraw

Use redeem to exit fully (burns all shares) or withdraw for an exact amount of wFiat:
withdraw.ts
On Morpho Vault V2, maxDeposit, maxWithdraw, maxMint and maxRedeem always return 0. Don’t use them to size a “Max” button: use the user’s share balance and the liquidity check above, or the Morpho SDK’s helpers.
A regular withdrawal is served from the vault’s idle wFiat and, if one is set, the liquidity adapter. KPK targets keeping at least half of each vault reachable for withdrawals, counting idle funds and what can be pulled from markets. If a large exit exceeds what is available, the depositor (or an address they approved) can call forceDeallocate to pull wFiat from a market that has unborrowed liquidity. It charges a penalty that is burned from the depositor’s own shares:
  • It is 0.01% today. Read the current value with forceDeallocatePenalty(adapter) instead of hardcoding it.
  • The curator can change it without a timelock. KPK says it may raise it to 0.5% if it detects abuse, and the protocol maximum is 2%.

6. Claim rewards

Incentive rewards aren’t added to the vault’s share price. They accrue to the address that holds the shares and are claimed separately through Merkl: either send users to the Merkl app, or read claimable amounts and build the claim transaction with the Merkl API. Rewards keep accruing even if the user never opens your app. If you hold shares for your users in an omnibus wallet or a smart contract, make sure that address can call Merkl’s claim function and that you pass the rewards on to your users. Otherwise most of the advertised yield can stay unclaimed.

Monetize the integration

If you distribute these vaults to your users and want to earn a fee, KPK can deploy a Morpho fee wrapper for you: a vault on top of the KPK vault that charges your own performance or management fee and sends it to your fee recipient. Fee wrappers aren’t listed in the Morpho app, and the Morpho API reports their APY net of your fee. See KPK’s integration guide and contact them to set one up. Before you put users behind a wrapper, confirm:
  • Who holds the wrapper’s roles. Know who the owner, curator and sentinel of the wrapper are.
  • The wrapper’s gates are abdicated. Morpho considers a wrapper fully non-custodial only when its receive-shares, send-shares and receive-assets gates are abdicated at deployment.
  • The underlying vault’s gate. The KPK vaults’ sendAssetsGate isn’t abdicated: it can be set after a 7-day timelock, and a gate there could block the wrapper’s withdrawals.
  • How rewards reach your users. Merkl rewards accrue to the wrapper’s address, so agree with KPK and Merkl on how they are forwarded to wrapper depositors.

Risks to disclose to your users

  • Issuer and peg risk. wARS and wBRL are issued by Ripio and depend on its reserves backing them. The vault oracles value wARS and wBRL at a 1:1 reference price, so a depeg in the market isn’t reflected in pricing: liquidations could fail and leave bad debt in the vault.
  • Smart contract risk. Bugs in Morpho, the vault or the oracles can cause losses. Morpho and the vaults are audited, but audits don’t remove the risk.
  • Market and liquidation risk. If collateral prices drop faster than liquidations execute, markets can accrue bad debt that the vault absorbs. Liquidity of wFiat on-chain affects how smoothly liquidations work.
  • Oracle risk. Markets price wFiat against the collateral through a USD/ARS or USD/BRL feed. KPK notes that the USD/ARS feed reflects a crypto-derived rate, not the official onshore rate. Every wARS market uses the same USD/ARS feed, so a feed failure hits all of them at once.
  • Currency risk. wARS and wBRL track the ARS and BRL. Yield is earned in local currency stablecoins, so its value in USD moves with the exchange rate.
  • Withdrawal liquidity. When utilization is high, a regular withdrawal can exceed the available liquidity and require forceDeallocate, whose penalty the curator can raise at any time, or waiting for borrowers to repay.
  • Curator and governance risk. A 2-of-5 KPK multisig and KPK’s agents move funds between markets instantly, with no timelock, and on-chain caps don’t limit how much goes to each market. Only some changes, such as enabling new markets or changing fees, are timelocked and can be vetoed by the sentinel.
  • Variable yield. Native APY depends on borrowing demand and can be near zero; incentive rewards are temporary.
KPK publishes its risk framework and a per-vault risk assessment on each vault page. Also read their disclaimer and confirm the product is available in your users’ jurisdictions.

Resources

Questions about wFiat? Write to [email protected]. For vault-specific questions, contact KPK.