tx · Yuhn1h5Tnz9N7pg9e5vNkFuTxzFWGhZJ4A7W9r25rEf

3MypDvVCAuJeZ6TpPpcmwi2FaRxFUSUkLx7:  -0.01400000 Waves

2019.09.08 13:00 [666948] smart account 3MypDvVCAuJeZ6TpPpcmwi2FaRxFUSUkLx7 > SELF 0.00000000 Waves

{ "type": 13, "id": "Yuhn1h5Tnz9N7pg9e5vNkFuTxzFWGhZJ4A7W9r25rEf", "fee": 1400000, "feeAssetId": null, "timestamp": 1567936912751, "version": 1, "sender": "3MypDvVCAuJeZ6TpPpcmwi2FaRxFUSUkLx7", "senderPublicKey": "Cv3xSd2ankhDcqBfBHybjYZNcDCbXHV9HtUXPD1Na9jU", "proofs": [ "3xRP32gAALtXjaAKHAw2bje1j3jFJLyUo3mGHoPHvmjMWSEYpdEw2P5RnGzaGLDJUwFKDhVvdkBLNZbHcdPvQ3jN" ], "script": "base64:AAIDAAAAAAAAAAAAAAAIAAAAAAhkZXRlY3RvcgkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABAgAAAAAAAAAAA2ZlZQAAAAAAAJiWgAAAAAAGbWF4RmVlAAAAAAAATEtAAAAAAAdkYXlTaXplCQAAaAAAAAIJAABoAAAAAgAAAAAAAAAD6AAAAAAAAAAAPAAAAAAAAAAAPAAAAAAJZGF5TWFyZ2luCQAAaAAAAAIJAABoAAAAAgAAAAAAAAAD6AAAAAAAAAAAPAAAAAAAAAAAHgAAAAALdHJhZGVNYXJnaW4JAABoAAAAAgkAAGgAAAACAAAAAAAAAAPoAAAAAAAAAAA8AAAAAAAAAAAKAAAAAA1kZXRlY3RvckdyYWNlCQAAaAAAAAIJAABoAAAAAgAAAAAAAAAD6AAAAAAAAAAAPAAAAAAAAAAACgEAAAALZ2V0SW50ZWdlcjAAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABa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5lcnNBbW91bnQFAAAADWxvb3NlcnNBbW91bnQEAAAADHBheW91dEFtb3VudAkAAGgAAAACCQAAaQAAAAIJAABoAAAAAgkAAGkAAAACBQAAAAt0b3RhbEFtb3VudAAAAAAAAA9CQAUAAAAGYW1vdW50BQAAAA13aW5uZXJzQW1vdW50AAAAAAAAD0JACQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAJcGF5b3V0S2V5BgUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAAFb3duZXIFAAAADHBheW91dEFtb3VudAUAAAAEdW5pdAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAADaW52AAAABmNhbGxlcggFAAAAA2ludgAAAANmZWUFAAAABHVuaXQFAAAAA25pbAAAAADZc6bc", "chainId": 84, "height": 666948, "spentComplexity": 0 } View: original | compacted Prev: B5fJ3c3LuQDmJmCDbBSusth7HCQ1B3o5bKUwvT6rFvpU Next: none Full:
OldNewDifferences
1-{-# STDLIB_VERSION 2 #-}
2-{-# CONTENT_TYPE EXPRESSION #-}
3-let matcherPublicKey = base58''
4-let daySize = ((1000 * 60) * 60)
5-let dayMargin = ((1000 * 60) * 30)
6-let tradeMargin = ((1000 * 60) * 10)
7-let detectorGrace = ((1000 * 60) * 10)
8-match tx {
9- case d: DataTransaction =>
10- let exchangeTx = extract( match transactionById(tx.proofs[0]) {
11- case e: ExchangeTransaction =>
12- e
13- case _ =>
14- unit
15- })
16- let day = (exchangeTx.timestamp / daySize)
17- let tradePeriodStart = (((day + 1) * daySize) - tradeMargin)
18- let tradePeriodEnd = ((day + 1) * daySize)
19- let prefix = ("day_" + toString(day))
20- let maxPrice = match getInteger(tx.sender, (prefix + "_max_price")) {
21- case i: Int =>
22- i
23- case _ =>
24- 0
25- }
26- if (if (if (if (if (if (if ((size(d.data) == 2))
27- then (exchangeTx.price > maxPrice)
28- else false)
29- then (exchangeTx.timestamp >= tradePeriodStart)
30- else false)
31- then (tradePeriodEnd >= exchangeTx.timestamp)
32- else false)
33- then (d.data[0].key == (prefix + "_max_txid"))
34- else false)
35- then (d.data[0].value == toBase58String(tx.proofs[0]))
36- else false)
37- then (d.data[1].key == (prefix + "_max_price"))
38- else false)
39- then (d.data[1].value == exchangeTx.price)
40- else false
41- case _ =>
42- sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
43-}
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let a = addressFromStringValue("")
5+
6+let b = 10000000
7+
8+let c = 5000000
9+
10+let d = ((1000 * 60) * 60)
11+
12+let e = ((1000 * 60) * 30)
13+
14+let f = ((1000 * 60) * 10)
15+
16+let g = ((1000 * 60) * 10)
17+
18+func h (i) = {
19+ let j = getInteger(this, i)
20+ if ($isInstanceOf(j, "Int"))
21+ then {
22+ let k = j
23+ k
24+ }
25+ else 0
26+ }
27+
28+
29+@Callable(l)
30+func bet (m,n) = {
31+ let o = extract(l.payment)
32+ if ((o.assetId != unit))
33+ then throw("bet must be in WAVES")
34+ else {
35+ let p = (o.amount - b)
36+ if ((0 > p))
37+ then throw("amount too low")
38+ else {
39+ let q = (lastBlock.timestamp / d)
40+ let r = (((q + 1) * d) - e)
41+ if ((lastBlock.timestamp > r))
42+ then throw(("timestamp must be less then " + toString(r)))
43+ else {
44+ let s = toBase58String(l.transactionId)
45+ let t = ((("bet_" + toString(q)) + "_") + s)
46+ let u = ("bettotal_" + toString(q))
47+ let v = h(u)
48+ WriteSet([DataEntry((t + "_price"), m), DataEntry((t + "_day"), q), DataEntry((t + "_bet_is_above"), n), DataEntry((t + "_amount"), p), DataEntry((t + "_owner"), toBase58String(l.caller.bytes)), DataEntry(u, (v + 1))])
49+ }
50+ }
51+ }
52+ }
53+
54+
55+
56+@Callable(l)
57+func countBet (w) = if ((l.fee > c))
58+ then throw("unreasonable large fee")
59+ else if ((l.feeAssetId != unit))
60+ then throw("fee must be in WAVES")
61+ else if ((getBoolean(this, (w + "_winner")) != unit))
62+ then throw("already spent")
63+ else {
64+ let p = getIntegerValue(this, (w + "_amount"))
65+ let m = getIntegerValue(this, (w + "_price"))
66+ let x = getIntegerValue(this, (w + "_day"))
67+ let y = getBooleanValue(this, (w + "_bet_is_above"))
68+ let q = (lastBlock.timestamp / d)
69+ if ((x >= q))
70+ then throw("only can process previous day bets")
71+ else {
72+ let z = getIntegerValue(a, (("day_" + toString(x)) + "_max"))
73+ let A = (m >= z)
74+ let B = (A == y)
75+ let C = if (B)
76+ then "winners"
77+ else "loosers"
78+ let D = ((C + "_") + toString(x))
79+ let E = h(D)
80+ let F = ("betcount_" + toString(x))
81+ let G = h(F)
82+ ScriptResult(WriteSet([DataEntry((w + "_winner"), B), DataEntry(D, (E + p)), DataEntry(F, (G + 1))]), TransferSet([ScriptTransfer(l.caller, l.fee, unit)]))
83+ }
84+ }
85+
86+
87+
88+@Callable(l)
89+func payout (w) = if ((l.fee > c))
90+ then throw("unreasonable large fee")
91+ else if ((l.feeAssetId != unit))
92+ then throw("fee must be in WAVES")
93+ else {
94+ let H = (w + "_paid")
95+ if ((getBoolean(this, H) != unit))
96+ then throw("already paid")
97+ else if ((getBoolean(this, (w + "_winner")) != true))
98+ then throw("bet is not winner")
99+ else {
100+ let p = getIntegerValue(this, (w + "_amount"))
101+ let m = getIntegerValue(this, (w + "_price"))
102+ let x = getIntegerValue(this, (w + "_day"))
103+ let I = getStringValue(this, (w + "_owner"))
104+ let F = ("betcount_" + toString(x))
105+ let u = ("bettotal_" + toString(x))
106+ if ((getIntegerValue(this, u) != getIntegerValue(this, F)))
107+ then throw("plase count all tx first")
108+ else {
109+ let J = h(("winners_" + toString(x)))
110+ let K = h(("loosers_" + toString(x)))
111+ let L = (J + K)
112+ let M = ((((L / 1000000) * p) / J) * 1000000)
113+ ScriptResult(WriteSet([DataEntry(H, true)]), TransferSet([ScriptTransfer(addressFromStringValue(I), M, unit), ScriptTransfer(l.caller, l.fee, unit)]))
114+ }
115+ }
116+ }
117+
118+

github/deemru/w8io/026f985 
29.74 ms