ContractsAirdropRecipient

AirdropRecipient

Contracts/src/contracts/utils/AirdropRecipient.sol

Lets the protocol owner subscribe to upstream airdrops via arbitrary external calls (requestAirdrop), then merkle-distribute the proceeds to CollectionToken holders (distributeAirdropclaimAirdrop).

See Airdrops journey for the lifecycle and the ERC-1271 signing note.

State views

FunctionReturns
merkleClaims(_merkle, _claimType)True if (_merkle, _claimType) has been published
isClaimed(_merkle, _node)True if a specific leaf has already been claimed
erc1272Signer()The address used to satisfy ERC-1271 signature checks against AirdropRecipient (e.g. when subscribing to an upstream airdrop that signs over its claimer)

Structs

struct MerkleClaim {
  address recipient;
  address target;     // payout target (token / NFT contract)
  uint tokenId;       // NFT id, or 0 for fungible
  uint amount;
}
 
enum ClaimType { ERC20, ERC721, ERC1155, NATIVE }

Public surface

FunctionCallerDescription
requestAirdrop(_contract, _value, _payload)Owner_contract.call{value:_value}(_payload)
distributeAirdrop(_merkle, _claimType)OwnerPublish a merkle root for a claim type
claimAirdrop(_merkle, _claimType, _node, _merkleProof)RecipientClaim a leaf
setERC1271Signer(_signer)OwnerUpdate the ERC-1271 signing key

Errors

ErrorCause
ExternalCallFailedThe downstream call in requestAirdrop reverted
MerkleAlreadyExists(_merkle, _claimType) already published
MerkleRootNotValid_merkle == bytes32(0)
AirdropAlreadyClaimedLeaf already claimed
InvalidClaimNodeLeaf doesn’t match (_recipient, _target, _tokenId, _amount)
TransferFailedDownstream payout transfer reverted

Events

EventTrigger
AirdropDistributed(_merkle, _claimType)distributeAirdrop
AirdropClaimed(_merkle, _claimType, _recipient, _target, _tokenId, _amount)claimAirdrop
AirdropTargetSet(_target, _allowed)setAirdropTarget

Subgraph mapping

EventEntity
AirdropDistributedAirdropDistribution
AirdropClaimedAirdropClaim
AirdropTargetSetAirdropTarget

Inherited surface

  • Ownable.
  • ERC-1271 signature receiver for upstream airdrop subscriptions.