Guard policy
The guard policy ensures that all token-related actions—minting, burning, transferring, buying, and selling—can only be performed by authorized parties. If you apply the guard policy when you create a token, you can specify who is authorized to perform each type of token activity.
This part of the documentation describes the schemas, tables, capabilities, and functions defined in the Marmalade guard policy contract.
Source code: guard-policy.pact
Schema and table
The guard policy smart contract defines one schema and one table.
The guards
schema describes guard values for mint
, burn
, sale
, and transfer
operations.
The policy-guards
table maps token identifiers to their guard values.
Capabilities
The guard policy smart contract defines the following capabilities to manage permissions:
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
The guard policy smart contract defines the following functions to enforce restrictions of different token activities:
-
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.