Michelson (docs): fixed reservoir example.
This commit is contained in:
parent
3a149af667
commit
5e06b9c719
@ -1400,21 +1400,33 @@ writen as
|
|||||||
pair timestamp tez
|
pair timestamp tez
|
||||||
pair (contract unit unit) (contract unit unit)
|
pair (contract unit unit) (contract unit unit)
|
||||||
|
|
||||||
its code is
|
The complete source `reservoir.tz` is:
|
||||||
|
|
||||||
DUP ; CDAAR # T
|
parameter timestamp ;
|
||||||
NOW
|
storage
|
||||||
COMPARE ; LE
|
pair
|
||||||
IF { DUP ; CDADR # N
|
(pair timestamp tez) # T N
|
||||||
BALANCE
|
(pair (contract unit unit) (contract unit unit)) ; # A B
|
||||||
COMPARE ; LE
|
return unit ;
|
||||||
IF { } # nothing to do
|
code
|
||||||
{ DUP ; CDDDR # B
|
{ DUP ; CDAAR ; # T
|
||||||
BALANCE ; UNIT ; TRANSFER_TOKENS ; DROP } }
|
NOW ;
|
||||||
|
COMPARE ; LE ;
|
||||||
|
IF { DUP ; CDADR ; # N
|
||||||
|
BALANCE ;
|
||||||
|
COMPARE ; LE ;
|
||||||
|
IF { CDR ; UNIT ; PAIR }
|
||||||
|
{ DUP ; CDDDR ; # B
|
||||||
|
BALANCE ; UNIT ;
|
||||||
|
DIIIP { CDR } ;
|
||||||
|
TRANSFER_TOKENS ;
|
||||||
|
PAIR } }
|
||||||
{ DUP ; CDDAR ; # A
|
{ DUP ; CDDAR ; # A
|
||||||
BALANCE ;
|
BALANCE ;
|
||||||
UNIT ; TRANSFER_TOKENS ; DROP }
|
UNIT ;
|
||||||
CDR ; UNIT ; PAIR
|
DIIIP { CDR } ;
|
||||||
|
TRANSFER_TOKENS ;
|
||||||
|
PAIR } }
|
||||||
|
|
||||||
### Reservoir contract (variant with broker and status)
|
### Reservoir contract (variant with broker and status)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user