Skip to main content
POST
/
lending-stocks
/
api
/
markets
/
deploy
curl -X POST "https://api.trusset.org/lending-stocks/api/markets/deploy" \
  -H "X-API-Key: trusset_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "stockTokenAddress": "0xabc...def",
    "issuerAddress": "0x111...222",
    "adminAddress": "0x333...444",
    "initialPrice": "50.00",
    "useRelayer": true
  }'
{
  "success": true,
  "data": {
    "market": { "id": "clx_market_002", "marketAddress": "0x..." },
    "txHash": "0xabc...def",
    "configurationSteps": [
      { "step": "authorizeMarketOnStockToken", "requiredRole": "ISSUER_ROLE" },
      { "step": "authorizeRouterOnStockToken", "requiredRole": "ISSUER_ROLE" }
    ]
  }
}
Deploys a complete lending market (oracle, interest model, insurance fund, and market contract) through the factory. When useRelayer is false, returns unsigned calldata for client-side signing.
After deployment, the stock token issuer must authorize both the market and liquidation router on the stock token contract via addAuthorizedContract.

Body Parameters

stockTokenAddress
string
required
ERC-20 stock token address.
issuerAddress
string
required
Issuer wallet (receives ISSUER_ROLE).
adminAddress
string
required
Admin wallet (receives DEFAULT_ADMIN_ROLE).
initialPrice
string
required
Initial oracle price in USD (e.g. "50.00").
useRelayer
boolean
default:"false"
Execute via relayer or return calldata.
curl -X POST "https://api.trusset.org/lending-stocks/api/markets/deploy" \
  -H "X-API-Key: trusset_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "stockTokenAddress": "0xabc...def",
    "issuerAddress": "0x111...222",
    "adminAddress": "0x333...444",
    "initialPrice": "50.00",
    "useRelayer": true
  }'
{
  "success": true,
  "data": {
    "market": { "id": "clx_market_002", "marketAddress": "0x..." },
    "txHash": "0xabc...def",
    "configurationSteps": [
      { "step": "authorizeMarketOnStockToken", "requiredRole": "ISSUER_ROLE" },
      { "step": "authorizeRouterOnStockToken", "requiredRole": "ISSUER_ROLE" }
    ]
  }
}