Skip to content

LoanBrokerSet

[Source]

Creates or updates a LoanBroker ledger entry, configuring protocol parameters and associating it with a Vault.

Only the owner of the associated vault can initiate this transaction.

Note

A loan broker can only be attached to a closed-ended vault. This restriction only applies to loan brokers created after the LendingProtocolV1_1 amendment is enabled. If a loan broker was created before the amendment, it can still originate loans from open-ended vaults.

Requires the LendingProtocol amendment. Loading...

Requires the LendingProtocolV1_1 amendment. Loading...

Example LoanBrokerSet JSON

{
  "TransactionType": "LoanBrokerSet",
  "Account": "rEXAMPLE9AbCdEfGhIjKlMnOpQrStUvWxYz",
  "Fee": "12",
  "Flags": 0,
  "LastLedgerSequence": 7108682,
  "Sequence": 8,
  "VaultID": "ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890",
  "LoanBrokerID": "E123F4567890ABCDE123F4567890ABCDEF1234567890ABCDEF1234567890ABCD",
  "Data": "5468697320697320617262697472617279206D657461646174612061626F757420746865206C6F616E62726F6B65722E",
  "ManagementFeeRate": 100,
  "DebtMaximum": 100000,
  "CoverRateMinimum": 10000,
  "CoverRateLiquidation": 5000
}

LoanBrokerSet Fields

In addition to the common fields, LoanBrokerSet transactions use the following fields:

Field NameJSON TypeInternal TypeRequired?Description
VaultIDStringHash256YesThe ID of the vault that the lending protocol will use to access liquidity.
LoanBrokerIDStringHash256NoThe loan broker ID that the transaction is modifying.
DataStringBlobNoArbitrary metadata in hex format--limited to 256 bytes.
ManagementFeeRateNumberUInt16NoThe 1/10th basis point fee charged by the lending protocol owner against any loan interest. Valid values range from 0 to 10000 (inclusive), representing 0% to 10%.
DebtMaximumStringNumberNoThe maximum amount the protocol can owe the vault. The default value of 0 means there is no limit to the debt. Must be a positive value.
CoverRateMinimumNumberUInt32NoThe 1/10th basis point DebtTotal that the first-loss capital must cover. Valid values range from 0 to 100000 (inclusive), representing 0% to 100%.
CoverRateLiquidationNumberUInt32NoThe 1/10th basis point of minimum required first-loss capital that is moved to an asset vault to cover a loan default. Valid values range from 0 to 100000 (inclusive), representing 0% to 100%.

When this transaction modifies an existing LoanBroker ledger entry, you can only modify Flags, Data, and DebtMaximum.

Error Cases

Besides errors that can occur for all transactions, LoanBrokerSet transactions can result in the following transaction result codes:

Error CodeDescription
tecINSUFFICIENT_RESERVEThe owner's account doesn't have enough to cover the reserve requirement for the new LoanBroker ledger entry.
tecLIMIT_EXCEEDEDThe transaction reduces DebtMaximum below the LoanBroker's current DebtTotal.
tecNO_ENTRYA LoanBroker entry with the specified ID does not exist. You can also receive this if the specified VaultID doesn't exist.
tecNO_PERMISSION
  • The account submitting the transaction doesn't own the associated Vault ledger entry.
  • The account submitting the transaction doesn't own the LoanBroker ledger entry it's modifying.
  • The transaction tries to modify the VaultID of an existing LoanBroker ledger entry.
  • The transaction is creating a new LoanBroker and the associated vault isn't closed-ended. Updating an existing LoanBroker isn't affected.

    Requires the LendingProtocolV1_1 amendment. Loading...

  • tecPRECISION_LOSSDebtMaximum is more precise than the vault's asset can hold.
    temINVALID
  • Data is present but empty, or larger than 256 bytes.
  • A numeric field is outside its valid range.
  • The transaction is trying to modify a fixed field. You can only update the values for Flags, Data, or DebtMaximum.
  • LoanBrokerID or VaultID is zero.
  • Only one of CoverRateMinimum and CoverRateLiquidation is zero. Both must be zero, or neither.