2017-10-30 10:22:16 +01:00
|
|
|
parameter nat;
|
2018-04-20 22:27:15 +02:00
|
|
|
storage (list address);
|
2017-10-30 10:22:16 +01:00
|
|
|
code { DUP;
|
|
|
|
CAR; # Get the number
|
2018-04-20 22:27:15 +02:00
|
|
|
DIP{CDR; NIL operation}; # Put the accumulators on the stack
|
2017-10-30 10:22:16 +01:00
|
|
|
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
|
2018-04-05 17:17:27 +02:00
|
|
|
PUSH string "init"; # Storage type
|
2017-10-30 10:22:16 +01:00
|
|
|
PUSH tez "5.00"; # Strating balance
|
|
|
|
PUSH bool False; DUP; # Not spendable or delegatable
|
|
|
|
NONE key_hash;
|
|
|
|
PUSH key_hash "tz1cxcwwnzENRdhe2Kb8ZdTrdNy4bFNyScx5";
|
2018-05-02 01:45:15 +02:00
|
|
|
CREATE_CONTRACT
|
|
|
|
{ parameter string ;
|
|
|
|
storage string ;
|
|
|
|
code { CAR ; NIL operation ; PAIR } } ; # Make the contract
|
2018-04-20 22:27:15 +02:00
|
|
|
SWAP ; DIP { SWAP ; DIP { CONS } } ; # emit the operation
|
|
|
|
SWAP ; DIP { SWAP ; DIP { CONS } } ; # add to the list
|
2017-10-30 10:22:16 +01:00
|
|
|
PUSH bool True}}; # Continue the loop
|
2018-04-20 22:27:15 +02:00
|
|
|
DROP; PAIR} # Calling convention
|