tx · BqVr4oZhbQ7bbcuQyk6Hr6dYPxSg5dxT9TfgEimAJaSm 3MpDyhdDDnQX4ZczyFxswwaaC46DWe4baRX: -0.01000000 Waves 2019.09.20 09:10 [684256] smart account 3MpDyhdDDnQX4ZczyFxswwaaC46DWe4baRX > SELF 0.00000000 Waves
{ "type": 13, "id": "BqVr4oZhbQ7bbcuQyk6Hr6dYPxSg5dxT9TfgEimAJaSm", "fee": 1000000, "feeAssetId": null, "timestamp": 1568959220863, "version": 1, "sender": "3MpDyhdDDnQX4ZczyFxswwaaC46DWe4baRX", "senderPublicKey": "AxiRXYHSeXqrnLPNFD86aRSRJLPJZkNWVZN5BEUQQSdu", "proofs": [ "nC1tTXtHWYQPiQ6Y6uXzp1L8KHsXhfeSMHWeQRLvDWQtSVPLFKwcWf3pMfEh5NVEPNxWuwubYedqZTrRQav9aZr" ], "script": "base64:AAIDAAAAAAAAAAAAAAAFAAAAAAdxMXN0YXJ0AAAAAAAAAAC+AAAAAAdxMnN0YXJ0AAAAAAAAAAC+AAAAAAFzAAAAAAAAAAAKAQAAAARjb2VmAAAAAgAAAAFxAAAAA2RpZgkAAGkAAAACCQAAaAAAAAIFAAAAAXEJAABkAAAAAgkAAGgAAAACCQAAaAAAAAIA/////////9EFAAAAA2RpZgUAAAADZGlmAAAAAAAAACcQAAAAAAAAACcQAQAAAAthbm90aGVyY29lZgAAAAEAAAABcQQAAAADdmlnAAAAAAAAAAA0CQAAbAAAAAYJAABlAAAAAgkAAGQAAAACBQAAAAN2aWcAAAAAAAAAA+gJAABpAAAAAgAAAAAAAAGGoAUAAAABcQAAAAAAAAAAAAD//////////wAAAAAAAAAAAAAAAAAAAAAABQUAAAAERE9XTgAAAAIAAAAKY29udGV4dE9iagEAAAADYmV0AAAAAQAAAAVldmVudAQAAAABbgkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGhpcwIAAAABbgQAAAABbQkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAA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yAAAAAwgFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyCQAAaAAAAAIFAAAADGV2ZW50MWFtb3VudAAAAAAAAA9CQAUAAAAEdW5pdAUAAAADbmlsAwUAAAAGZXZlbnQyCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQAEJQAAAAEIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgIAAAANX2V2ZW50MmFtb3VudAAAAAAAAAAAAAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgkAAGgAAAACBQAAAAxldmVudDJhbW91bnQAAAAAAAAPQkAFAAAABHVuaXQFAAAAA25pbAkAAAIAAAABAgAAAClldmVudCBkaWQgbm90IGhhcHBlbiBvciB5b3UgaGF2ZSB6ZXJvIHdpbgAAAAD+hUnx", "chainId": 84, "height": 684256, "spentComplexity": 0 } View: original | compacted Prev: none Next: 7JvNp7YobMAUjZVHh3Ao65CPWB6AjcMt5GFWaeEZdqBP Full:
Old | New | Differences | |
---|---|---|---|
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 s = 10 | |
9 | + | ||
10 | + | func coef (q,dif) = ((q * (((-47 * dif) * dif) + 10000)) / 10000) | |
11 | + | ||
12 | + | ||
13 | + | func anothercoef (q) = { | |
14 | + | let vig = 52 | |
15 | + | pow(((vig + 1000) - (100000 / q)), 0, -1, 0, 5, DOWN) | |
16 | + | } | |
17 | + | ||
18 | + | ||
19 | + | @Callable(contextObj) | |
20 | + | func bet (event) = { | |
21 | + | let n = getIntegerValue(this, "n") | |
22 | + | let m = getIntegerValue(this, "m") | |
23 | + | let count = getIntegerValue(this, "count") | |
24 | + | let dif = (n - m) | |
25 | + | let event1amount = match getInteger(this, (toString(contextObj.caller) + "_event1amount")) { | |
26 | + | case u: Unit => | |
27 | + | 0 | |
28 | + | case i: Int => | |
29 | + | i | |
30 | + | case _ => | |
31 | + | throw() | |
32 | + | } | |
33 | + | let event2amount = match getInteger(this, (toString(contextObj.caller) + "_event2amount")) { | |
34 | + | case u: Unit => | |
35 | + | 0 | |
36 | + | case i: Int => | |
37 | + | i | |
38 | + | case _ => | |
39 | + | throw() | |
40 | + | } | |
41 | + | if ((event == 1)) | |
42 | + | then if ((100 > coef(q1start, ((n + 1) - m)))) | |
43 | + | then throw(("to low coef q1 = " + toString(coef(q1start, ((n + 1) - m))))) | |
44 | + | else { | |
45 | + | let nNew = (n + 1) | |
46 | + | let countNew = (count + 1) | |
47 | + | WriteSet([DataEntry((toString(contextObj.caller) + "_event1amount"), (event1amount + coef(q1start, (n - m)))), DataEntry((toString(countNew) + "_event"), event), DataEntry((toString(countNew) + "_qoef1"), coef(q1start, (n - m))), DataEntry((toString(countNew) + "_qoef2"), anothercoef(coef(q1start, (n - m)))), DataEntry((toString(countNew) + "_bettor"), toString(contextObj.caller)), DataEntry("q1_next", coef(q1start, ((n + 1) - m))), DataEntry("q2_next", anothercoef(coef(q1start, ((n + 1) - m)))), DataEntry("n", nNew), DataEntry("count", countNew)]) | |
48 | + | } | |
49 | + | else if ((100 > anothercoef(coef(q1start, ((n - m) - 1))))) | |
50 | + | then throw(("to low coef q2 = " + toString(anothercoef(coef(q1start, ((n - m) - 1)))))) | |
51 | + | else { | |
52 | + | let mNew = (m + 1) | |
53 | + | let countNew = (count + 1) | |
54 | + | WriteSet([DataEntry((toString(contextObj.caller) + "_event2amount"), (event2amount + anothercoef(coef(q1start, (n - m))))), DataEntry((toString(countNew) + "_event"), event), DataEntry((toString(countNew) + "_qoef2"), anothercoef(coef(q1start, (n - m)))), DataEntry((toString(countNew) + "_bettor"), toString(contextObj.caller)), DataEntry("q1_next", coef(q1start, ((n - 1) - m))), DataEntry("q2_next", anothercoef(coef(q1start, ((n - 1) - m)))), DataEntry((toString(countNew) + "_qoef1"), coef(q1start, (n - m))), DataEntry("m", mNew), DataEntry("count", countNew)]) | |
55 | + | } | |
56 | + | } | |
57 | + | ||
58 | + | ||
59 | + | ||
60 | + | @Callable(contextObj) | |
61 | + | func withdraw () = { | |
62 | + | let event1amount = match getInteger(this, (toString(contextObj.caller) + "_event1amount")) { | |
63 | + | case u: Unit => | |
64 | + | 0 | |
65 | + | case i: Int => | |
66 | + | i | |
67 | + | case _ => | |
68 | + | throw() | |
69 | + | } | |
70 | + | let event2amount = match getInteger(this, (toString(contextObj.caller) + "_event2amount")) { | |
71 | + | case u: Unit => | |
72 | + | 0 | |
73 | + | case i: Int => | |
74 | + | i | |
75 | + | case _ => | |
76 | + | throw() | |
77 | + | } | |
78 | + | let event1 = match getBoolean(this, "result_event_1") { | |
79 | + | case u: Unit => | |
80 | + | false | |
81 | + | case b: Boolean => | |
82 | + | b | |
83 | + | case _ => | |
84 | + | throw() | |
85 | + | } | |
86 | + | let event2 = match getBoolean(this, "result_event_2") { | |
87 | + | case u: Unit => | |
88 | + | false | |
89 | + | case b: Boolean => | |
90 | + | b | |
91 | + | case _ => | |
92 | + | throw() | |
93 | + | } | |
94 | + | if (event1) | |
95 | + | then ScriptResult(WriteSet([DataEntry((toString(contextObj.caller) + "_event1amount"), 0)]), TransferSet([ScriptTransfer(contextObj.caller, (event1amount * 1000000), unit)])) | |
96 | + | else if (event2) | |
97 | + | then ScriptResult(WriteSet([DataEntry((toString(contextObj.caller) + "_event2amount"), 0)]), TransferSet([ScriptTransfer(contextObj.caller, (event2amount * 1000000), unit)])) | |
98 | + | else throw("event did not happen or you have zero win") | |
99 | + | } | |
100 | + | ||
101 | + |
github/deemru/w8io/026f985 32.42 ms ◑