LogoLogo
Our WorkHelp CenterAbout Us
  • Developer Resources
    • ⚙️Web/HTML Implementation
      • Getting Started
      • Simple HTML Example
  • Native App Implementation
  • 🛠️API Resources
    • Verify
    • Claim
    • Recover
    • Tag Verifications
  • Protocol
    • 🖼️Overview
      • Technical Specs
    • 📜Smart Contracts
      • 🔓Locking Mechanism
      • 🔓Locked721
      • 🔑Access Control Roles
      • 📃Customizing the Locked721 Contracts
    • 📏Customizations
      • 🛳️Blockchain Deployment Options
      • 🪙Digital ID Options
      • 🗞️Product Metadata Options
      • 🔐Locking Mechanism Options
Powered by GitBook
On this page
  • Locked721Base
  • Helper Functions
  • Options
  • Locked721 and Locked721Psi

Was this helpful?

Export as PDF
  1. Protocol
  2. Smart Contracts

Locked721

PreviousLocking MechanismNextAccess Control Roles

Last updated 10 months ago

Was this helpful?

Locked721Base

Legitimate maps each unique digital ID to a token on a decentralized blockchain network. For simplicity and consistency, our documentation will refer to each digital ID as a token.

At the core of Legitimate's token smart contracts is the Locked721Base smart contract.

The Locked721Base smart contract is an implementation of .

However, the Locked721Base contract adds additional functionality that makes the tokens locked state mutable.

Each token can be locked or unlocked individually, providing granular control over the locked state.

provides the high level interface for setting and getting the locked state of each token. Furthermore, ILocked721Base defines , which is a function designed for API_DELEGATE users to transfer locked tokens without modifying their locked state.

is the implementation of the interface. This adds additional functions that allow third-party contracts and users with the role of 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 token will revert. By default, this is set to true.

Locked721 and Locked721Psi

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.

Legitimate provides two default implementations of Locked721Base: (an implementation of ) and (an implementation of ).

and

These hooks call to determine whether or not locked tokens can be transferred by their owners.

and

These hooks call to set the locked state of the transferred tokens after a transfer.

📜
🔓
shouldLockTokensAfterMint
shouldPreventTransferWhenLocked
Locked721
OpenZeppelin's ERC721 contract
Locked721Psi
ERC721Psi
_beforeTokenTransfer
_beforeTokenTransfers
_afterTokenTransfers
_afterTokenTransfers
_shouldPreventTokenTransfer
_lockTokensAfterTransfer
ERC-5192
ILocked721Base
claim
Locked721Base
_shouldPreventTokenTransfer
_lockTokensAfterTransfer
API_DELEGATE