> ## Documentation Index
> Fetch the complete documentation index at: https://rain-sandbox-trial.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# contract.created

<Update label="v1.0.1" description="add userId field">
  ### contract.created webhook (v1.0.1)

  Added the `userId` field to the webhook payload. This field contains the Rain user ID associated with the contract's `userAddress`, when a matching user exists.

  #### New Field

  | Field         | Type                | Description                                                                                          |
  | ------------- | ------------------- | ---------------------------------------------------------------------------------------------------- |
  | `body.userId` | `string` (optional) | The Rain user ID associated with the `userAddress`. May be `undefined` if no matching user is found. |

  #### Example Payload (v1.0.1)

  ```json theme={null}
  {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "resource": "contract",
      "action": "created",
      "version": "1.0.1",
      "body": {
          "id": "cc_abc123",
          "userAddress": "0x1234567890abcdef1234567890abcdef12345678",
          "chainId": "1",
          "proxyAddress": "0xabcdef1234567890abcdef1234567890abcdef12",
          "depositAddress": "0xfedcba0987654321fedcba0987654321fedcba09",
          "controllerAddress": "0x9876543210fedcba9876543210fedcba98765432",
          "contractVersion": 1,
          "userId": "usr_def456"
      }
  }
  ```
</Update>

<Update label="v1.0.0" description="initial release">
  ### contract.created webhook

  Added the `contract.created` webhook. This webhook is triggered when a new collateral smart contract is deployed for a user. It provides the contract details including addresses needed for depositing collateral.

  #### Payload Fields

  | Field                    | Type                | Description                                                |
  | ------------------------ | ------------------- | ---------------------------------------------------------- |
  | `id`                     | `string`            | Webhook ID                                                 |
  | `resource`               | `string`            | Always `"contract"`                                        |
  | `action`                 | `string`            | Always `"created"`                                         |
  | `version`                | `string`            | The webhook version                                        |
  | `body.id`                | `string`            | The collateral contract ID                                 |
  | `body.userAddress`       | `string`            | The user's wallet address associated with the contract     |
  | `body.chainId`           | `string`            | The blockchain chain ID (e.g., `"1"` for Ethereum mainnet) |
  | `body.proxyAddress`      | `string` (optional) | The proxy contract address                                 |
  | `body.depositAddress`    | `string` (optional) | The address where collateral should be deposited           |
  | `body.controllerAddress` | `string` (optional) | The coordinator/controller contract address                |
  | `body.contractVersion`   | `number`            | The version of the smart contract                          |

  #### Example Payload

  ```json theme={null}
  {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "resource": "contract",
      "action": "created",
      "version": "1.0.0",
      "body": {
          "id": "cc_abc123",
          "userAddress": "0x1234567890abcdef1234567890abcdef12345678",
          "chainId": "1",
          "proxyAddress": "0xabcdef1234567890abcdef1234567890abcdef12",
          "depositAddress": "0xfedcba0987654321fedcba0987654321fedcba09",
          "controllerAddress": "0x9876543210fedcba9876543210fedcba98765432",
          "contractVersion": 1
      }
  }
  ```
</Update>
