Michelson: removes amount from calling convention
This commit is contained in:
parent
aa49d7bb31
commit
7bfaf2fe9b
@ -517,7 +517,7 @@ let unexpand_macros type_map (program : Script.code) =
|
|||||||
match node with
|
match node with
|
||||||
| Seq (loc, l) ->
|
| Seq (loc, l) ->
|
||||||
begin match caddr type_map [] l with
|
begin match caddr type_map [] l with
|
||||||
| None ->
|
| None | Some [] ->
|
||||||
let type_map, l =
|
let type_map, l =
|
||||||
List.fold_left
|
List.fold_left
|
||||||
(fun (type_map, acc) e ->
|
(fun (type_map, acc) e ->
|
||||||
|
@ -1052,7 +1052,7 @@ for under/overflows.
|
|||||||
Forge a new contract.
|
Forge a new contract.
|
||||||
|
|
||||||
|
|
||||||
:: key : key? : bool : bool : tez : lambda (pair (pair tez 'p) 'g) (pair 'r 'g) : 'g : 'S
|
:: key : key? : bool : bool : tez : lambda (pair 'p 'g) (pair 'r 'g) : 'g : 'S
|
||||||
-> contract 'p 'r : 'S
|
-> contract 'p 'r : 'S
|
||||||
|
|
||||||
As with non code-emitted originations the
|
As with non code-emitted originations the
|
||||||
@ -1061,7 +1061,7 @@ for under/overflows.
|
|||||||
the global data and returns it to be stored and retrieved on the
|
the global data and returns it to be stored and retrieved on the
|
||||||
next transaction. These data are initialized by another
|
next transaction. These data are initialized by another
|
||||||
parameter. The calling convention for the code is as follows:
|
parameter. The calling convention for the code is as follows:
|
||||||
`(Pair (Pair amount arg) globals)) -> (Pair ret globals)`, as
|
`(Pair arg globals)) -> (Pair ret globals)`, as
|
||||||
extrapolable from the instruction type. The first parameters are
|
extrapolable from the instruction type. The first parameters are
|
||||||
the manager, optional delegate, then spendable and delegatable
|
the manager, optional delegate, then spendable and delegatable
|
||||||
flags and finally the initial amount taken from the currently
|
flags and finally the initial amount taken from the currently
|
||||||
@ -1149,12 +1149,12 @@ for under/overflows.
|
|||||||
|
|
||||||
:: 'a : 'S -> string : 'S
|
:: 'a : 'S -> string : 'S
|
||||||
|
|
||||||
* `CHECK_SIGNATURE`
|
* `CHECK_SIGNATURE`:
|
||||||
Check that a sequence of bytes has been signed with a given key.
|
Check that a sequence of bytes has been signed with a given key.
|
||||||
|
|
||||||
:: key : pair signature string : 'S -> bool : 'S
|
:: key : pair signature string : 'S -> bool : 'S
|
||||||
|
|
||||||
* `COMPARE`
|
* `COMPARE`:
|
||||||
|
|
||||||
:: key : key : 'S -> int64 : 'S
|
:: key : key : 'S -> int64 : 'S
|
||||||
|
|
||||||
@ -1349,27 +1349,23 @@ data storage. The type of the global data of the storage is fixed for
|
|||||||
each contract at origination time. This is ensured statically by
|
each contract at origination time. This is ensured statically by
|
||||||
checking on origination that the code preserves the type of the global
|
checking on origination that the code preserves the type of the global
|
||||||
data. For this, the code of the contract is checked to be of the
|
data. For this, the code of the contract is checked to be of the
|
||||||
following type lambda (pair (pair tez 'arg) 'global) -> (pair 'ret
|
following type lambda (pair 'arg 'global) -> (pair 'ret
|
||||||
'global) where 'global is the type of the original global store given
|
'global) where 'global is the type of the original global store given
|
||||||
on origination. The contract also takes a parameter and an amount, and
|
on origination. The contract also takes a parameter and
|
||||||
returns a value, hence the complete calling convention above.
|
returns a value, hence the complete calling convention above.
|
||||||
|
|
||||||
### Empty contract
|
### Empty contract
|
||||||
|
|
||||||
Because of the calling convention, the empty sequence is not a valid
|
Any contract with the same `parameter` and `return` types
|
||||||
contract of type `(contract unit unit)`. The code for building a
|
may be written with an empty sequence in its `code` section.
|
||||||
contract of such a type must take a `unit` argument, an amount in `tez`,
|
The simplest contracts is the contract for which the
|
||||||
and transform a unit global storage, and must thus be of type `(lambda
|
`parameter`, `storage`, and `return` are all of type `unit`.
|
||||||
(pair (pair tez unit) unit) (pair unit unit))`.
|
This contract is as follows:
|
||||||
|
|
||||||
Such a minimal contract code is thus `{ CDR ; UNIT ; PAIR }`.
|
code { };
|
||||||
|
storage unit;
|
||||||
A valid contract source file would be as follows.
|
parameter unit;
|
||||||
|
return unit;
|
||||||
code { CDR ; UNIT ; PAIR }
|
|
||||||
storage unit
|
|
||||||
parameter unit
|
|
||||||
return unit
|
|
||||||
|
|
||||||
### Reservoir contract
|
### Reservoir contract
|
||||||
|
|
||||||
@ -1393,13 +1389,13 @@ Hence, the global data of the contract has the following type
|
|||||||
Following the contract calling convention, the code is a lambda of type
|
Following the contract calling convention, the code is a lambda of type
|
||||||
|
|
||||||
lambda
|
lambda
|
||||||
pair (pair tez unit) 'g
|
pair unit 'g
|
||||||
pair unit 'g
|
pair unit 'g
|
||||||
|
|
||||||
writen as
|
writen as
|
||||||
|
|
||||||
lambda
|
lambda
|
||||||
pair (pair tez unit)
|
pair unit
|
||||||
pair
|
pair
|
||||||
pair timestamp tez
|
pair timestamp tez
|
||||||
pair (contract unit unit) (contract unit unit)
|
pair (contract unit unit) (contract unit unit)
|
||||||
@ -1614,9 +1610,8 @@ At the beginning of the transaction:
|
|||||||
S via a CDDDDADR
|
S via a CDDDDADR
|
||||||
W via a CDDDDDR
|
W via a CDDDDDR
|
||||||
the delivery counter via a CDAAR
|
the delivery counter via a CDAAR
|
||||||
the amount versed by the buyer via a CDADAR
|
|
||||||
the amount versed by the seller via a CDADDR
|
the amount versed by the seller via a CDADDR
|
||||||
the argument via a CADR
|
the argument via a CAR
|
||||||
|
|
||||||
The contract returns a unit value, and we assume that it is created
|
The contract returns a unit value, and we assume that it is created
|
||||||
with the minimum amount, set to `(Tez "1.00")`.
|
with the minimum amount, set to `(Tez "1.00")`.
|
||||||
@ -1640,12 +1635,12 @@ The complete source `forward.tz` is:
|
|||||||
PUSH uint64 86400 ; SWAP ; ADD ; # one day in second
|
PUSH uint64 86400 ; SWAP ; ADD ; # one day in second
|
||||||
NOW ; COMPARE ; LT ;
|
NOW ; COMPARE ; LT ;
|
||||||
IF { # Before Z + 24
|
IF { # Before Z + 24
|
||||||
DUP ; CADR ; # we must receive (Left "buyer") or (Left "seller")
|
DUP ; CAR ; # we must receive (Left "buyer") or (Left "seller")
|
||||||
IF_LEFT
|
IF_LEFT
|
||||||
{ DUP ; PUSH string "buyer" ; COMPARE ; EQ ;
|
{ DUP ; PUSH string "buyer" ; COMPARE ; EQ ;
|
||||||
IF { DROP ;
|
IF { DROP ;
|
||||||
DUP ; CDADAR ; # amount already versed by the buyer
|
DUP ; CDADAR ; # amount already versed by the buyer
|
||||||
DIP { DUP ; CAAR } ; ADD ; # transaction
|
DIP { AMOUNT } ; ADD ; # transaction
|
||||||
# then we rebuild the globals
|
# then we rebuild the globals
|
||||||
DIP { DUP ; CDADDR } ; PAIR ; # seller amount
|
DIP { DUP ; CDADDR } ; PAIR ; # seller amount
|
||||||
PUSH uint32 0 ; PAIR ; # delivery counter at 0
|
PUSH uint32 0 ; PAIR ; # delivery counter at 0
|
||||||
@ -1654,7 +1649,7 @@ The complete source `forward.tz` is:
|
|||||||
UNIT ; PAIR }
|
UNIT ; PAIR }
|
||||||
{ PUSH string "seller" ; COMPARE ; EQ ;
|
{ PUSH string "seller" ; COMPARE ; EQ ;
|
||||||
IF { DUP ; CDADDR ; # amount already versed by the seller
|
IF { DUP ; CDADDR ; # amount already versed by the seller
|
||||||
DIP { DUP ; CAAR } ; ADD ; # transaction
|
DIP { AMOUNT } ; ADD ; # transaction
|
||||||
# then we rebuild the globals
|
# then we rebuild the globals
|
||||||
DIP { DUP ; CDADAR } ; SWAP ; PAIR ; # buyer amount
|
DIP { DUP ; CDADAR } ; SWAP ; PAIR ; # buyer amount
|
||||||
PUSH uint32 0 ; PAIR ; # delivery counter at 0
|
PUSH uint32 0 ; PAIR ; # delivery counter at 0
|
||||||
@ -1693,11 +1688,11 @@ The complete source `forward.tz` is:
|
|||||||
NOW ; COMPARE ; LT
|
NOW ; COMPARE ; LT
|
||||||
IF { # Between T and T + 24
|
IF { # Between T and T + 24
|
||||||
# we only accept transactions from the buyer
|
# we only accept transactions from the buyer
|
||||||
DUP ; CADR ; # we must receive (Left "buyer")
|
DUP ; CAR ; # we must receive (Left "buyer")
|
||||||
IF_LEFT
|
IF_LEFT
|
||||||
{ PUSH string "buyer" ; COMPARE ; EQ ;
|
{ PUSH string "buyer" ; COMPARE ; EQ ;
|
||||||
IF { DUP ; CDADAR ; # amount already versed by the buyer
|
IF { DUP ; CDADAR ; # amount already versed by the buyer
|
||||||
DIP { DUP ; CAAR } ; ADD ; # transaction
|
DIP { AMOUNT } ; ADD ; # transaction
|
||||||
# The amount must not exceed Q * K
|
# The amount must not exceed Q * K
|
||||||
DUP ;
|
DUP ;
|
||||||
DIIP { DUP ; CDDAAR ; # Q
|
DIIP { DUP ; CDDAAR ; # Q
|
||||||
@ -1736,7 +1731,7 @@ The complete source `forward.tz` is:
|
|||||||
SOURCE unit unit ; MANAGER ;
|
SOURCE unit unit ; MANAGER ;
|
||||||
COMPARE ; NEQ ;
|
COMPARE ; NEQ ;
|
||||||
IF { FAIL } {} # fail if not the warehouse
|
IF { FAIL } {} # fail if not the warehouse
|
||||||
DUP ; CADR ; # we must receive (Right amount)
|
DUP ; CAR ; # we must receive (Right amount)
|
||||||
IF_LEFT
|
IF_LEFT
|
||||||
{ FAIL } # (Left _)
|
{ FAIL } # (Left _)
|
||||||
{ # We increment the counter
|
{ # We increment the counter
|
||||||
@ -1763,7 +1758,7 @@ The complete source `forward.tz` is:
|
|||||||
UNIT ; TRANSFER_TOKENS ; DROP ;
|
UNIT ; TRANSFER_TOKENS ; DROP ;
|
||||||
# and return unit
|
# and return unit
|
||||||
UNIT ; PAIR } } } } } } }
|
UNIT ; PAIR } } } } } } }
|
||||||
|
|
||||||
X - Full grammar
|
X - Full grammar
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
@ -512,14 +512,14 @@ and execute ?log origination orig source ctxt storage script amount arg qta =
|
|||||||
(Lwt.return (parse_ty arg_type)) >>=? fun (Ex_ty arg_type) ->
|
(Lwt.return (parse_ty arg_type)) >>=? fun (Ex_ty arg_type) ->
|
||||||
(Lwt.return (parse_ty ret_type)) >>=? fun (Ex_ty ret_type) ->
|
(Lwt.return (parse_ty ret_type)) >>=? fun (Ex_ty ret_type) ->
|
||||||
(Lwt.return (parse_ty storage_type)) >>=? fun (Ex_ty storage_type) ->
|
(Lwt.return (parse_ty storage_type)) >>=? fun (Ex_ty storage_type) ->
|
||||||
let arg_type_full = Pair_t (Pair_t (Tez_t, arg_type), storage_type) in
|
let arg_type_full = Pair_t (arg_type, storage_type) in
|
||||||
let ret_type_full = Pair_t (ret_type, storage_type) in
|
let ret_type_full = Pair_t (ret_type, storage_type) in
|
||||||
trace
|
trace
|
||||||
(Ill_typed_contract (code, arg_type, ret_type, storage_type, []))
|
(Ill_typed_contract (code, arg_type, ret_type, storage_type, []))
|
||||||
(parse_lambda ~storage_type ctxt arg_type_full ret_type_full code) >>=? fun lambda ->
|
(parse_lambda ~storage_type ctxt arg_type_full ret_type_full code) >>=? fun lambda ->
|
||||||
parse_data ctxt arg_type arg >>=? fun arg ->
|
parse_data ctxt arg_type arg >>=? fun arg ->
|
||||||
parse_data ctxt storage_type storage >>=? fun storage ->
|
parse_data ctxt storage_type storage >>=? fun storage ->
|
||||||
interp ?log origination qta orig source amount ctxt lambda ((amount, arg), storage)
|
interp ?log origination qta orig source amount ctxt lambda (arg, storage)
|
||||||
>>=? fun (ret, qta, ctxt, origination) ->
|
>>=? fun (ret, qta, ctxt, origination) ->
|
||||||
let ret, storage = ret in
|
let ret, storage = ret in
|
||||||
return (unparse_data storage_type storage,
|
return (unparse_data storage_type storage,
|
||||||
|
@ -1275,7 +1275,7 @@ and parse_instr
|
|||||||
(Bool_t, Item_t
|
(Bool_t, Item_t
|
||||||
(Bool_t, Item_t
|
(Bool_t, Item_t
|
||||||
(Tez_t, Item_t
|
(Tez_t, Item_t
|
||||||
(Lambda_t (Pair_t (Pair_t (Tez_t, p), gp),
|
(Lambda_t (Pair_t (p, gp),
|
||||||
Pair_t (r, gr)), Item_t
|
Pair_t (r, gr)), Item_t
|
||||||
(ginit, rest))))))) ->
|
(ginit, rest))))))) ->
|
||||||
check_item_ty gp gr loc "CREATE_CONTRACT" 5 7 >>=? fun (Eq _) ->
|
check_item_ty gp gr loc "CREATE_CONTRACT" 5 7 >>=? fun (Eq _) ->
|
||||||
@ -1437,7 +1437,7 @@ let parse_script
|
|||||||
(Lwt.return (parse_ty ret_type)) >>=? fun (Ex_ty ret_type) ->
|
(Lwt.return (parse_ty ret_type)) >>=? fun (Ex_ty ret_type) ->
|
||||||
(Lwt.return (parse_ty init_storage_type)) >>=? fun (Ex_ty init_storage_type) ->
|
(Lwt.return (parse_ty init_storage_type)) >>=? fun (Ex_ty init_storage_type) ->
|
||||||
(Lwt.return (parse_ty storage_type)) >>=? fun (Ex_ty storage_type) ->
|
(Lwt.return (parse_ty storage_type)) >>=? fun (Ex_ty storage_type) ->
|
||||||
let arg_type_full = Pair_t (Pair_t (Tez_t, arg_type), storage_type) in
|
let arg_type_full = Pair_t (arg_type, storage_type) in
|
||||||
let ret_type_full = Pair_t (ret_type, storage_type) in
|
let ret_type_full = Pair_t (ret_type, storage_type) in
|
||||||
Lwt.return (ty_eq init_storage_type storage_type) >>=? fun (Eq _) ->
|
Lwt.return (ty_eq init_storage_type storage_type) >>=? fun (Eq _) ->
|
||||||
parse_data ?type_logger ctxt storage_type storage >>=? fun storage ->
|
parse_data ?type_logger ctxt storage_type storage >>=? fun storage ->
|
||||||
@ -1546,7 +1546,7 @@ let typecheck_code
|
|||||||
trace
|
trace
|
||||||
(Ill_formed_type (Some "storage", storage_type))
|
(Ill_formed_type (Some "storage", storage_type))
|
||||||
(Lwt.return (parse_ty storage_type)) >>=? fun (Ex_ty storage_type) ->
|
(Lwt.return (parse_ty storage_type)) >>=? fun (Ex_ty storage_type) ->
|
||||||
let arg_type_full = Pair_t (Pair_t (Tez_t, arg_type), storage_type) in
|
let arg_type_full = Pair_t (arg_type, storage_type) in
|
||||||
let ret_type_full = Pair_t (ret_type, storage_type) in
|
let ret_type_full = Pair_t (ret_type, storage_type) in
|
||||||
let result =
|
let result =
|
||||||
parse_lambda ctxt
|
parse_lambda ctxt
|
||||||
|
@ -40,7 +40,7 @@ end
|
|||||||
type ('key, 'value) map = (module Boxed_map with type key = 'key and type value = 'value)
|
type ('key, 'value) map = (module Boxed_map with type key = 'key and type value = 'value)
|
||||||
|
|
||||||
type ('arg, 'ret, 'storage) script =
|
type ('arg, 'ret, 'storage) script =
|
||||||
{ code : (((Tez.t, 'arg) pair, 'storage) pair, ('ret, 'storage) pair) lambda ;
|
{ code : (('arg, 'storage) pair, ('ret, 'storage) pair) lambda ;
|
||||||
arg_type : 'arg ty ;
|
arg_type : 'arg ty ;
|
||||||
ret_type : 'ret ty ;
|
ret_type : 'ret ty ;
|
||||||
storage : 'storage ;
|
storage : 'storage ;
|
||||||
@ -270,7 +270,7 @@ and ('bef, 'aft) instr =
|
|||||||
| Default_account : (public_key_hash * 'rest, (unit, unit) typed_contract * 'rest) instr
|
| Default_account : (public_key_hash * 'rest, (unit, unit) typed_contract * 'rest) instr
|
||||||
| Create_contract : 'g ty * 'p ty * 'r ty ->
|
| Create_contract : 'g ty * 'p ty * 'r ty ->
|
||||||
(public_key_hash * (public_key_hash option * (bool * (bool * (Tez.t *
|
(public_key_hash * (public_key_hash option * (bool * (bool * (Tez.t *
|
||||||
(((Tez.t * 'p) * 'g, 'r * 'g) lambda * ('g * 'rest)))))),
|
(('p * 'g, 'r * 'g) lambda * ('g * 'rest)))))),
|
||||||
('p, 'r) typed_contract * 'rest) instr
|
('p, 'r) typed_contract * 'rest) instr
|
||||||
| Now :
|
| Now :
|
||||||
('rest, Timestamp.t * 'rest) instr
|
('rest, Timestamp.t * 'rest) instr
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
parameter (pair bool bool);
|
parameter (pair bool bool);
|
||||||
return bool;
|
return bool;
|
||||||
storage unit;
|
storage unit;
|
||||||
code {DUP; CADR; CAR; SWAP; CADR; CDR; AND;
|
code {CAR; DUP; CAR; DIP{CDR}; AND; UNIT; SWAP; PAIR};
|
||||||
UNIT; SWAP; PAIR};
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
parameter uint64;
|
parameter uint64;
|
||||||
return (list uint64);
|
return (list uint64);
|
||||||
storage unit;
|
storage unit;
|
||||||
code {CADR; NIL uint64; SWAP; DUP; PUSH uint64 0; CMPNEQ;
|
code {CAR; NIL uint64; SWAP; DUP; PUSH uint64 0; CMPNEQ;
|
||||||
LOOP {DUP; DIP {SWAP}; CONS; SWAP; PUSH uint64 1; SWAP; SUB;
|
LOOP {DUP; DIP {SWAP}; CONS; SWAP; PUSH uint64 1; SWAP; SUB;
|
||||||
DUP; PUSH uint64 0; CMPNEQ};
|
DUP; PUSH uint64 0; CMPNEQ};
|
||||||
CONS; UNIT; SWAP; PAIR};
|
CONS; UNIT; SWAP; PAIR};
|
||||||
|
@ -2,4 +2,4 @@ parameter key;
|
|||||||
storage (pair signature string);
|
storage (pair signature string);
|
||||||
return bool;
|
return bool;
|
||||||
code {DUP; DUP; DIP{CDR; DUP; CAR; DIP{CDR; H}; PAIR};
|
code {DUP; DUP; DIP{CDR; DUP; CAR; DIP{CDR; H}; PAIR};
|
||||||
CADR; CHECK_SIGNATURE; DIP{CDR}; PAIR};
|
CAR; CHECK_SIGNATURE; DIP{CDR}; PAIR};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
parameter (pair tez tez);
|
parameter (pair tez tez);
|
||||||
return (list bool);
|
return (list bool);
|
||||||
storage unit;
|
storage unit;
|
||||||
code {CADR; DUP; DUP; DUP; DUP; DIIIIIP {NIL bool};
|
code {CAR; DUP; DUP; DUP; DUP; DIIIIIP {NIL bool};
|
||||||
DIIIIP {DUP; CAR; DIP {CDR}; COMPARE; LE; CONS};
|
DIIIIP {DUP; CAR; DIP {CDR}; COMPARE; LE; CONS};
|
||||||
DIIIP {DUP; CAR; DIP {CDR}; COMPARE; GE; CONS};
|
DIIIP {DUP; CAR; DIP {CDR}; COMPARE; GE; CONS};
|
||||||
DIIP{DUP; CAR; DIP {CDR}; COMPARE; LT; CONS};
|
DIIP{DUP; CAR; DIP {CDR}; COMPARE; LT; CONS};
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
parameter (list string);
|
parameter (list string);
|
||||||
return (list string);
|
return (list string);
|
||||||
storage unit;
|
storage unit;
|
||||||
code {CADR; LAMBDA string string {PUSH string "Hello "; CONCAT}; MAP; UNIT; SWAP; PAIR};
|
code{CAR; LAMBDA string string {PUSH string "Hello "; CONCAT};
|
||||||
|
MAP; UNIT; SWAP; PAIR};
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
parameter (list string);
|
parameter (list string);
|
||||||
return string;
|
return string;
|
||||||
storage unit;
|
storage unit;
|
||||||
code {CADR; PUSH string ""; SWAP; LAMBDA (pair string string) string {DUP; CAR; SWAP; CDR; SWAP; CONCAT}; REDUCE;
|
code {CAR; PUSH string ""; SWAP;
|
||||||
UNIT; SWAP; PAIR};
|
LAMBDA (pair string string) string {DUP; CAR; SWAP; CDR; SWAP; CONCAT};
|
||||||
|
REDUCE; UNIT; SWAP; PAIR};
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
parameter (pair (list string) (list string));
|
parameter (pair (list string) (list string));
|
||||||
storage unit;
|
storage unit;
|
||||||
return bool;
|
return bool;
|
||||||
code {CADR; DUP; CAR; DIP{CDR}; EMPTY_SET string; SWAP;
|
code {CAR; DUP; CAR; DIP{CDR}; EMPTY_SET string; SWAP;
|
||||||
LAMBDA (pair string (set string)) (set string) {DUP; CAR; DIP{CDR}; PUSH bool True; SWAP; UPDATE};
|
LAMBDA (pair string (set string)) (set string) {DUP; CAR; DIP{CDR}; PUSH bool True; SWAP; UPDATE};
|
||||||
REDUCE; PUSH bool True; SWAP; PAIR; SWAP;
|
REDUCE; PUSH bool True; SWAP; PAIR; SWAP;
|
||||||
LAMBDA (pair string (pair (set string) bool)) (pair (set string) bool) {DUP; DUP; CAR; DIP{CDAR; DIP{CDDR}; DUP}; MEM; DIP{SWAP}; AND; SWAP; PAIR};
|
LAMBDA (pair string (pair (set string) bool))
|
||||||
|
(pair (set string) bool)
|
||||||
|
{DUP; DUP; CAR; DIP{CDAR; DIP{CDDR}; DUP}; MEM; DIP{SWAP}; AND; SWAP; PAIR};
|
||||||
REDUCE; CDR; UNIT; SWAP; PAIR};
|
REDUCE; CDR; UNIT; SWAP; PAIR};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
parameter key;
|
parameter key;
|
||||||
return unit;
|
return unit;
|
||||||
storage (contract unit unit);
|
storage (contract unit unit);
|
||||||
code {CADR; DIP{PUSH tez "100.00"; PUSH bool False; NONE key}; CREATE_ACCOUNT;
|
code {CAR; DIP{PUSH tez "100.00"; PUSH bool False; NONE key};
|
||||||
UNIT; PAIR};
|
CREATE_ACCOUNT; UNIT; PAIR};
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
parameter key;
|
parameter key;
|
||||||
storage string;
|
storage string;
|
||||||
return unit;
|
return unit;
|
||||||
code {CADR; DIP{UNIT; LAMBDA (pair (pair tez string) unit) (pair string unit) {CADR; UNIT; SWAP; PAIR};
|
code {CAR; DIP{UNIT; LAMBDA (pair string unit)
|
||||||
PUSH tez "100.00"; PUSH bool False; PUSH bool False; NONE key};
|
(pair string unit)
|
||||||
CREATE_CONTRACT; DIP{PUSH string ""}; PUSH tez "0.00"; PUSH string "abcdefg"; TRANSFER_TOKENS;
|
{CAR; UNIT; SWAP; PAIR};
|
||||||
|
PUSH tez "100.00"; PUSH bool False;
|
||||||
|
PUSH bool False; NONE key};
|
||||||
|
CREATE_CONTRACT; DIP{PUSH string ""}; PUSH tez "0.00";
|
||||||
|
PUSH string "abcdefg"; TRANSFER_TOKENS;
|
||||||
DIP{DROP}; UNIT; PAIR};
|
DIP{DROP}; UNIT; PAIR};
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
parameter key
|
parameter key
|
||||||
return unit
|
return unit
|
||||||
storage unit
|
storage unit
|
||||||
code {DIP{UNIT}; CADR; DEFAULT_ACCOUNT; PUSH tez "100"; UNIT; TRANSFER_TOKENS; PAIR}
|
code {DIP{UNIT}; CAR; DEFAULT_ACCOUNT;
|
||||||
|
PUSH tez "100"; UNIT; TRANSFER_TOKENS; PAIR}
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
storage unit;
|
storage unit;
|
||||||
return (map string string);
|
return (map string string);
|
||||||
parameter unit;
|
parameter unit;
|
||||||
code {DROP; EMPTY_MAP string string; PUSH string "world"; SOME; PUSH string "hello"; UPDATE; UNIT; SWAP; PAIR};
|
code {DROP;
|
||||||
|
EMPTY_MAP string string;
|
||||||
|
PUSH string "world"; SOME; PUSH string "hello"; UPDATE;
|
||||||
|
UNIT; SWAP; PAIR};
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
parameter string;
|
parameter string;
|
||||||
return string;
|
return string;
|
||||||
storage unit;
|
storage unit;
|
||||||
code {CADR; LAMBDA string string {PUSH string "_abc"; SWAP; CONCAT}; SWAP; EXEC; UNIT; SWAP; PAIR};
|
code {CAR;
|
||||||
|
LAMBDA string string {PUSH string "_abc"; SWAP; CONCAT};
|
||||||
|
SWAP; EXEC; UNIT; SWAP; PAIR};
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
parameter unit;
|
parameter unit;
|
||||||
storage unit;
|
storage unit;
|
||||||
return unit;
|
return unit;
|
||||||
code {CAAR; PUSH tez "10"; CMPGT; IF {FAIL} {UNIT; UNIT; PAIR}}
|
code {AMOUNT; PUSH tez "10"; CMPGT; IF {FAIL} {}}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
parameter string;
|
parameter string;
|
||||||
storage (map string string);
|
storage (map string string);
|
||||||
return (option string);
|
return (option string);
|
||||||
code {DUP; CADR; DIP{CDR; DUP}; GET; PAIR};
|
code {DUP; CAR; DIP{CDR; DUP}; GET; PAIR};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
parameter string;
|
parameter string;
|
||||||
return string;
|
return string;
|
||||||
storage unit;
|
storage unit;
|
||||||
code {CADR; H; UNIT; SWAP; PAIR};
|
code {CAR; H; UNIT; SWAP; PAIR};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
parameter bool;
|
parameter bool;
|
||||||
storage unit;
|
storage unit;
|
||||||
return bool;
|
return bool;
|
||||||
code {CADR; IF {PUSH bool True} {PUSH bool False}; UNIT; SWAP; PAIR};
|
code {CAR; IF {PUSH bool True} {PUSH bool False}; UNIT; SWAP; PAIR};
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
parameter (list int32);
|
parameter (list int32);
|
||||||
storage unit;
|
storage unit;
|
||||||
return (option int32);
|
return (option int32);
|
||||||
code {CADR; DIP{NONE int32};
|
code {CAR; DIP{NONE int32};
|
||||||
LAMBDA
|
LAMBDA
|
||||||
(pair int32 (option int32))
|
(pair int32 (option int32))
|
||||||
(option int32)
|
(option int32)
|
||||||
{DUP; DUP; CAR; SWAP; CDR;
|
{DUP; DUP; CAR; SWAP; CDR;
|
||||||
IF_NONE {DIP{DROP}; SOME} {CMPGT; IF {CDR} {CAR; SOME}}};
|
IF_NONE {DIP{DROP}; SOME} {CMPGT; IF {CDR} {CAR; SOME}}};
|
||||||
REDUCE; UNIT; SWAP; PAIR};
|
REDUCE; UNIT; SWAP; PAIR};
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
parameter unit
|
parameter unit;
|
||||||
code
|
code {};
|
||||||
{ # This is a noop contract
|
return unit;
|
||||||
CDR ; UNIT ; PAIR
|
storage unit;
|
||||||
}
|
|
||||||
return unit
|
|
||||||
storage unit
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
parameter bool;
|
parameter bool;
|
||||||
return bool;
|
return bool;
|
||||||
storage unit;
|
storage unit;
|
||||||
code {CADR; NOT; UNIT; SWAP; PAIR};
|
code {CAR; NOT; UNIT; SWAP; PAIR};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
parameter (pair bool bool);
|
parameter (pair bool bool);
|
||||||
return bool;
|
return bool;
|
||||||
storage unit;
|
storage unit;
|
||||||
code {CADR; DUP; CAR; SWAP; CDR; OR;
|
code {CAR; DUP; CAR; SWAP; CDR; OR;
|
||||||
UNIT; SWAP; PAIR};
|
UNIT; SWAP; PAIR};
|
||||||
|
@ -2,16 +2,16 @@ storage unit ;
|
|||||||
parameter uint16 ;
|
parameter uint16 ;
|
||||||
return (list (contract unit unit)) ;
|
return (list (contract unit unit)) ;
|
||||||
code
|
code
|
||||||
{ CADR ; DUP ; PUSH uint16 0 ; CMPNEQ ;
|
{ CAR ; DUP ; PUSH uint16 0 ; CMPNEQ ;
|
||||||
DIIP { NIL (contract unit unit) } ;
|
DIIP { NIL (contract unit unit) } ;
|
||||||
LOOP
|
LOOP
|
||||||
{ PUSH tez "5.00" ;
|
{ PUSH tez "5.00" ;
|
||||||
PUSH bool True ; # delegatable
|
PUSH bool True ; # delegatable
|
||||||
NONE key ; # delegate
|
NONE key ; # delegate
|
||||||
PUSH key "Nf4DPTCksayh83VhjDVE8M8et7KmXAppD3s7" ; # manager
|
PUSH key "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" ; # manager
|
||||||
CREATE_ACCOUNT ;
|
CREATE_ACCOUNT ;
|
||||||
SWAP ; DIP { CONS } ;
|
SWAP ; DIP { CONS } ;
|
||||||
PUSH uint16 1 ; SWAP ; SUB ;
|
PUSH uint16 1 ; SWAP ; SUB ;
|
||||||
DUP ; PUSH uint16 0 ; CMPNEQ } ;
|
DUP ; PUSH uint16 0 ; CMPNEQ } ;
|
||||||
DROP ;
|
DROP ;
|
||||||
UNIT ; SWAP ; PAIR }
|
UNIT ; SWAP ; PAIR }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
parameter unit;
|
parameter unit;
|
||||||
code {CADR; PUSH uint32 300; PAIR};
|
code {CAR; PUSH uint32 300; PAIR};
|
||||||
return uint32;
|
return uint32;
|
||||||
storage unit;
|
storage unit;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
parameter (list string);
|
parameter (list string);
|
||||||
storage unit;
|
storage unit;
|
||||||
return (list string);
|
return (list string);
|
||||||
code {CADR; DIP {NIL string}; SWAP; PUSH bool True;
|
code {CAR; DIP {NIL string}; SWAP; PUSH bool True;
|
||||||
# INV: BOOL : ORIG_LIST : REV_LIST : []
|
# INV: BOOL : ORIG_LIST : REV_LIST : []
|
||||||
LOOP {IF_CONS {DIP {SWAP}; CONS; SWAP; PUSH bool True} {NIL string; PUSH bool False}};
|
LOOP {IF_CONS {DIP {SWAP}; CONS; SWAP; PUSH bool True} {NIL string; PUSH bool False}};
|
||||||
DROP; UNIT; SWAP; PAIR};
|
DROP; UNIT; SWAP; PAIR};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
parameter string;
|
parameter string;
|
||||||
storage (set string);
|
storage (set string);
|
||||||
return bool;
|
return bool;
|
||||||
code {DUP; CADR; DIP{CDR}; MEM; DIP{EMPTY_SET string}; PAIR};
|
code {DUP; CAR; DIP{CDR}; MEM; DIP{EMPTY_SET string}; PAIR};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
parameter string;
|
parameter string;
|
||||||
return unit;
|
return unit;
|
||||||
storage string;
|
storage string;
|
||||||
code {CADR; UNIT; PAIR};
|
code {CAR; UNIT; PAIR};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
parameter string;
|
parameter string;
|
||||||
return string;
|
return string;
|
||||||
storage unit;
|
storage unit;
|
||||||
code {CADR; UNIT; SWAP; PAIR};
|
code {CAR; UNIT; SWAP; PAIR};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
parameter (or bool string);
|
parameter (or bool string);
|
||||||
return (or string bool);
|
return (or string bool);
|
||||||
storage unit;
|
storage unit;
|
||||||
code {CADR; IF_LEFT {RIGHT string} {LEFT bool}; UNIT; SWAP; PAIR};
|
code {CAR; IF_LEFT {RIGHT string} {LEFT bool}; UNIT; SWAP; PAIR};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
parameter (pair tez tez);
|
parameter (pair tez tez);
|
||||||
storage unit;
|
storage unit;
|
||||||
return (pair tez tez);
|
return (pair tez tez);
|
||||||
code {CADR; DUP; DUP; CAR; DIP{CDR}; ADD;
|
code {CAR; DUP; DUP; CAR; DIP{CDR}; ADD;
|
||||||
DIP{DUP; CAR; DIP{CDR}; SUB};
|
DIP{DUP; CAR; DIP{CDR}; SUB};
|
||||||
PAIR; UNIT; SWAP; PAIR};
|
PAIR; UNIT; SWAP; PAIR};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
parameter (contract unit unit);
|
parameter (contract unit unit);
|
||||||
return unit;
|
return unit;
|
||||||
storage unit;
|
storage unit;
|
||||||
code {CADR; DIP{UNIT}; PUSH tez "100.00"; UNIT; TRANSFER_TOKENS; PAIR};
|
code {CAR; DIP{UNIT}; PUSH tez "100.00"; UNIT; TRANSFER_TOKENS; PAIR};
|
||||||
|
@ -4,12 +4,12 @@ parameter (pair signature uint16);
|
|||||||
storage (pair (pair (contract unit unit) (contract unit unit)) (pair uint16 key));
|
storage (pair (pair (contract unit unit) (contract unit unit)) (pair uint16 key));
|
||||||
return unit;
|
return unit;
|
||||||
code {DUP; DUP;
|
code {DUP; DUP;
|
||||||
CADR; DUP; DIP{CDR; H}; CAR; PAIR;
|
CAR; DUP; DIP{CDR; H}; CAR; PAIR;
|
||||||
SWAP; CDDDR; CHECK_SIGNATURE; # Check if the data has been correctly signed
|
SWAP; CDDDR; CHECK_SIGNATURE; # Check if the data has been correctly signed
|
||||||
IF {NOP} {FAIL} # If signature is not correct, end the execution
|
IF {} {FAIL} # If signature is not correct, end the execution
|
||||||
DUP; DUP; DUP; DIIIP{CDR}; # Place storage type on bottom of stack
|
DUP; DUP; DUP; DIIIP{CDR}; # Place storage type on bottom of stack
|
||||||
DIIP{CDAR}; # Place contracts below numbers
|
DIIP{CDAR}; # Place contracts below numbers
|
||||||
DIP{CADDR}; # Get actual rain
|
DIP{CADR}; # Get actual rain
|
||||||
CDDAR; # Get rain threshold
|
CDDAR; # Get rain threshold
|
||||||
CMPLT; IF {CAR} {CDR}; # Select contract to receive tokens
|
CMPLT; IF {CAR} {CDR}; # Select contract to receive tokens
|
||||||
BALANCE; UNIT; TRANSFER_TOKENS; # Setup and execute transfer
|
BALANCE; UNIT; TRANSFER_TOKENS; # Setup and execute transfer
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
parameter (pair bool bool);
|
parameter (pair bool bool);
|
||||||
return bool;
|
return bool;
|
||||||
storage unit;
|
storage unit;
|
||||||
code {CADR; DUP; CAR; DIP{CDR}; XOR; UNIT; SWAP; PAIR};
|
code {CAR; DUP; CAR; DIP{CDR}; XOR; UNIT; SWAP; PAIR};
|
||||||
|
Loading…
Reference in New Issue
Block a user