# Airdrop

The Airdrop feature represents an on-chain incentive that leverages OpenCohort. The Silicon development team provides deployers on the Silicon Network that perform four basic types of Airdrop distribution for Builders and Airdrop Helpers to utilize.&#x20;

* [Reward Type](https://docs.silicon.network/builders/opencohort/framework/developer/airdrop/reward-type)

The Airdrop Contract is an NFT based on ERC-721 that implements ERC-5192. It has functions such as cohort reference, Merkle Proof verification, and identity verification, and is the entity that provides incentives to users. Airdrop Deployer is a Factory Contract that issues Airdrop SBT based on specified airdrop configurations.

The signature verification for the airdrop follows the ERC-1271 standard, allowing signature verification via contracts without necessarily signing with an EOA that has a secp256k1 PrivateKey.

## Code

* GitHub:[ OpenCohortAirdrop.sol](https://github.com/0xSilicon/opencohort-contracts/blob/main/contracts/airdrop/OpenCohortAirdrop.sol)

## Address

* Mainnet: TBD

## Standard Implementations

Details regarding standard ERC-721 and ERC-5192 implementations are omitted, as no special understanding is required.

## Data Structures

* **enum RewardType**
  * Defines reward types. Airdrop currently supports Weight, Count, Constant, and Unit types.<br>
* **struct OpenCohortAirdropConfig**
  * A structure that allows querying all settings for the airdrop. Not all variables are used across every reward type.
  * Struct Variables
    * `rewardType`: Defines the type of reward.
    * `token`: Specifies the token for the airdrop.
    * `totalAmount`: Defines the total airdrop amount for Weight and Count types.
    * `claimableTime`: The start time at which users can claim their rewards.
    * `amountPer`: Defines the reward amount for Constant or Unit types.
    * `signer`: Specifies the identity cohort's mapping signature provider.
    * `name`: The name of the airdrop.
    * `description`: Description of the airdrop.
    * `image`: The main image representing the airdrop.
    * `baseURI`: The base URI for the airdrop SBT per NFT standards.

## Events

* SetCohortId
  * Triggered when setting the target cohort item for the airdrop.

    * Parameters
      * `cohortId`: The assigned cohort ID.
      * `cohortGrant`: Assigned cohort grant information.
      * `cohortGrantRateDenominator`: Denominator for the cohort grant rate.

* SetCohortTime
  * Parameters
    * `cohortTime`: The assigned cohort snapshot time.
    * `cohortMetadata`: Assigned cohort metadata.<br>

* Claimed
  * Parameters
    * `cohortTime`: The assigned cohort snapshot time.
    * `cohortMetadata`: Assigned cohort metadata.

## Read-Only Functions

* cohort
  * Return Value: The address of the currently set cohort.
* cohortMetadata
  * Return Value: Metadata of the currently set cohort item.
* cohortGrant
  * Return Value: Grant information for the current cohort partner.
* cohortGrantRateDenominator
  * Return Value: Denominator of the current cohort grant rate.
* openCohortAirdropConfig
  * Return Value: Current OpenCohort Airdrop settings.
* claimableTime
  * Return Value: Time at which claims can start.
* signer
  * Return Value: Address of the mapping signature provider for the identity cohort.
* image
  * Return Value: Image URL.
* cohortId
  * Return Value: The ID of the current cohort item.
* cohortTime
  * Return Value: Snapshot time of the current cohort.
* isClaimed
  * Parameters
    * `index`: Membership index in the Merkle Tree.
  * Return Value: Boolean indicating if the index has been claimed.

## State-Changing Functions

* setCohortId
  * Sets the cohort ID targeted by the airdrop and initiates necessary verification before triggering the SetCohortId event.
  * Parameters
    * `cohortId_`: Cohort ID to set.<br>
* setCohortTime
  * Resets the snapshot time within the target cohort and performs necessary verification before triggering the SetCohortTime event.
  * Parameters
    * `cohortTime_`: Cohort time to set.<br>
* claim
  * Allows users with membership in the target cohort to claim incentives using proof information from the Prover.
  * Parameters
    * `index`: Merkle Tree index.
    * `uniqueKey`: Address.
    * `weight`: Weight.
    * `proof`: Merkle proof for the claim.<br>
* claimBySignature
  * Same as claim, but for Identity Cohort, performs claim with additional validation of the Signer's Identity Mapping Signature.
  * Parameters
    * `index`: Merkle Tree index.
    * `uniqueKey`: Identity.
    * `weight`: Weight.
    * `proof`: Merkle proof for the claim.
    * `beneficiary`: Blockchain address of the identity mapping.
    * `signature`: Identity mapping signature.
