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