Cohort

The Cohort is a blockchain smart contract designed for the OpenCohort system. It functions as both an ERC-721 NFT and a Soulbound Token (SBT) implementing the ERC-5192 standard. The contract provides metadata and snapshot capabilities and defines multiple structures for storing Merkle Tree information.

Code

Address

  • Mainnet : 0x5bed204DFF313eFb26cfB8b2B2222140F4697BbE

Standard Implementations

The standard aspects of ERC-721 and ERC-5192 that do not require specific understanding are omitted in the section below.

Data Structures

  • Enum CohortType

    • This enum specifies whether to define the cohort of Address Type or Identity Type.

  • Struct CohortMetadata

    • This common structure is used to represent both general information about the Cohort item and details about snapshots.

    • For general item information, it defines standard NFT attributes via tokenURI and specifies the Cohort type. It also references details about the latest rollup data, such as merkleRoot, totalWeight, totalCount, and prover.

    • For snapshot metadata, it contains information for each snapshot, including merkleRoot, totalWeight, totalCount, and the prover.

    • Structure Variables

      • cohortType: Specifies the type of Cohort.

      • tokenURI: Standard token URI.

      • merkleRoot: Merkle Tree Root Hash for the snapshot.

      • totalWeight: Total weight of the snapshot.

      • totalCount: Total member count in the snapshot.

      • prover: Prover that provides snapshot data.

Events

  • MetadataUpdate

    • Triggered when the metadata of a specific Cohort is updated.

    • Parameters

      • tokenId: Unique ID of the token whose metadata was updated.

  • SetCohortMetadata

    • Triggered when Cohort metadata is set.

    • Parameters

      • tokenId: Unique ID of the token for which metadata is set.

      • nonce: Unique value for the metadata.

      • metadata: Contents of the set Cohort metadata.

      • snapShotTime: Timestamp of the snapshot.

  • SetCohortGrant

    • Triggered when the grant rate for a specific Cohort item is set.

    • Parameters

      • tokenId: Unique ID of the token for which the grant is set.

      • cohortGrant: Set information regarding the Cohort grant rate.

Read-Only Functions

  • cohortType

    • Returns the cohort type of a specific token.

    • Parameters

      • tokenId: The unique ID of the token to check the type for.

    • Return Value: The cohort type of the specified token.

  • grant

    • Returns the grant rate information for a specific token's cohort. The accuracy of this rate is determined by GRANT_RATE_DENOMINATOR, and the maximum rate is set by MAX_GRANT_RATE.

    • Parameters

      • tokenId: The unique ID of the token to check the grant for.

    • Return Value: The grant rate information for the specified token's cohort.

  • metadata

    • Returns the metadata of a specific token.

    • Parameters

      • tokenId: The unique ID of the token to check the metadata for.

    • Return Value: The metadata of the specified token.

  • metadataNonce

    • Returns the metadata nonce for a specific token. This is used to verify the nonce for the next rollup.

    • Parameters

      • tokenId: The unique ID of the token to check the metadata nonce for.

    • Return Value: The metadata nonce of the specified token.

  • getLastSnapShotTime

    • Returns the timestamp of the last rollup snapshot for a specific token.

    • Parameters

      • tokenId: The unique ID of the token to check the snapshot timestamp for.

    • Return Value: The timestamp of the last snapshot.

  • getExactTimeSnapShot

    • Returns the exact snapshot metadata for a specific timestamp.

    • Parameters

      • tokenId: The unique ID of the token to check the snapshot for.

      • timestamp: The timestamp to verify.

    • Return Value: The snapshot metadata for the specified timestamp.

  • getSnapShot

    • Returns snapshot data for a specific timestamp.

    • Parameters

      • tokenId: The unique ID of the token to check the snapshot for.

      • timestamp: The timestamp to verify.

    • Return Value: The snapshot metadata for the specified timestamp.

  • getChainId

    • Returns the current chain ID.

    • Return Value: The chain ID.

State-Changing Functions

  • mint

    • Mints a new cohort token. Any user can issue a new cohort.

      • Parameters

        • cohortMetadata: Metadata of the token to be minted.

    • Return Value: The unique ID of the minted token.

  • setTokenURI

    • Sets the URI for a specific token.

      • Parameters

        • tokenId: The unique ID of the token for which to set the URI.

        • tokenURI_: The URI string to be set.

  • setCohortGrant

    • Sets the cohort grant rate for a specific token.

      • Parameters

        • tokenId: The unique ID of the token for which to set the grant.

        • cohortGrant: The cohort grant rate information to be set.

  • rollupWithSignature

    • Processes a rollup with a signature, utilizing snapshot signature information provided by the partner as Manager.

      • Parameters

        • tokenId: The unique ID of the token to process the rollup for.

        • cohortMetadata: Specifies the cohort information.

        • timestamp: The snapshot timestamp.

        • signature: A signature to confirm that the snapshot to be rolled up was created by the owner.

Last updated

Logo

Copyright HIGHDRAW. All Rights Reserved.