-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add non-updatable-uri-policy into util-v1
- Loading branch information
ggobugi27
committed
May 16, 2024
1 parent
5e3cb53
commit fab68d1
Showing
5 changed files
with
118 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
pact/concrete-policies/non-updatable-uri-policy/non-updatable-uri-policy-v1.repl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,40 @@ | ||
;;load policy manager, ledger | ||
(load "../../policy-manager/policy-manager.repl") | ||
(typecheck "marmalade-v2.non-updatable-uri-policy-v1") | ||
|
||
(begin-tx "Create a non-updatable-uri token") | ||
(use marmalade-v2.ledger) | ||
(use marmalade-v2.util-v1) | ||
(use marmalade-v2.guard-policy-v1) | ||
(use marmalade-v2.util-v1 [DEFAULT_NON_UPDATABLE]) | ||
(use mini-guard-utils) | ||
|
||
(env-data { | ||
"token-id": (create-token-id { 'uri: "test-non-updatable-uri", 'precision: 0, 'policies: (create-policies DEFAULT_NON_UPDATABLE) } ALWAYS-TRUE) | ||
,"account": "k:e4c6807d79d8bf4695e10e5678ebf72862f59b71f971d39dd3349f4beeacd6e3" | ||
}) | ||
|
||
(expect "Create token with non-updatable-uri-policy" | ||
true | ||
(create-token (read-msg "token-id") 0 "test-non-updatable-uri" (create-policies DEFAULT_NON_UPDATABLE) ALWAYS-TRUE)) | ||
|
||
(expect "create-token events" | ||
[ {"name": "marmalade-v2.guard-policy-v1.GUARDS","params": [(read-msg 'token-id) {"burn-guard": GUARD_SUCCESS,"mint-guard": GUARD_SUCCESS,"sale-guard": GUARD_SUCCESS,"transfer-guard": GUARD_SUCCESS, "uri-guard": GUARD_SUCCESS}]} | ||
{"name": "marmalade-v2.ledger.TOKEN","params": [(read-msg 'token-id) 0 [marmalade-v2.non-fungible-policy-v1 marmalade-v2.guard-policy-v1 marmalade-v2.non-updatable-uri-policy-v1] "test-non-updatable-uri" ALWAYS-TRUE]}] | ||
(map (remove "module-hash") (env-events true))) | ||
|
||
(commit-tx) | ||
|
||
(begin-tx "Update URI fails") | ||
|
||
(use marmalade-v2.ledger) | ||
(env-sigs [ | ||
{ 'key: 'e4c6807d79d8bf4695e10e5678ebf72862f59b71f971d39dd3349f4beeacd6e3 | ||
,'caps: [(marmalade-v2.ledger.UPDATE-URI (read-msg 'token-id ) "new-updatable-uri") ] | ||
}]) | ||
|
||
(expect-failure "update-uri fails" | ||
"Update URI Prohibited" | ||
(update-uri (read-msg "token-id") "new-updatable-uri") ) | ||
|
||
(commit-tx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters