Setup
Get Upgrade Status
Compare the implementations a market runs with the ones the factory serves
GET
/
lending-external-securities-v2
/
api
/
markets
/
{marketId}
/
upgrade
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/upgrade" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/upgrade`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
const pending = [
data.upgradeAvailable && 'market',
data.rateModel?.upgradeAvailable && 'rateModel',
data.router?.upgradeAvailable && 'router',
data.insuranceFund?.upgradeAvailable && 'insuranceFund'
].filter(Boolean);
{
"success": true,
"data": {
"marketId": "cmssh7p1k0001cghxq2m4v8rz",
"marketAddress": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"readable": true,
"instrumented": true,
"stampsLoanTerms": true,
"currentImplementation": "0x894956CB1c7E0a5D2f3B8e4A6d9C1b7F0e2A5c83",
"targetImplementation": "0x1D5e7B9a3C0f2E4d6B8a0C2e4F6a8B0d2E4f6A81",
"upgradeAvailable": true,
"description": "Upgrade the market to implementation 0x1d5e...6a81: every loan signed from then on carries its own grace period and term penalty...",
"perimeter": null,
"feeModel": null,
"feeShareGeneration": "FIXED_SHARES",
"inFactory": true,
"requiredRole": "DEFAULT_ADMIN_ROLE",
"relayerAddress": "0x4e91a7c05d3b62f18a0c94e7db2358f1c60a4e93",
"relayerIsAdmin": true,
"rateModel": {
"address": "0x2c7e91d4a3b05f68e1c2a4b7d9f03e5a6c8b1d42",
"readable": true,
"currentImplementation": "0x6B2d4F8a0C1e3A5b7D9f1C3e5A7b9D1f3E5a7C09",
"targetImplementation": "0x6B2d4F8a0C1e3A5b7D9f1C3e5A7b9D1f3E5a7C09",
"upgradeAvailable": false,
"owner": "0x4e91a7c05d3b62f18a0c94e7db2358f1c60a4e93",
"pendingOwner": null,
"ownedByMarket": false,
"requiredRole": "owner"
},
"router": {
"routerAddress": "0x067a3feea46649adad8e31c33b3a4d8774b8d8cf",
"currentImplementation": "0x3F5a7C9e1B3d5F7a9C1e3B5d7F9a1C3e5B7d9F12",
"targetImplementation": "0x3F5a7C9e1B3d5F7a9C1e3B5d7F9a1C3e5B7d9F12",
"upgradeAvailable": false
},
"insuranceFund": {
"address": "0x8f1a4c2e9b7d3056a1e8c4f29d0b7a3e5c619c22",
"readable": true,
"currentImplementation": "0x7A9c1E3b5D7f9A1c3E5b7D9f1A3c5E7b9D1f3A58",
"targetImplementation": "0x7A9c1E3b5D7f9A1c3E5b7D9f1A3c5E7b9D1f3A58",
"upgradeAvailable": false,
"owner": "0x4e91a7c05d3b62f18a0c94e7db2358f1c60a4e93",
"pendingOwner": null,
"ownedByMarket": false,
"heldByFactory": false,
"carriesTopUp": true,
"requiredRole": "owner"
}
}
}
Reports, for the market and each of its three upgradeable satellites, which implementation it runs, which one the factory serves today, and whether an upgrade is available. The market, its interest rate model, its liquidation router and its insurance fund are separate proxies with separate administrators, and each entry names who must sign its upgrade. Upgrade Market builds the transaction.
An upgrade is offered only to a market the factory deployed and recorded. A market from another factory generation runs its own storage layout, so the factory’s implementation is never an upgrade for it:
When
inFactory is then false and no entry offers an upgrade.
The read never fails outright. When the factory or the chain cannot be reached, it answers with readable: false and empty entries.
Path Parameters
string
required
Market ID.
Response Fields
object
Show child attributes
Show child attributes
string
Market ID.
string
Market contract address.
boolean
Whether the market’s implementation pointer could be read.
string
The implementation the market runs, or
null.string
The market implementation the factory serves, or
null when it serves none or the market is not in the factory.boolean
Whether the two differ, so an upgrade can be built.
string
What the upgrade changes, in words, when one is available. Otherwise
null.boolean
Whether the current implementation can emit an on-demand history snapshot.
boolean
Whether the current implementation stamps the grace period and term penalty onto each loan at signing.
null when unreadable.string
FIXED_SHARES when the current implementation pays the fixed 8 percent operator and 5 percent distributor shares, OFFERED_SHARE when it pays the share offered at deployment. null when unreadable.object
Present when the upgrade brings in a separate provider register and the pool is open to third-party providers.
null otherwise, and when the current register could not be read.Show child attributes
Show child attributes
string
The register borrowers are examined through after the upgrade, or
null.string
The register providers are examined through after the upgrade, or
null.boolean
true when the upgrade installs the current register on both sides in the same transaction, so every provider it admitted keeps depositing.string
What happens to third-party deposits, in words.
object
Present when the upgrade moves the market onto the fixed fee shares.
null otherwise.Show child attributes
Show child attributes
boolean
Whether third parties could provide liquidity directly before the upgrade. After it, they provide only through a vault.
array
Vaults registered on the market, lowercased.
boolean
Whether each registered vault must be deregistered and registered again after the upgrade, which Upgrade Market returns as
followUps.boolean
true when providers hold shares or loans are open. The upgrade is then refused until you send acknowledgeFeeModelImpact: true.object
providersHoldShares, openLoans, outstandingPrincipal, the borrow asset, thirdPartyProviders holding direct positions (each provider, shares, value), thirdPartyProvidersComplete, and directProvidersKeepSlice. null when the positions could not be read.string
What changes for the liquidity providers, in words. Tell them before you upgrade.
array
Present when a registered vault runs an implementation from before distributor attribution. Each carries
code, vault and message.boolean
Whether the factory holds a deployment record for this market.
null when the factory could not be read.string
MARKET_NOT_IN_FACTORY when inFactory is false, with the explanation in reasonMessage. Absent otherwise.string
DEFAULT_ADMIN_ROLE: the market admin signs the market’s upgrade.string
The instance’s registered wallet, or
null.boolean
Whether that wallet holds
DEFAULT_ADMIN_ROLE on the market.object
The interest rate model.
null when it could not be resolved.Show child attributes
Show child attributes
string
The model’s proxy address.
boolean
Whether its implementation pointer could be read.
string
The implementation it runs.
string
The implementation the factory serves, or
null.boolean
Whether an upgrade can be built.
string
Its owner, who signs the upgrade.
string
The owner nominated by the lender of record and not yet accepted, or
null.boolean
true while the market or the factory still owns it. No wallet can upgrade it until the nominated owner accepts. See Get Handover.string
owner.string
What the upgrade changes, when one is available.
object
The liquidation router:
routerAddress, currentImplementation, targetImplementation, upgradeAvailable, and description when an upgrade is available. The router admin signs its upgrade. null when it could not be resolved.object
The insurance fund, with the same fields as
rateModel plus heldByFactory, true while the deploying factory still owns it, and carriesTopUp, whether it already takes permissionless top-ups. null when it could not be resolved.inFactory is false, rateModel, router and insuranceFund each carry upgradeAvailable: false, targetImplementation: null and reason: "MARKET_NOT_IN_FACTORY".
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/upgrade" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/upgrade`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
const pending = [
data.upgradeAvailable && 'market',
data.rateModel?.upgradeAvailable && 'rateModel',
data.router?.upgradeAvailable && 'router',
data.insuranceFund?.upgradeAvailable && 'insuranceFund'
].filter(Boolean);
{
"success": true,
"data": {
"marketId": "cmssh7p1k0001cghxq2m4v8rz",
"marketAddress": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"readable": true,
"instrumented": true,
"stampsLoanTerms": true,
"currentImplementation": "0x894956CB1c7E0a5D2f3B8e4A6d9C1b7F0e2A5c83",
"targetImplementation": "0x1D5e7B9a3C0f2E4d6B8a0C2e4F6a8B0d2E4f6A81",
"upgradeAvailable": true,
"description": "Upgrade the market to implementation 0x1d5e...6a81: every loan signed from then on carries its own grace period and term penalty...",
"perimeter": null,
"feeModel": null,
"feeShareGeneration": "FIXED_SHARES",
"inFactory": true,
"requiredRole": "DEFAULT_ADMIN_ROLE",
"relayerAddress": "0x4e91a7c05d3b62f18a0c94e7db2358f1c60a4e93",
"relayerIsAdmin": true,
"rateModel": {
"address": "0x2c7e91d4a3b05f68e1c2a4b7d9f03e5a6c8b1d42",
"readable": true,
"currentImplementation": "0x6B2d4F8a0C1e3A5b7D9f1C3e5A7b9D1f3E5a7C09",
"targetImplementation": "0x6B2d4F8a0C1e3A5b7D9f1C3e5A7b9D1f3E5a7C09",
"upgradeAvailable": false,
"owner": "0x4e91a7c05d3b62f18a0c94e7db2358f1c60a4e93",
"pendingOwner": null,
"ownedByMarket": false,
"requiredRole": "owner"
},
"router": {
"routerAddress": "0x067a3feea46649adad8e31c33b3a4d8774b8d8cf",
"currentImplementation": "0x3F5a7C9e1B3d5F7a9C1e3B5d7F9a1C3e5B7d9F12",
"targetImplementation": "0x3F5a7C9e1B3d5F7a9C1e3B5d7F9a1C3e5B7d9F12",
"upgradeAvailable": false
},
"insuranceFund": {
"address": "0x8f1a4c2e9b7d3056a1e8c4f29d0b7a3e5c619c22",
"readable": true,
"currentImplementation": "0x7A9c1E3b5D7f9A1c3E5b7D9f1A3c5E7b9D1f3A58",
"targetImplementation": "0x7A9c1E3b5D7f9A1c3E5b7D9f1A3c5E7b9D1f3A58",
"upgradeAvailable": false,
"owner": "0x4e91a7c05d3b62f18a0c94e7db2358f1c60a4e93",
"pendingOwner": null,
"ownedByMarket": false,
"heldByFactory": false,
"carriesTopUp": true,
"requiredRole": "owner"
}
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
NO_MARKET_ADDRESS | 400 | The market has no on-chain address recorded |
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}/upgrade" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/upgrade`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
const pending = [
data.upgradeAvailable && 'market',
data.rateModel?.upgradeAvailable && 'rateModel',
data.router?.upgradeAvailable && 'router',
data.insuranceFund?.upgradeAvailable && 'insuranceFund'
].filter(Boolean);
{
"success": true,
"data": {
"marketId": "cmssh7p1k0001cghxq2m4v8rz",
"marketAddress": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"readable": true,
"instrumented": true,
"stampsLoanTerms": true,
"currentImplementation": "0x894956CB1c7E0a5D2f3B8e4A6d9C1b7F0e2A5c83",
"targetImplementation": "0x1D5e7B9a3C0f2E4d6B8a0C2e4F6a8B0d2E4f6A81",
"upgradeAvailable": true,
"description": "Upgrade the market to implementation 0x1d5e...6a81: every loan signed from then on carries its own grace period and term penalty...",
"perimeter": null,
"feeModel": null,
"feeShareGeneration": "FIXED_SHARES",
"inFactory": true,
"requiredRole": "DEFAULT_ADMIN_ROLE",
"relayerAddress": "0x4e91a7c05d3b62f18a0c94e7db2358f1c60a4e93",
"relayerIsAdmin": true,
"rateModel": {
"address": "0x2c7e91d4a3b05f68e1c2a4b7d9f03e5a6c8b1d42",
"readable": true,
"currentImplementation": "0x6B2d4F8a0C1e3A5b7D9f1C3e5A7b9D1f3E5a7C09",
"targetImplementation": "0x6B2d4F8a0C1e3A5b7D9f1C3e5A7b9D1f3E5a7C09",
"upgradeAvailable": false,
"owner": "0x4e91a7c05d3b62f18a0c94e7db2358f1c60a4e93",
"pendingOwner": null,
"ownedByMarket": false,
"requiredRole": "owner"
},
"router": {
"routerAddress": "0x067a3feea46649adad8e31c33b3a4d8774b8d8cf",
"currentImplementation": "0x3F5a7C9e1B3d5F7a9C1e3B5d7F9a1C3e5B7d9F12",
"targetImplementation": "0x3F5a7C9e1B3d5F7a9C1e3B5d7F9a1C3e5B7d9F12",
"upgradeAvailable": false
},
"insuranceFund": {
"address": "0x8f1a4c2e9b7d3056a1e8c4f29d0b7a3e5c619c22",
"readable": true,
"currentImplementation": "0x7A9c1E3b5D7f9A1c3E5b7D9f1A3c5E7b9D1f3A58",
"targetImplementation": "0x7A9c1E3b5D7f9A1c3E5b7D9f1A3c5E7b9D1f3A58",
"upgradeAvailable": false,
"owner": "0x4e91a7c05d3b62f18a0c94e7db2358f1c60a4e93",
"pendingOwner": null,
"ownedByMarket": false,
"heldByFactory": false,
"carriesTopUp": true,
"requiredRole": "owner"
}
}
}
