Smart Contract

StakingNFTVerifiers

A.1b77ba4b414de352.StakingNFTVerifiers

Deployed

1w ago
Feb 20, 2026, 07:32:00 AM UTC

Dependents

2 imports
1/**
2    A set of NFT eligibility verifiers to check whether a given nft is allowed.
3    Use cases: e.g. All floats are in the same Collection, even if they belong to different FLOATEvents.
4
5    More verifier can be added, and the interface is defined in StakingNFT.cdc
6
7    Author: Increment Labs
8*/
9
10import NonFungibleToken from 0x1d7e57aa55817448
11import FLOAT from 0x2d4c3caffbeab845
12import StakingNFT from 0x1b77ba4b414de352
13
14access(all) contract StakingNFTVerifiers {
15
16    // Verifier to check if the given nft (FLOAT) belongs to a specific FloatEvent.
17    access(all) struct FloatVerifier: StakingNFT.INFTVerifier {
18        access(all) let eligibleEventId: UInt64
19
20        access(all) view fun verify(nftRef: &{NonFungibleToken.NFT}, extraParams: {String: AnyStruct}): Bool {
21            let floatRef = (nftRef as? &FLOAT.NFT) ?? panic("Hmm...this nft is not a float")
22            // Pool creator / admin should make sure float pool is correctly created with "eventId" && "hostAddr" parameters
23            let eventIdFromParam = (extraParams["eventId"] ?? panic("Float eventId not set")) as! UInt64
24            let hostFromParam = (extraParams["hostAddr"] ?? panic("FloatEvent host address not set")) as! Address
25            return (floatRef.eventId == self.eligibleEventId) && (floatRef.eventId == eventIdFromParam) && (floatRef.eventHost == hostFromParam)
26        }
27
28        init(eventId: UInt64) {
29            self.eligibleEventId = eventId
30        }
31    }
32
33    // You're welcome to implement extra Verifier if necessary
34}
35