Guest User

Untitled

a guest
Feb 19th, 2020
105
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. parameter (or (address %changeOwner) (or (pair %setDate (string %name) (string %newDate)) (pair %setNumGuests (string %name) (int %newNumGuests))));
  2. storage (pair (map %nameToEvent string (pair string int)) (address %owner));
  3. code
  4. {
  5. DUP; # pair @parameter @storage : pair @parameter @storage
  6. CDR; # @storage : pair @parameter @storage
  7. SWAP; # pair @parameter @storage : @storage
  8. CAR; # @parameter : @storage
  9. IF_LEFT
  10. {
  11. # Entry point: changeOwner # @parameter.changeOwner : @storage
  12. # sp.verify(sp.sender == self.data.owner) # @parameter.changeOwner : @storage
  13. SWAP; # @storage : @parameter.changeOwner
  14. DUP; # @storage : @storage : @parameter.changeOwner
  15. DUG 2; # @storage : @parameter.changeOwner : @storage
  16. CDR; # address : @parameter.changeOwner : @storage
  17. SENDER; # address : address : @parameter.changeOwner : @storage
  18. COMPARE; # int : @parameter.changeOwner : @storage
  19. EQ; # bool : @parameter.changeOwner : @storage
  20. IF
  21. {}
  22. {
  23. PUSH string "WrongCondition: sp.sender == self.data.owner"; # string : @parameter.changeOwner : @storage
  24. FAILWITH; # FAILED
  25. }; # @parameter.changeOwner : @storage
  26. # self.data.owner = params.newOwner # @parameter.changeOwner : @storage
  27. SWAP; # @storage : @parameter.changeOwner
  28. DUP; # @storage : @storage : @parameter.changeOwner
  29. DUG 2; # @storage : @parameter.changeOwner : @storage
  30. CAR; # map string (pair string int) : @parameter.changeOwner : @storage
  31. SWAP; # @parameter.changeOwner : map string (pair string int) : @storage
  32. DUP; # @parameter.changeOwner : @parameter.changeOwner : map string (pair string int) : @storage
  33. DUG 2; # @parameter.changeOwner : map string (pair string int) : @parameter.changeOwner : @storage
  34. SWAP; # map string (pair string int) : @parameter.changeOwner : @parameter.changeOwner : @storage
  35. PAIR; # pair (map string (pair string int)) @parameter.changeOwner : @parameter.changeOwner : @storage
  36. DUG 2; # @parameter.changeOwner : @storage : pair (map string (pair string int)) @parameter.changeOwner
  37. DROP; # @storage : pair (map string (pair string int)) @parameter.changeOwner
  38. DROP; # pair (map string (pair string int)) @parameter.changeOwner
  39. }
  40. {
  41. IF_LEFT
  42. {
  43. # Entry point: setDate # @parameter.right.setDate : @storage
  44. # sp.verify(sp.sender == self.data.owner) # @parameter.right.setDate : @storage
  45. SWAP; # @storage : @parameter.right.setDate
  46. DUP; # @storage : @storage : @parameter.right.setDate
  47. DUG 2; # @storage : @parameter.right.setDate : @storage
  48. CDR; # address : @parameter.right.setDate : @storage
  49. SENDER; # address : address : @parameter.right.setDate : @storage
  50. COMPARE; # int : @parameter.right.setDate : @storage
  51. EQ; # bool : @parameter.right.setDate : @storage
  52. IF
  53. {}
  54. {
  55. PUSH string "WrongCondition: sp.sender == self.data.owner"; # string : @parameter.right.setDate : @storage
  56. FAILWITH; # FAILED
  57. }; # @parameter.right.setDate : @storage
  58. # if ~ (self.data.nameToEvent.contains(params.name)): # @parameter.right.setDate : @storage
  59. SWAP; # @storage : @parameter.right.setDate
  60. DUP; # @storage : @storage : @parameter.right.setDate
  61. DUG 2; # @storage : @parameter.right.setDate : @storage
  62. CAR; # map string (pair string int) : @parameter.right.setDate : @storage
  63. SWAP; # @parameter.right.setDate : map string (pair string int) : @storage
  64. DUP; # @parameter.right.setDate : @parameter.right.setDate : map string (pair string int) : @storage
  65. DUG 2; # @parameter.right.setDate : map string (pair string int) : @parameter.right.setDate : @storage
  66. CAR; # string : map string (pair string int) : @parameter.right.setDate : @storage
  67. MEM; # bool : @parameter.right.setDate : @storage
  68. IF
  69. {}
  70. {
  71. # self.data.nameToEvent[params.name] = ('', 0) # @parameter.right.setDate : @storage
  72. SWAP; # @storage : @parameter.right.setDate
  73. DUP; # @storage : @storage : @parameter.right.setDate
  74. DUG 2; # @storage : @parameter.right.setDate : @storage
  75. DUP; # @storage : @storage : @parameter.right.setDate : @storage
  76. CDR; # address : @storage : @parameter.right.setDate : @storage
  77. SWAP; # @storage : address : @parameter.right.setDate : @storage
  78. CAR; # map string (pair string int) : address : @parameter.right.setDate : @storage
  79. PUSH (option (pair string int)) (Some (Pair "" 0)); # option (pair string int) : map string (pair string int) : address : @parameter.right.setDate : @storage
  80. DIG 3; # @parameter.right.setDate : option (pair string int) : map string (pair string int) : address : @storage
  81. DUP; # @parameter.right.setDate : @parameter.right.setDate : option (pair string int) : map string (pair string int) : address : @storage
  82. DUG 4; # @parameter.right.setDate : option (pair string int) : map string (pair string int) : address : @parameter.right.setDate : @storage
  83. CAR; # string : option (pair string int) : map string (pair string int) : address : @parameter.right.setDate : @storage
  84. UPDATE; # map string (pair string int) : address : @parameter.right.setDate : @storage
  85. PAIR; # pair (map string (pair string int)) address : @parameter.right.setDate : @storage
  86. DUG 2; # @parameter.right.setDate : @storage : pair (map string (pair string int)) address
  87. SWAP; # @storage : @parameter.right.setDate : pair (map string (pair string int)) address
  88. DROP; # @parameter.right.setDate : pair (map string (pair string int)) address
  89. }; # @parameter.right.setDate : @storage
  90. # self.data.nameToEvent[params.name] = (params.newDate, sp.snd(self.data.nameToEvent[params.name])) # @parameter.right.setDate : @storage
  91. SWAP; # @storage : @parameter.right.setDate
  92. DUP; # @storage : @storage : @parameter.right.setDate
  93. DUG 2; # @storage : @parameter.right.setDate : @storage
  94. DUP; # @storage : @storage : @parameter.right.setDate : @storage
  95. CDR; # address : @storage : @parameter.right.setDate : @storage
  96. SWAP; # @storage : address : @parameter.right.setDate : @storage
  97. CAR; # map string (pair string int) : address : @parameter.right.setDate : @storage
  98. DIG 3; # @storage : map string (pair string int) : address : @parameter.right.setDate
  99. DUP; # @storage : @storage : map string (pair string int) : address : @parameter.right.setDate
  100. DUG 4; # @storage : map string (pair string int) : address : @parameter.right.setDate : @storage
  101. CAR; # map string (pair string int) : map string (pair string int) : address : @parameter.right.setDate : @storage
  102. DIG 3; # @parameter.right.setDate : map string (pair string int) : map string (pair string int) : address : @storage
  103. DUP; # @parameter.right.setDate : @parameter.right.setDate : map string (pair string int) : map string (pair string int) : address : @storage
  104. DUG 4; # @parameter.right.setDate : map string (pair string int) : map string (pair string int) : address : @parameter.right.setDate : @storage
  105. CAR; # string : map string (pair string int) : map string (pair string int) : address : @parameter.right.setDate : @storage
  106. GET; # option (pair string int) : map string (pair string int) : address : @parameter.right.setDate : @storage
  107. IF_SOME
  108. {
  109. # of_some: Get-item:9 # @some : map string (pair string int) : address : @parameter.right.setDate : @storage
  110. }
  111. {
  112. PUSH string "Get-item:9"; # string : map string (pair string int) : address : @parameter.right.setDate : @storage
  113. FAILWITH; # FAILED
  114. }; # @some : map string (pair string int) : address : @parameter.right.setDate : @storage
  115. CDR; # int : map string (pair string int) : address : @parameter.right.setDate : @storage
  116. DIG 3; # @parameter.right.setDate : int : map string (pair string int) : address : @storage
  117. DUP; # @parameter.right.setDate : @parameter.right.setDate : int : map string (pair string int) : address : @storage
  118. DUG 4; # @parameter.right.setDate : int : map string (pair string int) : address : @parameter.right.setDate : @storage
  119. CDR; # string : int : map string (pair string int) : address : @parameter.right.setDate : @storage
  120. PAIR; # pair string int : map string (pair string int) : address : @parameter.right.setDate : @storage
  121. SOME; # option (pair string int) : map string (pair string int) : address : @parameter.right.setDate : @storage
  122. DIG 3; # @parameter.right.setDate : option (pair string int) : map string (pair string int) : address : @storage
  123. DUP; # @parameter.right.setDate : @parameter.right.setDate : option (pair string int) : map string (pair string int) : address : @storage
  124. DUG 4; # @parameter.right.setDate : option (pair string int) : map string (pair string int) : address : @parameter.right.setDate : @storage
  125. CAR; # string : option (pair string int) : map string (pair string int) : address : @parameter.right.setDate : @storage
  126. UPDATE; # map string (pair string int) : address : @parameter.right.setDate : @storage
  127. PAIR; # pair (map string (pair string int)) address : @parameter.right.setDate : @storage
  128. DUG 2; # @parameter.right.setDate : @storage : pair (map string (pair string int)) address
  129. DROP; # @storage : pair (map string (pair string int)) address
  130. DROP; # pair (map string (pair string int)) address
  131. }
  132. {
  133. # Entry point: setNumGuests # @parameter.right.setNumGuests : @storage
  134. # sp.verify(sp.sender == self.data.owner) # @parameter.right.setNumGuests : @storage
  135. SWAP; # @storage : @parameter.right.setNumGuests
  136. DUP; # @storage : @storage : @parameter.right.setNumGuests
  137. DUG 2; # @storage : @parameter.right.setNumGuests : @storage
  138. CDR; # address : @parameter.right.setNumGuests : @storage
  139. SENDER; # address : address : @parameter.right.setNumGuests : @storage
  140. COMPARE; # int : @parameter.right.setNumGuests : @storage
  141. EQ; # bool : @parameter.right.setNumGuests : @storage
  142. IF
  143. {}
  144. {
  145. PUSH string "WrongCondition: sp.sender == self.data.owner"; # string : @parameter.right.setNumGuests : @storage
  146. FAILWITH; # FAILED
  147. }; # @parameter.right.setNumGuests : @storage
  148. # if ~ (self.data.nameToEvent.contains(params.name)): # @parameter.right.setNumGuests : @storage
  149. SWAP; # @storage : @parameter.right.setNumGuests
  150. DUP; # @storage : @storage : @parameter.right.setNumGuests
  151. DUG 2; # @storage : @parameter.right.setNumGuests : @storage
  152. CAR; # map string (pair string int) : @parameter.right.setNumGuests : @storage
  153. SWAP; # @parameter.right.setNumGuests : map string (pair string int) : @storage
  154. DUP; # @parameter.right.setNumGuests : @parameter.right.setNumGuests : map string (pair string int) : @storage
  155. DUG 2; # @parameter.right.setNumGuests : map string (pair string int) : @parameter.right.setNumGuests : @storage
  156. CAR; # string : map string (pair string int) : @parameter.right.setNumGuests : @storage
  157. MEM; # bool : @parameter.right.setNumGuests : @storage
  158. IF
  159. {}
  160. {
  161. # self.data.nameToEvent[params.name] = ('', 0) # @parameter.right.setNumGuests : @storage
  162. SWAP; # @storage : @parameter.right.setNumGuests
  163. DUP; # @storage : @storage : @parameter.right.setNumGuests
  164. DUG 2; # @storage : @parameter.right.setNumGuests : @storage
  165. DUP; # @storage : @storage : @parameter.right.setNumGuests : @storage
  166. CDR; # address : @storage : @parameter.right.setNumGuests : @storage
  167. SWAP; # @storage : address : @parameter.right.setNumGuests : @storage
  168. CAR; # map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  169. PUSH (option (pair string int)) (Some (Pair "" 0)); # option (pair string int) : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  170. DIG 3; # @parameter.right.setNumGuests : option (pair string int) : map string (pair string int) : address : @storage
  171. DUP; # @parameter.right.setNumGuests : @parameter.right.setNumGuests : option (pair string int) : map string (pair string int) : address : @storage
  172. DUG 4; # @parameter.right.setNumGuests : option (pair string int) : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  173. CAR; # string : option (pair string int) : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  174. UPDATE; # map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  175. PAIR; # pair (map string (pair string int)) address : @parameter.right.setNumGuests : @storage
  176. DUG 2; # @parameter.right.setNumGuests : @storage : pair (map string (pair string int)) address
  177. SWAP; # @storage : @parameter.right.setNumGuests : pair (map string (pair string int)) address
  178. DROP; # @parameter.right.setNumGuests : pair (map string (pair string int)) address
  179. }; # @parameter.right.setNumGuests : @storage
  180. # self.data.nameToEvent[params.name] = (sp.fst(self.data.nameToEvent[params.name]), params.newNumGuests) # @parameter.right.setNumGuests : @storage
  181. SWAP; # @storage : @parameter.right.setNumGuests
  182. DUP; # @storage : @storage : @parameter.right.setNumGuests
  183. DUG 2; # @storage : @parameter.right.setNumGuests : @storage
  184. DUP; # @storage : @storage : @parameter.right.setNumGuests : @storage
  185. CDR; # address : @storage : @parameter.right.setNumGuests : @storage
  186. SWAP; # @storage : address : @parameter.right.setNumGuests : @storage
  187. CAR; # map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  188. DIG 2; # @parameter.right.setNumGuests : map string (pair string int) : address : @storage
  189. DUP; # @parameter.right.setNumGuests : @parameter.right.setNumGuests : map string (pair string int) : address : @storage
  190. DUG 3; # @parameter.right.setNumGuests : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  191. CDR; # int : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  192. DIG 4; # @storage : int : map string (pair string int) : address : @parameter.right.setNumGuests
  193. DUP; # @storage : @storage : int : map string (pair string int) : address : @parameter.right.setNumGuests
  194. DUG 5; # @storage : int : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  195. CAR; # map string (pair string int) : int : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  196. DIG 4; # @parameter.right.setNumGuests : map string (pair string int) : int : map string (pair string int) : address : @storage
  197. DUP; # @parameter.right.setNumGuests : @parameter.right.setNumGuests : map string (pair string int) : int : map string (pair string int) : address : @storage
  198. DUG 5; # @parameter.right.setNumGuests : map string (pair string int) : int : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  199. CAR; # string : map string (pair string int) : int : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  200. GET; # option (pair string int) : int : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  201. IF_SOME
  202. {
  203. # of_some: Get-item:15 # @some : int : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  204. }
  205. {
  206. PUSH string "Get-item:15"; # string : int : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  207. FAILWITH; # FAILED
  208. }; # @some : int : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  209. CAR; # string : int : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  210. PAIR; # pair string int : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  211. SOME; # option (pair string int) : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  212. DIG 3; # @parameter.right.setNumGuests : option (pair string int) : map string (pair string int) : address : @storage
  213. DUP; # @parameter.right.setNumGuests : @parameter.right.setNumGuests : option (pair string int) : map string (pair string int) : address : @storage
  214. DUG 4; # @parameter.right.setNumGuests : option (pair string int) : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  215. CAR; # string : option (pair string int) : map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  216. UPDATE; # map string (pair string int) : address : @parameter.right.setNumGuests : @storage
  217. PAIR; # pair (map string (pair string int)) address : @parameter.right.setNumGuests : @storage
  218. DUG 2; # @parameter.right.setNumGuests : @storage : pair (map string (pair string int)) address
  219. DROP; # @storage : pair (map string (pair string int)) address
  220. DROP; # pair (map string (pair string int)) address
  221. }; # pair (map string (pair string int)) address
  222. }; # pair (map string (pair string int)) @parameter.changeOwner
  223. NIL operation; # list operation : pair (map string (pair string int)) @parameter.changeOwner
  224. PAIR; # pair (list operation) (pair (map string (pair string int)) @parameter.changeOwner)
  225. } # pair (list operation) (pair (map string (pair string int)) @parameter.changeOwner);
RAW Paste Data