Skip to main content
The Loopscale instructions module enables vault managers and allocators to interact with Loopscale through LoopscaleClient. Unlike the other integrations that start from createVaultSyncTransaction directly, Loopscale flows start from raw Loopscale API responses and then turn those responses into executable vault transactions. Loopscale exposes two distinct Strategy Vault surfaces:
  • Lender-side strategy flows — create, fund, update, withdraw from, and close a Loopscale strategy
  • Borrower-side loan flows — create a loan, deposit collateral, borrow principal, repay, withdraw collateral, and close the loan

How co-signing works

Loopscale transaction flow is slightly different from the other Strategy Vault integrations:
  1. Loopscale constructs the transaction flow through its API.
  2. The SDK turns that raw response into manager-facing vault transactions and signs them locally.
  3. If a transaction is flagged with requiresLoopscaleCoSign, send that transaction to client.coSign(...).
  4. Submit the returned co-signed transaction on-chain.
Only the wrapped Loopscale transaction belongs to Loopscale’s signing domain. Setup transactions and other local top-level transactions should be sent directly.
If you need more detail on Loopscale-specific mechanics, markets, or transaction endpoints, visit the Loopscale Docs.

Loopscale client

Create a client once and reuse it across your strategy or loan flow:

Choose an execution path

Loopscale transaction methods return raw Loopscale responses. After each call, choose one of two execution paths.

Prepare appendable transactions

Use prepareVaultTransactions(...) when you want lower-level transaction pieces that you can compose yourself.
Each prepared entry contains:
  • setupInstructions — send these first when present
  • instructions — the main instruction list for the step
  • signers — any extra local signers required for the step
  • addressLookupTableAddresses — lookup tables needed to compile the transaction
  • requiresLoopscaleCoSign — whether the main transaction still needs client.coSign(...)

Build ready-to-send transactions

Use buildVaultTransactions(...) when you want locally signed VersionedTransactions that are ready to send.
requiresLoopscaleCoSign is the exact boundary for Loopscale MPC signing. Only call coSign(...) for transactions flagged true.
buildVaultTransactions(...) requires context.signers[0] to match context.signer.
If you are already using VaultTransactionBuilder, pass the raw response to addLoopscaleResponse(...) and let result.send() handle any required Loopscale co-signing.

Create strategy

createStrategy(...) returns a raw Loopscale batch response. The response itself is enough to execute the create flow. If you want to keep the created strategy address for later calls, you can extract it from the response.

Parameters

A matching policy must exist before executing. See Policy Builders. See also Loopscale: Create Strategy for API details.

Deposit strategy

Parameters

A matching policy must exist before executing. See Policy Builders. See also Loopscale: Deposit Strategy for API details.

Update strategy

updateStrategy(...) also accepts collateralTerms when you need to change collateral matrices or duration / APY settings.

Parameters

A matching policy must exist before executing. See Policy Builders. See also Loopscale: Update Strategy for API details.

Withdraw strategy

Parameters

A matching policy must exist before executing. See Policy Builders. See also Loopscale: Withdraw Strategy for API details.

Close strategy

Parameters

A matching policy must exist before executing. See Policy Builders. See also Loopscale: Close Strategy for API details.

Create loan

createLoan(...) returns a raw Loopscale response plus a loanAddress string you can use immediately in follow-up calls.

Parameters

A matching policy must exist before executing. See Policy Builders. See also Loopscale: Create Loan for API details.

Deposit collateral

Parameters

A matching policy must exist before executing. See Policy Builders. See also Loopscale: Deposit Collateral for API details.

Borrow principal

Before you request a borrow, inspect the available Loopscale lending options for the principal, collateral, and duration you want to use. In the SDK, the usual discovery calls are:
  • getQuotes(...) when you want a list of current lend orders for a principal / collateral / duration combination
  • getMaxQuote(...) when you already know the collateral input and want the top matching quote for that borrow
After you choose the strategy you want to borrow from, pass that strategy address into borrowPrincipal(...).

Parameters

A matching policy must exist before executing. See Policy Builders. See also Loopscale: Borrow Principal for API details.
If you need more detail on Loopscale-specific market discovery and borrow selection, visit the Loopscale Docs. The official data endpoints are Get quotes and Get best quote.

Repay loan

repayLoanSimple(...) builds the raw repay_simple Loopscale response.

Parameters

A matching policy must exist before executing. See Policy Builders. See also Loopscale: Repay Loan for API details.

Withdraw collateral

Parameters

A matching policy must exist before executing. See Policy Builders. See also Loopscale: Withdraw Collateral for API details.

Close loan

Parameters

A matching policy must exist before executing. See Policy Builders. See also Loopscale: Close Loan for API details.

Practical notes

  • createStrategy(...) can be executed directly from its raw response. Use extractCreatedStrategyAddress(...) only when you want to reference the created strategy later.
  • createLoan(...) returns a raw response plus loanAddress, so you can construct the loan public key immediately.
  • Only call coSign(...) for transactions flagged with requiresLoopscaleCoSign === true.
  • Split lender-side strategy actions and borrower-side loan actions into separate Loopscale policies when you configure the vault.