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

# AIResolver

> ECDSA-verifies TEE judge signatures on-chain, then forwards resolve() to the market.

Source: [`packages/contracts/src/resolvers/AIResolver.sol`](https://github.com/rstfulzz/signalium/blob/main/packages/contracts/src/resolvers/AIResolver.sol)

Decouples the market from the judge worker. Markets see a single trusted resolver address; the resolver gates which TEE provider keys can finalize a verdict.

## Storage

```solidity theme={null}
mapping(address => bool) public allowedProvider; // owner-managed allowlist
mapping(bytes32 => bool) public usedNonce;       // replay protection
bytes32 public constant DOMAIN_TAG = keccak256("Signalium.AIResolver.v1");
```

## submitResolution(market, outcome, attestationHash, proof)

`proof` is `abi.encode(uint256 deadline, bytes32 nonce, bytes signature)`. The resolver:

1. Decodes the proof.
2. Rejects past `deadline` or used `nonce`.
3. Builds the digest `keccak256(abi.encode(DOMAIN_TAG, chainId, address(this), market, outcome, attestationHash, nonce))`.
4. `ecrecover` against the EIP-191 prefixed hash to recover the signer.
5. Rejects unknown signers.
6. Marks the nonce used, emits `ResolutionSubmitted`, and forwards `IPredictionMarket(market).resolve(outcome, attestationHash)`.

## Why a domain tag

Without `DOMAIN_TAG`, a verdict signed for one Signalium deployment could be replayed against another (e.g., a hypothetical future v2 contract). The tag binds every signature to this specific resolver version.
