> ## Documentation Index
> Fetch the complete documentation index at: https://docs.convallax.com/llms.txt
> Use this file to discover all available pages before exploring further.

# settleWithAttestation()

> Submit a signed resolution attestation on-chain to settle an expired option series.

Submit a signed resolution attestation to settle an expired option series. Anyone holding option tokens for the series (or the contract owner) can relay the attestation. The contract verifies the EIP-712 signature against the registered `resolutionSigner`.

After settlement, holders can call [`claimHolderPayout()`](/api-reference/contracts/claim-holder) and writers can call [`claimWriterCollateral()`](/api-reference/contracts/claim-writer).

**Contract:** `ConvallaxCore` — `0x76c41a03e0993F0261bB3B1949320cA693f76faE`

## Function Signature

```solidity theme={null}
function settleWithAttestation(
    uint256 seriesId,
    uint16 resolutionBps,
    uint256 validUntil,
    bytes calldata signature
) external
```

## Parameters

<ParamField body="seriesId" type="uint256" required>
  The expired option series to settle.
</ParamField>

<ParamField body="resolutionBps" type="uint16" required>
  Resolution price in basis points (0–100). `0` = NO wins, `100` = YES wins, or any intermediate value for a continuous TWAP settlement.
</ParamField>

<ParamField body="validUntil" type="uint256" required>
  Attestation expiry (Unix timestamp). Must be ≥ `block.timestamp`.
</ParamField>

<ParamField body="signature" type="bytes" required>
  EIP-712 signature from the resolution signer over the `SettlementAttestation` struct.
</ParamField>

## EIP-712 Domain

| Field               | Value                                        |
| ------------------- | -------------------------------------------- |
| `name`              | `ConvallaxCore`                              |
| `version`           | `1`                                          |
| `chainId`           | `80002`                                      |
| `verifyingContract` | `0x76c41a03e0993F0261bB3B1949320cA693f76faE` |

## Attestation Struct

```solidity theme={null}
struct SettlementAttestation {
    uint256 seriesId;
    uint16  resolutionBps;
    uint256 validUntil;
}
```

## Getting the Attestation

Use [`POST /settlement/prepare`](/api-reference/settlement/prepare) to compute the VWAP and receive the signed attestation. Pass the returned values directly to this function.

## Prerequisites

* `block.timestamp ≥ expiry` — the option must have expired
* The series must not already be settled
* The caller must hold option tokens for the series, or be the contract owner
* `block.timestamp ≤ validUntil` — the attestation must not have expired
* The signature must recover to the registered `resolutionSigner`

## Example

```javascript theme={null}
const core = new ethers.Contract(
  '0x76c41a03e0993F0261bB3B1949320cA693f76faE',
  ['function settleWithAttestation(uint256 seriesId, uint16 resolutionBps, uint256 validUntil, bytes signature) external'],
  signer
);

// Values from POST /settlement/prepare
const tx = await core.settleWithAttestation(
  seriesId,
  59,        // resolutionBps
  validUntil,
  signature
);
await tx.wait();
```

## Reverts

| Condition                             | Reason                       |
| ------------------------------------- | ---------------------------- |
| Not yet expired                       | `SeriesNotExpired(seriesId)` |
| Already settled                       | `AlreadySettled(seriesId)`   |
| Attestation expired                   | `AttestationExpired`         |
| Invalid signer                        | `InvalidSigner`              |
| Caller has no tokens and is not owner | `NotHolderOrOwner`           |
