github.com/ethereum-optimism/optimism@v1.7.2/packages/contracts-bedrock/src/EAS/IEAS.sol (about)

     1  // SPDX-License-Identifier: MIT
     2  pragma solidity ^0.8.0;
     3  
     4  import { ISchemaRegistry } from "src/EAS/ISchemaRegistry.sol";
     5  import { Attestation, Signature } from "src/EAS/Common.sol";
     6  
     7  /// @dev A struct representing the arguments of the attestation request.
     8  struct AttestationRequestData {
     9      address recipient; // The recipient of the attestation.
    10      uint64 expirationTime; // The time when the attestation expires (Unix timestamp).
    11      bool revocable; // Whether the attestation is revocable.
    12      bytes32 refUID; // The UID of the related attestation.
    13      bytes data; // Custom attestation data.
    14      uint256 value; // An explicit ETH amount to send to the resolver. This is important to prevent accidental user
    15          // errors.
    16  }
    17  
    18  /// @dev A struct representing the full arguments of the attestation request.
    19  struct AttestationRequest {
    20      bytes32 schema; // The unique identifier of the schema.
    21      AttestationRequestData data; // The arguments of the attestation request.
    22  }
    23  
    24  /// @dev A struct representing the full arguments of the full delegated attestation request.
    25  struct DelegatedAttestationRequest {
    26      bytes32 schema; // The unique identifier of the schema.
    27      AttestationRequestData data; // The arguments of the attestation request.
    28      Signature signature; // The ECDSA signature data.
    29      address attester; // The attesting account.
    30      uint64 deadline; // The deadline of the signature/request.
    31  }
    32  
    33  /// @dev A struct representing the full arguments of the multi attestation request.
    34  struct MultiAttestationRequest {
    35      bytes32 schema; // The unique identifier of the schema.
    36      AttestationRequestData[] data; // The arguments of the attestation request.
    37  }
    38  
    39  /// @dev A struct representing the full arguments of the delegated multi attestation request.
    40  struct MultiDelegatedAttestationRequest {
    41      bytes32 schema; // The unique identifier of the schema.
    42      AttestationRequestData[] data; // The arguments of the attestation requests.
    43      Signature[] signatures; // The ECDSA signatures data. Please note that the signatures are assumed to be signed with
    44          // increasing nonces.
    45      address attester; // The attesting account.
    46      uint64 deadline; // The deadline of the signature/request.
    47  }
    48  
    49  /// @dev A struct representing the arguments of the revocation request.
    50  struct RevocationRequestData {
    51      bytes32 uid; // The UID of the attestation to revoke.
    52      uint256 value; // An explicit ETH amount to send to the resolver. This is important to prevent accidental user
    53          // errors.
    54  }
    55  
    56  /// @dev A struct representing the full arguments of the revocation request.
    57  struct RevocationRequest {
    58      bytes32 schema; // The unique identifier of the schema.
    59      RevocationRequestData data; // The arguments of the revocation request.
    60  }
    61  
    62  /// @dev A struct representing the arguments of the full delegated revocation request.
    63  struct DelegatedRevocationRequest {
    64      bytes32 schema; // The unique identifier of the schema.
    65      RevocationRequestData data; // The arguments of the revocation request.
    66      Signature signature; // The ECDSA signature data.
    67      address revoker; // The revoking account.
    68      uint64 deadline; // The deadline of the signature/request.
    69  }
    70  
    71  /// @dev A struct representing the full arguments of the multi revocation request.
    72  struct MultiRevocationRequest {
    73      bytes32 schema; // The unique identifier of the schema.
    74      RevocationRequestData[] data; // The arguments of the revocation request.
    75  }
    76  
    77  /// @dev A struct representing the full arguments of the delegated multi revocation request.
    78  struct MultiDelegatedRevocationRequest {
    79      bytes32 schema; // The unique identifier of the schema.
    80      RevocationRequestData[] data; // The arguments of the revocation requests.
    81      Signature[] signatures; // The ECDSA signatures data. Please note that the signatures are assumed to be signed with
    82          // increasing nonces.
    83      address revoker; // The revoking account.
    84      uint64 deadline; // The deadline of the signature/request.
    85  }
    86  
    87  /// @title IEAS
    88  /// @notice The Ethereum Attestation Service interface.
    89  interface IEAS {
    90      /// @dev Emitted when an attestation has been made.
    91      /// @param recipient The recipient of the attestation.
    92      /// @param attester The attesting account.
    93      /// @param uid The UID the revoked attestation.
    94      /// @param schemaUID The UID of the schema.
    95      event Attested(address indexed recipient, address indexed attester, bytes32 uid, bytes32 indexed schemaUID);
    96  
    97      /// @dev Emitted when an attestation has been revoked.
    98      /// @param recipient The recipient of the attestation.
    99      /// @param attester The attesting account.
   100      /// @param schemaUID The UID of the schema.
   101      /// @param uid The UID the revoked attestation.
   102      event Revoked(address indexed recipient, address indexed attester, bytes32 uid, bytes32 indexed schemaUID);
   103  
   104      /// @dev Emitted when a data has been timestamped.
   105      /// @param data The data.
   106      /// @param timestamp The timestamp.
   107      event Timestamped(bytes32 indexed data, uint64 indexed timestamp);
   108  
   109      /// @dev Emitted when a data has been revoked.
   110      /// @param revoker The address of the revoker.
   111      /// @param data The data.
   112      /// @param timestamp The timestamp.
   113      event RevokedOffchain(address indexed revoker, bytes32 indexed data, uint64 indexed timestamp);
   114  
   115      /// @notice Returns the address of the global schema registry.
   116      /// @return The address of the global schema registry.
   117      function getSchemaRegistry() external view returns (ISchemaRegistry);
   118  
   119      /// @notice Attests to a specific schema.
   120      ///
   121      ///      Example:
   122      ///
   123      ///      attest({
   124      ///         schema: "0facc36681cbe2456019c1b0d1e7bedd6d1d40f6f324bf3dd3a4cef2999200a0",
   125      ///         data: {
   126      ///             recipient: "0xdEADBeAFdeAdbEafdeadbeafDeAdbEAFdeadbeaf",
   127      ///             expirationTime: 0,
   128      ///             revocable: true,
   129      ///             refUID: "0x0000000000000000000000000000000000000000000000000000000000000000",
   130      ///             data: "0xF00D",
   131      ///             value: 0
   132      ///         }
   133      ///      })
   134      ///
   135      /// @param request The arguments of the attestation request.
   136      /// @return The UID of the new attestation.
   137      function attest(AttestationRequest calldata request) external payable returns (bytes32);
   138  
   139      /// @notice Attests to a specific schema via the provided EIP712 signature.
   140      ///
   141      ///         Example:
   142      ///
   143      ///         attestByDelegation({
   144      ///             schema: '0x8e72f5bc0a8d4be6aa98360baa889040c50a0e51f32dbf0baa5199bd93472ebc',
   145      ///             data: {
   146      ///                 recipient: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
   147      ///                 expirationTime: 1673891048,
   148      ///                 revocable: true,
   149      ///                 refUID: '0x0000000000000000000000000000000000000000000000000000000000000000',
   150      ///                 data: '0x1234',
   151      ///                 value: 0
   152      ///             },
   153      ///             signature: {
   154      ///                 v: 28,
   155      ///                 r: '0x148c...b25b',
   156      ///                 s: '0x5a72...be22'
   157      ///             },
   158      ///             attester: '0xc5E8740aD971409492b1A63Db8d83025e0Fc427e',
   159      ///             deadline: 1673891048
   160      ///         })
   161      ///
   162      /// @param delegatedRequest The arguments of the delegated attestation request.
   163      /// @return The UID of the new attestation.
   164      function attestByDelegation(DelegatedAttestationRequest calldata delegatedRequest)
   165          external
   166          payable
   167          returns (bytes32);
   168  
   169      /// @notice Attests to multiple schemas.
   170      ///
   171      ///         Example:
   172      ///
   173      ///         multiAttest([{
   174      ///             schema: '0x33e9094830a5cba5554d1954310e4fbed2ef5f859ec1404619adea4207f391fd',
   175      ///             data: [{
   176      ///                 recipient: '0xdEADBeAFdeAdbEafdeadbeafDeAdbEAFdeadbeaf',
   177      ///                 expirationTime: 1673891048,
   178      ///                 revocable: true,
   179      ///                 refUID: '0x0000000000000000000000000000000000000000000000000000000000000000',
   180      ///                 data: '0x1234',
   181      ///                 value: 1000
   182      ///             },
   183      ///             {
   184      ///                 recipient: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
   185      ///                 expirationTime: 0,
   186      ///                 revocable: false,
   187      ///                 refUID: '0x480df4a039efc31b11bfdf491b383ca138b6bde160988222a2a3509c02cee174',
   188      ///                 data: '0x00',
   189      ///                 value: 0
   190      ///             }],
   191      ///         },
   192      ///         {
   193      ///             schema: '0x5ac273ce41e3c8bfa383efe7c03e54c5f0bff29c9f11ef6ffa930fc84ca32425',
   194      ///             data: [{
   195      ///                 recipient: '0xdEADBeAFdeAdbEafdeadbeafDeAdbEAFdeadbeaf',
   196      ///                 expirationTime: 0,
   197      ///                 revocable: true,
   198      ///                 refUID: '0x75bf2ed8dca25a8190c50c52db136664de25b2449535839008ccfdab469b214f',
   199      ///                 data: '0x12345678',
   200      ///                 value: 0
   201      ///             },
   202      ///         }])
   203      ///
   204      /// @param multiRequests The arguments of the multi attestation requests. The requests should be grouped by distinct
   205      ///        schema ids to benefit from the best batching optimization.
   206      /// @return The UIDs of the new attestations.
   207      function multiAttest(MultiAttestationRequest[] calldata multiRequests)
   208          external
   209          payable
   210          returns (bytes32[] memory);
   211  
   212      /// @notice Attests to multiple schemas using via provided EIP712 signatures.
   213      ///
   214      ///         Example:
   215      ///
   216      ///         multiAttestByDelegation([{
   217      ///             schema: '0x8e72f5bc0a8d4be6aa98360baa889040c50a0e51f32dbf0baa5199bd93472ebc',
   218      ///             data: [{
   219      ///                 recipient: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
   220      ///                 expirationTime: 1673891048,
   221      ///                 revocable: true,
   222      ///                 refUID: '0x0000000000000000000000000000000000000000000000000000000000000000',
   223      ///                 data: '0x1234',
   224      ///                 value: 0
   225      ///             },
   226      ///             {
   227      ///                 recipient: '0xdEADBeAFdeAdbEafdeadbeafDeAdbEAFdeadbeaf',
   228      ///                 expirationTime: 0,
   229      ///                 revocable: false,
   230      ///                 refUID: '0x0000000000000000000000000000000000000000000000000000000000000000',
   231      ///                 data: '0x00',
   232      ///                 value: 0
   233      ///             }],
   234      ///             signatures: [{
   235      ///                 v: 28,
   236      ///                 r: '0x148c...b25b',
   237      ///                 s: '0x5a72...be22'
   238      ///             },
   239      ///             {
   240      ///                 v: 28,
   241      ///                 r: '0x487s...67bb',
   242      ///                 s: '0x12ad...2366'
   243      ///             }],
   244      ///             attester: '0x1D86495b2A7B524D747d2839b3C645Bed32e8CF4',
   245      ///             deadline: 1673891048
   246      ///         }])
   247      ///
   248      /// @param multiDelegatedRequests The arguments of the delegated multi attestation requests. The requests should be
   249      ///        grouped by distinct schema ids to benefit from the best batching optimization.
   250      /// @return The UIDs of the new attestations.
   251      function multiAttestByDelegation(MultiDelegatedAttestationRequest[] calldata multiDelegatedRequests)
   252          external
   253          payable
   254          returns (bytes32[] memory);
   255  
   256      /// @notice Revokes an existing attestation to a specific schema.
   257      ///
   258      ///         Example:
   259      ///
   260      ///         revoke({
   261      ///             schema: '0x8e72f5bc0a8d4be6aa98360baa889040c50a0e51f32dbf0baa5199bd93472ebc',
   262      ///             data: {
   263      ///                 uid: '0x101032e487642ee04ee17049f99a70590c735b8614079fc9275f9dd57c00966d',
   264      ///                 value: 0
   265      ///             }
   266      ///         })
   267      ///
   268      /// @param request The arguments of the revocation request.
   269      function revoke(RevocationRequest calldata request) external payable;
   270  
   271      /// @notice Revokes an existing attestation to a specific schema via the provided EIP712 signature.
   272      ///
   273      ///         Example:
   274      ///
   275      ///         revokeByDelegation({
   276      ///             schema: '0x8e72f5bc0a8d4be6aa98360baa889040c50a0e51f32dbf0baa5199bd93472ebc',
   277      ///             data: {
   278      ///                 uid: '0xcbbc12102578c642a0f7b34fe7111e41afa25683b6cd7b5a14caf90fa14d24ba',
   279      ///                 value: 0
   280      ///             },
   281      ///             signature: {
   282      ///                 v: 27,
   283      ///                 r: '0xb593...7142',
   284      ///                 s: '0x0f5b...2cce'
   285      ///             },
   286      ///             revoker: '0x244934dd3e31bE2c81f84ECf0b3E6329F5381992',
   287      ///             deadline: 1673891048
   288      ///         })
   289      ///
   290      /// @param delegatedRequest The arguments of the delegated revocation request.
   291      function revokeByDelegation(DelegatedRevocationRequest calldata delegatedRequest) external payable;
   292  
   293      /// @notice Revokes existing attestations to multiple schemas.
   294      ///
   295      ///         Example:
   296      ///
   297      ///         multiRevoke([{
   298      ///             schema: '0x8e72f5bc0a8d4be6aa98360baa889040c50a0e51f32dbf0baa5199bd93472ebc',
   299      ///             data: [{
   300      ///                 uid: '0x211296a1ca0d7f9f2cfebf0daaa575bea9b20e968d81aef4e743d699c6ac4b25',
   301      ///                 value: 1000
   302      ///             },
   303      ///             {
   304      ///                 uid: '0xe160ac1bd3606a287b4d53d5d1d6da5895f65b4b4bab6d93aaf5046e48167ade',
   305      ///                 value: 0
   306      ///             }],
   307      ///         },
   308      ///         {
   309      ///             schema: '0x5ac273ce41e3c8bfa383efe7c03e54c5f0bff29c9f11ef6ffa930fc84ca32425',
   310      ///             data: [{
   311      ///                 uid: '0x053d42abce1fd7c8fcddfae21845ad34dae287b2c326220b03ba241bc5a8f019',
   312      ///                 value: 0
   313      ///             },
   314      ///         }])
   315      ///
   316      /// @param multiRequests The arguments of the multi revocation requests. The requests should be grouped by distinct
   317      ///        schema ids to benefit from the best batching optimization.
   318      function multiRevoke(MultiRevocationRequest[] calldata multiRequests) external payable;
   319  
   320      /// @notice Revokes existing attestations to multiple schemas via provided EIP712 signatures.
   321      ///
   322      ///         Example:
   323      ///
   324      ///         multiRevokeByDelegation([{
   325      ///             schema: '0x8e72f5bc0a8d4be6aa98360baa889040c50a0e51f32dbf0baa5199bd93472ebc',
   326      ///             data: [{
   327      ///                 uid: '0x211296a1ca0d7f9f2cfebf0daaa575bea9b20e968d81aef4e743d699c6ac4b25',
   328      ///                 value: 1000
   329      ///             },
   330      ///             {
   331      ///                 uid: '0xe160ac1bd3606a287b4d53d5d1d6da5895f65b4b4bab6d93aaf5046e48167ade',
   332      ///                 value: 0
   333      ///             }],
   334      ///             signatures: [{
   335      ///                 v: 28,
   336      ///                 r: '0x148c...b25b',
   337      ///                 s: '0x5a72...be22'
   338      ///             },
   339      ///             {
   340      ///                 v: 28,
   341      ///                 r: '0x487s...67bb',
   342      ///                 s: '0x12ad...2366'
   343      ///             }],
   344      ///             revoker: '0x244934dd3e31bE2c81f84ECf0b3E6329F5381992',
   345      ///             deadline: 1673891048
   346      ///         }])
   347      ///
   348      /// @param multiDelegatedRequests The arguments of the delegated multi revocation attestation requests. The requests
   349      /// should be
   350      ///        grouped by distinct schema ids to benefit from the best batching optimization.
   351      function multiRevokeByDelegation(MultiDelegatedRevocationRequest[] calldata multiDelegatedRequests)
   352          external
   353          payable;
   354  
   355      /// @notice Timestamps the specified bytes32 data.
   356      /// @param data The data to timestamp.
   357      /// @return The timestamp the data was timestamped with.
   358      function timestamp(bytes32 data) external returns (uint64);
   359  
   360      /// @notice Timestamps the specified multiple bytes32 data.
   361      /// @param data The data to timestamp.
   362      /// @return The timestamp the data was timestamped with.
   363      function multiTimestamp(bytes32[] calldata data) external returns (uint64);
   364  
   365      /// @notice Revokes the specified bytes32 data.
   366      /// @param data The data to timestamp.
   367      /// @return The timestamp the data was revoked with.
   368      function revokeOffchain(bytes32 data) external returns (uint64);
   369  
   370      /// @notice Revokes the specified multiple bytes32 data.
   371      /// @param data The data to timestamp.
   372      /// @return The timestamp the data was revoked with.
   373      function multiRevokeOffchain(bytes32[] calldata data) external returns (uint64);
   374  
   375      /// @notice Returns an existing attestation by UID.
   376      /// @param uid The UID of the attestation to retrieve.
   377      /// @return The attestation data members.
   378      function getAttestation(bytes32 uid) external view returns (Attestation memory);
   379  
   380      /// @notice Checks whether an attestation exists.
   381      /// @param uid The UID of the attestation to retrieve.
   382      /// @return Whether an attestation exists.
   383      function isAttestationValid(bytes32 uid) external view returns (bool);
   384  
   385      /// @notice Returns the timestamp that the specified data was timestamped with.
   386      /// @param data The data to query.
   387      /// @return The timestamp the data was timestamped with.
   388      function getTimestamp(bytes32 data) external view returns (uint64);
   389  
   390      /// @notice Returns the timestamp that the specified data was timestamped with.
   391      /// @param data The data to query.
   392      /// @return The timestamp the data was timestamped with.
   393      function getRevokeOffchain(address revoker, bytes32 data) external view returns (uint64);
   394  }