Skip to content

Instantly share code, notes, and snippets.

@gromakovsky
Created August 7, 2020 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gromakovsky/5ec540a467d81d495c1fa7b6655ea52f to your computer and use it in GitHub Desktop.
Save gromakovsky/5ec540a467d81d495c1fa7b6655ea52f to your computer and use it in GitHub Desktop.
type operator_param_ is record
owner : address
; operator : address
end
type operator_param is michelson_pair_right_comb(operator_param_)
type operators is
big_map ((address * address), unit)
function validate_operator_owner_is_sender
( const param : operator_param
) : unit is if param.0 = Tezos.sender
then unit else failwith ("NOT_TOKEN_OWNER")
function add_operator
( const param : operator_param
; const operators : operators
) : operators is block
{ validate_operator_owner_is_sender (param)
; const operator_key : (address * address) = (param.0, param.1)
} with Big_map.update (operator_key, Some (unit), operators)
type entrypoint is list (operation) * operators
function main
( const parameter : operator_param
; const store : operators
) : entrypoint is block
{ const updated_operators : operators =
add_operator (parameter, store)
} with
( (nil : list (operation))
, updated_operators
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment