Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private token policy #195

Merged
merged 14 commits into from
May 16, 2024
Merged

Private token policy #195

merged 14 commits into from
May 16, 2024

Conversation

wooglie
Copy link
Member

@wooglie wooglie commented Apr 9, 2024

Private token policy

Private token policy allows creators to make an airdrop without revealing the metadata of the token beforehand. The token URI can be revealed at any time, making the metadata known to all.

Requirements:

Concrete policy guard-policy must be used in conjunction with private-token-policy to make sure only an authorized account can update the token URI.

While creating a token, the URI should be the hash of the actual URI. This can be calculated using a local call to the node so there is no trace recorded on the chain.

Note: token URI can still be updated by the uri-guard but only after revealing the initial URI.

Specification, tables, capabilities, events:

Schemas: revealed-tokens-schema is a schema that stores which tokens have been revealed

  • revealed: shows if the URI has been revealed.

Tables: revealed-tokens table stores which tokens have been revealed.

  • id: the id of the token

Capabilities:

  • GOVERNANCE: enforces access control of contract upgrades.

Events:

  • TOKEN_REVEALED (token-id uri): Emitted when the token URI has been revealed.

Policy Functions

enforce-init: Enforced during marmalade-v2.ledger.create-token, and will ensure the concrete guard-policy is present along with the URI guard.

enforce-mint: Enabled without limitation.

enforce-burn: Enabled without limitation.

enforce-offer: Enabled without limitation.

enforce-buy: Enabled without limitation.

enforce-withdraw: Enabled without limitation.

enforce-transfer: Enabled without limitation.

enforce-update-uri: Enforced during marmalade-v2.ledger.update-uri, and will allow updating only if the token has been revealed before.

reveal-uri: Will make sure that the saved hash of the URI matches the hashed new URI and will invoke marmalade-v2.ledger.update-uri.

is-revealed: Check if the URI has been revealed.

@wooglie wooglie mentioned this pull request Apr 9, 2024
@wooglie wooglie requested review from jermaine150 and ggobugi27 and removed request for jermaine150 April 9, 2024 10:36
@wooglie wooglie changed the base branch from main to feat/multi-chain April 9, 2024 13:21
@wooglie
Copy link
Member Author

wooglie commented Apr 11, 2024

The failing test should be resolved with this PR #197

@wooglie wooglie changed the base branch from feat/multi-chain to main April 25, 2024 09:26
@wooglie wooglie merged commit 3eaaf08 into main May 16, 2024
3 checks passed
@wooglie wooglie deleted the feat/private-token-policy-2 branch May 16, 2024 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants