tx · 9tnHv4V8UF73Z8Uo4EXwiZkDdfi7QpkmpxPPSBopBFr7 3N78mWnEqz1PUDVJjBgoyivJpitqpxwVAgH: -0.01400000 Waves 2019.09.17 11:06 [679979] smart account 3N78mWnEqz1PUDVJjBgoyivJpitqpxwVAgH > SELF 0.00000000 Waves
{ "type": 13, "id": "9tnHv4V8UF73Z8Uo4EXwiZkDdfi7QpkmpxPPSBopBFr7", "fee": 1400000, "feeAssetId": null, "timestamp": 1568707648784, "version": 1, "sender": "3N78mWnEqz1PUDVJjBgoyivJpitqpxwVAgH", "senderPublicKey": "88re7tFwGU4jjye6Kxg3U4cKzYz7FooSWnqP2NNMfRt5", "proofs": [ "3U7m6KYefLRgtt1dkkb8WfvEZUaDewr5mzabhpWgUkozCDpSnXZwPbiZ2rqf9BVycWnDFnK1dDyrEuc4wxYWw6gZ" ], "script": "base64:AAIDAAAAAAAAAAAAAAAFAAAAAAdxMXN0YXJ0AAAAAAAAAAC+AAAAAAdxMnN0YXJ0AAAAAAAAAAC+AAAAAAFzAAAAAAAAAAAKAQAAAARjb2VmAAAAAgAAAAFxAAAAA2RpZgkAAGkAAAACCQAAaAAAAAIFAAAAAXEJAABkAAAAAgkAAGgAAAACCQAAaAAAAAIA/////////9EFAAAAA2RpZgUAAAADZGlmAAAAAAAAACcQAAAAAAAAACcQAQAAAAthbm90aGVyY29lZgAAAAEAAAABcQQAAAADdmlnAAAAAAAAAAA0CQAAbAAAAAYJAABlAAAAAgkAAGQAAAACBQAAAAN2aWcAAAAAAAAAA+gJAABpAAAAAgAAAAAAAAGGoAUAAAABcQAAAAAAAAAAAAD//////////wAAAAAAAAAAAAAAAAAAAAAABQUAAAAERE9XTgAAAAIAAAAKY29udGV4dE9iagEAAAADYmV0AAAAAQAAAAVldmVudAQAAAABbgkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGhpcwIAAAABbgQAAAABbQkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGh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QEAAAAFdGhyb3cAAAAABAAAAAZldmVudDIEAAAAByRtYXRjaDAJAAQbAAAAAgUAAAAEdGhpcwIAAAAOcmVzdWx0X2V2ZW50XzIDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABFVuaXQEAAAAAXUFAAAAByRtYXRjaDAHAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAdCb29sZWFuBAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiCQEAAAAFdGhyb3cAAAAAAwUAAAAGZXZlbnQxCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQAEJQAAAAEIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgIAAAANX2V2ZW50MWFtb3VudAAAAAAAAAAAAAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgUAAAAMZXZlbnQxYW1vdW50BQAAAAR1bml0BQAAAANuaWwDBQAAAAZldmVudDIJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAQlAAAAAQgFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyAgAAAA1fZXZlbnQyYW1vdW50AAAAAAAAAAAABQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyBQAAAAxldmVudDJhbW91bnQFAAAABHVuaXQFAAAAA25pbAkAAAIAAAABAgAAAAUxMjEyMgAAAADLWO/C", "chainId": 84, "height": 679979, "spentComplexity": 0 } View: original | compacted Prev: Sx7ofUUpnr5r8gMpVWYmtVhLQQDiesXbwyhhxM3yr1A Next: 35SHfw2KPBjCwMwM5hwjTLo1y5ekXuEzJAgjjMMeQ1qH Diff:
Old | New | Differences | |
---|---|---|---|
22 | 22 | let m = getIntegerValue(this, "m") | |
23 | 23 | let count = getIntegerValue(this, "count") | |
24 | 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 | + | } | |
25 | 41 | if ((event == 1)) | |
26 | 42 | then if ((100 >= coef(q1start, ((n + 1) - m)))) | |
27 | 43 | then throw("to low coef") | |
28 | 44 | else { | |
29 | 45 | let nNew = (n + 1) | |
30 | 46 | let countNew = (count + 1) | |
31 | - | WriteSet([DataEntry((toString(countNew) + "_event"), event), DataEntry((toString(countNew) + "_qoef1"), coef(q1start, (n - m))), DataEntry((toString(countNew) + "_qoef2"), anothercoef(coef(q1start, (n - m)))), DataEntry("q1_next", coef(q1start, ((n + 1) - m))), DataEntry("q2_next", anothercoef(coef(q1start, ((n + 1) - m)))), DataEntry("n", nNew), DataEntry("count", countNew)]) | |
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("q1_next", coef(q1start, ((n + 1) - m))), DataEntry("q2_next", anothercoef(coef(q1start, ((n + 1) - m)))), DataEntry("n", nNew), DataEntry("count", countNew)]) | |
32 | 48 | } | |
33 | - | else if ((100 >= anothercoef(coef(q1start, (( | |
49 | + | else if ((100 >= anothercoef(coef(q1start, ((n - m) - 1))))) | |
34 | 50 | then throw("to low coef") | |
35 | 51 | else { | |
36 | 52 | let mNew = (m + 1) | |
37 | 53 | let countNew = (count + 1) | |
38 | - | WriteSet([DataEntry((toString(countNew) + "_event"), event), DataEntry((toString(countNew) + "_qoef2"), anothercoef(coef(q1start, (n - m)))), 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)]) | |
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("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)]) | |
39 | 55 | } | |
40 | 56 | } | |
41 | 57 | ||
42 | 58 | ||
43 | - | @Verifier(contextObj) | |
44 | - | func verify () = true | |
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, unit)])) | |
96 | + | else if (event2) | |
97 | + | then ScriptResult(WriteSet([DataEntry((toString(contextObj.caller) + "_event2amount"), 0)]), TransferSet([ScriptTransfer(contextObj.caller, event2amount, unit)])) | |
98 | + | else throw("12122") | |
99 | + | } | |
100 | + | ||
45 | 101 |
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 s = 10 | |
9 | 9 | ||
10 | 10 | func coef (q,dif) = ((q * (((-47 * dif) * dif) + 10000)) / 10000) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func anothercoef (q) = { | |
14 | 14 | let vig = 52 | |
15 | 15 | pow(((vig + 1000) - (100000 / q)), 0, -1, 0, 5, DOWN) | |
16 | 16 | } | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | @Callable(contextObj) | |
20 | 20 | func bet (event) = { | |
21 | 21 | let n = getIntegerValue(this, "n") | |
22 | 22 | let m = getIntegerValue(this, "m") | |
23 | 23 | let count = getIntegerValue(this, "count") | |
24 | 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 | + | } | |
25 | 41 | if ((event == 1)) | |
26 | 42 | then if ((100 >= coef(q1start, ((n + 1) - m)))) | |
27 | 43 | then throw("to low coef") | |
28 | 44 | else { | |
29 | 45 | let nNew = (n + 1) | |
30 | 46 | let countNew = (count + 1) | |
31 | - | WriteSet([DataEntry((toString(countNew) + "_event"), event), DataEntry((toString(countNew) + "_qoef1"), coef(q1start, (n - m))), DataEntry((toString(countNew) + "_qoef2"), anothercoef(coef(q1start, (n - m)))), DataEntry("q1_next", coef(q1start, ((n + 1) - m))), DataEntry("q2_next", anothercoef(coef(q1start, ((n + 1) - m)))), DataEntry("n", nNew), DataEntry("count", countNew)]) | |
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("q1_next", coef(q1start, ((n + 1) - m))), DataEntry("q2_next", anothercoef(coef(q1start, ((n + 1) - m)))), DataEntry("n", nNew), DataEntry("count", countNew)]) | |
32 | 48 | } | |
33 | - | else if ((100 >= anothercoef(coef(q1start, (( | |
49 | + | else if ((100 >= anothercoef(coef(q1start, ((n - m) - 1))))) | |
34 | 50 | then throw("to low coef") | |
35 | 51 | else { | |
36 | 52 | let mNew = (m + 1) | |
37 | 53 | let countNew = (count + 1) | |
38 | - | WriteSet([DataEntry((toString(countNew) + "_event"), event), DataEntry((toString(countNew) + "_qoef2"), anothercoef(coef(q1start, (n - m)))), 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)]) | |
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("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)]) | |
39 | 55 | } | |
40 | 56 | } | |
41 | 57 | ||
42 | 58 | ||
43 | - | @Verifier(contextObj) | |
44 | - | func verify () = true | |
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, unit)])) | |
96 | + | else if (event2) | |
97 | + | then ScriptResult(WriteSet([DataEntry((toString(contextObj.caller) + "_event2amount"), 0)]), TransferSet([ScriptTransfer(contextObj.caller, event2amount, unit)])) | |
98 | + | else throw("12122") | |
99 | + | } | |
100 | + | ||
45 | 101 |
github/deemru/w8io/169f3d6 59.08 ms ◑