Plugins
Freeze Delegate
Overview
The Freeze Plugin is a Owner Managed
plugin that freezes the Asset disallowing transfer. The authority of the plugin can revoke themselves or unfreeze at any time.
The Freeze Plugin will work in areas such as:
- Escrowless staking: Freeze NFTs while they are staked in a protocol without needing to transfer them to an escrow account
- Escrowless listing of an NFT on a marketplace: List NFTs for sale without transferring them to the marketplace's escrow
- Game item locking: Temporarily lock in-game items while they are being used in gameplay
- Rental marketplaces: Lock NFTs while they are being rented out to users
- Governance participation: Lock governance tokens while participating in voting or proposals
- Collateral management: Lock NFTs being used as collateral in lending protocols
- Tournament participation: Lock NFTs while they are being used in tournaments or competitions
Works With
MPL Core Asset | ✅ |
MPL Core Collection | ❌ |
Arguments
Arg | Value |
---|---|
frozen | bool |
Functions
Add Freeze Delegate Plugin to an Asset
The addPlugin
command adds the Freeze Delegate Plugin to an Asset. This plugin allows the Asset to be frozen, preventing transfers and burns.
Adding a Freeze Plugin to an MPL Core Asset
import { publicKey } from '@metaplex-foundation/umi'
import { addPlugin } from '@metaplex-foundation/mpl-core'
const assetAddress = publicKey('11111111111111111111111111111111')
await addPlugin(umi, {
asset: assetAddress,
plugin: { type: 'FreezeDelegate', data: { frozen: true } },
}).sendAndConfirm(umi)
Delegate the Freeze Authority
The approvePluginAuthority
command delegates the freeze authority to a different address. This allows another address to freeze and thaw the Asset while maintaining ownership.
Delegate the Freeze Authority
import { publicKey } from '@metaplex-foundation/umi'
import { approvePluginAuthority } from '@metaplex-foundation/mpl-core'
const asset = publicKey('11111111111111111111111111111111')
const delegateAddress = publicKey('22222222222222222222222222222222')
await approvePluginAuthority(umi, {
asset: asset.publicKey,
plugin: { type: 'FreezeDelegate' },
newAuthority: { type: 'Address', address: delegateAddress },
}).sendAndConfirm(umi)
Freezing an Asset
The freezeAsset
command freezes an Asset, preventing it from being transferred or burned. This is useful for escrowless staking or marketplace listings.
Freeze an MPL Core Asset
import { publicKey } from '@metaplex-foundation/umi'
import { freezeAsset, fetchAsset } from '@metaplex-foundation/mpl-core'
const assetAddress = publicKey('11111111111111111111111111111111')
const assetAccount = await fetchAsset(umi, assetAddress)
const delegateSigner = generateSigner(umi)
await freezeAsset(umi, {
asset: assetAccount,
delegate: delegateSigner.publicKey,
authority: delegateSigner,
}).sendAndConfirm(umi)
Thawing a Frozen Asset
The thawAsset
command unfreezes a frozen Asset, restoring its ability to be transferred and burned.
Thaw an MPL Core Asset
import { publicKey } from '@metaplex-foundation/umi'
import { thawAsset, fetchAsset } from '@metaplex-foundation/mpl-core'
const assetAddress = publicKey('11111111111111111111111111111111')
const assetAccount = await fetchAsset(umi, assetAddress)
const delegateSigner = generateSigner(umi)
await thawAsset(umi, {
asset: assetAccount,
delegate: delegateSigner,
}).sendAndConfirm(umi)