tx · AJwraVHbGZETX4LA2k7ejNkSYinksMEwywySndVxnocB

3Mu46QfBkouwvPnhYc6QZa45NAFTpiD64YG:  -0.01000000 Waves

2019.02.12 21:10 [492264] smart account 3Mu46QfBkouwvPnhYc6QZa45NAFTpiD64YG > SELF 0.00000000 Waves

{ "type": 13, "id": "AJwraVHbGZETX4LA2k7ejNkSYinksMEwywySndVxnocB", "fee": 1000000, "feeAssetId": null, "timestamp": 1549995150780, "version": 1, "sender": "3Mu46QfBkouwvPnhYc6QZa45NAFTpiD64YG", "senderPublicKey": "6pNwnxPaq9gFLzCbWjiseC5UTT3Gtt3RFwaQ6bMshN6p", "proofs": [ "23b1sMssJxxzSmJZhYY6zRJusEH7UcmFU8CqZjFtV9NAUtbkzEpf38aqgoXD9wQ6AtE4Yb6rDU1e24RiCdA4qdov" ], "script": "base64:AQQAAAACbWUIBQAAAAJ0eAAAAAZzZW5kZXIEAAAABm9yYWNsZQkBAAAAB2V4dHJhY3QAAAABCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAACMzTkN6YVlUTkRHdFI4emY5eWZjcWVQRmpDcUZ4OVM1emhzNAQAAAAObWluV2l0aGRyYXdGZWUAAAAAAAAHoSAEAAAAEHJlZ2lzdGVyQmV0VHhGZWUAAAAAAAAHoSAEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNUcmFuc2ZlclRyYW5zYWN0aW9uBAAAAAp3aXRoZHJhd1R4BQAAAAckbWF0Y2gwBAAAAA5wYXltZW50VHhJZFN0cgkAAlgAAAABCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAEEAAAACndpdGhkcmF3SWQJAQAAAAdleHRyYWN0AAAAAQkABB0AAAACBQAAAAJtZQkAASwAAAACBQAAAA5wYXltZW50VHhJZFN0cgIAAAAJX3dpdGhkcmF3BAAAAAckbWF0Y2gxCQAD6AAAAAEJAAGRAAAAAggFAAAAAnR4AAAABnBy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ZW50VHgAAAAGYW1vdW50CAUAAAADZHR4AAAAA2ZlZQcHBwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXlXYE7u", "chainId": 84, "height": 492264, "spentComplexity": 0 } View: original | compacted Prev: none Next: 5rgEVY2Jv4Du8fJdbMatAZ2qcYakztvEds3n4XDfPopD Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 1 #-}
2+{-# CONTENT_TYPE EXPRESSION #-}
3+let me = tx.sender
4+let oracle = extract(addressFromString("3NCzaYTNDGtR8zf9yfcqePFjCqFx9S5zhs4"))
5+let minWithdrawFee = 500000
6+let registerBetTxFee = 500000
7+match tx {
8+ case withdrawTx: TransferTransaction =>
9+ let paymentTxIdStr = toBase58String(tx.proofs[1])
10+ let withdrawId = extract(getString(me, (paymentTxIdStr + "_withdraw")))
11+ match transactionById(tx.proofs[1]) {
12+ case paymentTx: TransferTransaction =>
13+ let withdrawAllowed = if ((withdrawId == toBase58String(tx.id)))
14+ then sigVerify(tx.bodyBytes, tx.proofs[0], paymentTx.senderPublicKey)
15+ else false
16+ let feesKey = (toBase58String(tx.proofs[1]) + "_withdraw_fees")
17+ let dataTxsFees = extract(getInteger(me, feesKey))
18+ let winAmount = extract(getInteger(me, (paymentTxIdStr + "_win")))
19+ let correctAmount = ((winAmount - dataTxsFees) - withdrawTx.fee)
20+ let isInWaves = if (!(isDefined(withdrawTx.feeAssetId)))
21+ then !(isDefined(withdrawTx.assetId))
22+ else false
23+ if (if (if (withdrawAllowed)
24+ then true
25+ else throw("Withdraw isn't registered or isn't signed by orignal payment sender"))
26+ then if ((withdrawTx.amount == correctAmount))
27+ then true
28+ else throw(("Amount of withdraw is incorrect. Correct amount is " + toString(correctAmount)))
29+ else false)
30+ then if (isInWaves)
31+ then true
32+ else throw("Withdraw and fee must be in WAVES")
33+ else false
34+ case _ =>
35+ false
36+ }
37+ case dtx: DataTransaction =>
38+ if ((size(dtx.data) == 1))
39+ then {
40+ let winStr = extract(dtx.data[0].key)
41+ let paymentTxIdStr = dropRight(winStr, 4)
42+ let guess = extract(getString(me, paymentTxIdStr))
43+ let linkToGame = extract(getString(me, (paymentTxIdStr + "_round")))
44+ let resultOfGame = extract(getString(oracle, linkToGame))
45+ let paymentTx = transactionById(fromBase58String(paymentTxIdStr))
46+ match paymentTx {
47+ case paymentTx: TransferTransaction =>
48+ if ((guess == resultOfGame))
49+ then {
50+ let sum0 = if (isDefined(getInteger(me, (linkToGame + "_0"))))
51+ then extract(getInteger(me, (linkToGame + "_0")))
52+ else 0
53+ let sum1 = if (isDefined(getInteger(me, (linkToGame + "_1"))))
54+ then extract(getInteger(me, (linkToGame + "_1")))
55+ else 0
56+ let sum2 = if (isDefined(getInteger(me, (linkToGame + "_2"))))
57+ then extract(getInteger(me, (linkToGame + "_2")))
58+ else 0
59+ let total = ((sum0 + sum1) + sum2)
60+ let koeff = if ((resultOfGame == "0"))
61+ then (total / sum0)
62+ else if ((resultOfGame == "1"))
63+ then (total / sum1)
64+ else if ((resultOfGame == "2"))
65+ then (total / sum2)
66+ else throw("Internal error. Wrong value for result of game")
67+ ((((paymentTx.amount - registerBetTxFee) * koeff) - dtx.fee) == extract(getInteger(dtx.data, dtx.data[0].key)))
68+ }
69+ else throw("You didn't guess right.")
70+ case _ =>
71+ false
72+ }
73+ }
74+ else if ((size(dtx.data) == 2))
75+ then {
76+ let withdrawStr = extract(dtx.data[0].key)
77+ let paymentTxIdStr = dropRight(withdrawStr, 9)
78+ let winAmount = extract(getInteger(me, (paymentTxIdStr + "_win")))
79+ let feesKey = (extract(dtx.data[0].key) + "_fees")
80+ let newFees = extract(getInteger(dtx.data, feesKey))
81+ let oldFees = if (isDefined(getInteger(me, feesKey)))
82+ then extract(getInteger(me, feesKey))
83+ else 0
84+ let isFeeCorrect = (newFees == (oldFees + dtx.fee))
85+ let isPaymentAlreadyMentioned = isDefined(getString(me, withdrawStr))
86+ let withdrawTransactionId = fromBase58String(extract(getString(me, withdrawStr)))
87+ let isWithdrawExist = isDefined(transactionById(withdrawTransactionId))
88+ if (if (if (if (if (!(isPaymentAlreadyMentioned))
89+ then true
90+ else !(isWithdrawExist))
91+ then true
92+ else throw("Withdraw for this bet already exist"))
93+ then isFeeCorrect
94+ else false)
95+ then true
96+ else throw("Value for withdraw fees is incorrect"))
97+ then if ((winAmount > (newFees - minWithdrawFee)))
98+ then true
99+ else throw("Win amount is not enough for all fees")
100+ else false
101+ }
102+ else if ((size(dtx.data) == 3))
103+ then {
104+ let paymentTxIdStr = extract(dtx.data[0].key)
105+ let guessStr = extract(getString(dtx.data, paymentTxIdStr))
106+ let paymentRoundKey = (paymentTxIdStr + "_round")
107+ let paymentRound = extract(getString(dtx.data, paymentRoundKey))
108+ let sumBetsOld = if (isDefined(getInteger(me, ((paymentRound + "_") + guessStr))))
109+ then extract(getInteger(me, ((paymentRound + "_") + guessStr)))
110+ else 0
111+ let sumBetsNew = extract(getInteger(dtx.data, ((paymentRound + "_") + guessStr)))
112+ let isPaymentAlreadyMentioned = isDefined(getString(me, paymentTxIdStr))
113+ let paymentTx = transactionById(fromBase58String(paymentTxIdStr))
114+ match paymentTx {
115+ case paymentTx: TransferTransaction =>
116+ let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey)
117+ if (!(isPaymentAlreadyMentioned))
118+ then (sumBetsNew == ((sumBetsOld + paymentTx.amount) - dtx.fee))
119+ else false
120+ case _ =>
121+ false
122+ }
123+ }
124+ else false
125+ case _ =>
126+ sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
127+}

github/deemru/w8io/026f985 
17.14 ms