Waves are the main contracts of Tide, each one representing a campaign launched by a project. You can find the full code for Wave contracts in our public repo.
Features and Standards
Waves are ERC-721 compliant, meaning that the badges issued to users are NFTs that can be viewed and transferred on any NFT marketplace. The ownership of the contract is set to the deployer, so the project can have advanced on-chain customization with their campaign.
Waves are also ERC-2771 compliant, meaning they support transactions relayers. This allows projects to sponsor their users' gas fees by having the transaction been sent by our forwarder, which leverages Openzeppelin Defender to provide the best gasless experience for claiming rewards.
Our contracts support two different methods of releasing of ERC-20 tokens, either by First Come First Served (FCFS) or by Raffle.
How does a claim work?
Waves implement a signature verification to restrict the access to the claim() function only to addresses that satisfy the correct requirements.
When a user tries to claim with Tide frontend, our verifier runs the checks required by the campaign on its wallet and, if all of them are satisfied, signs a message with the claim info and returns it to the user.
The user can then use this signed message as a receipt to claim its badge by calling the claim() function on our contract: when called, the function checks the validity on the signature and mints the NFT to the user.
What are the benefits?
Having this setup for minting, allows Tide to manage access by integrating off-chain events (e.g., Twitter or Discord interactions) or off-chain listeners (e.g., TheGraph) while giving users full ownership of their credentials.
It also allows projects to have a suite of composable requirements to grant access to the campaigns, while keeping a gas-efficient smart contract.
How are ERC-20 rewards managed?
At deployment, projects are required to secure campaign funds within the contract, ensuring fulfillment. The tokens are then locked until rewards are released. If excess token is still present in the contract after all rewards are distributed, the funds can be then returned to the deployer.
First Come First Served (FCFS): Rewards are disbursed upon successful claims, continuing until the allocated funds are exhausted.
Raffle: randomly allocates rewards among NFT badge holders, introducing an element of chance in reward distribution. The random extraction is managed using API3's QRNG as a decentralized provider for on-chain random numbers.
Everyone can see which rewards and distribution methods are set up in the contract by calling the public view functions claimRewards() and raffleRewards() on the campaign contract.