Markets
Confirm Deploy
Register a deployed lending market after the factory transaction is mined
POST
/
lending-stocks
/
api
/
markets
/
confirm-deploy
curl -X POST "https://api.trusset.org/lending-stocks/api/markets/confirm-deploy" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"stockTokenAddress": "0xabc...def",
"txHash": "0x9f2c...a41b",
"issuerAddress": "0x111...222",
"adminAddress": "0x333...444"
}'
const res = await fetch(
'https://api.trusset.org/lending-stocks/api/markets/confirm-deploy',
{
method: 'POST',
headers: {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
stockTokenAddress: '0xabc...def',
txHash: tx.hash,
issuerAddress: '0x111...222',
adminAddress: '0x333...444'
})
}
);
const { data } = await res.json();
for (const [step, calldata] of Object.entries(data.configurationCalldata)) {
console.log(step, calldata.description);
}
{
"success": true,
"data": {
"market": {
"id": "clx_market_002",
"marketAddress": "0x70a0...9c2d",
"oracleAddress": "0x8b2e...4a7c",
"stockTokenSymbol": "ACME",
"borrowAssetSymbol": "USDC"
},
"txHash": "0x9f2c...a41b",
"signedBy": "0x123...456",
"signerAddress": "0x123...456",
"liquidationRouterAddress": "0x4c1f...8e3b",
"configurationSteps": [
{ "step": "authorizeMarketOnStockToken", "requiredRole": "ISSUER_ROLE", "done": false },
{ "step": "authorizeRouterOnStockToken", "requiredRole": "ISSUER_ROLE", "done": false }
],
"configurationCalldata": {
"authorizeMarketOnStockToken": {
"to": "0xabc...def",
"data": "0x1e4f8a20...",
"description": "Authorize the lending market on the stock token (requires ISSUER_ROLE)"
}
}
}
}
{
"success": false,
"error": {
"code": "TX_WRONG_ARGS",
"message": "Transaction deploys a market for a different stock token"
}
}
Records a market that has been deployed on-chain. Call this once the transaction from Deploy Market is mined.
The factory call is verified before anything is written: the receipt must target the factory, call
deployMarket, and name the same stock token you pass here. The market is then read back from the factory, stored against your instance, and returned with its configuration checklist.
Body Parameters
string
required
ERC-20 stock token the market collateralises. Must match the token in the deployment transaction.
string
required
Hash of the mined factory deployment transaction.
string
required
Issuer wallet holding
ISSUER_ROLE. Used to build the configuration steps.string
required
Admin wallet holding
DEFAULT_ADMIN_ROLE. Used to build the configuration steps.Response Fields
object
Show child attributes
Show child attributes
object
The stored market record, including
id, marketAddress, oracleAddress, insuranceFundAddress, and the borrow asset.string
The deployment transaction hash.
string
Address that signed the deployment, read from the receipt.
string
Registered wallet for this instance. Oracle signer and role checks are evaluated against it.
string
Liquidation router serving this market.
object
On-chain wiring state read back from the market contract.
object
Whether the market and router are authorised contracts on the stock token.
array
Remaining setup steps, each with the role required to execute it.
object
Ready-to-sign calldata keyed by step, for the steps not yet complete.
boolean
Present and
true when the market was already registered. The call is idempotent and returns 200 instead of 201.The market is not usable until the stock token issuer authorises both the market and the liquidation router on the token via
addAuthorizedContract. Those steps come back in configurationSteps with calldata in configurationCalldata.curl -X POST "https://api.trusset.org/lending-stocks/api/markets/confirm-deploy" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"stockTokenAddress": "0xabc...def",
"txHash": "0x9f2c...a41b",
"issuerAddress": "0x111...222",
"adminAddress": "0x333...444"
}'
const res = await fetch(
'https://api.trusset.org/lending-stocks/api/markets/confirm-deploy',
{
method: 'POST',
headers: {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
stockTokenAddress: '0xabc...def',
txHash: tx.hash,
issuerAddress: '0x111...222',
adminAddress: '0x333...444'
})
}
);
const { data } = await res.json();
for (const [step, calldata] of Object.entries(data.configurationCalldata)) {
console.log(step, calldata.description);
}
{
"success": true,
"data": {
"market": {
"id": "clx_market_002",
"marketAddress": "0x70a0...9c2d",
"oracleAddress": "0x8b2e...4a7c",
"stockTokenSymbol": "ACME",
"borrowAssetSymbol": "USDC"
},
"txHash": "0x9f2c...a41b",
"signedBy": "0x123...456",
"signerAddress": "0x123...456",
"liquidationRouterAddress": "0x4c1f...8e3b",
"configurationSteps": [
{ "step": "authorizeMarketOnStockToken", "requiredRole": "ISSUER_ROLE", "done": false },
{ "step": "authorizeRouterOnStockToken", "requiredRole": "ISSUER_ROLE", "done": false }
],
"configurationCalldata": {
"authorizeMarketOnStockToken": {
"to": "0xabc...def",
"data": "0x1e4f8a20...",
"description": "Authorize the lending market on the stock token (requires ISSUER_ROLE)"
}
}
}
}
{
"success": false,
"error": {
"code": "TX_WRONG_ARGS",
"message": "Transaction deploys a market for a different stock token"
}
}
Errors
| Code | HTTP | Cause |
|---|---|---|
VALIDATION_ERROR | 400 | A required field is missing or malformed |
TX_WRONG_TARGET | 400 | The transaction was not sent to the market factory |
TX_WRONG_FUNCTION | 400 | The transaction did not call deployMarket |
TX_WRONG_ARGS | 400 | The transaction deploys a market for a different stock token |
TX_REVERTED | 400 | The deployment reverted on-chain |
TX_NOT_FOUND | 404 | No receipt yet. The deployment is unmined or on another network |
⌘I
curl -X POST "https://api.trusset.org/lending-stocks/api/markets/confirm-deploy" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"stockTokenAddress": "0xabc...def",
"txHash": "0x9f2c...a41b",
"issuerAddress": "0x111...222",
"adminAddress": "0x333...444"
}'
const res = await fetch(
'https://api.trusset.org/lending-stocks/api/markets/confirm-deploy',
{
method: 'POST',
headers: {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
stockTokenAddress: '0xabc...def',
txHash: tx.hash,
issuerAddress: '0x111...222',
adminAddress: '0x333...444'
})
}
);
const { data } = await res.json();
for (const [step, calldata] of Object.entries(data.configurationCalldata)) {
console.log(step, calldata.description);
}
{
"success": true,
"data": {
"market": {
"id": "clx_market_002",
"marketAddress": "0x70a0...9c2d",
"oracleAddress": "0x8b2e...4a7c",
"stockTokenSymbol": "ACME",
"borrowAssetSymbol": "USDC"
},
"txHash": "0x9f2c...a41b",
"signedBy": "0x123...456",
"signerAddress": "0x123...456",
"liquidationRouterAddress": "0x4c1f...8e3b",
"configurationSteps": [
{ "step": "authorizeMarketOnStockToken", "requiredRole": "ISSUER_ROLE", "done": false },
{ "step": "authorizeRouterOnStockToken", "requiredRole": "ISSUER_ROLE", "done": false }
],
"configurationCalldata": {
"authorizeMarketOnStockToken": {
"to": "0xabc...def",
"data": "0x1e4f8a20...",
"description": "Authorize the lending market on the stock token (requires ISSUER_ROLE)"
}
}
}
}
{
"success": false,
"error": {
"code": "TX_WRONG_ARGS",
"message": "Transaction deploys a market for a different stock token"
}
}
