{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/carbonmark-com/json-schema/carbonmark-com-asset-price-schema.json",
  "title": "AssetPrice",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/carbonmark-com-openapi.json#/components/schemas/AssetPrice",
  "type": "object",
  "properties": {
    "sourceId": {
      "description": "Unique identifier for this price source. Provide this id when generating a Quote.",
      "type": "string"
    },
    "type": {
      "description": "Type of the asset price",
      "anyOf": [
        {
          "title": "listing",
          "description": "Marketplace listing",
          "type": "string",
          "enum": [
            "listing"
          ]
        },
        {
          "title": "klimaprotocol",
          "description": "Klima Protocol",
          "type": "string",
          "enum": [
            "klimaprotocol"
          ]
        }
      ]
    },
    "purchasePrice": {
      "description": "Quoted price to retire 1 tonne of this asset.",
      "type": "number"
    },
    "baseUnitPrice": {
      "description": "Value of the asset set by the seller for listing or raw redemption cost for carbon pools.",
      "type": "number"
    },
    "supply": {
      "description": "Total supply of carbon tokens in the listing or pool. For carbon pools, some of this may be illiquid. Use liquidSupply instead.",
      "type": "number"
    },
    "liquidSupply": {
      "description": "Amount of carbon available for retirement. For carbon pools, this value excludes the illiquid supply.",
      "type": "number"
    },
    "minFillAmount": {
      "description": "Minimum required quantity for transactions.",
      "type": "number"
    },
    "settlementToken": {
      "description": "Token used to settle purchases for this asset price.",
      "anyOf": [
        {
          "title": "kvcm",
          "description": "KVCM token used for settlement (Klima Protocol on Base).",
          "type": "string",
          "enum": [
            "kvcm"
          ]
        },
        {
          "title": "usdc",
          "description": "USDC used for settlement.",
          "type": "string",
          "enum": [
            "usdc"
          ]
        }
      ]
    },
    "listing": {
      "description": "Listing specific metadata",
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "creditId": {
          "$ref": "#/$defs/CarbonCreditId"
        },
        "token": {
          "$ref": "#/$defs/Token"
        },
        "sellerId": {
          "description": "Wallet address of the user who created the listing.",
          "type": "string"
        },
        "expiresAfter": {
          "description": "Timestamp when this price automatically expires",
          "type": "number"
        }
      },
      "required": [
        "id",
        "creditId",
        "token",
        "sellerId",
        "expiresAfter"
      ]
    },
    "klimaprotocol": {
      "description": "Listing specific metadata",
      "type": "object",
      "properties": {
        "creditId": {
          "$ref": "#/$defs/CarbonCreditId"
        },
        "token": {
          "$ref": "#/$defs/Token"
        },
        "carbonClass": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            }
          },
          "required": [
            "id"
          ]
        }
      },
      "required": [
        "creditId",
        "token",
        "carbonClass"
      ]
    }
  },
  "required": [
    "sourceId",
    "type",
    "purchasePrice",
    "baseUnitPrice",
    "supply",
    "liquidSupply",
    "minFillAmount",
    "settlementToken"
  ],
  "$defs": {
    "CarbonCreditId": {
      "type": "object",
      "properties": {
        "vintage": {
          "description": "Vintage of the carbon credit",
          "type": "number"
        },
        "projectId": {
          "description": "ID of the project associated with this credit",
          "type": "string"
        },
        "creditId": {
          "description": "ID of the credit",
          "type": "string"
        }
      },
      "required": [
        "vintage",
        "projectId"
      ]
    },
    "Token": {
      "type": "object",
      "properties": {
        "id": {
          "description": "Identifier of the token",
          "type": "string"
        },
        "address": {
          "description": "Address of the credit being sold",
          "type": "string"
        },
        "decimals": {
          "description": "The smallest divisible unit for the token ",
          "type": "number"
        },
        "tokenId": {
          "anyOf": [
            {
              "description": "ID of the credit being sold (0 for ERC20 tokens)",
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "tokenStandard": {
          "description": "Standard of the Token",
          "anyOf": [
            {
              "title": "erc20",
              "type": "string",
              "enum": [
                "erc20"
              ]
            },
            {
              "title": "erc1155",
              "type": "string",
              "enum": [
                "erc1155"
              ]
            }
          ]
        },
        "name": {
          "description": "Name of the token.",
          "type": "string"
        },
        "isExAnte": {
          "description": "Ex-ante credits refer to those that are issued on the basis of predicted or expected future carbon emissions reductions or removals.",
          "type": "boolean"
        },
        "symbol": {
          "description": "Symbol of the token",
          "type": "string"
        },
        "creditTokenId": {
          "description": "Unique identifier for this token",
          "type": "string"
        }
      },
      "required": [
        "id",
        "address",
        "decimals",
        "tokenStandard",
        "name",
        "isExAnte",
        "symbol",
        "creditTokenId"
      ]
    }
  }
}