tx · D4cHqUaVd8nJZRMptNGfzNfb6aVCd4yvrjutUSJKoyc8 3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP: -0.01400000 Waves 2020.01.03 17:52 [837823] smart account 3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP > SELF 0.00000000 Waves
{ "type": 13, "id": "D4cHqUaVd8nJZRMptNGfzNfb6aVCd4yvrjutUSJKoyc8", "fee": 1400000, "feeAssetId": null, "timestamp": 1578063225007, "version": 1, "sender": "3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP", "senderPublicKey": "3bmZaUZ9wp3K1YZQFqTkN1oZzumQPi7WLQ9QowMaqqEZ", "proofs": [ "5tQxXJoHdMiv8DeyMdj6wbw21Ueopmx6Um5pBjijKmAfntnTCzFydmyAyG57trYpbkB376EjigZcmJ5sQjoybMta" ], "script": "base64:AAIDAAAAAAAAAAkIARIDCgEBEgAAAAAOAAAAAAdxMXN0YXJ0AAAAAAAAAAC+AAAAAAdxMnN0YXJ0AAAAAAAAAAC+AAAAAAN2aWcAAAAAAAAAADQAAAAACnJpc2tBbW91bnQAAAAAAAAAA+gAAAAADGJldFRocmVzaG9sZAAAAAAAAAAACgAAAAAGYmV0TWluAAAAAAAAAAACAAAAAAZiZXRNYXgAAAAAAAAAAGQBAAAACXExRXh0cmFjdAAAAAAEAAAAAnExAwkBAAAACWlzRGVmaW5lZAAAAAECAAAAB3ExX25leHQJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMCAAAAB3ExX25leHQFAAAAB3Exc3RhcnQFAAAAAnExAQAAAAlxMkV4dHJhY3QAAAAABAAAAAJxMgMJAQAAAAlpc0RlZmluZWQAAAABAgAAAAdxMl9uZXh0CQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzAgAAAAdxMl9uZXh0BQAAAAdxMnN0YXJ0BQAAAAJxMgEAAAASZGVidEFtb3VudDFFeHRyYWN0AAAAAAQAAAALZGVidE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AARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkABCUAAAABCAUAAAAKY29udGV4dE9iagAAAAZjYWxsZXICAAAADV9ldmVudDJhbW91bnQAAAAAAAAAAAAFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAAKY29udGV4dE9iagAAAAZjYWxsZXIJAABoAAAAAgUAAAAMZXZlbnQyYW1vdW50AAAAAAAAD0JABQAAAAR1bml0BQAAAANuaWwJAAACAAAAAQIAAAApZXZlbnQgZGlkIG5vdCBoYXBwZW4gb3IgeW91IGhhdmUgemVybyB3aW4AAAAAEeHWeQ==", "chainId": 84, "height": 837823, "spentComplexity": 0 } View: original | compacted Prev: Ds2FD1uGvSTGr473yiPwjXW5963phP91kuF7LjjttmVs Next: DrLXNcvWfaXJYk8sXpAB2NwxiRNitwm8YcwNYEhFLyaZ Diff:
Old | New | Differences | |
---|---|---|---|
98 | 98 | let count = if (isDefined("count")) | |
99 | 99 | then getIntegerValue(this, "count") | |
100 | 100 | else 0 | |
101 | - | throw( | |
101 | + | throw(toString(count)) | |
102 | 102 | } | |
103 | 103 | ||
104 | 104 |
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 | 8 | let vig = 52 | |
9 | 9 | ||
10 | 10 | let riskAmount = 1000 | |
11 | 11 | ||
12 | 12 | let betThreshold = 10 | |
13 | 13 | ||
14 | 14 | let betMin = 2 | |
15 | 15 | ||
16 | 16 | let betMax = 100 | |
17 | 17 | ||
18 | 18 | func q1Extract () = { | |
19 | 19 | let q1 = if (isDefined("q1_next")) | |
20 | 20 | then getIntegerValue(this, "q1_next") | |
21 | 21 | else q1start | |
22 | 22 | q1 | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func q2Extract () = { | |
27 | 27 | let q2 = if (isDefined("q2_next")) | |
28 | 28 | then getIntegerValue(this, "q2_next") | |
29 | 29 | else q2start | |
30 | 30 | q2 | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func debtAmount1Extract () = { | |
35 | 35 | let debtAmount1 = if (isDefined("debtAmount1")) | |
36 | 36 | then getIntegerValue(this, "debtAmount1") | |
37 | 37 | else 0 | |
38 | 38 | debtAmount1 | |
39 | 39 | } | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func debtAmount2Extract () = { | |
43 | 43 | let debtAmount2 = if (isDefined("debtAmount2")) | |
44 | 44 | then getIntegerValue(this, "debtAmount2") | |
45 | 45 | else 0 | |
46 | 46 | debtAmount2 | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func calcCoefIfBigBet (event,betAmount) = { | |
51 | 51 | let q = getIntegerValue(this, event) | |
52 | 52 | let k = (((1 * 100000) - (q * 1000)) / (betMax - betThreshold)) | |
53 | 53 | let b = ((1 * 100000) - (k * betMax)) | |
54 | 54 | let qCorrected = (((betAmount * k) + b) / 1000) | |
55 | 55 | qCorrected | |
56 | 56 | } | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func anothercoef (q,vig) = { | |
60 | 60 | let anothercoef = pow(((vig + 1000) - (100000 / q)), 0, -1, 0, 5, DOWN) | |
61 | 61 | anothercoef | |
62 | 62 | } | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func actualNewCoefs (betAmount,debtAmount1,debtAmount2) = if ((0 > debtAmount1)) | |
66 | 66 | then { | |
67 | 67 | let k = (((1 * 1000000) - (q1start * 10000)) / riskAmount) | |
68 | 68 | let b = ((1 * 1000000) - (k * riskAmount)) | |
69 | 69 | let q1 = ((-(k) * debtAmount1) + (b / 1000)) | |
70 | 70 | let q2 = anothercoef(q1, vig) | |
71 | 71 | [q1, q2] | |
72 | 72 | } | |
73 | 73 | else if ((debtAmount1 > 0)) | |
74 | 74 | then { | |
75 | 75 | let k = (((1 * 1000000) - (q1start * 10000)) / riskAmount) | |
76 | 76 | let b = ((1 * 1000000) - (k * riskAmount)) | |
77 | 77 | let q2 = ((-(k) * debtAmount2) + (b / 1000)) | |
78 | 78 | let q1 = anothercoef(q2, vig) | |
79 | 79 | [q1, q2] | |
80 | 80 | } | |
81 | 81 | else { | |
82 | 82 | let q1 = q1start | |
83 | 83 | let q2 = q2start | |
84 | 84 | [q1, q2] | |
85 | 85 | } | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | @Callable(contextObj) | |
89 | 89 | func bet (event) = { | |
90 | 90 | let betAmount = match contextObj.payment { | |
91 | 91 | case p: AttachedPayment => | |
92 | 92 | if ((betMin > p.amount)) | |
93 | 93 | then throw("low payment") | |
94 | 94 | else p.amount | |
95 | 95 | case _ => | |
96 | 96 | throw("Payment not attached") | |
97 | 97 | } | |
98 | 98 | let count = if (isDefined("count")) | |
99 | 99 | then getIntegerValue(this, "count") | |
100 | 100 | else 0 | |
101 | - | throw( | |
101 | + | throw(toString(count)) | |
102 | 102 | } | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | ||
106 | 106 | @Callable(contextObj) | |
107 | 107 | func withdraw () = { | |
108 | 108 | let event1amount = match getInteger(this, (toString(contextObj.caller) + "__event1DebtForThisPlayer")) { | |
109 | 109 | case u: Unit => | |
110 | 110 | 0 | |
111 | 111 | case i: Int => | |
112 | 112 | i | |
113 | 113 | case _ => | |
114 | 114 | throw() | |
115 | 115 | } | |
116 | 116 | let event2amount = match getInteger(this, (toString(contextObj.caller) + "__event2DebtForThisPlayer")) { | |
117 | 117 | case u: Unit => | |
118 | 118 | 0 | |
119 | 119 | case i: Int => | |
120 | 120 | i | |
121 | 121 | case _ => | |
122 | 122 | throw() | |
123 | 123 | } | |
124 | 124 | let event1 = match getBoolean(this, "result_event_1") { | |
125 | 125 | case u: Unit => | |
126 | 126 | false | |
127 | 127 | case b: Boolean => | |
128 | 128 | b | |
129 | 129 | case _ => | |
130 | 130 | throw() | |
131 | 131 | } | |
132 | 132 | let event2 = match getBoolean(this, "result_event_2") { | |
133 | 133 | case u: Unit => | |
134 | 134 | false | |
135 | 135 | case b: Boolean => | |
136 | 136 | b | |
137 | 137 | case _ => | |
138 | 138 | throw() | |
139 | 139 | } | |
140 | 140 | if (event1) | |
141 | 141 | then ScriptResult(WriteSet([DataEntry((toString(contextObj.caller) + "_event1amount"), 0)]), TransferSet([ScriptTransfer(contextObj.caller, (event1amount * 1000000), unit)])) | |
142 | 142 | else if (event2) | |
143 | 143 | then ScriptResult(WriteSet([DataEntry((toString(contextObj.caller) + "_event2amount"), 0)]), TransferSet([ScriptTransfer(contextObj.caller, (event2amount * 1000000), unit)])) | |
144 | 144 | else throw("event did not happen or you have zero win") | |
145 | 145 | } | |
146 | 146 | ||
147 | 147 |
github/deemru/w8io/026f985 49.90 ms ◑