tx · 5kXvuNXuHnR48SPhf4ffSCSz5SDzhS1g8ehCzuPDv7fg 3N18S8xfWJYHVuGfJcpcPVh7LsnqR9hKTcc: -0.01400000 Waves 2019.09.08 13:43 [666991] smart account 3N18S8xfWJYHVuGfJcpcPVh7LsnqR9hKTcc > SELF 0.00000000 Waves
{ "type": 13, "id": "5kXvuNXuHnR48SPhf4ffSCSz5SDzhS1g8ehCzuPDv7fg", "fee": 1400000, "feeAssetId": null, "timestamp": 1567939414558, "version": 1, "sender": "3N18S8xfWJYHVuGfJcpcPVh7LsnqR9hKTcc", "senderPublicKey": "9cETBksYN8YMHGvDB6BEqmH9HScpCMBRZwnjCviRQ9aA", "proofs": [ "4xPxCZS4iRUWBrTcuhcsKSR4tGDSmhcGKihk1SpPYvKdwsgufzsnFmHwtD8xK4m8LGcN2FUKeYzy9v2tcmyEmP8e" ], "script": "base64:AAIDAAAAAAAAAAAAAAAVAAAAAAVQUklDRQAAAAAABfXhAAAAAAALUEFURU5UUFJJQ0UAAAAAAAvrwgAAAAAABk9SQUNMRQIAAAAjM012aXNEZkE2dk5nNGk2aUtZV1o4Yld2eVA0aW1mQmI5ZXEAAAAAA1dJTgIAAAADV0lOAAAAAARMT1NFAgAAAARMT1NFAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAA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AACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAFGdldEtleUluc3VyYW5jZUNvdW50AAAAAQUAAAALdXNlckFkZHJlc3MJAABkAAAAAgkBAAAAFmdldFZhbHVlSW5zdXJhbmNlQ291bnQAAAABBQAAAAt1c2VyQWRkcmVzcwAAAAAAAAAAAQUAAAADbmlsAAAAABn1AZY=", "chainId": 84, "height": 666991, "spentComplexity": 0 } View: original | compacted Prev: Vzswnt7gd2A5f1f7uwyfSoRmTwGhiLfkLkfqHH6kP2E Next: CJBoNBF5kKKjWqhLQ2E123KMaCxZM2rei8qyxka2jjKs Diff:
Old | New | Differences | |
---|---|---|---|
63 | 63 | else true | |
64 | 64 | ||
65 | 65 | ||
66 | - | func B (o,p,q,r,t,u,v,w,x,y,z,A) = ((((((((((((((((((((((toString(o) + ",") + toString(p)) + ";") + toString(q)) + ",") + toString(r)) + ";") + toString(t)) + ",") + toString(u)) + ";") + toString(v)) + ",") + toString(w)) + ";") + toString(x)) + ",") + toString(y)) + ";") + toString(z)) + ",") + toString(A)) | |
66 | + | 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)) | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func C (D) = (D + "_balance") | |
90 | 90 | func M (L) = l(K(L)) | |
91 | 91 | ||
92 | 92 | ||
93 | - | @Callable(N) | |
93 | + | func N (G) = (G + "_insurance_cnt") | |
94 | + | ||
95 | + | ||
96 | + | func O (G) = g(N(G)) | |
97 | + | ||
98 | + | ||
99 | + | @Callable(P) | |
94 | 100 | func patent (o,p,q,r,t,u,v,w,x,y,z,A) = { | |
95 | - | let | |
96 | - | if (isDefined( | |
101 | + | let Q = extract(P.payment) | |
102 | + | if (isDefined(Q.assetId)) | |
97 | 103 | then throw("can use WAVES only at the moment") | |
98 | 104 | else { | |
99 | - | let | |
100 | - | if (( | |
105 | + | let R = toBase58String(P.caller.bytes) | |
106 | + | if ((Q.amount != a)) | |
101 | 107 | then throw("purchase amount cannot be not equal to the price") | |
102 | 108 | else if (!(s(o, p, q, r, t, u, v, w, x, y, z, A))) | |
103 | 109 | then throw("invalid coordinates order") | |
104 | 110 | else if ((l(B(o, p, q, r, t, u, v, w, x, y, z, A)) != f)) | |
105 | 111 | then throw("this patent is already exists") | |
106 | - | else WriteSet([DataEntry(B(o, p, q, r, t, u, v, w, x, y, z, A), | |
112 | + | else WriteSet([DataEntry(B(o, p, q, r, t, u, v, w, x, y, z, A), R)]) | |
107 | 113 | } | |
108 | 114 | } | |
109 | 115 | ||
110 | 116 | ||
111 | 117 | ||
112 | - | @Callable( | |
118 | + | @Callable(P) | |
113 | 119 | func buyPatent (o,p,q,r,t,u,v,w,x,y,z,A) = { | |
114 | - | let | |
115 | - | if (isDefined( | |
120 | + | let Q = extract(P.payment) | |
121 | + | if (isDefined(Q.assetId)) | |
116 | 122 | then throw("can use WAVES only at the moment") | |
117 | 123 | else { | |
118 | - | let | |
119 | - | let | |
120 | - | if (( | |
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)) | |
121 | 127 | then throw("purchase amount cannot be not equal to the price") | |
122 | 128 | else if (!(s(o, p, q, r, t, u, v, w, x, y, z, A))) | |
123 | 129 | then throw("invalid coordinates order") | |
124 | - | else if (( | |
130 | + | else if ((S == f)) | |
125 | 131 | then throw("there is no such patent") | |
126 | - | else if (( | |
132 | + | else if ((S == R)) | |
127 | 133 | then throw("you cannot buy your own patent") | |
128 | - | else WriteSet([DataEntry(B(o, p, q, r, t, u, v, w, x, y, z, A), | |
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))]) | |
129 | 135 | } | |
130 | 136 | } | |
131 | 137 | ||
132 | 138 | ||
133 | 139 | ||
134 | - | @Callable( | |
140 | + | @Callable(P) | |
135 | 141 | func withdraw () = { | |
136 | - | let | |
137 | - | let | |
138 | - | if ((0 >= | |
142 | + | let R = toBase58String(P.caller.bytes) | |
143 | + | let T = E(R) | |
144 | + | if ((0 >= T)) | |
139 | 145 | then throw("insufficient balance") | |
140 | - | else ScriptResult(WriteSet([DataEntry(C( | |
146 | + | else ScriptResult(WriteSet([DataEntry(C(R), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(R), T, unit)])) | |
141 | 147 | } | |
142 | 148 | ||
143 | 149 | ||
144 | 150 | ||
145 | - | @Callable( | |
146 | - | func gameReport (L, | |
147 | - | let | |
148 | - | if (( | |
151 | + | @Callable(P) | |
152 | + | func gameReport (L,U,V) = { | |
153 | + | let W = toBase58String(P.caller.bytes) | |
154 | + | if ((W != c)) | |
149 | 155 | then throw("only oracle can inform about games results") | |
150 | - | else if (( | |
156 | + | else if ((U == V)) | |
151 | 157 | then throw("winner and loser must be different") | |
152 | 158 | else if ((M(L) != f)) | |
153 | 159 | then throw("this game has already been played") | |
154 | - | else WriteSet([DataEntry(K(L), (((S + "-WIN;") + T) + "-LOSE")), DataEntry(F(S), (H(S) + 1)), DataEntry(I(T), (J(T) + 1))]) | |
160 | + | else WriteSet([DataEntry(K(L), (((U + "-WIN;") + V) + "-LOSE")), DataEntry(F(U), (H(U) + 1)), DataEntry(I(V), (J(V) + 1))]) | |
161 | + | } | |
162 | + | ||
163 | + | ||
164 | + | ||
165 | + | @Callable(P) | |
166 | + | func insure () = { | |
167 | + | let Q = extract(P.payment) | |
168 | + | let X = fraction(a, 7, 100) | |
169 | + | if (isDefined(Q.assetId)) | |
170 | + | then throw("can use WAVES only at the moment") | |
171 | + | else { | |
172 | + | let R = toBase58String(P.caller.bytes) | |
173 | + | if ((Q.amount != X)) | |
174 | + | then throw("insurance payment amount cannot be not equal to the insurance price") | |
175 | + | else WriteSet([DataEntry(N(R), (O(R) + 1))]) | |
176 | + | } | |
155 | 177 | } | |
156 | 178 | ||
157 | 179 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = 100000000 | |
5 | 5 | ||
6 | 6 | let b = 200000000 | |
7 | 7 | ||
8 | 8 | let c = "3MvisDfA6vNg4i6iKYWZ8bWvyP4imfBb9eq" | |
9 | 9 | ||
10 | 10 | let d = "WIN" | |
11 | 11 | ||
12 | 12 | let e = "LOSE" | |
13 | 13 | ||
14 | 14 | let f = "none" | |
15 | 15 | ||
16 | 16 | func g (h) = { | |
17 | 17 | let i = { | |
18 | 18 | let j = getInteger(this, h) | |
19 | 19 | if ($isInstanceOf(j, "Int")) | |
20 | 20 | then { | |
21 | 21 | let k = j | |
22 | 22 | k | |
23 | 23 | } | |
24 | 24 | else 0 | |
25 | 25 | } | |
26 | 26 | i | |
27 | 27 | } | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func l (h) = { | |
31 | 31 | let m = { | |
32 | 32 | let j = getString(this, h) | |
33 | 33 | if ($isInstanceOf(j, "String")) | |
34 | 34 | then { | |
35 | 35 | let k = j | |
36 | 36 | k | |
37 | 37 | } | |
38 | 38 | else f | |
39 | 39 | } | |
40 | 40 | m | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func n (o,p,q,r) = if ((o > q)) | |
45 | 45 | then false | |
46 | 46 | else if (if ((o == q)) | |
47 | 47 | then (p > r) | |
48 | 48 | else false) | |
49 | 49 | then false | |
50 | 50 | else true | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | func s (o,p,q,r,t,u,v,w,x,y,z,A) = if (!(n(o, p, q, r))) | |
54 | 54 | then false | |
55 | 55 | else if (!(n(q, r, t, u))) | |
56 | 56 | then false | |
57 | 57 | else if (!(n(t, u, v, w))) | |
58 | 58 | then false | |
59 | 59 | else if (!(n(v, w, x, y))) | |
60 | 60 | then false | |
61 | 61 | else if (!(n(x, y, z, A))) | |
62 | 62 | then false | |
63 | 63 | else true | |
64 | 64 | ||
65 | 65 | ||
66 | - | func B (o,p,q,r,t,u,v,w,x,y,z,A) = ((((((((((((((((((((((toString(o) + ",") + toString(p)) + ";") + toString(q)) + ",") + toString(r)) + ";") + toString(t)) + ",") + toString(u)) + ";") + toString(v)) + ",") + toString(w)) + ";") + toString(x)) + ",") + toString(y)) + ";") + toString(z)) + ",") + toString(A)) | |
66 | + | 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)) | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func C (D) = (D + "_balance") | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func E (D) = g(C(D)) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func F (G) = (G + "_wincnt") | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func H (G) = g(F(G)) | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func I (G) = (G + "_losecnt") | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func J (G) = g(I(G)) | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func K (L) = ("game_" + L) | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func M (L) = l(K(L)) | |
91 | 91 | ||
92 | 92 | ||
93 | - | @Callable(N) | |
93 | + | func N (G) = (G + "_insurance_cnt") | |
94 | + | ||
95 | + | ||
96 | + | func O (G) = g(N(G)) | |
97 | + | ||
98 | + | ||
99 | + | @Callable(P) | |
94 | 100 | func patent (o,p,q,r,t,u,v,w,x,y,z,A) = { | |
95 | - | let | |
96 | - | if (isDefined( | |
101 | + | let Q = extract(P.payment) | |
102 | + | if (isDefined(Q.assetId)) | |
97 | 103 | then throw("can use WAVES only at the moment") | |
98 | 104 | else { | |
99 | - | let | |
100 | - | if (( | |
105 | + | let R = toBase58String(P.caller.bytes) | |
106 | + | if ((Q.amount != a)) | |
101 | 107 | then throw("purchase amount cannot be not equal to the price") | |
102 | 108 | else if (!(s(o, p, q, r, t, u, v, w, x, y, z, A))) | |
103 | 109 | then throw("invalid coordinates order") | |
104 | 110 | else if ((l(B(o, p, q, r, t, u, v, w, x, y, z, A)) != f)) | |
105 | 111 | then throw("this patent is already exists") | |
106 | - | else WriteSet([DataEntry(B(o, p, q, r, t, u, v, w, x, y, z, A), | |
112 | + | else WriteSet([DataEntry(B(o, p, q, r, t, u, v, w, x, y, z, A), R)]) | |
107 | 113 | } | |
108 | 114 | } | |
109 | 115 | ||
110 | 116 | ||
111 | 117 | ||
112 | - | @Callable( | |
118 | + | @Callable(P) | |
113 | 119 | func buyPatent (o,p,q,r,t,u,v,w,x,y,z,A) = { | |
114 | - | let | |
115 | - | if (isDefined( | |
120 | + | let Q = extract(P.payment) | |
121 | + | if (isDefined(Q.assetId)) | |
116 | 122 | then throw("can use WAVES only at the moment") | |
117 | 123 | else { | |
118 | - | let | |
119 | - | let | |
120 | - | if (( | |
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)) | |
121 | 127 | then throw("purchase amount cannot be not equal to the price") | |
122 | 128 | else if (!(s(o, p, q, r, t, u, v, w, x, y, z, A))) | |
123 | 129 | then throw("invalid coordinates order") | |
124 | - | else if (( | |
130 | + | else if ((S == f)) | |
125 | 131 | then throw("there is no such patent") | |
126 | - | else if (( | |
132 | + | else if ((S == R)) | |
127 | 133 | then throw("you cannot buy your own patent") | |
128 | - | else WriteSet([DataEntry(B(o, p, q, r, t, u, v, w, x, y, z, A), | |
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))]) | |
129 | 135 | } | |
130 | 136 | } | |
131 | 137 | ||
132 | 138 | ||
133 | 139 | ||
134 | - | @Callable( | |
140 | + | @Callable(P) | |
135 | 141 | func withdraw () = { | |
136 | - | let | |
137 | - | let | |
138 | - | if ((0 >= | |
142 | + | let R = toBase58String(P.caller.bytes) | |
143 | + | let T = E(R) | |
144 | + | if ((0 >= T)) | |
139 | 145 | then throw("insufficient balance") | |
140 | - | else ScriptResult(WriteSet([DataEntry(C( | |
146 | + | else ScriptResult(WriteSet([DataEntry(C(R), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(R), T, unit)])) | |
141 | 147 | } | |
142 | 148 | ||
143 | 149 | ||
144 | 150 | ||
145 | - | @Callable( | |
146 | - | func gameReport (L, | |
147 | - | let | |
148 | - | if (( | |
151 | + | @Callable(P) | |
152 | + | func gameReport (L,U,V) = { | |
153 | + | let W = toBase58String(P.caller.bytes) | |
154 | + | if ((W != c)) | |
149 | 155 | then throw("only oracle can inform about games results") | |
150 | - | else if (( | |
156 | + | else if ((U == V)) | |
151 | 157 | then throw("winner and loser must be different") | |
152 | 158 | else if ((M(L) != f)) | |
153 | 159 | then throw("this game has already been played") | |
154 | - | else WriteSet([DataEntry(K(L), (((S + "-WIN;") + T) + "-LOSE")), DataEntry(F(S), (H(S) + 1)), DataEntry(I(T), (J(T) + 1))]) | |
160 | + | else WriteSet([DataEntry(K(L), (((U + "-WIN;") + V) + "-LOSE")), DataEntry(F(U), (H(U) + 1)), DataEntry(I(V), (J(V) + 1))]) | |
161 | + | } | |
162 | + | ||
163 | + | ||
164 | + | ||
165 | + | @Callable(P) | |
166 | + | func insure () = { | |
167 | + | let Q = extract(P.payment) | |
168 | + | let X = fraction(a, 7, 100) | |
169 | + | if (isDefined(Q.assetId)) | |
170 | + | then throw("can use WAVES only at the moment") | |
171 | + | else { | |
172 | + | let R = toBase58String(P.caller.bytes) | |
173 | + | if ((Q.amount != X)) | |
174 | + | then throw("insurance payment amount cannot be not equal to the insurance price") | |
175 | + | else WriteSet([DataEntry(N(R), (O(R) + 1))]) | |
176 | + | } | |
155 | 177 | } | |
156 | 178 | ||
157 | 179 |
github/deemru/w8io/169f3d6 45.40 ms ◑