Contract
Solidity contract for the Autonomous Airdrop example
Introduction
Contract code is all in /contracts/src
. The main files of interest are AutonomousAirdrop.sol
and AxiomV2Client.sol
.
WARNING: This code is not audited and is only provided as an example.
AxiomV2Client.sol
AxiomV2Client is a useful reference implementation for the callback, which will be called in this form from the Prover. The axiomV2Callback
function receives the callback, runs the internal and overrideable _validateAxiomV2Call
and _axiomV2Callback
functions.
AutonomousAirdrop.sol
In our AutonomousAirdrop contract, we inherit AxiomV2Client
and proceed to override the _validateAxiomV2Call
and _axiomV2Callback
functions in order for us to do our validation on the callback.
Callback
Inside AutonomousAirdrop.sol, we override _axiomV2Callback
. Inside this function, we do a number of things:
Decode the callbackExtraData to be the user's address, which was checked earlier
Parse the
eventSchema
,userEventAddress
, andblockNumber
from the results arrayValidate the results
Transfer the tokens to the user
Emit the
ClaimAirdrop
event
Last updated