tx · 7FZXu7prfvwUG1YEu62qwYjvqyza1NLtjNnqeJDbDear

3N6UbaxTBjMS5jZmJ9cxqX3YGfe7bsQAzyn:  -0.01400000 Waves

2020.01.03 17:55 [837826] smart account 3N6UbaxTBjMS5jZmJ9cxqX3YGfe7bsQAzyn > SELF 0.00000000 Waves

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

github/deemru/w8io/169f3d6 
27.23 ms