...
 
Commits (2)
......@@ -6,7 +6,8 @@ Transfer is permitted if a receiver address is in the receiver white list OR imp
interface, its `tokens_received` entry point must be called.
*)
#include "fa2_behaviors.mligo"
#include "../lib/fa2_hook_lib.mligo"
#include "../lib/fa2_behaviors.mligo"
type storage = {
......
......@@ -3,7 +3,8 @@ Implementation of the permission transfer hook, which behavior is driven
by a particular settings of `permission_policy`.
*)
#include "fa2_behaviors.mligo"
#include "../lib/fa2_hook_lib.mligo"
#include "../lib/fa2_behaviors.mligo"
type storage = {
fa2_registry : fa2_registry;
......
......@@ -5,7 +5,8 @@ additional custom policy "schedule" which let pause/unpause transfers
based on used schedule
*)
#include "fa2_behaviors.mligo"
#include "../lib/fa2_hook_lib.mligo"
#include "../lib/fa2_behaviors.mligo"
type schedule_interval = {
interval : int;
......
#if !FA2_ERRORS
#define FA2_ERRORS
(** One of the specified `token_id`s is not defined within the FA2 contract *)
let token_undefined = "TOKEN_UNDEFINED"
(**
......@@ -36,4 +39,6 @@ let receiver_hook_undefined = "RECEIVER_HOOK_UNDEFINED"
Sender hook is required by the permission behavior, but is not implemented by
a sender contract
*)
let sender_hook_undefined = "SENDER_HOOK_UNDEFINED"
\ No newline at end of file
let sender_hook_undefined = "SENDER_HOOK_UNDEFINED"
#endif
#if !FA2_HOOK
#define FA2_HOOK
#include "fa2_interface.mligo"
......@@ -16,3 +20,5 @@ type set_hook_param_michelson = set_hook_param_aux michelson_pair_right_comb
type fa2_with_hook_entry_points =
| Fa2 of fa2_entry_points
| Set_transfer_hook of set_hook_param_michelson
#endif
#if ! FA2_INTERFACE
#define FA2_INTERFACE
type token_id = nat
type transfer_destination = {
......@@ -212,3 +215,5 @@ type fa2_token_receiver =
type fa2_token_sender =
| Tokens_sent of transfer_descriptor_param_michelson
#endif
\ No newline at end of file
#include "fa2_hook_lib.mligo"
#if !FA2_BEHAVIORS
#define FA2_BEHAVIORS
(* #include "fa2_hook_lib.mligo" *)
#include "../fa2_interface.mligo"
#include "../fa2_errors.mligo"
......@@ -80,3 +84,4 @@ let standard_transfer_hook (p, descriptor : transfer_hook_params * permissions_d
(* merge two lists *)
List.fold (fun (l, o : (operation list) * operation) -> o :: l) receiver_ops sender_ops
#endif
#include "../fa2_hook.mligo"
#if !FA2_CONVERTORS
#define FA2_CONVERTORS
#include "../fa2_interface.mligo"
let permissions_descriptor_to_michelson (d : permissions_descriptor)
: permissions_descriptor_michelson =
......@@ -180,3 +183,5 @@ let token_metas_to_michelson (ms : token_metadata list) : token_metadata_michels
let mm : token_metadata_michelson = Layout.convert_to_right_comb m in
mm
) ms
#endif
\ No newline at end of file
#if !FA2_HOOK_LIB
#define FA2_HOOK_LIB
#include "../fa2_hook.mligo"
#include "fa2_convertors.mligo"
let get_hook_entrypoint (hook_contract : address) (u : unit)
......@@ -32,3 +36,5 @@ let validate_hook_call (fa2, registry: address * fa2_registry) : unit =
if Set.mem fa2 registry
then unit
else failwith "UNKNOWN_FA2_CALL"
#endif
(** Reference implementation of the FA2 operator storage and config API functions *)
#if !FA2_OPERATOR_LIB
#define FA2_OPERATOR_LIB
#include "fa2_convertors.mligo"
......@@ -46,3 +48,5 @@ let validate_operator (tx_policy, txs, ops_storage
if Big_map.mem (tx.from_, operator) ops_storage
then unit else failwith "NOT_OPERATOR"
) txs
#endif