Proto/CLST: update_operators entrypoint

Based on !20633 (merged).

This MRs implements the following according to the FA2.1 standard:

  • update_operators entrypoint
  • is_operator view
  • operator_update event

Part of #8214.

Manually testing the MR

dune exec src/proto_alpha/lib_protocol/test/integration/main.exe -- --file test_clst.ml -m "update_operators" or in sandbox:

./src/bin_node/octez-sandboxed-node.sh 1 --connections 0
eval $(./src/bin_client/octez-init-sandboxed-client.sh 1)
octez-activate-alpha

octez-client --wait none clst deposit 300000 for bootstrap2 --burn-cap 1
octez-client bake for --minimal-timestamp

octez-client --wait none transfer 0 from bootstrap2 to KT1WCsbJx996ebZfutAitHYsZ8FUZFsTdaD7 --burn-cap 1 --entrypoint "update_operators" --arg "{ Left (Pair \"tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN\" \"tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx\" 0) }"

octez-client run view is_operator on contract KT1WCsbJx996ebZfutAitHYsZ8FUZFsTdaD7 with input "Pair \"tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN\" \"tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx\" 0"

octez-client --wait none transfer 0 from bootstrap2 to KT1WCsbJx996ebZfutAitHYsZ8FUZFsTdaD7 --burn-cap 1 --entrypoint "update_operators" --arg "{ Right (Pair \"tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN\" \"tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx\" 0) }"

update_operators triggers the operator_update event:

      Internal operations:
        Internal Event:
          From: KT1WCsbJx996ebZfutAitHYsZ8FUZFsTdaD7
          Type: (pair %operator_update
                   (address %owner)
                   (pair (address %operator) (pair (nat %token_id) (bool %is_operator))))
          Tag: update_operators
          Payload: { 0x0000e7670f32038107a59a2b9cfefae36ea21f5aa63c ;
                     0x000002298c03ed7d454a101eb7022bc95f7e5f41ac78 ;
                     0 ;
                     False }
          This event was successfully applied
          Consumed gas: 100

In the block metadata:

                "internal_operation_results":
                  [ { "kind": "event",
                      "source": "KT1WCsbJx996ebZfutAitHYsZ8FUZFsTdaD7",
                      "nonce": 0,
                      "type":
                        { "prim": "pair",
                          "args":
                            [ { "prim": "address", "annots": [ "%owner" ] },
                              { "prim": "pair",
                                "args":
                                  [ { "prim": "address",
                                      "annots": [ "%operator" ] },
                                    { "prim": "pair",
                                      "args":
                                        [ { "prim": "nat",
                                            "annots": [ "%token_id" ] },
                                          { "prim": "bool",
                                            "annots": [ "%is_operator" ] } ] } ] } ],
                          "annots": [ "%operator_update" ] },
                      "tag": "update_operators",
                      "payload":
                        [ { "bytes":
                              "0000e7670f32038107a59a2b9cfefae36ea21f5aa63c" },
                          { "bytes":
                              "000002298c03ed7d454a101eb7022bc95f7e5f41ac78" },
                          { "int": "0" }, { "prim": "False" } ],
                      "result":
                        { "status": "applied",
                          "consumed_milligas": "100000" } } ] } } ],

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Marina Polubelova

Merge request reports

Loading