Created
August 7, 2020 16:28
-
-
Save gromakovsky/5ec540a467d81d495c1fa7b6655ea52f to your computer and use it in GitHub Desktop.
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
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