tx · CJBoNBF5kKKjWqhLQ2E123KMaCxZM2rei8qyxka2jjKs

3N18S8xfWJYHVuGfJcpcPVh7LsnqR9hKTcc:  -0.01400000 Waves

2019.09.08 14:56 [667072] smart account 3N18S8xfWJYHVuGfJcpcPVh7LsnqR9hKTcc > SELF 0.00000000 Waves

{ "type": 13, "id": "CJBoNBF5kKKjWqhLQ2E123KMaCxZM2rei8qyxka2jjKs", "fee": 1400000, "feeAssetId": null, "timestamp": 1567943722569, "version": 1, "sender": "3N18S8xfWJYHVuGfJcpcPVh7LsnqR9hKTcc", "senderPublicKey": "9cETBksYN8YMHGvDB6BEqmH9HScpCMBRZwnjCviRQ9aA", "proofs": [ "C8qe1eAudoZhE3ZDUSGCXvJo1MMZdprvrUEozcC8jB1yLHXve8JrBuFJro6gBpwjfT8T6HuzTvoPmXiZvvx4VX4" ], "script": "base64:AAIDAAAAAAAAAAAAAAAXAAAAAAVQUklDRQAAAAAABfXhAAAAAAALUEFURU5UUFJJQ0UAAAAAAAvrwgAAAAAABk9SQUNMRQIAAAAjM012aXNEZkE2dk5nNGk2aUtZV1o4Yld2eVA0aW1mQmI5ZXEAAAAAA1dJTgIAAAADV0lOAAAAAARMT1NFAgAAAARMT1NFAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAAAAEXZhb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hbHVlTG9zZUNvdW50AAAAAQUAAAAFbG9zZXIAAAAAAAAAAAEFAAAAA25pbAAAAAFpAQAAAAZpbnN1cmUAAAAABAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAQAAAAOaW5zdXJhbmNlUHJpY2UJAABrAAAAAwUAAAAFUFJJQ0UAAAAAAAAAAAcAAAAAAAAAAGQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAIGNhbiB1c2UgV0FWRVMgb25seSBhdCB0aGUgbW9tZW50BAAAAAt1c2VyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAwkBAAAAAiE9AAAAAggFAAAAA3BtdAAAAAZhbW91bnQFAAAADmluc3VyYW5jZVByaWNlCQAAAgAAAAECAAAAQ2luc3VyYW5jZSBwYXltZW50IGFtb3VudCBjYW5ub3QgYmUgbm90IGVxdWFsIHRvIHRoZSBpbnN1cmFuY2UgcHJpY2UJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABRnZXRLZXlJbnN1cmFuY2VDb3VudAAAAAEFAAAAC3VzZXJBZGRyZXNzCQAAZAAAAAIJAQAAABZnZXRWYWx1ZUluc3VyYW5jZUNvdW50AAAAAQUAAAALdXNlckFkZHJlc3MAAAAAAAAAAAEFAAAAA25pbAAAAABL5G38", "chainId": 84, "height": 667072, "spentComplexity": 0 } View: original | compacted Prev: 5kXvuNXuHnR48SPhf4ffSCSz5SDzhS1g8ehCzuPDv7fg Next: BBcE14RcP2V15Ck5JEdWuT4NGASCJzuaSzvJRgQ9TFPM Diff:
OldNewDifferences
9696 func O (G) = g(N(G))
9797
9898
99-@Callable(P)
99+func P (G) = (G + "_patent_cnt")
100+
101+
102+func Q (G) = g(P(G))
103+
104+
105+@Callable(R)
100106 func patent (o,p,q,r,t,u,v,w,x,y,z,A) = {
101- let Q = extract(P.payment)
102- if (isDefined(Q.assetId))
107+ let S = extract(R.payment)
108+ if (isDefined(S.assetId))
103109 then throw("can use WAVES only at the moment")
104110 else {
105- let R = toBase58String(P.caller.bytes)
106- if ((Q.amount != a))
111+ let T = toBase58String(R.caller.bytes)
112+ if ((S.amount != a))
107113 then throw("purchase amount cannot be not equal to the price")
108114 else if (!(s(o, p, q, r, t, u, v, w, x, y, z, A)))
109115 then throw("invalid coordinates order")
110116 else if ((l(B(o, p, q, r, t, u, v, w, x, y, z, A)) != f))
111117 then throw("this patent is already exists")
112- else WriteSet([DataEntry(B(o, p, q, r, t, u, v, w, x, y, z, A), R)])
118+ else if ((Q(T) >= 2))
119+ then throw("you cannot have more than 2 patents")
120+ else WriteSet([DataEntry(B(o, p, q, r, t, u, v, w, x, y, z, A), T), DataEntry(P(T), (Q(T) + 1))])
113121 }
114122 }
115123
116124
117125
118-@Callable(P)
126+@Callable(R)
119127 func buyPatent (o,p,q,r,t,u,v,w,x,y,z,A) = {
120- let Q = extract(P.payment)
121- if (isDefined(Q.assetId))
128+ let S = extract(R.payment)
129+ if (isDefined(S.assetId))
122130 then throw("can use WAVES only at the moment")
123131 else {
124- let R = toBase58String(P.caller.bytes)
125- let S = l(B(o, p, q, r, t, u, v, w, x, y, z, A))
126- if ((Q.amount != b))
132+ let T = toBase58String(R.caller.bytes)
133+ let U = l(B(o, p, q, r, t, u, v, w, x, y, z, A))
134+ if ((S.amount != b))
127135 then throw("purchase amount cannot be not equal to the price")
128136 else if (!(s(o, p, q, r, t, u, v, w, x, y, z, A)))
129137 then throw("invalid coordinates order")
130- else if ((S == f))
138+ else if ((U == f))
131139 then throw("there is no such patent")
132- else if ((S == R))
140+ else if ((U == T))
133141 then throw("you cannot buy your own patent")
134- else WriteSet([DataEntry(B(o, p, q, r, t, u, v, w, x, y, z, A), R), DataEntry(C(S), (E(S) + Q.amount))])
142+ else WriteSet([DataEntry(B(o, p, q, r, t, u, v, w, x, y, z, A), T), DataEntry(C(U), (E(U) + S.amount))])
135143 }
136144 }
137145
138146
139147
140-@Callable(P)
148+@Callable(R)
141149 func withdraw () = {
142- let R = toBase58String(P.caller.bytes)
143- let T = E(R)
144- if ((0 >= T))
150+ let T = toBase58String(R.caller.bytes)
151+ let V = E(T)
152+ if ((0 >= V))
145153 then throw("insufficient balance")
146- else ScriptResult(WriteSet([DataEntry(C(R), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(R), T, unit)]))
154+ else ScriptResult(WriteSet([DataEntry(C(T), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(T), V, unit)]))
147155 }
148156
149157
150158
151-@Callable(P)
152-func gameReport (L,U,V) = {
153- let W = toBase58String(P.caller.bytes)
154- if ((W != c))
159+@Callable(R)
160+func gameReport (L,W,X) = {
161+ let Y = toBase58String(R.caller.bytes)
162+ if ((Y != c))
155163 then throw("only oracle can inform about games results")
156- else if ((U == V))
164+ else if ((W == X))
157165 then throw("winner and loser must be different")
158166 else if ((M(L) != f))
159167 then throw("this game has already been played")
160- else WriteSet([DataEntry(K(L), (((U + "-WIN;") + V) + "-LOSE")), DataEntry(F(U), (H(U) + 1)), DataEntry(I(V), (J(V) + 1))])
168+ else WriteSet([DataEntry(K(L), (((W + "-WIN;") + X) + "-LOSE")), DataEntry(F(W), (H(W) + 1)), DataEntry(I(X), (J(X) + 1))])
161169 }
162170
163171
164172
165-@Callable(P)
173+@Callable(R)
166174 func insure () = {
167- let Q = extract(P.payment)
168- let X = fraction(a, 7, 100)
169- if (isDefined(Q.assetId))
175+ let S = extract(R.payment)
176+ let Z = fraction(a, 7, 100)
177+ if (isDefined(S.assetId))
170178 then throw("can use WAVES only at the moment")
171179 else {
172- let R = toBase58String(P.caller.bytes)
173- if ((Q.amount != X))
180+ let T = toBase58String(R.caller.bytes)
181+ if ((S.amount != Z))
174182 then throw("insurance payment amount cannot be not equal to the insurance price")
175- else WriteSet([DataEntry(N(R), (O(R) + 1))])
183+ else WriteSet([DataEntry(N(T), (O(T) + 1))])
176184 }
177185 }
178186
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = 100000000
55
66 let b = 200000000
77
88 let c = "3MvisDfA6vNg4i6iKYWZ8bWvyP4imfBb9eq"
99
1010 let d = "WIN"
1111
1212 let e = "LOSE"
1313
1414 let f = "none"
1515
1616 func g (h) = {
1717 let i = {
1818 let j = getInteger(this, h)
1919 if ($isInstanceOf(j, "Int"))
2020 then {
2121 let k = j
2222 k
2323 }
2424 else 0
2525 }
2626 i
2727 }
2828
2929
3030 func l (h) = {
3131 let m = {
3232 let j = getString(this, h)
3333 if ($isInstanceOf(j, "String"))
3434 then {
3535 let k = j
3636 k
3737 }
3838 else f
3939 }
4040 m
4141 }
4242
4343
4444 func n (o,p,q,r) = if ((o > q))
4545 then false
4646 else if (if ((o == q))
4747 then (p > r)
4848 else false)
4949 then false
5050 else true
5151
5252
5353 func s (o,p,q,r,t,u,v,w,x,y,z,A) = if (!(n(o, p, q, r)))
5454 then false
5555 else if (!(n(q, r, t, u)))
5656 then false
5757 else if (!(n(t, u, v, w)))
5858 then false
5959 else if (!(n(v, w, x, y)))
6060 then false
6161 else if (!(n(x, y, z, A)))
6262 then false
6363 else true
6464
6565
6666 func B (o,p,q,r,t,u,v,w,x,y,z,A) = ((((((((((((((((((((((("patent:" + toString(o)) + ",") + toString(p)) + ";") + toString(q)) + ",") + toString(r)) + ";") + toString(t)) + ",") + toString(u)) + ";") + toString(v)) + ",") + toString(w)) + ";") + toString(x)) + ",") + toString(y)) + ";") + toString(z)) + ",") + toString(A))
6767
6868
6969 func C (D) = (D + "_balance")
7070
7171
7272 func E (D) = g(C(D))
7373
7474
7575 func F (G) = (G + "_wincnt")
7676
7777
7878 func H (G) = g(F(G))
7979
8080
8181 func I (G) = (G + "_losecnt")
8282
8383
8484 func J (G) = g(I(G))
8585
8686
8787 func K (L) = ("game_" + L)
8888
8989
9090 func M (L) = l(K(L))
9191
9292
9393 func N (G) = (G + "_insurance_cnt")
9494
9595
9696 func O (G) = g(N(G))
9797
9898
99-@Callable(P)
99+func P (G) = (G + "_patent_cnt")
100+
101+
102+func Q (G) = g(P(G))
103+
104+
105+@Callable(R)
100106 func patent (o,p,q,r,t,u,v,w,x,y,z,A) = {
101- let Q = extract(P.payment)
102- if (isDefined(Q.assetId))
107+ let S = extract(R.payment)
108+ if (isDefined(S.assetId))
103109 then throw("can use WAVES only at the moment")
104110 else {
105- let R = toBase58String(P.caller.bytes)
106- if ((Q.amount != a))
111+ let T = toBase58String(R.caller.bytes)
112+ if ((S.amount != a))
107113 then throw("purchase amount cannot be not equal to the price")
108114 else if (!(s(o, p, q, r, t, u, v, w, x, y, z, A)))
109115 then throw("invalid coordinates order")
110116 else if ((l(B(o, p, q, r, t, u, v, w, x, y, z, A)) != f))
111117 then throw("this patent is already exists")
112- else WriteSet([DataEntry(B(o, p, q, r, t, u, v, w, x, y, z, A), R)])
118+ else if ((Q(T) >= 2))
119+ then throw("you cannot have more than 2 patents")
120+ else WriteSet([DataEntry(B(o, p, q, r, t, u, v, w, x, y, z, A), T), DataEntry(P(T), (Q(T) + 1))])
113121 }
114122 }
115123
116124
117125
118-@Callable(P)
126+@Callable(R)
119127 func buyPatent (o,p,q,r,t,u,v,w,x,y,z,A) = {
120- let Q = extract(P.payment)
121- if (isDefined(Q.assetId))
128+ let S = extract(R.payment)
129+ if (isDefined(S.assetId))
122130 then throw("can use WAVES only at the moment")
123131 else {
124- let R = toBase58String(P.caller.bytes)
125- let S = l(B(o, p, q, r, t, u, v, w, x, y, z, A))
126- if ((Q.amount != b))
132+ let T = toBase58String(R.caller.bytes)
133+ let U = l(B(o, p, q, r, t, u, v, w, x, y, z, A))
134+ if ((S.amount != b))
127135 then throw("purchase amount cannot be not equal to the price")
128136 else if (!(s(o, p, q, r, t, u, v, w, x, y, z, A)))
129137 then throw("invalid coordinates order")
130- else if ((S == f))
138+ else if ((U == f))
131139 then throw("there is no such patent")
132- else if ((S == R))
140+ else if ((U == T))
133141 then throw("you cannot buy your own patent")
134- else WriteSet([DataEntry(B(o, p, q, r, t, u, v, w, x, y, z, A), R), DataEntry(C(S), (E(S) + Q.amount))])
142+ else WriteSet([DataEntry(B(o, p, q, r, t, u, v, w, x, y, z, A), T), DataEntry(C(U), (E(U) + S.amount))])
135143 }
136144 }
137145
138146
139147
140-@Callable(P)
148+@Callable(R)
141149 func withdraw () = {
142- let R = toBase58String(P.caller.bytes)
143- let T = E(R)
144- if ((0 >= T))
150+ let T = toBase58String(R.caller.bytes)
151+ let V = E(T)
152+ if ((0 >= V))
145153 then throw("insufficient balance")
146- else ScriptResult(WriteSet([DataEntry(C(R), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(R), T, unit)]))
154+ else ScriptResult(WriteSet([DataEntry(C(T), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(T), V, unit)]))
147155 }
148156
149157
150158
151-@Callable(P)
152-func gameReport (L,U,V) = {
153- let W = toBase58String(P.caller.bytes)
154- if ((W != c))
159+@Callable(R)
160+func gameReport (L,W,X) = {
161+ let Y = toBase58String(R.caller.bytes)
162+ if ((Y != c))
155163 then throw("only oracle can inform about games results")
156- else if ((U == V))
164+ else if ((W == X))
157165 then throw("winner and loser must be different")
158166 else if ((M(L) != f))
159167 then throw("this game has already been played")
160- else WriteSet([DataEntry(K(L), (((U + "-WIN;") + V) + "-LOSE")), DataEntry(F(U), (H(U) + 1)), DataEntry(I(V), (J(V) + 1))])
168+ else WriteSet([DataEntry(K(L), (((W + "-WIN;") + X) + "-LOSE")), DataEntry(F(W), (H(W) + 1)), DataEntry(I(X), (J(X) + 1))])
161169 }
162170
163171
164172
165-@Callable(P)
173+@Callable(R)
166174 func insure () = {
167- let Q = extract(P.payment)
168- let X = fraction(a, 7, 100)
169- if (isDefined(Q.assetId))
175+ let S = extract(R.payment)
176+ let Z = fraction(a, 7, 100)
177+ if (isDefined(S.assetId))
170178 then throw("can use WAVES only at the moment")
171179 else {
172- let R = toBase58String(P.caller.bytes)
173- if ((Q.amount != X))
180+ let T = toBase58String(R.caller.bytes)
181+ if ((S.amount != Z))
174182 then throw("insurance payment amount cannot be not equal to the insurance price")
175- else WriteSet([DataEntry(N(R), (O(R) + 1))])
183+ else WriteSet([DataEntry(N(T), (O(T) + 1))])
176184 }
177185 }
178186
179187

github/deemru/w8io/169f3d6 
45.05 ms