tx · 347qzHH7XZH6NJJbqcHPQsPBGGJnCXdJFUiNTeq8erCf

3ND17nVaEvRLifxdkwXmXZwBvuYwefCMErS:  -0.01400000 Waves

2019.08.07 17:44 [620664] smart account 3ND17nVaEvRLifxdkwXmXZwBvuYwefCMErS > SELF 0.00000000 Waves

{ "type": 13, "id": "347qzHH7XZH6NJJbqcHPQsPBGGJnCXdJFUiNTeq8erCf", "fee": 1400000, "feeAssetId": null, "timestamp": 1565189058289, "version": 1, "sender": "3ND17nVaEvRLifxdkwXmXZwBvuYwefCMErS", "senderPublicKey": "GDy5pgY6ePCFGV6tWjg7nLZQ8U4tXHg2jxbKBe5MHXtd", "proofs": [ "3tTJ9vouuPFUYWUT6KMCAuVgSwwtSX3mmmuFt6WwYoQznhCmtS2doBLS2bGnHb7LEKSNQXkNZiFmLbeDRqyEzPpS" ], "script": "base64:AAIDAAAAAAAAAAAAAAAJAAAAAApiZXRBc3NldElkAQAAACAea7QCZF/XAXMBPEnDQ5kqHUHyOfWmXu9KHDHL6zcNNwAAAAAGbWF4RmVlAAAAAAAATEtAAAAAAAZtaW5CZXQAAAAAAABMS0AAAAAAD21pbk1hdGNoTm9taW5hbAAAAAAAAExLQAEAAAAIY2hlY2tGZWUAAAABAAAAAWkDCQAAZgAAAAIIBQAAAAFpAAAAA2ZlZQUAAAAGbWF4RmVlCQAAAgAAAAECAAAAFnVucmVhc29uYWJsZSBsYXJnZSBmZWUDCQEAAAACIT0AAAACCAUAAAABaQAAAApmZWVBc3NldElkBQAAAAR1bml0CQAAAgAAAAECAAAAFGZlZSBtdXN0IGJlIGluIFdBVkVTBgEAAAAIcmVwYXlGZWUAAAAEAAAAAWkAAAACd3MAAAAGYW1vdW50AAAACXJlY2lwaWVudAMJAQAAAAhjaGVja0ZlZQAAAAEFAAAAAWkDAwkAAGYAAAACBQAAAAZhbW91bnQAAAAAAAAAAAAJAQAAAAlpc0RlZmluZWQAAAABBQAAAAlyZWNpcGllbnQHCQEAAAAMU2NyaXB0Um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bm5lckFkZHJlc3MJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMJAAEsAAAAAgUAAAAId2lubmVySWQCAAAABl9vd25lcgQAAAAGYW1vdW50CQEAAAAHZXh0cmFjdAAAAAEJAAQaAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAdtYXRjaElkAgAAAAdfYW1vdW50CQEAAAAIcmVwYXlGZWUAAAAEBQAAAAFpCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAAB21hdGNoSWQCAAAABV9wYWlkBQAAAAZhbW91bnQFAAAAA25pbAUAAAAGYW1vdW50CQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABBQAAAA13aW5uZXJBZGRyZXNzAAAAAMFYxeU=", "chainId": 84, "height": 620664, "spentComplexity": 0 } View: original | compacted Prev: AFY7L4kXfB76pdZijAFCkWLu2QQpMv8xi4GJi8aFZbJj Next: 9RZKWtSGL3oCjaE2LuVJUUvQ5BfRJv5XEQmh2gyuaBg1 Diff:
OldNewDifferences
1616 else true
1717
1818
19-func repayFee (i,ws,amount) = if (checkFee(i))
20- then ScriptResult(ws, TransferSet([ScriptTransfer(i.caller, i.fee, unit), ScriptTransfer(i.caller, amount, betAssetId)]))
19+func repayFee (i,ws,amount,recipient) = if (checkFee(i))
20+ then if (if ((amount > 0))
21+ then isDefined(recipient)
22+ else false)
23+ then ScriptResult(ws, TransferSet([ScriptTransfer(i.caller, i.fee, unit), ScriptTransfer(extract(recipient), amount, betAssetId)]))
24+ else ScriptResult(ws, TransferSet([ScriptTransfer(i.caller, i.fee, unit)]))
2125 else throw("error")
2226
2327
5660 case _ =>
5761 1
5862 }
59- repayFee(i, WriteSet([DataEntry((betid + "owner"), owner), DataEntry((betid + "event"), event), DataEntry((betid + "subevent"), subevent), DataEntry((betid + "side"), side), DataEntry((betid + "odds"), odds), DataEntry((betid + "amount"), payment.amount), DataEntry((betid + "spent"), 0), DataEntry((betid + "timestamp"), lastBlock.timestamp), DataEntry((betid + "sequence"), sequence), DataEntry(sequenceKey, sequence)]), 0)
63+ repayFee(i, WriteSet([DataEntry((betid + "owner"), owner), DataEntry((betid + "event"), event), DataEntry((betid + "subevent"), subevent), DataEntry((betid + "side"), side), DataEntry((betid + "odds"), odds), DataEntry((betid + "amount"), payment.amount), DataEntry((betid + "spent"), 0), DataEntry((betid + "timestamp"), lastBlock.timestamp), DataEntry((betid + "sequence"), sequence), DataEntry(sequenceKey, sequence)]), 0, unit)
6064 }
6165 }
6266
6973 let amount = extract(getInteger(this, (betid + "_amount")))
7074 let spent = extract(getInteger(this, (betid + "_spent")))
7175 let cancelAmount = (amount - spent)
72- repayFee(i, WriteSet([DataEntry((betid + "_spent"), amount), DataEntry((betid + "_cancel_amount"), cancelAmount), DataEntry((betid + "_cancel_tx"), toBase58String(i.transactionId))]), cancelAmount)
76+ repayFee(i, WriteSet([DataEntry((betid + "_spent"), amount), DataEntry((betid + "_cancel_amount"), cancelAmount), DataEntry((betid + "_cancel_tx"), toBase58String(i.transactionId))]), cancelAmount, i.caller)
7377 }
7478
7579
107111 then throw("invalid match")
108112 else if ((newSpentAgainst > extract(getInteger(this, (betAgainst + "_amount")))))
109113 then throw("invalid match")
110- else repayFee(i, WriteSet([DataEntry((matchid + "amount"), (spendFor + spendAgainst)), DataEntry((matchid + "for"), betFor), DataEntry((matchid + "against"), betAgainst), DataEntry((betFor + "_spent"), newSpentFor), DataEntry((betAgainst + "_spent"), newSpentAgainst)]), 0)
114+ else repayFee(i, WriteSet([DataEntry((matchid + "amount"), (spendFor + spendAgainst)), DataEntry((matchid + "for"), betFor), DataEntry((matchid + "against"), betAgainst), DataEntry((betFor + "_spent"), newSpentFor), DataEntry((betAgainst + "_spent"), newSpentAgainst)]), 0, unit)
111115 }
112116 }
113117
118122 then (defeat == 2)
119123 else false)
120124 then throw("can't dispute after approve")
121- else repayFee(i, WriteSet([DataEntry((betId + "_defeat"), defeat)]), 0)
125+ else repayFee(i, WriteSet([DataEntry((betId + "_defeat"), defeat)]), 0, unit)
122126
123127
124128
138142 let winnerId = if (betForDefeated)
139143 then betAgainstId
140144 else betForId
141- let winnerAddress = getString(this, (winnerId + "_owner"))
142- if ((winnerAddress != toBase58String(i.caller.bytes)))
143- then throw("paywinner() should be called by winner only")
144- else {
145- let amount = extract(getInteger(this, (matchId + "_amount")))
146- repayFee(i, WriteSet([DataEntry((matchId + "_paid"), amount)]), amount)
147- }
145+ let winnerAddress = getStringValue(this, (winnerId + "_owner"))
146+ let amount = extract(getInteger(this, (matchId + "_amount")))
147+ repayFee(i, WriteSet([DataEntry((matchId + "_paid"), amount)]), amount, addressFromString(winnerAddress))
148148 }
149149 }
150150
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let betAssetId = base58'33kV5hRVtgEGpYqhp9wQn2g9hP1fNWSYGCzzYk1T9Hyg'
55
66 let maxFee = 5000000
77
88 let minBet = 5000000
99
1010 let minMatchNominal = 5000000
1111
1212 func checkFee (i) = if ((i.fee > maxFee))
1313 then throw("unreasonable large fee")
1414 else if ((i.feeAssetId != unit))
1515 then throw("fee must be in WAVES")
1616 else true
1717
1818
19-func repayFee (i,ws,amount) = if (checkFee(i))
20- then ScriptResult(ws, TransferSet([ScriptTransfer(i.caller, i.fee, unit), ScriptTransfer(i.caller, amount, betAssetId)]))
19+func repayFee (i,ws,amount,recipient) = if (checkFee(i))
20+ then if (if ((amount > 0))
21+ then isDefined(recipient)
22+ else false)
23+ then ScriptResult(ws, TransferSet([ScriptTransfer(i.caller, i.fee, unit), ScriptTransfer(extract(recipient), amount, betAssetId)]))
24+ else ScriptResult(ws, TransferSet([ScriptTransfer(i.caller, i.fee, unit)]))
2125 else throw("error")
2226
2327
2428 func checkOwner (i,betid) = (getString(this, (betid + "_owner")) == toBase58String(i.caller.bytes))
2529
2630
2731 func getUnspent (betid) = (extract(getInteger(this, (betid + "_amount"))) - extract(getInteger(this, (betid + "_spent"))))
2832
2933
3034 func isDefeated (betid) = {
3135 let defeatStatus = getInteger(this, (betid + "_defeat"))
3236 if ((defeatStatus == 1))
3337 then true
3438 else (defeatStatus == 3)
3539 }
3640
3741
3842 @Callable(i)
3943 func bet (event,subevent,side,odds) = {
4044 let owner = toBase58String(i.caller.bytes)
4145 let payment = extract(i.payment)
4246 if ((payment.assetId != betAssetId))
4347 then throw(("bet must be in asset " + toBase58String(betAssetId)))
4448 else if ((minBet > payment.amount))
4549 then throw(("minimum allowed bet is " + toString(minBet)))
4650 else if (if ((side != "for"))
4751 then (side != "against")
4852 else false)
4953 then throw("unexpected side")
5054 else {
5155 let betid = (((((("bet_" + event) + "_") + toBase58String(i.caller.bytes)) + "_") + take(toBase64String(i.transactionId), 15)) + "_")
5256 let sequenceKey = ((("seq_" + event) + "_") + subevent)
5357 let sequence = match getInteger(this, sequenceKey) {
5458 case prevS: Int =>
5559 (prevS + 1)
5660 case _ =>
5761 1
5862 }
59- repayFee(i, WriteSet([DataEntry((betid + "owner"), owner), DataEntry((betid + "event"), event), DataEntry((betid + "subevent"), subevent), DataEntry((betid + "side"), side), DataEntry((betid + "odds"), odds), DataEntry((betid + "amount"), payment.amount), DataEntry((betid + "spent"), 0), DataEntry((betid + "timestamp"), lastBlock.timestamp), DataEntry((betid + "sequence"), sequence), DataEntry(sequenceKey, sequence)]), 0)
63+ repayFee(i, WriteSet([DataEntry((betid + "owner"), owner), DataEntry((betid + "event"), event), DataEntry((betid + "subevent"), subevent), DataEntry((betid + "side"), side), DataEntry((betid + "odds"), odds), DataEntry((betid + "amount"), payment.amount), DataEntry((betid + "spent"), 0), DataEntry((betid + "timestamp"), lastBlock.timestamp), DataEntry((betid + "sequence"), sequence), DataEntry(sequenceKey, sequence)]), 0, unit)
6064 }
6165 }
6266
6367
6468
6569 @Callable(i)
6670 func cancel (betid) = if (!(checkOwner(i, betid)))
6771 then throw("permission denied")
6872 else {
6973 let amount = extract(getInteger(this, (betid + "_amount")))
7074 let spent = extract(getInteger(this, (betid + "_spent")))
7175 let cancelAmount = (amount - spent)
72- repayFee(i, WriteSet([DataEntry((betid + "_spent"), amount), DataEntry((betid + "_cancel_amount"), cancelAmount), DataEntry((betid + "_cancel_tx"), toBase58String(i.transactionId))]), cancelAmount)
76+ repayFee(i, WriteSet([DataEntry((betid + "_spent"), amount), DataEntry((betid + "_cancel_amount"), cancelAmount), DataEntry((betid + "_cancel_tx"), toBase58String(i.transactionId))]), cancelAmount, i.caller)
7377 }
7478
7579
7680
7781 @Callable(i)
7882 func betMatch (betFor,betAgainst) = if ((getString(this, (betFor + "_event")) != getString(this, (betAgainst + "_event"))))
7983 then throw("event id must match")
8084 else if ((getString(this, (betFor + "_subevent")) != getString(this, (betAgainst + "_subevent"))))
8185 then throw("subevent id must match")
8286 else if ((getString(this, (betFor + "_side")) != "for"))
8387 then throw("invalid *for* bet")
8488 else if ((getString(this, (betAgainst + "_side")) != "against"))
8589 then throw("invalid *against* bet")
8690 else {
8791 let betForOwner = getStringValue(this, (betFor + "_owner"))
8892 let betAgainstOwner = getStringValue(this, (betAgainst + "_owner"))
8993 let eventid = extract(getString(this, (betFor + "_event")))
9094 let matchid = (((((((("match_" + eventid) + "_") + takeRight(betForOwner, 10)) + "_") + takeRight(betAgainstOwner, 10)) + "_") + toBase58String(i.transactionId)) + "_")
9195 let odds = extract(getInteger(this, (betFor + "_odds")))
9296 let unspentFor = getUnspent(betFor)
9397 let unspentAgainst = getUnspent(betAgainst)
9498 let maxForNominal = unspentFor
9599 let maxAgainstNominal = ((unspentAgainst * 100) / (odds - 100))
96100 let matchNominal = if ((maxForNominal > maxAgainstNominal))
97101 then maxAgainstNominal
98102 else maxForNominal
99103 if ((minMatchNominal > matchNominal))
100104 then throw("match nominal too low")
101105 else {
102106 let spendFor = matchNominal
103107 let spendAgainst = ((matchNominal * (odds - 100)) / 100)
104108 let newSpentFor = (spendFor + extract(getInteger(this, (betFor + "_spent"))))
105109 let newSpentAgainst = (spendAgainst + extract(getInteger(this, (betAgainst + "_spent"))))
106110 if ((newSpentFor > extract(getInteger(this, (betFor + "_amount")))))
107111 then throw("invalid match")
108112 else if ((newSpentAgainst > extract(getInteger(this, (betAgainst + "_amount")))))
109113 then throw("invalid match")
110- else repayFee(i, WriteSet([DataEntry((matchid + "amount"), (spendFor + spendAgainst)), DataEntry((matchid + "for"), betFor), DataEntry((matchid + "against"), betAgainst), DataEntry((betFor + "_spent"), newSpentFor), DataEntry((betAgainst + "_spent"), newSpentAgainst)]), 0)
114+ else repayFee(i, WriteSet([DataEntry((matchid + "amount"), (spendFor + spendAgainst)), DataEntry((matchid + "for"), betFor), DataEntry((matchid + "against"), betAgainst), DataEntry((betFor + "_spent"), newSpentFor), DataEntry((betAgainst + "_spent"), newSpentAgainst)]), 0, unit)
111115 }
112116 }
113117
114118
115119
116120 @Callable(i)
117121 func approveDefeat (betId,defeat) = if (if (isDefined(getInteger(this, (betId + "_defeat"))))
118122 then (defeat == 2)
119123 else false)
120124 then throw("can't dispute after approve")
121- else repayFee(i, WriteSet([DataEntry((betId + "_defeat"), defeat)]), 0)
125+ else repayFee(i, WriteSet([DataEntry((betId + "_defeat"), defeat)]), 0, unit)
122126
123127
124128
125129 @Callable(i)
126130 func payWinner (matchId) = if (isDefined(getInteger(this, (matchId + "_paid"))))
127131 then throw("already paid")
128132 else {
129133 let betForId = extract(getString(this, (matchId + "_for")))
130134 let betAgainstId = extract(getString(this, (matchId + "_against")))
131135 let betForDefeated = isDefeated(betForId)
132136 let betAgainstDefeated = isDefeated(betAgainstId)
133137 if (if (!(betForDefeated))
134138 then !(betAgainstDefeated)
135139 else false)
136140 then throw("no side approved defeat")
137141 else {
138142 let winnerId = if (betForDefeated)
139143 then betAgainstId
140144 else betForId
141- let winnerAddress = getString(this, (winnerId + "_owner"))
142- if ((winnerAddress != toBase58String(i.caller.bytes)))
143- then throw("paywinner() should be called by winner only")
144- else {
145- let amount = extract(getInteger(this, (matchId + "_amount")))
146- repayFee(i, WriteSet([DataEntry((matchId + "_paid"), amount)]), amount)
147- }
145+ let winnerAddress = getStringValue(this, (winnerId + "_owner"))
146+ let amount = extract(getInteger(this, (matchId + "_amount")))
147+ repayFee(i, WriteSet([DataEntry((matchId + "_paid"), amount)]), amount, addressFromString(winnerAddress))
148148 }
149149 }
150150
151151

github/deemru/w8io/026f985 
53.56 ms