Oracle
Get Oracle Status
Read the current price, staleness, and signer authorization
GET
/
lending-external-securities-v2
/
api
/
markets
/
{marketId}
/
oracle-status
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/oracle-status" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/oracle-status`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
{
"success": true,
"data": {
"price": "104.82",
"priceRaw": "104820000",
"timestamp": 1718445600,
"lastUpdate": "2024-06-15T10:00:00.000Z",
"isStale": false,
"priceAge": 1200,
"maxPriceAge": 86400,
"maxDeviationBps": 5000,
"configured": true,
"owner": "0x9c1e57a2d0b34f86e7a15c9d2b4f60e38a7d4b70",
"ownerIsInstanceWallet": false,
"signerAddress": "0x1234f9a07c6b53d81e2a4f70c9b385d6014a7e52",
"signerAuthorized": false,
"priceSigner": "0x9c1e57a2d0b34f86e7a15c9d2b4f60e38a7d4b70",
"priceSignerAuthorized": true
}
}
{
"success": true,
"data": {
"price": "0",
"priceRaw": "0",
"timestamp": 0,
"lastUpdate": null,
"isStale": true,
"configured": false,
"signerAuthorized": false,
"priceSigner": null,
"priceSignerAuthorized": null,
"error": "call revert exception"
}
}
{
"success": false,
"error": {
"code": "NO_ORACLE",
"message": "No oracle configured"
}
}
Returns the market oracle’s current state. Check this before any borrow or liquidation flow, since the contract rejects actions priced against a stale oracle.
A stale price makes opening a loan, borrowing more, liquidating, and withdrawing collateral against outstanding debt revert, unless the transaction carries a fresh signed price. Repaying never reads a price, so a stale oracle never blocks a repayment.
A healthy answer is held for up to 15 seconds per market and instance. Any successful write through this API clears it, so a read right after a confirmed price push reaches the chain.
Path Parameters
string
required
Response Fields
object
Show child attributes
Show child attributes
boolean
Whether the oracle was readable. When
false, the fields marked conditional below are absent and an error field is present instead.string
Current price as a decimal string, in borrow asset units.
string
Same price in base units.
integer
Unix seconds the current price is dated at. A pushed price carries its block time and a signed price its signed
timestamp. On an ORACLE-priced market it is the external feed’s own date.string
The same instant as an ISO 8601 string.
null only when configured is false.boolean
Whether the price is older than
maxPriceAge. An external feed that cannot answer reads as stale. Always false on a fixed price, which never goes stale.integer
Seconds since the price’s date. Conditional on
configured.integer
Staleness threshold in seconds, read from the oracle. It is an oracle setting and is not part of the market config struct. It defaults to 24 hours, and the oracle owner can set it between 1 minute and 30 days. Conditional on
configured.integer
Circuit breaker limit in basis points. A price push differing from the current price by more than this is rejected, and the same limit bounds the total movement within any one-hour window. Reported as
5000 when the oracle does not expose the value. It does not apply to an external feed. On a fixed price it bounds each mark-down, and the Issuer Portal only tightens it. See Mark down a fixed price. Conditional on configured.boolean
Whether the oracle holds a fixed price set at deployment.
true on a FIXED market, false on any other, null when it could not be read. Conditional on configured.boolean
true when fixed is true: the price can only be lowered. Conditional on configured.string
Oracle owner address. The owner is implicitly an authorized signer. Conditional on
configured.boolean
Whether that owner is a verified wallet of your instance. When
false, the oracle belongs to another party and no wallet of this instance can authorize signers on it. Conditional on configured.string
This instance’s first verified wallet, primary wallet first, or
null when none is verified. Conditional on configured.boolean
Whether that wallet can push and sign prices for this oracle, as an authorized signer or as the owner.
false when no wallet is verified.string
The wallet the lender of record declared as this market’s price authority when it took the role, or
null. It is not necessarily your registered wallet. It is the address Sync Oracle Price and Sign Price resolve to when you name none.boolean
Whether that declared signer is an authorized signer on the oracle.
null when no signer is declared or the read failed.string
Present only when
configured is false.The failure response is a different shape, not an error status. When
configured is false the endpoint still returns 200 with price: "0", isStale: true, and no priceAge, maxPriceAge, maxDeviationBps, fixed, markDownOnly, owner, ownerIsInstanceWallet or signerAddress. Guard on configured before reading those fields.Price Decimals
Oracle prices carry the market’s borrow asset decimals, not a fixed precision. The price is per whole collateral token, in the smallest unit of the settlement token (stablecoin): a 6-decimal token prices at 6 decimals, an 18-decimal one at 18. ReadborrowAssetDecimals from Get Market rather than assuming.
Fixed Price Markets
A market deployed with theFIXED price source holds the price stated at deployment for its whole life. fixed and markDownOnly read true, and the answer adds stale: false and staleness: null. The price never goes stale and accepts no signed price. The oracle owner or an authorized signer can only mark it down with Sync Oracle Price, within maxDeviationBps. Whoever owns the oracle, owner here, could still replace its implementation through an upgrade and with it the fixed price, so the lender of record keeps the oracle owner in its own control.
External Feed Markets
A market deployed with theORACLE price source reads an external feed. Its oracle takes no pushed or signed price, so price and timestamp are the feed’s live answer rescaled to the borrow asset’s decimals. When the feed cannot answer, isStale reads true and the price read fails. Read priceSource from Get Market to tell the two kinds apart.
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/oracle-status" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/oracle-status`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
{
"success": true,
"data": {
"price": "104.82",
"priceRaw": "104820000",
"timestamp": 1718445600,
"lastUpdate": "2024-06-15T10:00:00.000Z",
"isStale": false,
"priceAge": 1200,
"maxPriceAge": 86400,
"maxDeviationBps": 5000,
"configured": true,
"owner": "0x9c1e57a2d0b34f86e7a15c9d2b4f60e38a7d4b70",
"ownerIsInstanceWallet": false,
"signerAddress": "0x1234f9a07c6b53d81e2a4f70c9b385d6014a7e52",
"signerAuthorized": false,
"priceSigner": "0x9c1e57a2d0b34f86e7a15c9d2b4f60e38a7d4b70",
"priceSignerAuthorized": true
}
}
{
"success": true,
"data": {
"price": "0",
"priceRaw": "0",
"timestamp": 0,
"lastUpdate": null,
"isStale": true,
"configured": false,
"signerAuthorized": false,
"priceSigner": null,
"priceSignerAuthorized": null,
"error": "call revert exception"
}
}
{
"success": false,
"error": {
"code": "NO_ORACLE",
"message": "No oracle configured"
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
NO_ORACLE | 400 | The market records no oracle address |
MISSING_MARKET_ID | 400 | marketId is longer than 100 characters |
MARKET_NOT_FOUND | 404 | No market with this ID on your instance |
⌘I
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/oracle-status" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/oracle-status`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
{
"success": true,
"data": {
"price": "104.82",
"priceRaw": "104820000",
"timestamp": 1718445600,
"lastUpdate": "2024-06-15T10:00:00.000Z",
"isStale": false,
"priceAge": 1200,
"maxPriceAge": 86400,
"maxDeviationBps": 5000,
"configured": true,
"owner": "0x9c1e57a2d0b34f86e7a15c9d2b4f60e38a7d4b70",
"ownerIsInstanceWallet": false,
"signerAddress": "0x1234f9a07c6b53d81e2a4f70c9b385d6014a7e52",
"signerAuthorized": false,
"priceSigner": "0x9c1e57a2d0b34f86e7a15c9d2b4f60e38a7d4b70",
"priceSignerAuthorized": true
}
}
{
"success": true,
"data": {
"price": "0",
"priceRaw": "0",
"timestamp": 0,
"lastUpdate": null,
"isStale": true,
"configured": false,
"signerAuthorized": false,
"priceSigner": null,
"priceSignerAuthorized": null,
"error": "call revert exception"
}
}
{
"success": false,
"error": {
"code": "NO_ORACLE",
"message": "No oracle configured"
}
}
