Airdrop instructions
Overview
SPL404 is a simple utility extension exposing functionality that supports native airdrop claims for SPL404 contracts.
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {SPL404} from "../SPL404.sol";
import {SPL404MerkleClaim} from "../extensions/SPL404MerkleClaim.sol";
contract ExampleSPL404 is Ownable, SPL404, SPL404MerkleClaim {
constructor(
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 maxTotalSupplySPL721_,
address initialOwner_,
address initialMintRecipient_
) SPL404(name_, symbol_, decimals_) Ownable(initialOwner_) {
// Do not mint the SPL721s to the initial owner, as it's a waste of gas.
_setSPL721TransferExempt(initialMintRecipient_, true);
_mintSPL20(initialMintRecipient_, maxTotalSupplySPL721_ * units, false);
}
function tokenURI(uint256 id_) public pure override returns (string memory) {
return string.concat("https://example.com/token/", Strings.toString(id_));
}
function airdropMint(
bytes32[] memory proof_,
uint256 value_
) public override whenAirdropIsOpen {
super.airdropMint(proof_, value_);
_mintSPL20(msg.sender, value_, true);
}
function setAirdropMerkleRoot(bytes32 airdropMerkleRoot_) external onlyOwner {
_setAirdropMerkleRoot(airdropMerkleRoot_);
}
function toggleAirdropIsOpen() external onlyOwner {
_toggleAirdropIsOpen();
}
function setSPL721TransferExempt(address account_, bool value_) external onlyOwner {
_setToken2022TransferExempt(account_, value_);
}
}
Last updated