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

# ICAS

# Solidity API

## Grade

```solidity theme={null}
struct Grade {
  string name;
  uint256 fee;
  uint256 requiredTokens;
  uint256 requiredWLVerifiers;
  uint256 requiredCommunityUsers;
}
```

## AttestationRequestData

A struct representing the arguments of the attestation request.

```solidity theme={null}
struct AttestationRequestData {
  address recipient;
  uint64 expirationTime;
  bool revocable;
  bytes32 refUID;
  bytes data;
}
```

## AttestationRequest

A struct representing the full arguments of the attestation request.

```solidity theme={null}
struct AttestationRequest {
  bytes32 schema;
  struct AttestationRequestData data;
}
```

## AttestationsResult

A struct representing an internal attestation result.

```solidity theme={null}
struct AttestationsResult {
  uint256 usedValue;
  bytes32[] uids;
}
```

## ChallengeRequestData

A struct representing the arguments of the attestation request.

```solidity theme={null}
struct ChallengeRequestData {
  address recipient;
  uint64 expirationTime;
  bool revocable;
  bytes32 refUID;
  bytes data;
  uint256 value;
}
```

## ChallengeRequest

A struct representing the full arguments of the attestation request.

```solidity theme={null}
struct ChallengeRequest {
  bytes32 attestation;
  struct ChallengeRequestData data;
}
```

## CulturaRightsBoundAccountInfo

```solidity theme={null}
struct CulturaRightsBoundAccountInfo {
  address rightsBoundAccount;
  address attester;
  address digitalAssetAddress;
  uint256 digitalAssetId;
}
```

## TransferFailed

```solidity theme={null}
error TransferFailed()
```

Custom errors for better reverts

## VerifierNotWhitelisted

```solidity theme={null}
error VerifierNotWhitelisted()
```

## AttestationDoesNotExist

```solidity theme={null}
error AttestationDoesNotExist()
```

## AlreadyRevoked

```solidity theme={null}
error AlreadyRevoked()
```

## AlreadyRevokedOffchain

```solidity theme={null}
error AlreadyRevokedOffchain()
```

## AlreadyTimestamped

```solidity theme={null}
error AlreadyTimestamped()
```

## InsufficientValue

```solidity theme={null}
error InsufficientValue()
```

## InvalidAttestation

```solidity theme={null}
error InvalidAttestation()
```

## InvalidAttestations

```solidity theme={null}
error InvalidAttestations()
```

## InvalidExpirationTime

```solidity theme={null}
error InvalidExpirationTime()
```

## InvalidOffset

```solidity theme={null}
error InvalidOffset()
```

## InvalidRegistry

```solidity theme={null}
error InvalidRegistry()
```

## InvalidRevocation

```solidity theme={null}
error InvalidRevocation()
```

## InvalidRevocations

```solidity theme={null}
error InvalidRevocations()
```

## InvalidSchema

```solidity theme={null}
error InvalidSchema()
```

## InvalidVerifier

```solidity theme={null}
error InvalidVerifier()
```

## Irrevocable

```solidity theme={null}
error Irrevocable()
```

## NotPayable

```solidity theme={null}
error NotPayable()
```

## WrongSchema

```solidity theme={null}
error WrongSchema()
```

## LevelAlreadyExists

```solidity theme={null}
error LevelAlreadyExists()
```

## DigitalAssetCollectionCantBe0Address

```solidity theme={null}
error DigitalAssetCollectionCantBe0Address()
```

## ValueSentLessThanGradeFee

```solidity theme={null}
error ValueSentLessThanGradeFee()
```

## AssetHasToBeVerifiedRights

```solidity theme={null}
error AssetHasToBeVerifiedRights()
```

# Contract: ICAS

CAS - Cultura Attestation Service interface.

## External Functions

### getSchemaRegistry

```solidity theme={null}
function getSchemaRegistryfunction getSchemaRegistry() external view returns (contract ISchemaRegistry)
```

Returns the address of the global schema registry.

#### Return Values

| Description                                |
| ------------------------------------------ |
| The address of the global schema registry. |

### attest

```solidity theme={null}
function attestfunction attest(struct AttestationRequest request, address digitalAssetAddress, uint256 digitalAssetId, uint256 grade, uint256 amount) external returns (bytes32)
```

Creates an attestation for a digital asset with specified grade and bonded amount

#### Parameters

| Name                  | Description                                        |
| --------------------- | -------------------------------------------------- |
| `request`             | The attestation request containing schema and data |
| `digitalAssetAddress` | The address of the digital asset contract          |
| `digitalAssetId`      | The token ID of the digital asset                  |
| `grade`               | The grade level to assign (0=S, 1=A, 2=B, 3=C)     |
| `amount`              | The amount of bond tokens to lock                  |

#### Return Values

| Description                        |
| ---------------------------------- |
| UID The UID of the new attestation |

### delegatedAttest

```solidity theme={null}
function delegatedAttestfunction delegatedAttest(struct SignatureUtils.SignatureParams delegatedSignature, struct AttestationRequest request, address digitalAssetAddress, uint256 digitalAssetId, uint256 grade, uint256 amount, address attester) external returns (bytes32)
```

Allows users to attest to a specific schema on behalf of another user

#### Parameters

| Name                  | Description                                 |
| --------------------- | ------------------------------------------- |
| `delegatedSignature`  | The signature of the delegating user        |
| `request`             | The attestation request data                |
| `digitalAssetAddress` | The address of the digital asset collection |
| `digitalAssetId`      | The ID of the digital asset                 |
| `grade`               | The grade of the digital asset              |
| `amount`              | The amount of bond tokens to send           |
| `attester`            | The address of the attester                 |

#### Return Values

| Description                    |
| ------------------------------ |
| The UID of the new attestation |

### verifyAttestation

```solidity theme={null}
function verifyAttestationfunction verifyAttestation(bytes32 attestationUID, uint256 bondedAmount) external
```

Verifies an attestation

### challengeAttestation

```solidity theme={null}
function challengeAttestationfunction challengeAttestation(struct ChallengeRequest request, uint256 challengeAmount) external
```

Challenges an existing attestation by withdrawing bonded tokens

#### Parameters

| Name              | Description                                               |
| ----------------- | --------------------------------------------------------- |
| `request`         | The challenge request containing attestation UID and data |
| `challengeAmount` | The amount of bonded tokens to withdraw in the challenge  |

### isAttestationValid

```solidity theme={null}
function isAttestationValidfunction isAttestationValid(bytes32 uid) external view returns (bool)
```

Checks whether an attestation exists.

#### Parameters

| Name  | Description                             |
| ----- | --------------------------------------- |
| `uid` | The UID of the attestation to retrieve. |

#### Return Values

| Description                    |
| ------------------------------ |
| Whether an attestation exists. |

### addWLVerifier

```solidity theme={null}
function addWLVerifierfunction addWLVerifier(address verifier) external
```

Adds a whitelisted verifier to the contract

#### Parameters

| Name       | Description                        |
| ---------- | ---------------------------------- |
| `verifier` | The address of the verifier to add |

### removeWLVerifier

```solidity theme={null}
function removeWLVerifierfunction removeWLVerifier(address verifier) external
```

Removes a whitelisted verifier from the contract

#### Parameters

| Name       | Description                           |
| ---------- | ------------------------------------- |
| `verifier` | The address of the verifier to remove |

### getNonce

```solidity theme={null}
function getNoncefunction getNonce(address user) external view returns (uint256)
```

Returns the nonce for a given user.

#### Parameters

| Name   | Description              |
| ------ | ------------------------ |
| `user` | The address of the user. |

#### Return Values

| Description             |
| ----------------------- |
| The nonce for the user. |

## Events

### `Attested`

```solidity theme={null}
event Attestedevent Attested(address recipient, address attester, bytes32 uid, bytes32 schemaUID, uint256 grade)
```

Emitted when an attestation has been made.

### `Verified`

```solidity theme={null}
event Verifiedevent Verified(address attester, bytes32 attestationUID)
```

### `Challenged`

```solidity theme={null}
event Challengedevent Challenged(address challenger, bytes32 uid, uint256 bondedAmount)
```

Emitted when an attestation has been challenged.

### `Revoked`

```solidity theme={null}
event Revokedevent Revoked(address recipient, address attester, bytes32 uid, bytes32 schemaUID)
```

Emitted when an attestation has been revoked.

### `Timestamped`

```solidity theme={null}
event Timestampedevent Timestamped(bytes32 data, uint64 timestamp)
```

Emitted when a data has been timestamped.

### `RevokedOffchain`

```solidity theme={null}
event RevokedOffchainevent RevokedOffchain(address revoker, bytes32 data, uint64 timestamp)
```

Emitted when a data has been revoked.

### `CulturaRightsBoundAccountDeployed`

```solidity theme={null}
event CulturaRightsBoundAccountDeployedevent CulturaRightsBoundAccountDeployed(struct CulturaRightsBoundAccountInfo rightsBoundAccount)
```

Emitted when a CulturaRightsBoundAccount has been deployed.

### `VerifierWLStateChanged`

```solidity theme={null}
event VerifierWLStateChangedevent VerifierWLStateChanged(address verifier, bool isWhitelisted)
```

Emitted when a user is promoted or demoted from Verifier Whitelist.
