borrow_principal
Borrow principal against a locked loan.
Handler narrative
- Load the GLAM state or program account required by the instruction and verify the signer.
- Verify that the integration is enabled on the vault and that the caller has the required delegate permission or owner authority.
- Validate the instruction-specific policy, then invoke the external protocol with the vault authority where required.
- Borrow principal against a locked loan. - Permission requirement: `BorrowPrincipal`. - Policy - `principal_mint` must be present in `LoopscalePolicy::borrow_allowlist`. - `market_information` must be present in `LoopscalePolicy::markets_allowlist`.
Required conditions
- The submitted accounts must match the declared account list, signer requirements, writable requirements, fixed program addresses, and account relationships shown below.
- The GLAM state account is the source of truth for owner, enabled integrations, delegate permissions, policies, assets, borrowable assets, timelock settings, mint linkage, and pricing records.
- The vault account must be the PDA controlled by the core protocol program and derived conceptually from the state account; instructions use it as the vault authority for SOL, token accounts, and external positions.
- The vault integration ACL must enable this integration before the instruction is accepted; that enablement is defined on the GLAM state account.
- If the signer is not the owner, the delegate ACL on the GLAM state must contain the exact protocol permission required by this instruction; registering a delegate alone is insufficient.
- Instruction-specific destination accounts must satisfy the external protocol's own account model; GLAM validates the accounts it needs for authorization and policy enforcement, then passes the remaining protocol accounts through CPI.
- Borrowing must satisfy both the vault-level borrowable asset list and the integration-specific borrow allowlist where one is configured.
- The instruction metadata names `BorrowPrincipal` as the delegate permission for this instruction.
- Additional policy conditions documented for this instruction: Policy; `principal_mint` must be present in `LoopscalePolicy::borrow_allowlist`; `market_information` must be present in `LoopscalePolicy::markets_allowlist`.
Accounts
Uses the standard Big Seven account pattern, plus the instruction-specific accounts below.
| Account | Role | Description |
|---|---|---|
| bs_auth | signer | Fixed program or sysvar account required by this instruction. |
| loan | writable | External loan account used by the instruction. |
| strategy | writable | External strategy account used by the instruction. |
| market_information | writable | Instruction-specific account supplied by the caller or SDK. |
| principal_mint | read-only | Token mint account used by the instruction. |
| borrower_ta | writable | Instruction-specific account supplied by the caller or SDK. |
| strategy_ta | writable | External strategy account used by the instruction. |
| associated_token_program | read-only | Standard Solana program account required by the instruction. |
| event_authority | read-only | Instruction-specific account supplied by the caller or SDK. |
Arguments
| Argument | Type | Notes |
|---|---|---|
| params | BorrowPrincipalParams | Instruction parameter object; field details are listed below. Fields: |
Policy & permissions
Enable the Loopscale integration program on the vault integration ACL before Loopscale position actions.
Delegate permission:
BorrowPrincipal.Borrowing must satisfy the vault-level borrowable asset list and any integration-specific borrow allowlist.
TypeScript SDK usage
const borrowPrincipalIx =
await glamClient.loopscale.txBuilder.borrowPrincipalIx(
{ amount, assetIndexGuidance, duration, expectedLoanValues, skipSolUnwrap },
{ loan, strategy, marketInformation, principalMint, remainingAccounts },
);Cross-instruction constraints
- The Loopscale loan must exist; locking and unlocking determine when principal and collateral movements are valid.