Rates and Loan Terms
Set Reserve Ratio
Hold a share of the pool back from borrowing as an exit buffer
POST
/
lending-external-securities-v2
/
api
/
markets
/
{marketId}
/
reserve-ratio
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/reserve-ratio" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "reserveRatioBps": 500 }'
const url = `https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/reserve-ratio`;
const headers = { 'X-API-Key': 'trusset_your_key_here', 'Content-Type': 'application/json' };
const build = await fetch(url, { method: 'POST', headers, body: JSON.stringify({ reserveRatioBps: 500 }) });
const { data: calldata } = await build.json();
const tx = await issuerWallet.sendTransaction({
to: calldata.to,
data: calldata.data,
value: calldata.value,
chainId: calldata.chainId
});
await tx.wait();
const confirm = await fetch(url, { method: 'POST', headers, body: JSON.stringify({ txHash: tx.hash }) });
const { data } = await confirm.json();
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x..."
},
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x...",
"functionName": "setReserveRatio",
"requiredRole": "ISSUER_ROLE",
"requiredSigner": null,
"heldByThisInstance": true,
"signerAddress": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"note": null,
"confirmWith": {
"endpoint": "POST /lending-external-securities-v2/api/markets/clx_secmarket_001/reserve-ratio",
"field": "txHash"
},
"chainId": 11155111,
"value": "0"
}
}
{
"success": true,
"data": {
"txHash": "0x55635f4de8ec6649d2b3a78b49a449a99e9e31e1270fe3add4bcf9f71224bfb4",
"functionName": "setReserveRatio",
"signedBy": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"blockNumber": 6789012,
"offering": {
"maxLoanDuration": "15552000",
"termGracePeriod": "259200",
"terminalDueDate": null,
"termPenalty": "200",
"marketDueFloor": null,
"allowExtension": true,
"rateMode": "CURVE",
"rateFloor": "0",
"rateCap": "0",
"maxFixedRate": null,
"reserveRatio": "500",
"operatorShare": "800"
},
"updatedColumns": ["reserveRatio"]
}
}
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": [
{ "field": "reserveRatioBps", "message": "The market contract caps the reserve ratio at 5000 bps (50% of total liquidity)" }
]
}
}
Builds the
Confirming with
setReserveRatio transaction that earmarks a share of the market’s total liquidity against borrowing. Requires ISSUER_ROLE on the market, held by the wallet the lender of record named at adoption. The market brings its interest accrual up to date before the new ratio applies.
The reserve binds borrowing only. A withdrawal can always consume it, because a reserve that trapped a provider’s money would be the opposite failure from the one it prevents. It is a buffer, not a guarantee: it serves whichever provider exits first. The slice held back is not lent and earns no interest, a cost the lender of record should disclose to liquidity providers.
The ratio applies at once to what a new borrow can draw, shown as borrowableLiquidity on Get Exit Liquidity. It moves no open loan. When withdrawals have used the reserve up, repayments refill it before any new borrow can draw again.
Path Parameters
string
required
Body Parameters
integer
required
Share of total liquidity held back from borrowing, in basis points. Integer, 0 to 5000. The contract refuses anything above 50 percent.
0 clears the reserve, and every unit of unlent liquidity becomes borrowable again.string
Hash of the transaction you broadcast for this operation. Send it to confirm the transaction and record the result. Omit it to receive the calldata. When
txHash is present, every other field is ignored.Confirm the Change
Send the mined hash back to this path as{ "txHash": "0x..." }. The API checks that the transaction called setReserveRatio on the market. It then reads the offering back from the chain and updates the market record.
Response Fields
The calldata response carries the transaction twice.transaction holds to and data. The same to and data also sit directly on data, and that is where the chainId and value binding lands, so sign from those four fields.
object
Show child attributes
Show child attributes
string
SIGN_TRANSACTION. Returned when txHash is omitted.object
{ to, data } for the setReserveRatio call on the market. Returned when txHash is omitted.string
The market address. Returned when
txHash is omitted.string
The encoded
setReserveRatio call. Returned when txHash is omitted.string
Always
"0". Returned when txHash is omitted.integer
The chain your instance resolves to. Returned when
txHash is omitted.string
setReserveRatio, or the verified function when confirming.string
ISSUER_ROLE. Returned when txHash is omitted.string
Plain-language summary of the change, including its cost to liquidity providers. Returned when
txHash is omitted.string
Always
null here: the signer is whoever holds ISSUER_ROLE, not one fixed address. Returned when txHash is omitted.boolean
true when a verified wallet of your instance holds ISSUER_ROLE, false when none does, null when the check could not be completed. The build is never refused on it. Returned when txHash is omitted.string
The wallet of your instance that holds
ISSUER_ROLE, or null. Returned when txHash is omitted.string
What to do when your instance cannot sign: the wallet the lender of record placed the role with must sign, because the market reverts the call from any other wallet.
null when your instance can sign. Returned when txHash is omitted.object
{ endpoint, field }: the call that confirms this transaction, and the body field that carries the hash. Returned when txHash is omitted.string
Transaction hash. Returned when confirming.
string
The wallet that sent the transaction. Returned when confirming.
integer
Block the transaction was mined in. Returned when confirming.
object
The market’s rate and term offering, read back from the chain after the transaction, with
reserveRatio among its fields. The same object Set Rate Mode returns. Returned when confirming.array
Names of the stored market fields this confirmation changed. Returned when confirming.
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/reserve-ratio" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "reserveRatioBps": 500 }'
const url = `https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/reserve-ratio`;
const headers = { 'X-API-Key': 'trusset_your_key_here', 'Content-Type': 'application/json' };
const build = await fetch(url, { method: 'POST', headers, body: JSON.stringify({ reserveRatioBps: 500 }) });
const { data: calldata } = await build.json();
const tx = await issuerWallet.sendTransaction({
to: calldata.to,
data: calldata.data,
value: calldata.value,
chainId: calldata.chainId
});
await tx.wait();
const confirm = await fetch(url, { method: 'POST', headers, body: JSON.stringify({ txHash: tx.hash }) });
const { data } = await confirm.json();
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x..."
},
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x...",
"functionName": "setReserveRatio",
"requiredRole": "ISSUER_ROLE",
"requiredSigner": null,
"heldByThisInstance": true,
"signerAddress": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"note": null,
"confirmWith": {
"endpoint": "POST /lending-external-securities-v2/api/markets/clx_secmarket_001/reserve-ratio",
"field": "txHash"
},
"chainId": 11155111,
"value": "0"
}
}
{
"success": true,
"data": {
"txHash": "0x55635f4de8ec6649d2b3a78b49a449a99e9e31e1270fe3add4bcf9f71224bfb4",
"functionName": "setReserveRatio",
"signedBy": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"blockNumber": 6789012,
"offering": {
"maxLoanDuration": "15552000",
"termGracePeriod": "259200",
"terminalDueDate": null,
"termPenalty": "200",
"marketDueFloor": null,
"allowExtension": true,
"rateMode": "CURVE",
"rateFloor": "0",
"rateCap": "0",
"maxFixedRate": null,
"reserveRatio": "500",
"operatorShare": "800"
},
"updatedColumns": ["reserveRatio"]
}
}
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": [
{ "field": "reserveRatioBps", "message": "The market contract caps the reserve ratio at 5000 bps (50% of total liquidity)" }
]
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
MISSING_MARKET_ID | 400 | The marketId path segment is longer than 100 characters |
VALIDATION_ERROR | 400 | reserveRatioBps is missing, not an integer, or outside 0 to 5000, or txHash is malformed |
INVALID_CONFIRMATION | 400 | The market has no on-chain address, so there is nothing to confirm against |
MARKET_NOT_FOUND | 404 | No market with this ID on your instance |
MARKET_PENDING_CURATOR | 409 | The market has no lender of record yet, so nobody holds ISSUER_ROLE. Skipped when confirming with txHash |
INTERNAL_ERROR | 500 | The chain could not be read while confirming. Retry shortly |
txHash can also return any transaction verification error.⌘I
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/reserve-ratio" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "reserveRatioBps": 500 }'
const url = `https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/reserve-ratio`;
const headers = { 'X-API-Key': 'trusset_your_key_here', 'Content-Type': 'application/json' };
const build = await fetch(url, { method: 'POST', headers, body: JSON.stringify({ reserveRatioBps: 500 }) });
const { data: calldata } = await build.json();
const tx = await issuerWallet.sendTransaction({
to: calldata.to,
data: calldata.data,
value: calldata.value,
chainId: calldata.chainId
});
await tx.wait();
const confirm = await fetch(url, { method: 'POST', headers, body: JSON.stringify({ txHash: tx.hash }) });
const { data } = await confirm.json();
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x..."
},
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x...",
"functionName": "setReserveRatio",
"requiredRole": "ISSUER_ROLE",
"requiredSigner": null,
"heldByThisInstance": true,
"signerAddress": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"note": null,
"confirmWith": {
"endpoint": "POST /lending-external-securities-v2/api/markets/clx_secmarket_001/reserve-ratio",
"field": "txHash"
},
"chainId": 11155111,
"value": "0"
}
}
{
"success": true,
"data": {
"txHash": "0x55635f4de8ec6649d2b3a78b49a449a99e9e31e1270fe3add4bcf9f71224bfb4",
"functionName": "setReserveRatio",
"signedBy": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"blockNumber": 6789012,
"offering": {
"maxLoanDuration": "15552000",
"termGracePeriod": "259200",
"terminalDueDate": null,
"termPenalty": "200",
"marketDueFloor": null,
"allowExtension": true,
"rateMode": "CURVE",
"rateFloor": "0",
"rateCap": "0",
"maxFixedRate": null,
"reserveRatio": "500",
"operatorShare": "800"
},
"updatedColumns": ["reserveRatio"]
}
}
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": [
{ "field": "reserveRatioBps", "message": "The market contract caps the reserve ratio at 5000 bps (50% of total liquidity)" }
]
}
}
