Markets
Update Market Config
Set the on-chain risk parameters for a market
POST
/
lending-external-securities
/
api
/
markets
/
{marketId}
/
config
curl -X POST "https://api.trusset.org/lending-external-securities/api/markets/{marketId}/config" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"config": {
"collateralFactor": 7000,
"liquidationThreshold": 8000,
"liquidationPenalty": 500,
"protocolFeeRate": 2500,
"minBorrowAmount": "1000",
"maxPriceAge": 172800,
"closeFactor": 5000,
"maxTotalCollateral": "0",
"maxUserCollateral": "0",
"useDutchAuction": false,
"auctionDuration": 3600,
"auctionStartPremium": 13000,
"auctionMinPremium": 9500
}
}'
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": { "to": "0x70A0...", "data": "0x..." }
}
}
{
"success": true,
"data": { "txHash": "0xabc...def" }
}
{
"success": false,
"error": {
"code": "CONFIG_UPDATE_FAILED",
"message": "execution reverted: ThresholdChangeTooLarge"
}
}
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": [
{ "field": "config.collateralFactor", "message": "Number must be less than or equal to 9500" }
]
}
}
Writes the market’s full
config struct. Every field is required on every call, so read the current values with Get Market Config first and send them back with your changes applied. Partial updates are not supported: an omitted field fails validation rather than retaining its current value.
Requires ISSUER_ROLE on the market contract.
Changing
liquidationThreshold moves the point at which existing loans become liquidatable. Raising it immediately puts loans at risk that were healthy a moment earlier. The contract caps each change at 10 percent per call.Path Parameters
string
required
Market ID.
Body Parameters
object
required
Show child attributes
Show child attributes
integer
required
Maximum loan to value in basis points. 1000 to 9500.
integer
required
Liquidation trigger in basis points. 1000 to 9800. Must exceed
collateralFactor to leave borrowers any buffer.integer
required
Penalty on liquidated debt in basis points. 0 to 5000.
integer
required
Issuer share of accrued interest in basis points. 0 to 10000.
string
required
Minimum borrow per loan, as a decimal string in borrow asset units.
integer
required
Seconds before the oracle price is treated as stale. 300 to 604800.
integer
required
Maximum fraction of a loan’s debt repayable in one liquidation, in basis points. 1000 to 5000.
string
required
Global collateral cap as a decimal string in collateral token units.
"0" means uncapped.string
required
Per-borrower collateral cap as a decimal string in collateral token units.
"0" means uncapped.boolean
required
Whether liquidations open a Dutch auction. Rejected on-chain when the market’s
priceSource is MARKET.integer
required
Auction length in seconds. 600 to 86400.
integer
required
Opening price multiplier in basis points. 10000 to 20000, where 10000 is oracle price.
integer
required
Floor price multiplier in basis points. 8000 to 10000. Floored at 9800 on-chain when
priceSource is MARKET.maxPriceAge interacts directly with your NAV publication cadence. A fund that publishes NAV daily needs maxPriceAge above 86400 seconds, or every loan action will revert against a stale price between publications.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.
curl -X POST "https://api.trusset.org/lending-external-securities/api/markets/{marketId}/config" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"config": {
"collateralFactor": 7000,
"liquidationThreshold": 8000,
"liquidationPenalty": 500,
"protocolFeeRate": 2500,
"minBorrowAmount": "1000",
"maxPriceAge": 172800,
"closeFactor": 5000,
"maxTotalCollateral": "0",
"maxUserCollateral": "0",
"useDutchAuction": false,
"auctionDuration": 3600,
"auctionStartPremium": 13000,
"auctionMinPremium": 9500
}
}'
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": { "to": "0x70A0...", "data": "0x..." }
}
}
{
"success": true,
"data": { "txHash": "0xabc...def" }
}
{
"success": false,
"error": {
"code": "CONFIG_UPDATE_FAILED",
"message": "execution reverted: ThresholdChangeTooLarge"
}
}
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": [
{ "field": "config.collateralFactor", "message": "Number must be less than or equal to 9500" }
]
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
NO_MARKET_ADDRESS | 400 | The market has no on-chain address recorded |
VALIDATION_ERROR | 400 | A config field is outside its accepted range. error.details names each offending field |
CONFIG_UPDATE_FAILED | 400 | The confirmed transaction could not be verified against this market |
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 the admin role this change requires. Skipped when confirming with txHash |
⌘I
curl -X POST "https://api.trusset.org/lending-external-securities/api/markets/{marketId}/config" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"config": {
"collateralFactor": 7000,
"liquidationThreshold": 8000,
"liquidationPenalty": 500,
"protocolFeeRate": 2500,
"minBorrowAmount": "1000",
"maxPriceAge": 172800,
"closeFactor": 5000,
"maxTotalCollateral": "0",
"maxUserCollateral": "0",
"useDutchAuction": false,
"auctionDuration": 3600,
"auctionStartPremium": 13000,
"auctionMinPremium": 9500
}
}'
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": { "to": "0x70A0...", "data": "0x..." }
}
}
{
"success": true,
"data": { "txHash": "0xabc...def" }
}
{
"success": false,
"error": {
"code": "CONFIG_UPDATE_FAILED",
"message": "execution reverted: ThresholdChangeTooLarge"
}
}
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": [
{ "field": "config.collateralFactor", "message": "Number must be less than or equal to 9500" }
]
}
}
