tx · D6o5ccg55yGzo92omLTMVAJnh1PWx7rozQR9EVHYjE7e 3N3AeA5FWm7EHheHoik8BBEA3GXXJosnVY8: -0.01400000 Waves 2019.10.07 16:02 [709393] smart account 3N3AeA5FWm7EHheHoik8BBEA3GXXJosnVY8 > SELF 0.00000000 Waves
{ "type": 13, "id": "D6o5ccg55yGzo92omLTMVAJnh1PWx7rozQR9EVHYjE7e", "fee": 1400000, "feeAssetId": null, "timestamp": 1570453360521, "version": 1, "sender": "3N3AeA5FWm7EHheHoik8BBEA3GXXJosnVY8", "senderPublicKey": "87US7E5SdpUB7rbkzLmEUKfYg7uihzCvRzEKy1mCNNjq", "proofs": [ "37n1WM5KFP1BavbRjeFDVDmJYj9ag6f9QJmxGNSMZjAWu28L8zexzPrgFU8tpKwPg4Lh2o7PPqD7HRgZ7GCi1aF1" ], "script": "base64:AAIDAAAAAAAAAAkIARIDCgEBEgAAAAAGAAAAAAdxMXN0YXJ0AAAAAAAAAAC+AAAAAAdxMnN0YXJ0AAAAAAAAAAC+AAAAAAN2aWcAAAAAAAAAADQAAAAAAXMAAAAAAAAAAAoBAAAABGNvZWYAAAACAAAAAXEAAAADZGlmBAAAAARjb2VmCQAAaQAAAAIJAABoAAAAAgUAAAABcQkAAGQAAAACCQAAaAAAAAIJAABoAAAAAgD/////////0QUAAAADZGlmBQAAAANkaWYAAAAAAAAAJxAAAAAAAAAAJxAFAAAABGNvZWYBAAAAC2Fub3RoZXJjb2VmAAAAAgAAAAFxAAAAA2RpZgQAAAAJYWN0dWFsdmlnCQAAaQAAAAIJAABoAAAAAgUAAAADdmlnCQAAZAAAAAIJAABkAAAAAgkAAGgAAAACCQAAaAAAAAIA/////////6EFAAAAA2RpZgUAAAADZGlmCQAAaAAAAAIAAAAAAAAAB1UFAAAAA2RpZgAAAAAAAAAnEAAAAAAAAAAnEAQAAAALYW5vdGhlcmNvZWYJAABsAAAABgkAAGUAAAACCQAAZAAAAAIFAAAACWFjdHVhbHZpZwAAAAAAAAAD6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chainId": 84, "height": 709393, "spentComplexity": 0 } View: original | compacted Prev: 43vpTbvQ1CEj642HLsgoe22c4zr8SHpvrTmTPhSugngY Next: 8ABcaMB7WtXy5fRPAugb1XACU1HLrrTd4AUnMwaMFDqh Diff:
Old | New | Differences | |
---|---|---|---|
5 | 5 | ||
6 | 6 | let q2start = 190 | |
7 | 7 | ||
8 | - | let vig = | |
8 | + | let vig = 52 | |
9 | 9 | ||
10 | 10 | let s = 10 | |
11 | 11 | ||
59 | 59 | else (difold - 1) | |
60 | 60 | let q1 = if ((dif >= 0)) | |
61 | 61 | then coef(q1start, dif) | |
62 | - | else anothercoef( | |
62 | + | else anothercoef(coef(q2start, dif), dif) | |
63 | 63 | let q2 = if ((dif >= 0)) | |
64 | - | then anothercoef( | |
64 | + | then anothercoef(q1, dif) | |
65 | 65 | else coef(q2start, dif) | |
66 | 66 | let q1next = if (((dif + 1) >= 0)) | |
67 | 67 | then coef(q1start, (dif + 1)) | |
68 | - | else anothercoef( | |
68 | + | else anothercoef(coef(q2start, (dif + 1)), (dif + 1)) | |
69 | 69 | let q2next = if (((dif - 1) >= 0)) | |
70 | - | then anothercoef( | |
71 | - | else coef(q2start, (dif - 1)) | |
70 | + | then anothercoef(q1, (dif - 1)) | |
71 | + | else anothercoef(coef(q2start, (dif - 1)), (dif - 1)) | |
72 | 72 | let countNew = (count + 1) | |
73 | 73 | if ((event == 1)) | |
74 | 74 | then if ((100 > q1)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let q1start = 190 | |
5 | 5 | ||
6 | 6 | let q2start = 190 | |
7 | 7 | ||
8 | - | let vig = | |
8 | + | let vig = 52 | |
9 | 9 | ||
10 | 10 | let s = 10 | |
11 | 11 | ||
12 | 12 | func coef (q,dif) = { | |
13 | 13 | let coef = ((q * (((-47 * dif) * dif) + 10000)) / 10000) | |
14 | 14 | coef | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func anothercoef (q,dif) = { | |
19 | 19 | let actualvig = ((vig * ((((-95 * dif) * dif) + (1877 * dif)) + 10000)) / 10000) | |
20 | 20 | let anothercoef = pow(((actualvig + 1000) - (100000 / q)), 0, -1, 0, 5, DOWN) | |
21 | 21 | if ((anothercoef > 270)) | |
22 | 22 | then 270 | |
23 | 23 | else anothercoef | |
24 | 24 | } | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | @Callable(contextObj) | |
28 | 28 | func bet (event) = { | |
29 | 29 | let payment = match contextObj.payment { | |
30 | 30 | case p: AttachedPayment => | |
31 | 31 | if ((100000000 > p.amount)) | |
32 | 32 | then throw("low payment") | |
33 | 33 | else p | |
34 | 34 | case _ => | |
35 | 35 | throw("Payment not attached") | |
36 | 36 | } | |
37 | 37 | let n = getIntegerValue(this, "n") | |
38 | 38 | let m = getIntegerValue(this, "m") | |
39 | 39 | let count = getIntegerValue(this, "count") | |
40 | 40 | let difold = (n - m) | |
41 | 41 | let event1amount = match getInteger(this, (toString(contextObj.caller) + "_event1amount")) { | |
42 | 42 | case u: Unit => | |
43 | 43 | 0 | |
44 | 44 | case i: Int => | |
45 | 45 | i | |
46 | 46 | case _ => | |
47 | 47 | throw() | |
48 | 48 | } | |
49 | 49 | let event2amount = match getInteger(this, (toString(contextObj.caller) + "_event2amount")) { | |
50 | 50 | case u: Unit => | |
51 | 51 | 0 | |
52 | 52 | case i: Int => | |
53 | 53 | i | |
54 | 54 | case _ => | |
55 | 55 | throw() | |
56 | 56 | } | |
57 | 57 | let dif = if ((event == 1)) | |
58 | 58 | then (difold + 1) | |
59 | 59 | else (difold - 1) | |
60 | 60 | let q1 = if ((dif >= 0)) | |
61 | 61 | then coef(q1start, dif) | |
62 | - | else anothercoef( | |
62 | + | else anothercoef(coef(q2start, dif), dif) | |
63 | 63 | let q2 = if ((dif >= 0)) | |
64 | - | then anothercoef( | |
64 | + | then anothercoef(q1, dif) | |
65 | 65 | else coef(q2start, dif) | |
66 | 66 | let q1next = if (((dif + 1) >= 0)) | |
67 | 67 | then coef(q1start, (dif + 1)) | |
68 | - | else anothercoef( | |
68 | + | else anothercoef(coef(q2start, (dif + 1)), (dif + 1)) | |
69 | 69 | let q2next = if (((dif - 1) >= 0)) | |
70 | - | then anothercoef( | |
71 | - | else coef(q2start, (dif - 1)) | |
70 | + | then anothercoef(q1, (dif - 1)) | |
71 | + | else anothercoef(coef(q2start, (dif - 1)), (dif - 1)) | |
72 | 72 | let countNew = (count + 1) | |
73 | 73 | if ((event == 1)) | |
74 | 74 | then if ((100 > q1)) | |
75 | 75 | then throw(("to low coef q1 = " + toString(q1))) | |
76 | 76 | else { | |
77 | 77 | let nNew = (n + 1) | |
78 | 78 | WriteSet([DataEntry((toString(contextObj.caller) + "_event1amount"), (event1amount + q1)), DataEntry((toString(countNew) + "_event"), event), DataEntry((toString(countNew) + "_qoef1"), q1), DataEntry((toString(countNew) + "_qoef2"), q2), DataEntry((toString(countNew) + "_bettor"), toString(contextObj.caller)), DataEntry("q1_next", q1next), DataEntry("q2_next", q2next), DataEntry("n", nNew), DataEntry("count", countNew)]) | |
79 | 79 | } | |
80 | 80 | else if ((100 > q2)) | |
81 | 81 | then throw(("to low coef q2 = " + toString(q2))) | |
82 | 82 | else { | |
83 | 83 | let mNew = (m + 1) | |
84 | 84 | WriteSet([DataEntry((toString(contextObj.caller) + "_event2amount"), (event2amount + q2)), DataEntry((toString(countNew) + "_event"), event), DataEntry((toString(countNew) + "_qoef2"), q2), DataEntry((toString(countNew) + "_bettor"), toString(contextObj.caller)), DataEntry("q1_next", q1next), DataEntry("q2_next", q2next), DataEntry((toString(countNew) + "_qoef1"), coef(q1start, (n - m))), DataEntry("m", mNew), DataEntry("count", countNew)]) | |
85 | 85 | } | |
86 | 86 | } | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | ||
90 | 90 | @Callable(contextObj) | |
91 | 91 | func withdraw () = { | |
92 | 92 | let event1amount = match getInteger(this, (toString(contextObj.caller) + "_event1amount")) { | |
93 | 93 | case u: Unit => | |
94 | 94 | 0 | |
95 | 95 | case i: Int => | |
96 | 96 | i | |
97 | 97 | case _ => | |
98 | 98 | throw() | |
99 | 99 | } | |
100 | 100 | let event2amount = match getInteger(this, (toString(contextObj.caller) + "_event2amount")) { | |
101 | 101 | case u: Unit => | |
102 | 102 | 0 | |
103 | 103 | case i: Int => | |
104 | 104 | i | |
105 | 105 | case _ => | |
106 | 106 | throw() | |
107 | 107 | } | |
108 | 108 | let event1 = match getBoolean(this, "result_event_1") { | |
109 | 109 | case u: Unit => | |
110 | 110 | false | |
111 | 111 | case b: Boolean => | |
112 | 112 | b | |
113 | 113 | case _ => | |
114 | 114 | throw() | |
115 | 115 | } | |
116 | 116 | let event2 = match getBoolean(this, "result_event_2") { | |
117 | 117 | case u: Unit => | |
118 | 118 | false | |
119 | 119 | case b: Boolean => | |
120 | 120 | b | |
121 | 121 | case _ => | |
122 | 122 | throw() | |
123 | 123 | } | |
124 | 124 | if (event1) | |
125 | 125 | then ScriptResult(WriteSet([DataEntry((toString(contextObj.caller) + "_event1amount"), 0)]), TransferSet([ScriptTransfer(contextObj.caller, (event1amount * 1000000), unit)])) | |
126 | 126 | else if (event2) | |
127 | 127 | then ScriptResult(WriteSet([DataEntry((toString(contextObj.caller) + "_event2amount"), 0)]), TransferSet([ScriptTransfer(contextObj.caller, (event2amount * 1000000), unit)])) | |
128 | 128 | else throw("event did not happen or you have zero win") | |
129 | 129 | } | |
130 | 130 | ||
131 | 131 |
github/deemru/w8io/026f985 46.14 ms ◑