Links
🔓

Locked721

Locked721Base

At the core of Legitimate's Phygital NFT Contracts is the Locked721Base Contract. It is an implementation of ERC-5192, the minimal soulbound token standard.
However, the Locked721Base contract adds additional functionality that makes the tokens "semi-soulbound".
Each token can be locked or unlocked individually, providing granular control over the soulbound state.
ILocked721Base provides the high level interface for setting and getting the locked state of each token. Furthermore, ILocked721Base defines claim, which is a function designed for API_DELEGATE users to transfer LockedNFTs without modifying their locked state.
Locked721Base is the implementation of the interface. This adds additional functions that allow third-party contracts and users with the role of API_DELEGATE to modify the locked state of each token.

Helper Functions

Locked721Base itself does not implement IERC721. This is intentional in design. Locked721Base is an abstract class that allows developers to chose their own ERC721 implementation. However, Locked721Base provides two helper methods designed to be called within the hooks an ERC721 implementation
This helper function will return true if a token is locked and the option shouldPreventTransferWhenLocked is true
This helper function will iterate through a set of tokenIds and set the locked state to true.
If the calling method is a mint call (the from address is 0x0) and shouldLockTokensAfterMint is set to false, then this function will not set the locked state to true.

Options

This is a configurable option in the contract that defines whether or not tokens should be auto-locked after mint. By default, this is set to true.
This is a configurable option that determines whether any token in a locked state can be transfered successfully. If this flag is set to true, any transaction that attempts to transfer a locked NFT will revert. By default, this is set to true.

Locked721 and Locked721Psi

Legitimate provides two default implementations of Locked721Base: Locked721 (an implementation of OpenZeppelin's ERC721 contract) and Locked721Psi (an implementation of ERC721Psi).
Each of these are representative of their own ERC721 implementation. We won't get into too much detail about each of the underlying ERC721 implementations, but we will cover how both of these contracts implement Locked721Base.
These hooks call _shouldPreventTokenTransfer to determine whether or not locked tokens can be transferred by their owners.
These hooks call _lockTokensAfterTransfer to set the locked state of the transferred tokens after a transfer.