tx · AFY7L4kXfB76pdZijAFCkWLu2QQpMv8xi4GJi8aFZbJj 3ND17nVaEvRLifxdkwXmXZwBvuYwefCMErS: -0.01400000 Waves 2019.08.06 20:13 [619338] smart account 3ND17nVaEvRLifxdkwXmXZwBvuYwefCMErS > SELF 0.00000000 Waves
{ "type": 13, "id": "AFY7L4kXfB76pdZijAFCkWLu2QQpMv8xi4GJi8aFZbJj", "fee": 1400000, "feeAssetId": null, "timestamp": 1565111635237, "version": 1, "sender": "3ND17nVaEvRLifxdkwXmXZwBvuYwefCMErS", "senderPublicKey": "GDy5pgY6ePCFGV6tWjg7nLZQ8U4tXHg2jxbKBe5MHXtd", "proofs": [ "eNJxmwDR7yYLg5WMqwFaz7hRpWwUmaE7HrLpSFoFBctQ4yHP4imR1CiQqBHhYGb5D5KxVipjrt2Pt1VUWWWiCSt" ], "script": "base64:AAIDAAAAAAAAAAAAAAAJAAAAAApiZXRBc3NldElkAQAAACAea7QCZF/XAXMBPEnDQ5kqHUHyOfWmXu9KHDHL6zcNNwAAAAAGbWF4RmVlAAAAAAAATEtAAAAAAAZtaW5CZXQAAAAAAABMS0AAAAAAD21pbk1hdGNoTm9taW5hbAAAAAAAAExLQAEAAAAIY2hlY2tGZWUAAAABAAAAAWkDCQAAZgAAAAIIBQAAAAFpAAAAA2ZlZQUAAAAGbWF4RmVlCQAAAgAAAAECAAAAFnVucmVhc29uYWJsZSBsYXJnZSBmZWUDCQEAAAACIT0AAAACCAUAAAABaQAAAApmZWVBc3NldElkBQAAAAR1bml0CQAAAgAAAAECAAAAFGZlZSBtdXN0IGJlIGluIFdBVkVTBgEAAAAIcmVwYXlGZWUAAAADAAAAAWkAAAACd3MAAAAGYW1vdW50AwkBAAAACGNoZWNrRmVlAAAAAQUAAAABaQkBAAAADFNjcmlwdFJlc3VsdAAAAAIFAAAAAndzCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAA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AETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAAB21hdGNoSWQCAAAABV9wYWlkBQAAAAZhbW91bnQFAAAAA25pbAUAAAAGYW1vdW50AAAAAApzTgI=", "chainId": 84, "height": 619338, "spentComplexity": 0 } View: original | compacted Prev: GhxYTQgZsJMj63TeLxnYjgQKxWseGuf5R9sn6JSE5YrG Next: 347qzHH7XZH6NJJbqcHPQsPBGGJnCXdJFUiNTeq8erCf Diff:
Old | New | Differences | |
---|---|---|---|
72 | 72 | let i = extract(getInteger(this, (k + "_amount"))) | |
73 | 73 | let y = extract(getInteger(this, (k + "_spent"))) | |
74 | 74 | let z = (i - y) | |
75 | - | g(f, WriteSet([DataEntry((k + "_spent"), i), DataEntry((k + "_cancel_amount"), z)]), z) | |
75 | + | g(f, WriteSet([DataEntry((k + "_spent"), i), DataEntry((k + "_cancel_amount"), z), DataEntry((k + "_cancel_tx"), toBase58String(f.transactionId))]), z) | |
76 | 76 | } | |
77 | 77 | ||
78 | 78 |
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), ScriptTransfer(f.caller, i, a)])) | |
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 | 52 | let u = ((("seq_" + o) + "_") + p) | |
53 | 53 | let v = { | |
54 | 54 | let w = getInteger(this, u) | |
55 | 55 | if ($isInstanceOf(w, "Int")) | |
56 | 56 | then { | |
57 | 57 | let x = w | |
58 | 58 | (x + 1) | |
59 | 59 | } | |
60 | 60 | else 1 | |
61 | 61 | } | |
62 | 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) | |
63 | 63 | } | |
64 | 64 | } | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | ||
68 | 68 | @Callable(f) | |
69 | 69 | func cancel (k) = if (!(j(f, k))) | |
70 | 70 | then throw("permission denied") | |
71 | 71 | else { | |
72 | 72 | let i = extract(getInteger(this, (k + "_amount"))) | |
73 | 73 | let y = extract(getInteger(this, (k + "_spent"))) | |
74 | 74 | let z = (i - y) | |
75 | - | g(f, WriteSet([DataEntry((k + "_spent"), i), DataEntry((k + "_cancel_amount"), z)]), z) | |
75 | + | g(f, WriteSet([DataEntry((k + "_spent"), i), DataEntry((k + "_cancel_amount"), z), DataEntry((k + "_cancel_tx"), toBase58String(f.transactionId))]), z) | |
76 | 76 | } | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | ||
80 | 80 | @Callable(f) | |
81 | 81 | func betMatch (A,B) = if ((getString(this, (A + "_event")) != getString(this, (B + "_event")))) | |
82 | 82 | then throw("event id must match") | |
83 | 83 | else if ((getString(this, (A + "_subevent")) != getString(this, (B + "_subevent")))) | |
84 | 84 | then throw("subevent id must match") | |
85 | 85 | else if ((getString(this, (A + "_side")) != "for")) | |
86 | 86 | then throw("invalid *for* bet") | |
87 | 87 | else if ((getString(this, (B + "_side")) != "against")) | |
88 | 88 | then throw("invalid *against* bet") | |
89 | 89 | else { | |
90 | 90 | let C = getStringValue(this, (A + "_owner")) | |
91 | 91 | let D = getStringValue(this, (B + "_owner")) | |
92 | 92 | let E = extract(getString(this, (A + "_event"))) | |
93 | 93 | let F = (((((((("match_" + E) + "_") + takeRight(C, 10)) + "_") + takeRight(D, 10)) + "_") + toBase58String(f.transactionId)) + "_") | |
94 | 94 | let r = extract(getInteger(this, (A + "_odds"))) | |
95 | 95 | let G = l(A) | |
96 | 96 | let H = l(B) | |
97 | 97 | let I = G | |
98 | 98 | let J = ((H * 100) / (r - 100)) | |
99 | 99 | let K = if ((I > J)) | |
100 | 100 | then J | |
101 | 101 | else I | |
102 | 102 | if ((d > K)) | |
103 | 103 | then throw("match nominal too low") | |
104 | 104 | else { | |
105 | 105 | let L = K | |
106 | 106 | let M = ((K * (r - 100)) / 100) | |
107 | 107 | let N = (L + extract(getInteger(this, (A + "_spent")))) | |
108 | 108 | let O = (M + extract(getInteger(this, (B + "_spent")))) | |
109 | 109 | if ((N > extract(getInteger(this, (A + "_amount"))))) | |
110 | 110 | then throw("invalid match") | |
111 | 111 | else if ((O > extract(getInteger(this, (B + "_amount"))))) | |
112 | 112 | then throw("invalid match") | |
113 | 113 | else g(f, WriteSet([DataEntry((F + "amount"), (L + M)), DataEntry((F + "for"), A), DataEntry((F + "against"), B), DataEntry((A + "_spent"), N), DataEntry((B + "_spent"), O)]), 0) | |
114 | 114 | } | |
115 | 115 | } | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | ||
119 | 119 | @Callable(f) | |
120 | 120 | func approveDefeat (P,Q) = if (if (isDefined(getInteger(this, (P + "_defeat")))) | |
121 | 121 | then (Q == 2) | |
122 | 122 | else false) | |
123 | 123 | then throw("can't dispute after approve") | |
124 | 124 | else g(f, WriteSet([DataEntry((P + "_defeat"), Q)]), 0) | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | ||
128 | 128 | @Callable(f) | |
129 | 129 | func payWinner (R) = if (isDefined(getInteger(this, (R + "_paid")))) | |
130 | 130 | then throw("already paid") | |
131 | 131 | else { | |
132 | 132 | let S = extract(getString(this, (R + "_for"))) | |
133 | 133 | let T = extract(getString(this, (R + "_against"))) | |
134 | 134 | let U = m(S) | |
135 | 135 | let V = m(T) | |
136 | 136 | if (if (!(U)) | |
137 | 137 | then !(V) | |
138 | 138 | else false) | |
139 | 139 | then throw("no side approved defeat") | |
140 | 140 | else { | |
141 | 141 | let W = if (U) | |
142 | 142 | then T | |
143 | 143 | else S | |
144 | 144 | let X = getString(this, (W + "_owner")) | |
145 | 145 | if ((X != toBase58String(f.caller.bytes))) | |
146 | 146 | then throw("paywinner() should be called by winner only") | |
147 | 147 | else { | |
148 | 148 | let i = extract(getInteger(this, (R + "_amount"))) | |
149 | 149 | g(f, WriteSet([DataEntry((R + "_paid"), i)]), i) | |
150 | 150 | } | |
151 | 151 | } | |
152 | 152 | } | |
153 | 153 | ||
154 | 154 |
github/deemru/w8io/169f3d6 58.72 ms ◑