Skip to main content

How do I borrow or repay through Enso?

Borrow, repay, and similar lending actions are Bundle cases, generally with the delegate strategy. They are not available as a single Route path.

J
Written by Javier Diaz

Borrow, repay, and similar lending actions are Bundle cases. Compose them as ordered actions, generally with the delegate routing strategy, so protocol state stays with the user’s account.

Definition

Lending operations that must keep debt or collateral state at the user’s address are not a single tokenIn to tokenOut Route. They are explicit Bundle actions.

How it works

  • Use Bundle when Get Started lists the need as harvest, borrow, repay, leverage, or claim.

  • Set routingStrategy to delegate when execution must retain protocol state at fromAddress.

  • Put borrow or repay in the action list with the inputs required by that protocol’s action metadata.

  • Chain amounts with useOutputOfCallAt when a later repay, swap, or check depends on an earlier output.

  • Submit tx unchanged after any required preTransactions.

How Enso does this

The Route quick start says to use the Bundle API for actions such as harvest, borrow, and repay. Get Started assigns those use cases to Bundle, not Route. Routing Strategies notes that some actions that must retain state at the wallet, including borrow, harvest, and repay, require that execution model. Look up current argument names in the Actions reference.

FAQ

Can I borrow with the Route API?

No. Use POST https://api.enso.build/api/v1/shortcuts/bundle.

Why is delegate recommended?

Borrow and repay keep protocol state at the account. The delegate strategy uses fromAddress as the execution context so that state is not left on a shared router.

Related articles

  • How do I build a leverage or looping position in one transaction?

  • How do I use Enso with a smart wallet?

  • Router vs delegate routing strategies

  • When should I use the Bundle API instead of Route?

  • How do I use a flashloan in an Enso bundle?

Sources

Did this answer your question?