Discount Validators
Namoshi usesIDiscountValidator implementations to check if a user is eligible for a discount. The main validator types are:
Referral System
TheSecureReferralDiscountValidator allows users to register domains using a referral code.
- Discount: Users get a % off the registration fee.
- Security: The referral code is cryptographically verified to ensure authenticity.
NFT Ownership
TheERC721DiscountValidator and MultipleNFTDiscountValidator grant discounts to holders of specific NFT collections.
- Check: The contract verifies
balanceOf(user) > 0for the configured NFT contract. - Stacking: With
MultipleNFTDiscountValidator, holding NFTs from multiple collections can stack discounts (up to a limit).
Whitelists
TheMerkleWhitelistDiscountValidator allows for efficient on-chain whitelist verification.
- Merkle Proof: Users submit a Merkle proof along with their registration to prove they are in the whitelist.
- Gas Efficient: Only the root hash is stored on-chain.
Applying Discounts
To use a discount, pass the appropriate data to theregisterWithDiscount function on the controller:
discountData parameter contains the proof or signature required by the active DiscountValidator.