Tests/helpers: replace old test framework

This commit is contained in:
Grégoire Henry 2018-06-04 14:35:06 +02:00
parent 4105467603
commit e8e66a83c7
164 changed files with 1380 additions and 3567 deletions

View File

@ -1,43 +0,0 @@
# This is a very simple accounts system.
# (Left key) initializes or deposits into an account
# (Right key (pair mutez (signed mutez))) withdraws mutez amount to a
# IMPLICIT_ACCOUNT created from the key if the balance is available
# and the key is correctly signed
parameter (or key_hash (pair key (pair mutez signature)));
# Maps the key to the balance they have stored
storage (map key_hash mutez);
code { DUP; CAR;
# Deposit into account
IF_LEFT { DUP; DIIP{ CDR; DUP };
DIP{ SWAP }; GET;
# Create the account
IF_NONE { DIP{ AMOUNT; SOME }; UPDATE; NIL operation; PAIR }
# Add to an existing account
{ AMOUNT; ADD; SOME; SWAP; UPDATE; NIL operation; PAIR }}
# Withdrawl
{ DUP; DUP; DUP; DUP;
# Check signature on data
CAR; DIIP{ CDAR; H }; DIP{ CDDR }; CHECK_SIGNATURE;
IF {} { FAIL };
# Get user account information
DIIP{ CDR; DUP }; CAR; HASH_KEY; DIP{ SWAP }; GET;
# Account does not exist
IF_NONE { FAIL }
# Account exists
{ DUP; DIIP{ DUP; CDAR; DUP };
# Ensure funds are available
DIP{ CMPLT }; SWAP;
IF { FAIL }
{ SUB; DIP{ DUP; DIP{ SWAP }}; DUP;
# Delete account if balance is 0
PUSH mutez 0; CMPEQ;
IF { DROP; NONE mutez }
# Otherwise update storage with new balance
{ SOME };
SWAP; CAR; HASH_KEY; UPDATE;
SWAP; DUP; CDAR;
# Execute the transfer
DIP{ CAR; HASH_KEY; IMPLICIT_ACCOUNT }; UNIT;
TRANSFER_TOKENS;
NIL operation; SWAP; CONS;
PAIR }}}}

View File

@ -1,7 +0,0 @@
parameter int;
storage int;
code {CAR; # Get the parameter
PUSH int 1; # We're adding 1, so we need to put 1 on the stack
ADD; # Add the two numbers
NIL operation; # We put an empty list of operations on the stack
PAIR} # Create the end value

View File

@ -1,6 +0,0 @@
parameter (list int);
storage (list int);
code { CAR; # Get the parameter
MAP { PUSH int 1; ADD }; # Map over the list adding one
NIL operation; # No internal op
PAIR } # Match the calling convetion

View File

@ -1,3 +0,0 @@
parameter (pair int timestamp);
storage (option timestamp);
code { CAR; DUP; CAR; DIP{CDR}; ADD; SOME; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (pair timestamp int);
storage (option timestamp);
code { CAR; DUP; CAR; DIP{CDR}; ADD; SOME; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter nat;
storage (pair (pair nat bool) timestamp);
code {DUP; CAR; DIP{CDDR; DUP; NOW; CMPGT}; PAIR; PAIR ; NIL operation ; PAIR};

View File

@ -1,4 +0,0 @@
parameter nat;
storage (pair nat bool);
code { CAR; PUSH bool True; SWAP;
PAIR; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (pair (bool @first) (bool @second));
storage (option bool);
code { CAR @param; DUP; CAR @first; DIP{CDR @second}; AND; SOME; NIL operation; PAIR };

View File

@ -1,13 +0,0 @@
parameter (pair (list int) (list int));
storage (list int);
code { CAR; DUP; DIP{CDR}; CAR; # Unpack lists
NIL int; SWAP; # Setup reverse accumulator
LAMBDA (pair int (list int))
(list int)
{DUP; CAR; DIP{CDR}; CONS};
REDUCE; # Reverse list
LAMBDA (pair int (list int))
(list int)
{DUP; CAR; DIP{CDR}; CONS};
REDUCE; # Append reversed list
NIL operation; PAIR} # Calling convention

View File

@ -1,3 +0,0 @@
parameter bool;
storage unit;
code {CAR; ASSERT; UNIT; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (pair int int);
storage unit;
code {CAR; DUP; CAR; DIP{CDR}; ASSERT_CMPEQ; UNIT; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (pair int int);
storage unit;
code {CAR; DUP; CAR; DIP{CDR}; ASSERT_CMPGE; UNIT; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (pair int int);
storage unit;
code {CAR; DUP; CAR; DIP{CDR}; ASSERT_CMPGT; UNIT; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (pair int int);
storage unit;
code {CAR; DUP; CAR; DIP{CDR}; ASSERT_CMPLE; UNIT; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (pair int int);
storage unit;
code {CAR; DUP; CAR; DIP{CDR}; ASSERT_CMPLT; UNIT; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (pair int int);
storage unit;
code {CAR; DUP; CAR; DIP{CDR}; ASSERT_CMPNEQ; UNIT; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (pair int int);
storage unit;
code {CAR; DUP; CAR; DIP{CDR}; COMPARE; ASSERT_EQ; UNIT; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (pair int int);
storage unit;
code {CAR; DUP; CAR; DIP{CDR}; COMPARE; ASSERT_GE; UNIT; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (pair int int);
storage unit;
code {CAR; DUP; CAR; DIP{CDR}; COMPARE; ASSERT_GT; UNIT; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (pair int int);
storage unit;
code {CAR; DUP; CAR; DIP{CDR}; COMPARE; ASSERT_LE; UNIT; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (pair int int);
storage unit;
code {CAR; DUP; CAR; DIP{CDR}; COMPARE; ASSERT_LT; UNIT; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (pair int int);
storage unit;
code {CAR; DUP; CAR; DIP{CDR}; COMPARE; ASSERT_NEQ; UNIT; NIL operation; PAIR}

View File

@ -1,6 +0,0 @@
parameter unit;
storage mutez; # How much you have to send me
code {CDR; DUP; # Get the amount required (once for comparison, once to save back in storage)
AMOUNT; CMPLT; # Check to make sure no one is wasting my time
IF {FAIL} # Reject the person
{NIL operation;PAIR}} # Finish the transaction

View File

@ -1,8 +0,0 @@
parameter key_hash;
storage (pair timestamp (pair mutez key_hash));
code { DUP; CDAR; DUP; NOW; CMPGT; IF {FAIL} {}; SWAP; # Check if auction has ended
DUP; CAR; DIP{CDDR}; AMOUNT; PAIR; SWAP; DIP{SWAP; PAIR}; # Setup replacement storage
DUP; CAR; AMOUNT; CMPLE; IF {FAIL} {}; # Check to make sure that the new amount is greater
DUP; CAR; # Get amount of refund
DIP{CDR; IMPLICIT_ACCOUNT}; UNIT; TRANSFER_TOKENS; # Make refund
NIL operation; SWAP; CONS; PAIR} # Calling convention

View File

@ -1,6 +0,0 @@
parameter unit;
storage (pair timestamp (pair (contract unit) (contract unit)));
code { CDR; DUP; CAR; NOW; CMPLT; IF {FAIL} {};
DUP; CDAR; PUSH mutez 100000000; UNIT; TRANSFER_TOKENS; SWAP;
DUP; CDDR; PUSH mutez 100000000; UNIT; TRANSFER_TOKENS; DIP {SWAP} ;
NIL operation ; SWAP ; CONS ; SWAP ; CONS ; PAIR }

View File

@ -1,3 +0,0 @@
parameter unit;
storage mutez;
code {DROP; BALANCE; NIL operation; PAIR};

View File

@ -1,6 +0,0 @@
parameter nat;
storage (list nat);
code { CAR @counter; NIL @acc nat; SWAP; DUP @cmp_num; PUSH nat 0; CMPNEQ;
LOOP { DUP; DIP {SWAP}; CONS @acc; SWAP; PUSH nat 1; SWAP; SUB @counter;
DUP; DIP{ABS}; PUSH int 0; CMPNEQ};
CONS; NIL operation; PAIR};

View File

@ -1,3 +0,0 @@
parameter (pair (pair unit (string @no_name)) bool);
storage unit;
code { CAR @name; CADR @second_name; DROP; UNIT; NIL operation; PAIR }

View File

@ -1,8 +0,0 @@
parameter key;
storage (pair signature string);
code { DUP; DUP;
DIP{ CDR; DUP; CAR;
DIP{CDR; H}; PAIR};
CAR; DIP {UNPAIR}; CHECK_SIGNATURE;
IF {} {FAIL} ;
CDR; NIL operation ; PAIR};

View File

@ -1,9 +0,0 @@
parameter (pair mutez mutez);
storage (list bool);
code {CAR; DUP; DUP; DUP; DUP; DIIIIIP {NIL bool};
DIIIIP {DUP; CAR; DIP {CDR}; COMPARE; LE; CONS};
DIIIP {DUP; CAR; DIP {CDR}; COMPARE; GE; CONS};
DIIP{DUP; CAR; DIP {CDR}; COMPARE; LT; CONS};
DIP {DUP; CAR; DIP {CDR}; COMPARE; GT; CONS};
DUP; CAR; DIP {CDR}; COMPARE; EQ; CONS;
NIL operation; PAIR};

View File

@ -1,8 +0,0 @@
parameter string;
storage string;
code {DUP; # We're going to need both the storage and parameter
CAR; # Get the parameter
DIP{CDR}; # Get the storage value
SWAP; # Get the order we want (this is optional)
CONCAT; # Concatenate the strings
NIL operation; PAIR} # Match the calling convention

View File

@ -1,4 +0,0 @@
parameter (list string);
storage (list string);
code{ CAR;
MAP { PUSH @hello string "Hello "; CONCAT }; NIL operation; PAIR};

View File

@ -1,5 +0,0 @@
parameter (list string);
storage string;
code {CAR; PUSH string ""; SWAP;
ITER {SWAP; CONCAT};
NIL operation; PAIR};

View File

@ -1,9 +0,0 @@
parameter (or string (option int));
storage string;
code { CAR; # Access the storage
IF_LEFT {} # The string is on top of the stack, nothing to do
{ IF_NONE { FAIL} # Fail if None
{ PUSH int 0; CMPGT; # Check for negative number
IF {FAIL} # Fail if negative
{PUSH string ""}}}; # Push the empty string
NIL operation; PAIR} # Calling convention

View File

@ -1,9 +0,0 @@
parameter nat;
storage (list nat);
code { DUP; # Duplicate the storage and parameter
CAR; # Extract the parameter
DIP{CDR}; # Extract the storage
DUP; # Duplicate the parameter
DIP{CONS}; # Add the first instance of the parameter to the list
CONS; # Add the second instance of the parameter to the list
NIL operation; PAIR} # Finish the calling convention

View File

@ -1,7 +0,0 @@
parameter (pair (list string) (list string));
storage (option bool);
code {CAR; DUP; CAR; DIP{CDR}; EMPTY_SET string; SWAP;
ITER {PAIR; DUP; CAR; DIP{CDR}; PUSH bool True; SWAP; UPDATE};
PUSH bool True; SWAP; PAIR; SWAP;
ITER {PAIR; DUP; DUP; CAR; DIP{CDAR; DIP{CDDR}; DUP}; MEM; DIP{SWAP}; AND; SWAP; PAIR};
CDR; SOME; NIL operation; PAIR};

View File

@ -1,12 +0,0 @@
parameter (or key_hash address) ;
storage (option (contract unit)) ;
code { CAR;
IF_LEFT
{ DIP { PUSH mutez 100000000 ; PUSH bool False ; NONE key_hash };
CREATE_ACCOUNT ;
DIP { RIGHT key_hash ; DIP { SELF ; PUSH mutez 0 } ; TRANSFER_TOKENS ;
NIL operation ; SWAP ; CONS } ;
CONS ; NONE (contract unit) ; SWAP ; PAIR }
{ SELF ; ADDRESS ; SOURCE ; IFCMPNEQ { FAIL } {} ;
CONTRACT unit ; DUP ; IF_SOME { DROP } { FAIL } ;
NIL operation ; PAIR } } ;

View File

@ -1,17 +0,0 @@
parameter unit;
storage address;
code { DROP; NIL int; # starting storage for contract
AMOUNT; # Push the starting balance
PUSH bool False; # Not spendable
DUP; # Or delegatable
NONE key_hash; # No delegate
PUSH key_hash "tz1cxcwwnzENRdhe2Kb8ZdTrdNy4bFNyScx5";
CREATE_CONTRACT # Create the contract
{ parameter (list int) ;
storage (list int) ;
code
{ CAR;
MAP {PUSH int 1; ADD};
NIL operation;
PAIR } };
NIL operation; SWAP; CONS; PAIR} # Ending calling convention stuff

View File

@ -1,18 +0,0 @@
parameter (or key_hash address);
storage unit;
code { CAR;
IF_LEFT
{ DIP { PUSH string "dummy";
PUSH mutez 100000000 ; PUSH bool False ;
PUSH bool False ; NONE key_hash } ;
CREATE_CONTRACT
{ parameter string ;
storage string ;
code { CAR ; NIL operation ; PAIR } } ;
DIP { RIGHT key_hash ; DIP { SELF ; PUSH mutez 0 } ; TRANSFER_TOKENS ;
NIL operation ; SWAP ; CONS } ;
CONS ; UNIT ; SWAP ; PAIR }
{ SELF ; ADDRESS ; SOURCE ; IFCMPNEQ { FAIL } {} ;
CONTRACT string ; IF_SOME {} { FAIL } ;
PUSH mutez 0 ; PUSH string "abcdefg" ; TRANSFER_TOKENS ;
NIL operation; SWAP; CONS ; UNIT ; SWAP ; PAIR } };

View File

@ -1,8 +0,0 @@
parameter (pair signature (pair string nat));
storage (pair (pair key nat) string);
code { DUP; CAR; DIP{CDR; DUP};
SWAP; DIP{DUP}; CAAR; DIP{DUP; CAR; DIP{CDR; H}};
CHECK_SIGNATURE;
IF { CDR; DUP; DIP{CAR; DIP{CAAR}}; CDR; PUSH nat 1; ADD;
DIP{SWAP}; SWAP; PAIR; PAIR; NIL operation; PAIR}
{FAIL}}

View File

@ -1,5 +0,0 @@
parameter key_hash;
storage unit;
code {DIP{UNIT}; CAR; IMPLICIT_ACCOUNT;
PUSH mutez 100000000; UNIT; TRANSFER_TOKENS;
NIL operation; SWAP; CONS; PAIR}

View File

@ -1,3 +0,0 @@
parameter (pair timestamp timestamp);
storage int;
code { CAR; DUP; CAR; DIP{CDR}; SUB; NIL operation; PAIR }

View File

@ -1,9 +0,0 @@
parameter (or string (pair string (lambda unit string)));
storage (pair string (map string (lambda unit string)));
code { DUP; DIP{CDDR}; CAR; # Unpack stack
IF_LEFT { DIP{DUP}; GET; # Get lambda if it exists
IF_NONE {FAIL} {}; # Fail if it doesn't
UNIT; EXEC } # Execute the lambda
{ DUP; CAR; DIP {CDR; SOME}; UPDATE; PUSH string ""}; # Update the storage
PAIR;
NIL operation; PAIR} # Calling convention

View File

@ -1,3 +0,0 @@
parameter unit;
storage unit;
code {CDR; NIL operation; PAIR}

View File

@ -1,6 +0,0 @@
storage (map string string);
parameter unit;
code {DROP;
EMPTY_MAP string string;
PUSH string "world"; SOME; PUSH string "hello"; UPDATE;
NIL operation; PAIR};

View File

@ -1,5 +0,0 @@
parameter string;
storage string;
code {CAR;
LAMBDA string string {PUSH string "_abc"; SWAP; CONCAT};
SWAP; EXEC; NIL operation; PAIR};

View File

@ -1,5 +0,0 @@
parameter unit;
storage unit;
code
{ # This contract will never accept a incoming transaction
FAIL};

View File

@ -1,6 +0,0 @@
# Fail if the amount transferred is less than 10
parameter unit;
storage unit;
code { DROP;
AMOUNT; PUSH mutez 10000000; CMPGT; IF {FAIL} {};
UNIT; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (list nat);
storage nat;
code{CAR; IF_CONS {DIP{DROP}} {FAIL}; NIL operation; PAIR};

View File

@ -1,3 +0,0 @@
parameter string;
storage (pair (option string) (map string string));
code {DUP; CAR; DIP{CDDR; DUP}; GET; PAIR; NIL operation; PAIR};

View File

@ -1,5 +0,0 @@
parameter unit ;
storage int ;
code { # This contract stops accepting transactions after N incoming transactions
CDR ; DUP ; PUSH int 0 ; CMPLT; IF {PUSH int -1 ; ADD} {FAIL};
NIL operation ; PAIR} ;

View File

@ -1,3 +0,0 @@
parameter (pair mutez (pair timestamp int)) ;
storage string ;
code { CAR ; H ; NIL operation ; PAIR }

View File

@ -1,3 +0,0 @@
parameter key;
storage (option key_hash);
code {CAR; HASH_KEY; SOME ;NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter string;
storage string;
code {CAR; H; NIL operation; PAIR};

View File

@ -1,3 +0,0 @@
parameter string;
storage string;
code {CAR; NIL operation; PAIR};

View File

@ -1,3 +0,0 @@
parameter bool;
storage (option bool);
code {CAR; IF {PUSH bool True} {PUSH bool False}; SOME; NIL operation; PAIR};

View File

@ -1,3 +0,0 @@
parameter (option string);
storage string;
code { CAR; IF_SOME {} {PUSH string ""}; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter unit;
storage unit;
code { DROP; PUSH bool True; LOOP {PUSH bool True}; UNIT; NIL operation; PAIR }

View File

@ -1,25 +0,0 @@
parameter (list int);
storage (list int);
code { CAR; # Access list
# Insert procedure
LAMBDA (pair int (list int))
(list int)
{ DUP; CDR; DIP{CAR}; # Unpack accumulator and existing list
DIIP{NIL int}; PUSH bool True; # Setup loop
LOOP { IF_CONS { SWAP;
DIP{DUP; DIIP{DUP}; DIP{CMPLT}; SWAP}; # Duplicate numbers
SWAP;
# If less than
IF { DIP{SWAP; DIP{CONS}}; PUSH bool True}
# Otherwise
{ SWAP; CONS; PUSH bool False}}
# Ending case
{ NIL int; PUSH bool False}};
SWAP; CONS; SWAP; # Finish lists
LAMBDA (pair int (list int))
(list int)
{DUP; CAR; DIP{CDR}; CONS};
REDUCE};
NIL int; SWAP; DIP{SWAP}; # Accumulator for reverse onto
REDUCE; # Execute reverse onto
NIL operation; PAIR} # Calling convention

View File

@ -1,17 +0,0 @@
# (signed hash of the string, string)
parameter (option (pair signature int));
storage (pair key int);
code {DUP; DUP; CAR;
IF_NONE {PUSH mutez 1000000; # Fee pattern from July 26
AMOUNT; CMPLE; IF {FAIL} {};
# Provide the data
CDR; DIP {CDDR}}
{DUP; DIP{SWAP}; SWAP; CDAR; # Move key to the top
DIP {DUP; CAR; DIP {CDR; H}}; # Arrange the new piece of data
CHECK_SIGNATURE; # Check to ensure the data is authentic
# Update data
IF {CDR; SWAP; DIP{DUP}; CDAR; PAIR}
# Revert the update. This could be replaced with FAIL
{DROP; DUP; CDR; DIP{CDDR}}};
# Cleanup
DIP{DROP}; NIL operation; PAIR}

View File

@ -1,19 +0,0 @@
parameter key_hash;
storage (pair timestamp (pair mutez key_hash));
code { DUP; CDAR;
# If the time is more than 2 weeks, any amount makes you king
NOW; CMPGT;
# User becomes king of mutez
IF { CAR; AMOUNT; PAIR; NOW; PUSH int 604800; ADD; PAIR;
NIL operation }
# Check balance to see if user has paid enough to become the new king
{ DUP; CDDAR; AMOUNT; CMPLT;
IF { FAIL } # user has not paid out
{ CAR; DUP;
# New storage
DIP{ AMOUNT; PAIR; NOW; PUSH int 604800; ADD; PAIR };
# Pay funds to old king
IMPLICIT_ACCOUNT; AMOUNT; UNIT; TRANSFER_TOKENS;
NIL operation; SWAP; CONS}};
# Cleanup
PAIR };

View File

@ -1,3 +0,0 @@
parameter (list string);
storage (list string);
code {CAR; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (list string);
storage (list string);
code {CAR; MAP {}; NIL operation; PAIR}

View File

@ -1,5 +0,0 @@
parameter (list int);
storage int;
code { CAR; PUSH int 1; SWAP;
ITER { MUL };
NIL operation; PAIR}

View File

@ -1,5 +0,0 @@
parameter (list string);
storage string;
code { CAR; PUSH string ""; SWAP;
ITER { CONCAT };
NIL operation; PAIR}

View File

@ -1,5 +0,0 @@
parameter (list int);
storage (list int);
code { CAR; PUSH int 0; SWAP;
MAP { DIP{DUP}; ADD; DIP{PUSH int 1; ADD}};
NIL operation; PAIR; DIP{DROP}}

View File

@ -1,8 +0,0 @@
parameter unit;
storage (list (contract unit));
code { CDR; DUP;
DIP {NIL operation}; PUSH bool True; # Setup loop
LOOP {IF_CONS { PUSH mutez 1000000; UNIT; TRANSFER_TOKENS; # Make transfer
SWAP; DIP {CONS}; PUSH bool True} # Setup for next round of loop
{ NIL (contract unit); PUSH bool False}}; # Data to satisfy types and end loop
DROP; PAIR}; # Calling convention

View File

@ -1,18 +0,0 @@
parameter unit;
storage (pair timestamp (pair mutez (contract unit)));
code { CDR; # Ignore the parameter
DUP; # Duplicate the storage
CAR; # Get the timestamp
NOW; # Push the current timestamp
CMPLT; # Compare to the current time
IF {FAIL} {}; # Fail if it is too soon
DUP; # Duplicate the storage value
# this must be on the bottom of the stack for us to call transfer tokens
CDR; # Ignore the timestamp, focussing in on the tranfser data
DUP; # Duplicate the transfer information
CAR; # Get the amount of the transfer on top of the stack
DIP{CDR}; # Put the contract underneath it
UNIT; # Put the contract's argument type on top of the stack
TRANSFER_TOKENS; # Emit the transfer
NIL operation; SWAP; CONS;# Make a singleton list of internal operations
PAIR} # Pair up to meet the calling convention

View File

@ -1,7 +0,0 @@
parameter (list string);
storage (list string);
code { CAR; NIL string; SWAP; PAIR; LEFT (list string);
LOOP_LEFT { DUP; CAR; DIP{CDR};
IF_CONS { SWAP; DIP{CONS}; PAIR; LEFT (list string) }
{ RIGHT (pair (list string) (list string)) }; };
NIL operation; PAIR }

View File

@ -1,6 +0,0 @@
parameter unit;
storage (pair @truc unit unit);
code { DROP; UNIT ; UNIT ; PAIR ; UNIT ;
DUUP @truc ;
DIP { DROP ; DROP } ;
NIL operation ; PAIR }

View File

@ -1,4 +0,0 @@
parameter unit;
storage (pair (pair nat (pair nat (pair (pair (pair nat mutez) nat) nat))) nat);
code { MAP_CDADDAADR { PUSH mutez 1000000 ; ADD } ;
NIL operation ; SWAP; SET_CAR };

View File

@ -1,3 +0,0 @@
parameter bool;
storage (pair bool nat);
code { DUP; CAR; DIP{CDR}; SWAP; MAP_CAR { AND }; NIL operation; PAIR };

View File

@ -1,3 +0,0 @@
parameter (map nat nat);
storage (map nat nat);
code { CAR ; NIL operation ; PAIR }

View File

@ -1,6 +0,0 @@
parameter (map int int);
storage (pair int int);
code { CAR; PUSH int 0; DUP; PAIR; SWAP;
ITER { DIP {DUP; CAR; DIP{CDR}}; DUP; # Last instr
DIP{CAR; ADD}; SWAP; DIP{CDR; ADD}; PAIR };
NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter (map string nat);
storage nat;
code {CAR; SIZE; NIL operation; PAIR}

View File

@ -1,9 +0,0 @@
parameter (list int);
storage (option int);
code {CAR; DIP{NONE int};
ITER {SWAP;
IF_NONE {SOME}
{DIP {DUP}; DUP; DIP{SWAP};
CMPLE; IF {DROP} {DIP {DROP}};
SOME}};
NIL operation; PAIR};

View File

@ -1,11 +0,0 @@
parameter (pair int int);
storage int;
code { CAR; # Ignore the storage
DUP; # Duplicate so we can get both the numbers passed as parameters
DUP; # Second dup so we can access the lesser number
CAR; DIP{CDR}; # Unpack the numbers on top of the stack
CMPLT; # Compare the two numbers, placing a boolean on top of the stack
IF {CAR} {CDR}; # Access the first number if the boolean was true
NIL operation; # Return no op
PAIR} # Pair the numbers satisfying the calling convention

View File

@ -1,3 +0,0 @@
parameter unit;
storage unit;
code {CDR; NIL operation; PAIR};

View File

@ -1,3 +0,0 @@
parameter bool;
storage (option bool);
code {CAR; NOT; SOME; NIL operation; PAIR};

View File

@ -1,3 +0,0 @@
parameter (pair bool bool);
storage (option bool);
code {CAR; DUP; CAR; SWAP; CDR; OR; SOME; NIL operation; PAIR};

View File

@ -1,16 +0,0 @@
parameter nat ;
storage (list address) ;
code
{ DUP ; CAR ; PUSH nat 0 ; CMPNEQ ;
DIP { DUP ; CAR ; DIP { CDR ; NIL operation } } ;
LOOP
{ PUSH mutez 5000000 ;
PUSH bool True ; # delegatable
NONE key_hash ; # delegate
PUSH key_hash "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" ; # manager
CREATE_ACCOUNT ;
SWAP ; DIP { SWAP ; DIP { CONS } } ;
SWAP ; DIP { SWAP ; DIP { CONS } } ;
PUSH nat 1 ; SWAP ; SUB ; ABS ;
DUP ; PUSH nat 0 ; CMPNEQ } ;
DROP ; PAIR }

View File

@ -1,3 +0,0 @@
parameter (pair bool bool);
storage (option (pair bool bool));
code {CAR; SOME; NIL operation; PAIR}

View File

@ -1,4 +0,0 @@
parameter unit;
storage unit;
code { UNIT; UNIT; UNIT; UNIT; UNIT; PAIAAIAIAIR @name; DROP;
CDR; NIL operation; PAIR}

View File

@ -1,24 +0,0 @@
storage (pair bool (pair (map nat (pair bool bool)) (pair key key)));
parameter (or nat (pair signature nat));
code { DUP; CAR; DIP{CDDR}; # Stack rangling
IF_LEFT { DIP{DUP; CAR}; GET; # Get the value stored for that index
IF_NONE { PUSH bool False} # If not referenced, reject
{ DUP; CAR; DIP{CDR}; AND};
PAIR}
{ DUP; CAR; DIP{CDR; DUP; H}; PAIR; SWAP; # Create the signature pair
DIP{ DIP{DUP; CDR; DIP{CAR}; DUP};
SWAP; CAR; DIP{DUP; UNPAIR}; CHECK_SIGNATURE }; # Check the first signature
SWAP;
# If the signature typechecked, get and update the first element of the pair
IF { DIP{DROP; SWAP; DUP}; DUP;
DIP{ GET; IF_NONE{PUSH (pair bool bool) (Pair False False)} {};
CDR; PUSH bool True; PAIR; SOME }}
# Check the second signature
{ DIP{DIP{DUP; CDR}; SWAP; DIP {UNPAIR}; CHECK_SIGNATURE}; SWAP;
IF { DUP; DIP{DIP{SWAP; DUP}; GET}; SWAP;
IF_NONE {PUSH (pair bool bool) (Pair False False)} {};
CAR; PUSH bool True; SWAP; PAIR; SOME; SWAP}
{FAIL}};
# Update the stored value and finish off
UPDATE; PAIR; PUSH bool False; PAIR};
NIL operation; PAIR }

View File

@ -1,24 +0,0 @@
parameter (option string);
storage (pair (option string) (pair (pair nat nat) (map nat string)));
code { DUP; CAR;
# Retrieving an element
IF_NONE { CDDR; DUP; CAR; DIP{CDR; DUP}; DUP;
CAR; SWAP; DIP{GET}; # Check if an element is available
SWAP;
# Put NONE on stack and finish
IF_NONE { NONE string; DIP{PAIR}; PAIR}
# Reoption the element and remove the entry from the map
{ SOME;
DIP{ DUP; DIP{ CAR; DIP{ NONE string }; UPDATE };
# Increment the counter and cleanup
DUP; CAR; PUSH nat 1; ADD; DIP{ CDR }; PAIR; PAIR};
PAIR }}
# Arrange the stack
{ DIP{DUP; CDDAR; DIP{CDDDR}; DUP}; SWAP; CAR;
# Add the element to the map
DIP{ SOME; SWAP; CDR; DUP; DIP{UPDATE};
# Increment the second number
PUSH nat 1; ADD};
# Cleanup and finish
PAIR; PAIR; NONE string; PAIR };
NIL operation; PAIR}

View File

@ -1,21 +0,0 @@
parameter (pair (lambda int int) (list int));
storage (list int);
code { DIP{NIL int};
CAR;
DUP;
DIP{CAR; PAIR}; # Unpack data and setup accumulator
CDR;
LAMBDA (pair int (pair (lambda int int) (list int)))
(pair (lambda int int) (list int))
# Apply the lambda and add the new element to the list
{ DUP; CDAR;
DIP{ DUP; DIP{CDAR}; DUP;
CAR; DIP{CDDR; SWAP}; EXEC; CONS};
PAIR};
REDUCE; CDR; DIP{NIL int}; # First reduce
LAMBDA (pair int (list int))
(list int)
{DUP; CAR; DIP{CDR}; CONS};
REDUCE; # Correct list order
NIL operation; PAIR} # Calling convention

View File

@ -1,7 +0,0 @@
parameter unit;
storage (pair (contract unit) (contract unit));
code { CDR; DUP; CAR; PUSH mutez 5000000; UNIT;
TRANSFER_TOKENS;
DIP {DUP; CDR;
PUSH mutez 5000000; UNIT; TRANSFER_TOKENS};
DIIP{NIL operation};DIP{CONS};CONS;PAIR};

View File

@ -1,3 +0,0 @@
parameter unit;
storage (option nat);
code {DROP; PUSH nat 300; SOME; NIL operation; PAIR};

View File

@ -1,5 +0,0 @@
parameter (list string);
storage (list string);
code { CAR; NIL string; SWAP;
ITER {CONS};
NIL operation; PAIR};

View File

@ -1,5 +0,0 @@
parameter (list string);
storage (list string);
code { CAR; NIL string; SWAP; PUSH bool True;
LOOP { IF_CONS {SWAP; DIP{CONS}; PUSH bool True} {NIL string; PUSH bool False}};
DROP; NIL operation; PAIR}

View File

@ -1,3 +0,0 @@
parameter unit ;
storage (contract unit) ;
code { DROP ; SELF ; NIL operation ; PAIR }

View File

@ -1,5 +0,0 @@
parameter mutez;
storage (pair (pair nat (pair nat (pair (pair (pair nat mutez) nat) nat))) nat);
code { DUP ; CAR ; SWAP ; CDR ;
SET_CADDAADR @annot ;
NIL operation ; PAIR };

View File

@ -1,3 +0,0 @@
parameter string;
storage (pair string nat);
code { DUP; CDR; DIP{CAR}; SET_CAR @hello; NIL operation; PAIR };

View File

@ -1,3 +0,0 @@
parameter nat;
storage (pair string nat);
code { DUP; CDR; DIP{CAR}; SET_CDR @annot; NIL operation; PAIR };

View File

@ -1,3 +0,0 @@
parameter (set string);
storage (set string);
code { CAR ; NIL operation ; PAIR }

View File

@ -1,3 +0,0 @@
parameter (set int);
storage int;
code { CAR; PUSH int 0; SWAP; ITER { ADD }; NIL operation; PAIR }

View File

@ -1,3 +0,0 @@
parameter string;
storage (pair (set string) (option bool));
code {DUP; DUP; CAR; DIP{CDAR}; MEM; SOME; DIP {CDAR}; SWAP; PAIR ; NIL operation; PAIR};

View File

@ -1,3 +0,0 @@
parameter (set int);
storage nat;
code {CAR; SIZE; NIL operation; PAIR}

View File

@ -1,22 +0,0 @@
parameter nat;
storage (list address);
code { DUP;
CAR; # Get the number
DIP{CDR; NIL operation}; # Put the accumulators on the stack
PUSH bool True; # Push true so we have a do while loop
LOOP { DUP; PUSH nat 0; CMPEQ; # Check if the number is 0
IF { PUSH bool False} # End the loop
{ PUSH nat 1; SWAP; SUB; ABS; # Subtract 1. The ABS is to make it back into a nat
PUSH string "init"; # Storage type
PUSH mutez 5000000; # Strating balance
PUSH bool False; DUP; # Not spendable or delegatable
NONE key_hash;
PUSH key_hash "tz1cxcwwnzENRdhe2Kb8ZdTrdNy4bFNyScx5";
CREATE_CONTRACT
{ parameter string ;
storage string ;
code { CAR ; NIL operation ; PAIR } } ; # Make the contract
SWAP ; DIP { SWAP ; DIP { CONS } } ; # emit the operation
SWAP ; DIP { SWAP ; DIP { CONS } } ; # add to the list
PUSH bool True}}; # Continue the loop
DROP; PAIR} # Calling convention

View File

@ -1,3 +0,0 @@
parameter unit;
storage nat;
code {DROP; STEPS_TO_QUOTA; NIL operation; PAIR};

Some files were not shown because too many files have changed in this diff Show More