Guard Policy
The Guard Policy is designed to ensure that all token-related actions - minting, burning, transferring, and buying/selling - are done securely and only by authorized parties.
The Role of Guard Policy in Digital Asset Protection:
-
Token Creation and Initialization:
- Envision owning a unique Non-Fungible Token (NFT). When initiating your token, you apply the Guard Policy. This policy outlines specific guards or rules for different actions, from minting to transfer.
- A typical configuration for guards looks like:
'mint-guard': {"keys": ["mint"], "pred": "keys-all"},'burn-guard': {"keys": ["burn"], "pred": "keys-all"},'sale-guard': {"keys": ["sale"], "pred": "keys-all"},'transfer-guard': {"keys": ["transfer"], "pred": "keys-all"}
'mint-guard': {"keys": ["mint"], "pred": "keys-all"},'burn-guard': {"keys": ["burn"], "pred": "keys-all"},'sale-guard': {"keys": ["sale"], "pred": "keys-all"},'transfer-guard': {"keys": ["transfer"], "pred": "keys-all"}
-
Token Minting:
- After creation, you might want to produce new tokens. The Guard Policy ensures that only those with the appropriate 'mint' key can do this.
-
Token Burning:
- If you wish to reduce your token's supply, only those with the 'burn' key can proceed with this action under the Guard Policy.
-
Token Transfer:
- When moving your token to another party, the Guard Policy verifies the transfer, ensuring only those with the 'transfer' key can execute it.
-
Token Sale:
- When you're ready to sell, the Guard Policy checks that only entities with the 'sale' key can complete this action. It also confirms the sale ID with the ongoing pact to guarantee only authorized sales.
While this might seem intricate, the platform simplifies the process, taking most of the weight off token owners. All you need to do is set up your guard configuration.
In essence, the Guard Policy isn't just a security tool; it's a means to ensure trust, control, and peace of mind in the digital assets realm.
Technical Specifications
Schemas and Tables:
-
Schemas: Contains
guards
that specify values formint
,burn
,sale
, andtransfer
. -
Tables: The
policy-guards
table connects token IDs to their guard values.
Capabilities:
GOVERNANCE
: Governs contract upgrade access.GUARDS
@event: Emits guard info duringenforce-init
.MINT
: Applies themint-guard
inenforce-mint
.BURN
: Applies theburn-guard
inenforce-burn
.SALE
: Uses thesale-guard
duringenforce-offer
,enforce-withdraw
, andenforce-buy
.TRANSFER
: Uses thesale-guard
inenforce-transfer
.
Functions:
enforce-init
: Initializes thepolicy-guards
table with token ID and guard values.enforce-mint
: Validates minting processes.enforce-burn
: Validates burning processes.enforce-offer
: Confirms sale offers with guards and verifies the sale-id.enforce-withdraw
: Checks sale withdrawals and the sale-id.enforce-buy
: Validates buying processes and the sale-id.enforce-transfer
: Validates transfers, checking sender, receiver, and amount.
In summary, the Guard policy ensures the safety and integrity of digital assets.