Commit 120200f5 authored by Eugene Mishura's avatar Eugene Mishura

reverted back to addresses permission_policy_config

parent 05ab17d6
Pipeline #115992636 passed with stage
in 2 minutes and 36 seconds
......@@ -13,7 +13,7 @@
type entry_points =
| Allowances_config of fa2_allowances_config_entry_points
| Allowances of fa2_allowances_config_entry_points
| Tokens_transferred_hook of hook_param
| Register_with_fa2 of fa2_entry_points contract
......@@ -90,15 +90,12 @@ let config_allowances (param : fa2_allowances_config_entry_points) (s : allowanc
let main (param, s : entry_points * allowances) : (operation list) * allowances =
match param with
| Allowances_config p -> config_allowances p s
| Allowances p -> config_allowances p s
| Tokens_transferred_hook p ->
let new_s = List.fold (track_allowances p.operator) p.batch s in
([] : operation list), new_s
| Register_with_fa2 fa2 ->
let config_entrypoint : fa2_allowances_config_entry_points contract =
Operation.get_entrypoint "%allowances_config" Current.self_address in
let config = Allowances_config config_entrypoint in
let op = create_register_hook_op fa2 [config] in
let op = create_register_hook_op fa2 [Allowances_config Current.self_address] in
[op], s
......@@ -13,7 +13,7 @@
type entry_points =
| Operators_config of fa2_operators_config_entry_points
| Operators of fa2_operators_config_entry_points
| Tokens_transferred_hook of hook_param
| Register_with_fa2 of fa2_entry_points contract
......@@ -87,7 +87,7 @@ let config_operators (param : fa2_operators_config_entry_points) (s : operators)
let main (param, s : entry_points * operators) : (operation list) * operators =
match param with
| Operators_config oc -> config_operators oc s
| Operators oc -> config_operators oc s
| Tokens_transferred_hook p ->
let u = List.iter (fun (tx : hook_transfer) ->
......@@ -102,8 +102,5 @@ let main (param, s : entry_points * operators) : (operation list) * operators =
([] : operation list), s
| Register_with_fa2 fa2 ->
let config_entrypoint : fa2_operators_config_entry_points contract =
Operation.get_entrypoint "%operators_config" Current.self_address in
let config = Operators_config config_entrypoint in
let op = create_register_hook_op fa2 [config] in
let op = create_register_hook_op fa2 [Operators_config Current.self_address] in
[op], s
......@@ -12,7 +12,7 @@ MUST fail.
type entry_points =
| Whitelist_config of fa2_whitelist_config_entry_points
| Whitelist of fa2_whitelist_config_entry_points
| Tokens_transferred_hook of hook_param
| Register_with_fa2 of fa2_entry_points contract
......@@ -32,7 +32,7 @@ let config_whitelist (param : fa2_whitelist_config_entry_points) (s : whitelist)
let main (param, s : entry_points * whitelist) : (operation list) * whitelist =
match param with
| Whitelist_config p -> config_whitelist p s
| Whitelist p -> config_whitelist p s
| Tokens_transferred_hook p ->
let u = List.iter (fun (tx : hook_transfer) ->
......@@ -47,8 +47,5 @@ let main (param, s : entry_points * whitelist) : (operation list) * whitelist =
([] : operation list), s
| Register_with_fa2 fa2 ->
let config_entrypoint : fa2_whitelist_config_entry_points contract =
Operation.get_entrypoint "%whitelist_config" Current.self_address in
let config = Whitelist_config config_entrypoint in
let op = create_register_hook_op fa2 [config] in
let op = create_register_hook_op fa2 [Whitelist_config Current.self_address] in
[op], s
......@@ -11,6 +11,17 @@ type transfer = {
type transfer_param = transfer list
type custom_config_param = {
entrypoint : address;
tag : string;
}
type permission_policy_config =
| Allowances_config of address
| Operators_config of address
| Whitelist_config of address
| Custom_config of custom_config_param
type balance_request = {
owner : address;
token_id : token_id;
......@@ -65,6 +76,23 @@ type hook_param = {
operator : address;
}
type set_hook_param = {
hook : address;
config : permission_policy_config list;
}
type fa2_entry_points =
| Transfer of transfer_param
| Balance_of of balance_of_param
| Total_supply of total_supply_param
| Token_descriptor of token_descriptor_param
| Get_permissions_policy of permission_policy_config
(* Recommended design pattern. Not part of FA2 standard. *)
| Set_transfer_hook of set_hook_param
(** Different permissioning policy interfaces *)
(** Different permissioning policy interfaces *)
(**
......@@ -146,28 +174,3 @@ type get_allowance_response = {
type fa2_whitelist_config_entry_points =
| Add_to_white_list of address list
| Remove_from_white_list of address list
type custom_config_param = {
entrypoint : address;
tag : string;
}
type permission_policy_config =
| Allowances_config of (fa2_allowances_config_entry_points contract)
| Operators_config of (fa2_operators_config_entry_points contract)
| Whitelist_config of (fa2_whitelist_config_entry_points contract)
| Custom_config of custom_config_param
type set_hook_param = {
hook : address;
config : permission_policy_config list;
}
type fa2_entry_points =
| Transfer of transfer_param
| Balance_of of balance_of_param
| Total_supply of total_supply_param
| Token_descriptor of token_descriptor_param
| Get_permissions_policy of permission_policy_config
(* Recommended design pattern. Not part of FA2 standard. *)
| Set_transfer_hook of set_hook_param
\ No newline at end of file
......@@ -62,6 +62,17 @@ type transfer = {
type transfer_param = transfer list
type custom_config_param = {
entrypoint : address;
tag : string;
}
type permission_policy_config =
| Allowances_config of address
| Operators_config of address
| Whitelist_config of address
| Custom_config of custom_config_param
type balance_request = {
owner : address;
token_id : token_id;
......@@ -104,34 +115,6 @@ type token_descriptor_param = {
token_descriptor_view : (token_descriptor_response list) contract
}
type hook_transfer = {
from_ : address option;
to_ : address option;
token_id : token_id;
amount : nat;
}
type hook_param = {
batch : hook_transfer list;
operator : address;
}
type custom_config_param = {
entrypoint : address;
tag : string;
}
type permission_policy_config =
| Allowances_config of (fa2_allowances_config_entry_points contract)
| Operators_config of (fa2_operators_config_entry_points contract)
| Whitelist_config of (fa2_whitelist_config_entry_points contract)
| Custom_config of custom_config_param
type set_hook_param = {
hook : address;
config : permission_policy_config list;
}
type fa2_entry_points =
| Transfer of transfer_param
| Balance_of of balance_of_param
......@@ -216,7 +199,7 @@ Config API provides the following entry points:
```ocaml
type operator_param = {
owner : address;
operator : address;
operator : address;
}
type is_operator_response = {
......@@ -302,8 +285,8 @@ permission configuration contract.
| `permission_policy_config` option | config entry points type |
| :------------------------- | :----------------------- |
| `Allowance_config` | `fa2_allowance_config_entry_points` |
| `Operator_config` | `fa2_operator_config_entry_points` |
| `Allowances_config` | `fa2_allowances_config_entry_points` |
| `Operators_config` | `fa2_operators_config_entry_points` |
| `Whitelist_config` | `fa2_whitelist_config_entry_points` |
| `Custom_config` | Not specified |
......@@ -380,6 +363,18 @@ hook as well.
FA2 entry point with the following signature:
```ocaml
type hook_transfer = {
from_ : address option;
to_ : address option;
token_id : token_id;
amount : nat;
}
type hook_param = {
batch : hook_transfer list;
operator : address;
}
type set_hook_param = {
hook : address;
config : permission_policy_config;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment