# ISP

## Events

### SchemaRegistered

```solidity
event SchemaRegistered(uint64 schemaId)
```

### AttestationMade

```solidity
event AttestationMade(uint64 attestationId, string indexingKey)
```

### AttestationRevoked

```solidity
event AttestationRevoked(uint64 attestationId, string reason)
```

### OffchainAttestationMade

```solidity
event OffchainAttestationMade(string attestationId)
```

### OffchainAttestationRevoked

```solidity
event OffchainAttestationRevoked(string attestationId, string reason)
```

## Errors

### SchemaNonexistent

```solidity
error SchemaNonexistent(uint64 nonexistentSchemaId)
```

*0x38f8c6c4*

### SchemaWrongRegistrant

```solidity
error SchemaWrongRegistrant(address expected, address actual)
```

*0x71984561*

### AttestationIrrevocable

```solidity
error AttestationIrrevocable(uint64 schemaId, uint64 offendingAttestationId)
```

*0x8ac42f49*

### AttestationNonexistent

```solidity
error AttestationNonexistent(uint64 nonexistentAttestationId)
```

*0x54681a13*

### AttestationInvalidDuration

```solidity
error AttestationInvalidDuration(uint64 offendingAttestationId, uint64 maxDuration, uint64 inputDuration)
```

*0xa65e02ed*

### AttestationAlreadyRevoked

```solidity
error AttestationAlreadyRevoked(uint64 offendingAttestationId)
```

*0xd8c3da86*

### AttestationWrongAttester

```solidity
error AttestationWrongAttester(address expected, address actual)
```

*0xa9ad2007*

### OffchainAttestationExists

```solidity
error OffchainAttestationExists(string existingOffchainAttestationId)
```

*0xc83e3cdf*

### OffchainAttestationNonexistent

```solidity
error OffchainAttestationNonexistent(string nonexistentOffchainAttestationId)
```

*0xa006519a*

### OffchainAttestationAlreadyRevoked

```solidity
error OffchainAttestationAlreadyRevoked(string offendingOffchainAttestationId)
```

*0xa0671d20*

### InvalidDelegateSignature

```solidity
error InvalidDelegateSignature()
```

*0xfdf4e6f9*

### LegacySPRequired

```solidity
error LegacySPRequired(address legacySP)
```

*0x5c34b9cc*

## Functions

### register

```solidity
function register(struct Schema schema, bytes delegateSignature) external returns (uint64 schemaId)
```

Registers a Schema.

*Emits `SchemaRegistered`.*

#### Parameters

| Name              | Type          | Description   |
| ----------------- | ------------- | ------------- |
| schema            | struct Schema | See `Schema`. |
| delegateSignature | bytes         |               |

#### Return Values

| Name     | Type   | Description                               |
| -------- | ------ | ----------------------------------------- |
| schemaId | uint64 | The assigned ID of the registered schema. |

### attest

```solidity
function attest(struct Attestation attestation, string indexingKey, bytes delegateSignature, bytes extraData) external returns (uint64 attestationId)
```

Makes an attestation.

*Emits `AttestationMade`.*

#### Parameters

| Name              | Type               | Description                                                                                         |
| ----------------- | ------------------ | --------------------------------------------------------------------------------------------------- |
| attestation       | struct Attestation | See `Attestation`.                                                                                  |
| indexingKey       | string             | Used by the frontend to aid indexing.                                                               |
| delegateSignature | bytes              | An optional ECDSA delegateSignature if this is a delegated attestation. Use `""` or `0x` otherwise. |
| extraData         | bytes              | This is forwarded to the resolver directly.                                                         |

#### Return Values

| Name          | Type   | Description                         |
| ------------- | ------ | ----------------------------------- |
| attestationId | uint64 | The assigned ID of the attestation. |

### attest

```solidity
function attest(struct Attestation attestation, uint256 resolverFeesETH, string indexingKey, bytes delegateSignature, bytes extraData) external payable returns (uint64 attestationId)
```

Makes an attestation where the schema hook expects ETH payment.

*Emits `AttestationMade`.*

#### Parameters

| Name              | Type               | Description                                                                                         |
| ----------------- | ------------------ | --------------------------------------------------------------------------------------------------- |
| attestation       | struct Attestation | See `Attestation`.                                                                                  |
| resolverFeesETH   | uint256            | Amount of funds to send to the hook.                                                                |
| indexingKey       | string             | Used by the frontend to aid indexing.                                                               |
| delegateSignature | bytes              | An optional ECDSA delegateSignature if this is a delegated attestation. Use `""` or `0x` otherwise. |
| extraData         | bytes              | This is forwarded to the resolver directly.                                                         |

#### Return Values

| Name          | Type   | Description                         |
| ------------- | ------ | ----------------------------------- |
| attestationId | uint64 | The assigned ID of the attestation. |

### attest

```solidity
function attest(struct Attestation attestation, contract IERC20 resolverFeesERC20Token, uint256 resolverFeesERC20Amount, string indexingKey, bytes delegateSignature, bytes extraData) external returns (uint64 attestationId)
```

Makes an attestation where the schema hook expects ERC20 payment.

*Emits `AttestationMade`.*

#### Parameters

| Name                    | Type               | Description                                                                                         |
| ----------------------- | ------------------ | --------------------------------------------------------------------------------------------------- |
| attestation             | struct Attestation | See `Attestation`.                                                                                  |
| resolverFeesERC20Token  | contract IERC20    | ERC20 token address used for payment.                                                               |
| resolverFeesERC20Amount | uint256            | Amount of funds to send to the hook.                                                                |
| indexingKey             | string             | Used by the frontend to aid indexing.                                                               |
| delegateSignature       | bytes              | An optional ECDSA delegateSignature if this is a delegated attestation. Use `""` or `0x` otherwise. |
| extraData               | bytes              | This is forwarded to the resolver directly.                                                         |

#### Return Values

| Name          | Type   | Description                         |
| ------------- | ------ | ----------------------------------- |
| attestationId | uint64 | The assigned ID of the attestation. |

### attestOffchain

```solidity
function attestOffchain(string offchainAttestationId, address delegateAttester, bytes delegateSignature) external
```

Timestamps an off-chain data ID.

*Emits `OffchainAttestationMade`.*

#### Parameters

| Name                  | Type    | Description                                                                                                                                         |
| --------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| offchainAttestationId | string  | The off-chain data ID.                                                                                                                              |
| delegateAttester      | address | An optional delegated attester that authorized the caller to attest on their behalf if this is a delegated attestation. Use `address(0)` otherwise. |
| delegateSignature     | bytes   | An optional ECDSA delegateSignature if this is a delegated attestation. Use `""` or `0x` otherwise. Use `""` or `0x` otherwise.                     |

### revoke

```solidity
function revoke(uint64 attestationId, string reason, bytes delegateSignature, bytes extraData) external
```

Revokes an existing revocable attestation.

*Emits `AttestationRevoked`. Must be called by the attester.*

#### Parameters

| Name              | Type   | Description                                                            |
| ----------------- | ------ | ---------------------------------------------------------------------- |
| attestationId     | uint64 | An existing attestation ID.                                            |
| reason            | string | The revocation reason. This is only emitted as an event to save gas.   |
| delegateSignature | bytes  | An optional ECDSA delegateSignature if this is a delegated revocation. |
| extraData         | bytes  | This is forwarded to the resolver directly.                            |

### revoke

```solidity
function revoke(uint64 attestationId, string reason, uint256 resolverFeesETH, bytes delegateSignature, bytes extraData) external payable
```

Revokes an existing revocable attestation where the schema hook expects ERC20 payment.

*Emits `AttestationRevoked`. Must be called by the attester.*

#### Parameters

| Name              | Type    | Description                                                            |
| ----------------- | ------- | ---------------------------------------------------------------------- |
| attestationId     | uint64  | An existing attestation ID.                                            |
| reason            | string  | The revocation reason. This is only emitted as an event to save gas.   |
| resolverFeesETH   | uint256 | Amount of funds to send to the hook.                                   |
| delegateSignature | bytes   | An optional ECDSA delegateSignature if this is a delegated revocation. |
| extraData         | bytes   | This is forwarded to the resolver directly.                            |

### revoke

```solidity
function revoke(uint64 attestationId, string reason, contract IERC20 resolverFeesERC20Token, uint256 resolverFeesERC20Amount, bytes delegateSignature, bytes extraData) external
```

Revokes an existing revocable attestation where the schema hook expects ERC20 payment.

*Emits `AttestationRevoked`. Must be called by the attester.*

#### Parameters

| Name                    | Type            | Description                                                            |
| ----------------------- | --------------- | ---------------------------------------------------------------------- |
| attestationId           | uint64          | An existing attestation ID.                                            |
| reason                  | string          | The revocation reason. This is only emitted as an event to save gas.   |
| resolverFeesERC20Token  | contract IERC20 | ERC20 token address used for payment.                                  |
| resolverFeesERC20Amount | uint256         | Amount of funds to send to the hook.                                   |
| delegateSignature       | bytes           | An optional ECDSA delegateSignature if this is a delegated revocation. |
| extraData               | bytes           | This is forwarded to the resolver directly.                            |

### revokeOffchain

```solidity
function revokeOffchain(string offchainAttestationId, string reason, bytes delegateSignature) external
```

Revokes an existing offchain attestation.

*Emits `OffchainAttestationRevoked`. Must be called by the attester.*

#### Parameters

| Name                  | Type   | Description                                                            |
| --------------------- | ------ | ---------------------------------------------------------------------- |
| offchainAttestationId | string | An existing attestation ID.                                            |
| reason                | string | The revocation reason. This is only emitted as an event to save gas.   |
| delegateSignature     | bytes  | An optional ECDSA delegateSignature if this is a delegated revocation. |

### registerBatch

```solidity
function registerBatch(struct Schema[] schemas, bytes delegateSignature) external returns (uint64[] schemaIds)
```

Batch registers a Schema.

### attestBatch

```solidity
function attestBatch(struct Attestation[] attestations, string[] indexingKeys, bytes delegateSignature, bytes extraData) external returns (uint64[] attestationIds)
```

Batch attests.

### attestBatch

```solidity
function attestBatch(struct Attestation[] attestations, uint256[] resolverFeesETH, string[] indexingKeys, bytes delegateSignature, bytes extraData) external payable returns (uint64[] attestationIds)
```

Batch attests where the schema hook expects ETH payment.

### attestBatch

```solidity
function attestBatch(struct Attestation[] attestations, contract IERC20[] resolverFeesERC20Tokens, uint256[] resolverFeesERC20Amount, string[] indexingKeys, bytes delegateSignature, bytes extraData) external returns (uint64[] attestationIds)
```

Batch attests where the schema hook expects ERC20 payment.

### attestOffchainBatch

```solidity
function attestOffchainBatch(string[] offchainAttestationIds, address delegateAttester, bytes delegateSignature) external
```

Batch timestamps off-chain data IDs.

### revokeBatch

```solidity
function revokeBatch(uint64[] attestationIds, string[] reasons, bytes delegateSignature, bytes extraData) external
```

Batch revokes revocable on-chain attestations.

### revokeBatch

```solidity
function revokeBatch(uint64[] attestationIds, string[] reasons, uint256[] resolverFeesETH, bytes delegateSignature, bytes extraData) external payable
```

Batch revokes revocable on-chain attestations where the schema hook expects ETH payment.

### revokeBatch

```solidity
function revokeBatch(uint64[] attestationIds, string[] reasons, contract IERC20[] resolverFeesERC20Tokens, uint256[] resolverFeesERC20Amount, bytes delegateSignature, bytes extraData) external
```

Batch revokes revocable on-chain attestations where the schema hook expects ERC20 payment.

### revokeOffchainBatch

```solidity
function revokeOffchainBatch(string[] offchainAttestationIds, string[] reasons, bytes delegateSignature) external
```

Batch revokes off-chain attestations.

### getSchema

```solidity
function getSchema(uint64 schemaId) external view returns (struct Schema)
```

Returns the specified `Schema`.

### getAttestation

```solidity
function getAttestation(uint64 attestationId) external view returns (struct Attestation)
```

Returns the specified `Attestation`.

### getOffchainAttestation

```solidity
function getOffchainAttestation(string offchainAttestationId) external view returns (struct OffchainAttestation)
```

Returns the specified `OffchainAttestation`.

### getDelegatedRegisterHash

```solidity
function getDelegatedRegisterHash(struct Schema schema) external pure returns (bytes32)
```

Returns the hash that will be used to authorize a delegated registration.

### getDelegatedRegisterBatchHash

```solidity
function getDelegatedRegisterBatchHash(struct Schema[] schemas) external pure returns (bytes32)
```

Returns the hash that will be used to authorize a delegated batch registration.

### getDelegatedAttestHash

```solidity
function getDelegatedAttestHash(struct Attestation attestation) external pure returns (bytes32)
```

Returns the hash that will be used to authorize a delegated attestation.

### getDelegatedAttestBatchHash

```solidity
function getDelegatedAttestBatchHash(struct Attestation[] attestations) external pure returns (bytes32)
```

Returns the hash that will be used to authorize a delegated batch attestation.

### getDelegatedOffchainAttestHash

```solidity
function getDelegatedOffchainAttestHash(string offchainAttestationId) external pure returns (bytes32)
```

Returns the hash that will be used to authorize a delegated offchain attestation.

### getDelegatedOffchainAttestBatchHash

```solidity
function getDelegatedOffchainAttestBatchHash(string[] offchainAttestationIds) external pure returns (bytes32)
```

Returns the hash that will be used to authorize a delegated batch offchain attestation.

### getDelegatedRevokeHash

```solidity
function getDelegatedRevokeHash(uint64 attestationId, string reason) external pure returns (bytes32)
```

Returns the hash that will be used to authorize a delegated revocation.

### getDelegatedRevokeBatchHash

```solidity
function getDelegatedRevokeBatchHash(uint64[] attestationIds, string[] reasons) external pure returns (bytes32)
```

Returns the hash that will be used to authorize a delegated batch revocation.

### getDelegatedOffchainRevokeHash

```solidity
function getDelegatedOffchainRevokeHash(string offchainAttestationId, string reason) external pure returns (bytes32)
```

Returns the hash that will be used to authorize a delegated offchain revocation.

### getDelegatedOffchainRevokeBatchHash

```solidity
function getDelegatedOffchainRevokeBatchHash(string[] offchainAttestationIds, string[] reasons) external pure returns (bytes32)
```

Returns the hash that will be used to authorize a delegated batch offchain revocation.

### schemaCounter

```solidity
function schemaCounter() external view returns (uint64)
```

Returns the current schema counter. This is incremented for each `Schema` registered.

### attestationCounter

```solidity
function attestationCounter() external view returns (uint64)
```

Returns the current on-chain attestation counter. This is incremented for each `Attestation` made.
