tx · J93oV3u4Y7Z3hzJ53iZQVYw8AUF17Waea528bGXZq2DE 3MqLtJ49xFdzpVh8kJoaumrRN9GYXLrScMk: -0.01400000 Waves 2019.07.30 16:42 [608911] smart account 3MqLtJ49xFdzpVh8kJoaumrRN9GYXLrScMk > SELF 0.00000000 Waves
{ "type": 13, "id": "J93oV3u4Y7Z3hzJ53iZQVYw8AUF17Waea528bGXZq2DE", "fee": 1400000, "feeAssetId": null, "timestamp": 1564494172769, "version": 1, "sender": "3MqLtJ49xFdzpVh8kJoaumrRN9GYXLrScMk", "senderPublicKey": "5XLU4PwAQXZGmcUD3QtB2pXeV3VBEBp8cvA9NnTiv2mW", "proofs": [ "jZPgHrNzJJcdLWdWJDquE5g32QBroAXYm6jFRBXEeJstZcM3VRpe5E4QhVJCWfJZbUBe4JmYY58FZMUpRaDT76R" ], "script": "base64:AAIDAAAAAAAAAAAAAAAJAAAAAApiZXRBc3NldElkAQAAACAea7QCZF/XAXMBPEnDQ5kqHUHyOfWmXu9KHDHL6zcNNwAAAAAGbWF4RmVlAAAAAAAATEtAAAAAAAZtaW5CZXQAAAAAAABMS0AAAAAAD21pbk1hdGNoTm9taW5hbAAAAAAAAExLQAEAAAAIY2hlY2tGZWUAAAABAAAAAWkDCQAAZgAAAAIIBQAAAAFpAAAAA2ZlZQUAAAAGbWF4RmVlCQAAAgAAAAECAAAAFnVucmVhc29uYWJsZSBsYXJnZSBmZWUDCQEAAAACIT0AAAACCAUAAAABaQAAAApmZWVBc3NldElkBQAAAAR1bml0CQAAAgAAAAECAAAAFGZlZSBtdXN0IGJlIGluIFdBVkVTBgEAAAAIcmVwYXlGZWUAAAADAAAAAWkAAAACd3MAAAAGYW1vdW50AwkBAAAACGNoZWNrRmVlAAAAAQUAAAABaQkBAAAADFNjcmlwdFJlc3VsdAAAAAIFAAAAAndzCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAAB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kcmVzcwkABB0AAAACBQAAAAR0aGlzCQABLAAAAAIFAAAACHdpbm5lcklkAgAAAAZfb3duZXIDCQEAAAACIT0AAAACBQAAAA13aW5uZXJBZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMJAAACAAAAAQIAAAArcGF5d2lubmVyKCkgc2hvdWxkIGJlIGNhbGxlZCBieSB3aW5uZXIgb25seQQAAAAGYW1vdW50CQEAAAAHZXh0cmFjdAAAAAEJAAQaAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAdtYXRjaElkAgAAAAdfYW1vdW50CQEAAAAIcmVwYXlGZWUAAAADBQAAAAFpCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAAB21hdGNoSWQCAAAABV9wYWlkBQAAAAZhbW91bnQFAAAAA25pbAUAAAAGYW1vdW50AAAAAHjb8fo=", "chainId": 84, "height": 608911, "spentComplexity": 0 } View: original | compacted Prev: 6t5YZKTzbM3YyYw85eJKABYHBnUx1GT5Z9jmbRvVfdnc Next: 6rZLBkh4zbw5gbdwa2scvGEuW4Exsbhrgt9ryQ7vhTao Diff:
Old | New | Differences | |
---|---|---|---|
49 | 49 | then throw("unexpected side") | |
50 | 50 | else { | |
51 | 51 | let k = (((((("bet_" + o) + "_") + toBase58String(f.caller.bytes)) + "_") + take(toBase64String(f.transactionId), 15)) + "_") | |
52 | - | let u = { | |
53 | - | let v = getInteger(this, ((("seq_" + o) + "_") + p)) | |
54 | - | if ($isInstanceOf(v, "Int")) | |
52 | + | let u = ((("seq_" + o) + "_") + p) | |
53 | + | let v = { | |
54 | + | let w = getInteger(this, u) | |
55 | + | if ($isInstanceOf(w, "Int")) | |
55 | 56 | then { | |
56 | - | let | |
57 | - | ( | |
57 | + | let x = w | |
58 | + | (x + 1) | |
58 | 59 | } | |
59 | 60 | else 1 | |
60 | 61 | } | |
61 | - | g(f, WriteSet([DataEntry((k + "owner"), s), DataEntry((k + "event"), o), DataEntry((k + "subevent"), p), DataEntry((k + "side"), q), DataEntry((k + "odds"), r), DataEntry((k + "amount"), t.amount), DataEntry((k + "spent"), 0), DataEntry((k + "timestamp"), lastBlock.timestamp), DataEntry((k + "sequence"), u)]), 0) | |
62 | + | g(f, WriteSet([DataEntry((k + "owner"), s), DataEntry((k + "event"), o), DataEntry((k + "subevent"), p), DataEntry((k + "side"), q), DataEntry((k + "odds"), r), DataEntry((k + "amount"), t.amount), DataEntry((k + "spent"), 0), DataEntry((k + "timestamp"), lastBlock.timestamp), DataEntry((k + "sequence"), v), DataEntry(u, v)]), 0) | |
62 | 63 | } | |
63 | 64 | } | |
64 | 65 | ||
69 | 70 | then throw("permission denied") | |
70 | 71 | else { | |
71 | 72 | let i = extract(getInteger(this, (k + "_amount"))) | |
72 | - | let | |
73 | - | let | |
74 | - | g(f, WriteSet([DataEntry((k + "_spent"), i), DataEntry((k + "_cancel_amount"), | |
73 | + | let y = extract(getInteger(this, (k + "_spent"))) | |
74 | + | let z = (i - y) | |
75 | + | g(f, WriteSet([DataEntry((k + "_spent"), i), DataEntry((k + "_cancel_amount"), z)]), z) | |
75 | 76 | } | |
76 | 77 | ||
77 | 78 | ||
78 | 79 | ||
79 | 80 | @Callable(f) | |
80 | - | func betMatch ( | |
81 | + | func betMatch (A,B) = if ((getString(this, (A + "_event")) != getString(this, (B + "_event")))) | |
81 | 82 | then throw("event id must match") | |
82 | - | else if ((getString(this, ( | |
83 | + | else if ((getString(this, (A + "_subevent")) != getString(this, (B + "_subevent")))) | |
83 | 84 | then throw("subevent id must match") | |
84 | - | else if ((getString(this, ( | |
85 | + | else if ((getString(this, (A + "_side")) != "for")) | |
85 | 86 | then throw("invalid *for* bet") | |
86 | - | else if ((getString(this, ( | |
87 | + | else if ((getString(this, (B + "_side")) != "against")) | |
87 | 88 | then throw("invalid *against* bet") | |
88 | 89 | else { | |
89 | - | let B = extract(getString(this, (z + "_event"))) | |
90 | - | let C = (((((((("match_" + z) + "_") + A) + "_") + B) + "_") + toBase58String(f.transactionId)) + "_") | |
91 | - | let r = extract(getInteger(this, (z + "_odds"))) | |
92 | - | let D = l(z) | |
90 | + | let C = extract(getString(this, (A + "_event"))) | |
91 | + | let D = (((((((("match_" + A) + "_") + B) + "_") + C) + "_") + toBase58String(f.transactionId)) + "_") | |
92 | + | let r = extract(getInteger(this, (A + "_odds"))) | |
93 | 93 | let E = l(A) | |
94 | - | let F = D | |
95 | - | let G = ((E * 100) / r) | |
96 | - | let H = if ((F > G)) | |
97 | - | then G | |
98 | - | else F | |
99 | - | if ((d > H)) | |
94 | + | let F = l(B) | |
95 | + | let G = E | |
96 | + | let H = ((F * 100) / r) | |
97 | + | let I = if ((G > H)) | |
98 | + | then H | |
99 | + | else G | |
100 | + | if ((d > I)) | |
100 | 101 | then throw("match nominal too low") | |
101 | 102 | else { | |
102 | - | let I = H | |
103 | - | let J = ((H * r) / 100) | |
104 | - | let K = (I + D) | |
103 | + | let J = I | |
104 | + | let K = ((I * r) / 100) | |
105 | 105 | let L = (J + E) | |
106 | - | if ((K > extract(getInteger(this, (z + "_amount"))))) | |
106 | + | let M = (K + F) | |
107 | + | if ((L > extract(getInteger(this, (A + "_amount"))))) | |
107 | 108 | then throw("invalid match") | |
108 | - | else if (( | |
109 | + | else if ((M > extract(getInteger(this, (B + "_amount"))))) | |
109 | 110 | then throw("invalid match") | |
110 | - | else g(f, WriteSet([DataEntry(( | |
111 | + | else g(f, WriteSet([DataEntry((D + "amount"), (J + K)), DataEntry((D + "for"), A), DataEntry((D + "against"), B), DataEntry((A + "_spent"), L), DataEntry((B + "_spent"), M)]), 0) | |
111 | 112 | } | |
112 | 113 | } | |
113 | 114 | ||
114 | 115 | ||
115 | 116 | ||
116 | 117 | @Callable(f) | |
117 | - | func approveDefeat ( | |
118 | - | then ( | |
118 | + | func approveDefeat (N,O) = if (if (isDefined(getInteger(this, (N + "_defeat")))) | |
119 | + | then (O == 2) | |
119 | 120 | else false) | |
120 | 121 | then throw("can't dispute after approve") | |
121 | - | else g(f, WriteSet([DataEntry(( | |
122 | + | else g(f, WriteSet([DataEntry((N + "_defeat"), O)]), 0) | |
122 | 123 | ||
123 | 124 | ||
124 | 125 | ||
125 | 126 | @Callable(f) | |
126 | - | func payWinner ( | |
127 | + | func payWinner (P) = if (isDefined(getInteger(this, (P + "_paid")))) | |
127 | 128 | then throw("already paid") | |
128 | 129 | else { | |
129 | - | let P = extract(getString(this, (O + "_for"))) | |
130 | - | let Q = extract(getString(this, (O + "_against"))) | |
131 | - | let R = m(P) | |
130 | + | let Q = extract(getString(this, (P + "_for"))) | |
131 | + | let R = extract(getString(this, (P + "_against"))) | |
132 | 132 | let S = m(Q) | |
133 | - | if (if (!(R)) | |
134 | - | then !(S) | |
133 | + | let T = m(R) | |
134 | + | if (if (!(S)) | |
135 | + | then !(T) | |
135 | 136 | else false) | |
136 | 137 | then throw("no side approved defeat") | |
137 | 138 | else { | |
138 | - | let | |
139 | - | then | |
140 | - | else | |
141 | - | let | |
142 | - | if (( | |
139 | + | let U = if (S) | |
140 | + | then R | |
141 | + | else Q | |
142 | + | let V = getString(this, (U + "_owner")) | |
143 | + | if ((V != toBase58String(f.caller.bytes))) | |
143 | 144 | then throw("paywinner() should be called by winner only") | |
144 | 145 | else { | |
145 | - | let i = extract(getInteger(this, ( | |
146 | - | g(f, WriteSet([DataEntry(( | |
146 | + | let i = extract(getInteger(this, (P + "_amount"))) | |
147 | + | g(f, WriteSet([DataEntry((P + "_paid"), i)]), i) | |
147 | 148 | } | |
148 | 149 | } | |
149 | 150 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'33kV5hRVtgEGpYqhp9wQn2g9hP1fNWSYGCzzYk1T9Hyg' | |
5 | 5 | ||
6 | 6 | let b = 5000000 | |
7 | 7 | ||
8 | 8 | let c = 5000000 | |
9 | 9 | ||
10 | 10 | let d = 5000000 | |
11 | 11 | ||
12 | 12 | func e (f) = if ((f.fee > b)) | |
13 | 13 | then throw("unreasonable large fee") | |
14 | 14 | else if ((f.feeAssetId != unit)) | |
15 | 15 | then throw("fee must be in WAVES") | |
16 | 16 | else true | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func g (f,h,i) = if (e(f)) | |
20 | 20 | then ScriptResult(h, TransferSet([ScriptTransfer(f.caller, f.fee, unit)])) | |
21 | 21 | else throw("error") | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func j (f,k) = (getString(this, (k + "_owner")) == toBase58String(f.caller.bytes)) | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func l (k) = (extract(getInteger(this, (k + "_amount"))) - extract(getInteger(this, (k + "_spent")))) | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func m (k) = { | |
31 | 31 | let n = getInteger(this, (k + "_defeat")) | |
32 | 32 | if ((n == 1)) | |
33 | 33 | then true | |
34 | 34 | else (n == 3) | |
35 | 35 | } | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | @Callable(f) | |
39 | 39 | func bet (o,p,q,r) = { | |
40 | 40 | let s = toBase58String(f.caller.bytes) | |
41 | 41 | let t = extract(f.payment) | |
42 | 42 | if ((t.assetId != a)) | |
43 | 43 | then throw(("bet must be in asset " + toBase58String(a))) | |
44 | 44 | else if ((c > t.amount)) | |
45 | 45 | then throw(("minimum allowed bet is " + toString(c))) | |
46 | 46 | else if (if ((q != "for")) | |
47 | 47 | then (q != "against") | |
48 | 48 | else false) | |
49 | 49 | then throw("unexpected side") | |
50 | 50 | else { | |
51 | 51 | let k = (((((("bet_" + o) + "_") + toBase58String(f.caller.bytes)) + "_") + take(toBase64String(f.transactionId), 15)) + "_") | |
52 | - | let u = { | |
53 | - | let v = getInteger(this, ((("seq_" + o) + "_") + p)) | |
54 | - | if ($isInstanceOf(v, "Int")) | |
52 | + | let u = ((("seq_" + o) + "_") + p) | |
53 | + | let v = { | |
54 | + | let w = getInteger(this, u) | |
55 | + | if ($isInstanceOf(w, "Int")) | |
55 | 56 | then { | |
56 | - | let | |
57 | - | ( | |
57 | + | let x = w | |
58 | + | (x + 1) | |
58 | 59 | } | |
59 | 60 | else 1 | |
60 | 61 | } | |
61 | - | g(f, WriteSet([DataEntry((k + "owner"), s), DataEntry((k + "event"), o), DataEntry((k + "subevent"), p), DataEntry((k + "side"), q), DataEntry((k + "odds"), r), DataEntry((k + "amount"), t.amount), DataEntry((k + "spent"), 0), DataEntry((k + "timestamp"), lastBlock.timestamp), DataEntry((k + "sequence"), u)]), 0) | |
62 | + | g(f, WriteSet([DataEntry((k + "owner"), s), DataEntry((k + "event"), o), DataEntry((k + "subevent"), p), DataEntry((k + "side"), q), DataEntry((k + "odds"), r), DataEntry((k + "amount"), t.amount), DataEntry((k + "spent"), 0), DataEntry((k + "timestamp"), lastBlock.timestamp), DataEntry((k + "sequence"), v), DataEntry(u, v)]), 0) | |
62 | 63 | } | |
63 | 64 | } | |
64 | 65 | ||
65 | 66 | ||
66 | 67 | ||
67 | 68 | @Callable(f) | |
68 | 69 | func cancel (k) = if (!(j(f, k))) | |
69 | 70 | then throw("permission denied") | |
70 | 71 | else { | |
71 | 72 | let i = extract(getInteger(this, (k + "_amount"))) | |
72 | - | let | |
73 | - | let | |
74 | - | g(f, WriteSet([DataEntry((k + "_spent"), i), DataEntry((k + "_cancel_amount"), | |
73 | + | let y = extract(getInteger(this, (k + "_spent"))) | |
74 | + | let z = (i - y) | |
75 | + | g(f, WriteSet([DataEntry((k + "_spent"), i), DataEntry((k + "_cancel_amount"), z)]), z) | |
75 | 76 | } | |
76 | 77 | ||
77 | 78 | ||
78 | 79 | ||
79 | 80 | @Callable(f) | |
80 | - | func betMatch ( | |
81 | + | func betMatch (A,B) = if ((getString(this, (A + "_event")) != getString(this, (B + "_event")))) | |
81 | 82 | then throw("event id must match") | |
82 | - | else if ((getString(this, ( | |
83 | + | else if ((getString(this, (A + "_subevent")) != getString(this, (B + "_subevent")))) | |
83 | 84 | then throw("subevent id must match") | |
84 | - | else if ((getString(this, ( | |
85 | + | else if ((getString(this, (A + "_side")) != "for")) | |
85 | 86 | then throw("invalid *for* bet") | |
86 | - | else if ((getString(this, ( | |
87 | + | else if ((getString(this, (B + "_side")) != "against")) | |
87 | 88 | then throw("invalid *against* bet") | |
88 | 89 | else { | |
89 | - | let B = extract(getString(this, (z + "_event"))) | |
90 | - | let C = (((((((("match_" + z) + "_") + A) + "_") + B) + "_") + toBase58String(f.transactionId)) + "_") | |
91 | - | let r = extract(getInteger(this, (z + "_odds"))) | |
92 | - | let D = l(z) | |
90 | + | let C = extract(getString(this, (A + "_event"))) | |
91 | + | let D = (((((((("match_" + A) + "_") + B) + "_") + C) + "_") + toBase58String(f.transactionId)) + "_") | |
92 | + | let r = extract(getInteger(this, (A + "_odds"))) | |
93 | 93 | let E = l(A) | |
94 | - | let F = D | |
95 | - | let G = ((E * 100) / r) | |
96 | - | let H = if ((F > G)) | |
97 | - | then G | |
98 | - | else F | |
99 | - | if ((d > H)) | |
94 | + | let F = l(B) | |
95 | + | let G = E | |
96 | + | let H = ((F * 100) / r) | |
97 | + | let I = if ((G > H)) | |
98 | + | then H | |
99 | + | else G | |
100 | + | if ((d > I)) | |
100 | 101 | then throw("match nominal too low") | |
101 | 102 | else { | |
102 | - | let I = H | |
103 | - | let J = ((H * r) / 100) | |
104 | - | let K = (I + D) | |
103 | + | let J = I | |
104 | + | let K = ((I * r) / 100) | |
105 | 105 | let L = (J + E) | |
106 | - | if ((K > extract(getInteger(this, (z + "_amount"))))) | |
106 | + | let M = (K + F) | |
107 | + | if ((L > extract(getInteger(this, (A + "_amount"))))) | |
107 | 108 | then throw("invalid match") | |
108 | - | else if (( | |
109 | + | else if ((M > extract(getInteger(this, (B + "_amount"))))) | |
109 | 110 | then throw("invalid match") | |
110 | - | else g(f, WriteSet([DataEntry(( | |
111 | + | else g(f, WriteSet([DataEntry((D + "amount"), (J + K)), DataEntry((D + "for"), A), DataEntry((D + "against"), B), DataEntry((A + "_spent"), L), DataEntry((B + "_spent"), M)]), 0) | |
111 | 112 | } | |
112 | 113 | } | |
113 | 114 | ||
114 | 115 | ||
115 | 116 | ||
116 | 117 | @Callable(f) | |
117 | - | func approveDefeat ( | |
118 | - | then ( | |
118 | + | func approveDefeat (N,O) = if (if (isDefined(getInteger(this, (N + "_defeat")))) | |
119 | + | then (O == 2) | |
119 | 120 | else false) | |
120 | 121 | then throw("can't dispute after approve") | |
121 | - | else g(f, WriteSet([DataEntry(( | |
122 | + | else g(f, WriteSet([DataEntry((N + "_defeat"), O)]), 0) | |
122 | 123 | ||
123 | 124 | ||
124 | 125 | ||
125 | 126 | @Callable(f) | |
126 | - | func payWinner ( | |
127 | + | func payWinner (P) = if (isDefined(getInteger(this, (P + "_paid")))) | |
127 | 128 | then throw("already paid") | |
128 | 129 | else { | |
129 | - | let P = extract(getString(this, (O + "_for"))) | |
130 | - | let Q = extract(getString(this, (O + "_against"))) | |
131 | - | let R = m(P) | |
130 | + | let Q = extract(getString(this, (P + "_for"))) | |
131 | + | let R = extract(getString(this, (P + "_against"))) | |
132 | 132 | let S = m(Q) | |
133 | - | if (if (!(R)) | |
134 | - | then !(S) | |
133 | + | let T = m(R) | |
134 | + | if (if (!(S)) | |
135 | + | then !(T) | |
135 | 136 | else false) | |
136 | 137 | then throw("no side approved defeat") | |
137 | 138 | else { | |
138 | - | let | |
139 | - | then | |
140 | - | else | |
141 | - | let | |
142 | - | if (( | |
139 | + | let U = if (S) | |
140 | + | then R | |
141 | + | else Q | |
142 | + | let V = getString(this, (U + "_owner")) | |
143 | + | if ((V != toBase58String(f.caller.bytes))) | |
143 | 144 | then throw("paywinner() should be called by winner only") | |
144 | 145 | else { | |
145 | - | let i = extract(getInteger(this, ( | |
146 | - | g(f, WriteSet([DataEntry(( | |
146 | + | let i = extract(getInteger(this, (P + "_amount"))) | |
147 | + | g(f, WriteSet([DataEntry((P + "_paid"), i)]), i) | |
147 | 148 | } | |
148 | 149 | } | |
149 | 150 | } | |
150 | 151 | ||
151 | 152 |
github/deemru/w8io/169f3d6 48.30 ms ◑