tx · GaPQnzaxkLrKukGDaSyo1oxQwsL8kgCyuhAHPzkM8LXu

3MqQXg8TH4WLmX8PaK8jJsfSJzUBj6wUeiW:  -0.01000000 Waves

2019.09.07 14:33 [665592] smart account 3MqQXg8TH4WLmX8PaK8jJsfSJzUBj6wUeiW > SELF 0.00000000 Waves

{ "type": 13, "id": "GaPQnzaxkLrKukGDaSyo1oxQwsL8kgCyuhAHPzkM8LXu", "fee": 1000000, "feeAssetId": null, "timestamp": 1567856011943, "version": 1, "sender": "3MqQXg8TH4WLmX8PaK8jJsfSJzUBj6wUeiW", "senderPublicKey": "GYyWepK7hRV3wxNEnzgJkryWCnQtN9eDyaSbm3vQF3ec", "proofs": [ "2NEnFzU41LUaVWLNiNQscLX3TQ7RVr9zH5M5YnqyuZv3w7WqGKJg7KMZqvWoPKTbTvJxZbbmEcaKS75Thc1P7LN9" ], "script": "base64:AAIDAAAAAAAAAAwIARIDCgEIEgMKAQgAAAAIAAAAAA5iZXRBY2NlcHRVbnRpbAAAAADo1KUQAAAAAAAMYWJvdmVBY2NvdW50CQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAECAAAAAAAAAAAMYmVsb3dBY2NvdW50CQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAECAAAAAAAAAAAMdHJhZGVBY2NvdW50CQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAECAAAAAAAAAAAGbWF4RmVlAAAAAAAAD0JAAAAAAAltaW5BbW91bnQAAAAAAAX14QABAAAACHJlcGF5RmVlAAAABQAAAAFpAAAAAndzAAAAB2FkZHJlc3MAAAAGYW1vdW50AAAABWFzc2V0AwkAAGYAAAACCAUAAAABaQAAAANmZWUFAAAABm1heEZlZQkAAAIAAAABAgAAABZ1bnJlYXNvbmFibGUgbGFyZ2UgZmVlAwkBAAAAAiE9AAAAAggFAAAAAWkAAAAKZmVlQXNzZXRJZAUAAAAE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vdW50AwkAAGYAAAACBQAAAA5iZXRBY2NlcHRVbnRpbAUAAAALdHhUaW1lc3RhbXAJAQAAAAhyZXBheUZlZQAAAAUFAAAAA2ludgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAMYmV0UmVzdWx0S2V5AgAAAAhhY2NlcHRlZAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAMYmV0QW1vdW50S2V5CQAAZAAAAAIJAQAAAA1nZXRJbnREZWZhdWx0AAAAAwUAAAAEdGhpcwUAAAAMYmV0QW1vdW50S2V5AAAAAAAAAAAABQAAAAZhbW91bnQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAEWJldFRvdGFsQW1vdW50S2V5CQAAZAAAAAIJAQAAAA1nZXRJbnREZWZhdWx0AAAAAwUAAAAEdGhpcwUAAAARYmV0VG90YWxBbW91bnRLZXkAAAAAAAAAAAAFAAAABmFtb3VudAUAAAADbmlsBQAAAAxhYm92ZUFjY291bnQFAAAABmFtb3VudAUAAAAEdW5pdAkBAAAACHJlcGF5RmVlAAAABQUAAAADaW52CQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAxiZXRSZXN1bHRLZXkCAAAACHJldHVybmVkBQAAAANuaWwIBQAAAAZ0eERhdGEAAAAGc2VuZGVyBQAAAAZhbW91bnQIBQAAAAZ0eERhdGEAAAAHYXNzZXRJZAAAAADwxX+K", "chainId": 84, "height": 665592, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let betAcceptUntil = 1000000000000
5+
6+let aboveAccount = addressFromStringValue("")
7+
8+let belowAccount = addressFromStringValue("")
9+
10+let tradeAccount = addressFromStringValue("")
11+
12+let maxFee = 1000000
13+
14+let minAmount = 100000000
15+
16+func repayFee (i,ws,address,amount,asset) = if ((i.fee > maxFee))
17+ then throw("unreasonable large fee")
18+ else if ((i.feeAssetId != unit))
19+ then throw("fee must be in WAVES")
20+ else ScriptResult(ws, TransferSet([ScriptTransfer(i.caller, i.fee, unit), ScriptTransfer(address, amount, asset)]))
21+
22+
23+func getIntDefault (address,key,default) = match getInteger(address, key) {
24+ case i: Int =>
25+ i
26+ case _ =>
27+ default
28+}
29+
30+
31+@Callable(inv)
32+func payout (owner) = {
33+ let payoutKey = ("payout_ " + owner)
34+ if ((getBoolean(this, payoutKey) == true))
35+ then throw("payout already done")
36+ else {
37+ let winner = getString(tradeAccount, "winner")
38+ if (!(isDefined(winner)))
39+ then throw("winner unknown")
40+ else if ((this != aboveAccount))
41+ then throw("invalid account to request payout")
42+ else {
43+ let totalBetAbove = getIntDefault(aboveAccount, "bet_total_amount", 0)
44+ let totalBetBelow = getIntDefault(belowAccount, "bet_total_amount", 0)
45+ let totalBet = (totalBetAbove + totalBetBelow)
46+ let myBetAbove = getIntDefault(aboveAccount, (("bet_" + owner) + "_amount"), 0)
47+ let myBetBelow = getIntDefault(belowAccount, (("bet_" + owner) + "_amount"), 0)
48+ let myWinningBet = if ((winner == "above"))
49+ then myBetAbove
50+ else myBetBelow
51+ let myWinningBase = if ((winner == "above"))
52+ then totalBetAbove
53+ else totalBetBelow
54+ let myWinningAmount = ((totalBet * myWinningBet) / myWinningBase)
55+ let payAmount = if ((totalBet > minAmount))
56+ then (totalBet - minAmount)
57+ else 0
58+ repayFee(inv, WriteSet([DataEntry(payoutKey, true)]), addressFromStringValue(owner), payAmount, unit)
59+ }
60+ }
61+ }
62+
63+
64+
65+@Callable(inv)
66+func registerBetTx (tx) = {
67+ let txData = extract(transferTransactionById(fromBase58String(tx)))
68+ let owner = toBase58String(txData.sender.bytes)
69+ let amount = txData.amount
70+ let txTimestamp = extract(blockInfoByHeight(extract(transactionHeightById(fromBase58String(tx))))).timestamp
71+ let betAmountKey = ((("bet_" + owner) + "_") + "_amount")
72+ let betTotalAmountKey = "bet_total_amount"
73+ let betResultKey = (("tx_" + tx) + "_result")
74+ if ((txData.recipient != this))
75+ then throw("invalid destination")
76+ else if (isDefined(txData.assetId))
77+ then throw("asset not accepted")
78+ else if (isDefined(getInteger(this, betResultKey)))
79+ then throw("tx already registered")
80+ else if ((minAmount > amount))
81+ then throw(("min amount is " + toString(minAmount)))
82+ else if ((betAcceptUntil > txTimestamp))
83+ then repayFee(inv, WriteSet([DataEntry(betResultKey, "accepted"), DataEntry(betAmountKey, (getIntDefault(this, betAmountKey, 0) + amount)), DataEntry(betTotalAmountKey, (getIntDefault(this, betTotalAmountKey, 0) + amount))]), aboveAccount, amount, unit)
84+ else repayFee(inv, WriteSet([DataEntry(betResultKey, "returned")]), txData.sender, amount, txData.assetId)
85+ }
86+
87+

github/deemru/w8io/026f985 
34.35 ms