tx · FfyAK5oJ4T7L8KFXMAK4MrU3gJ6NykijhpygHAE7dmiW

3Mu7bwtYrymjrXt1ttcqaQbFc1PqGhZndhv:  -0.01400000 Waves

2019.09.13 00:54 [673507] smart account 3Mu7bwtYrymjrXt1ttcqaQbFc1PqGhZndhv > SELF 0.00000000 Waves

{ "type": 13, "id": "FfyAK5oJ4T7L8KFXMAK4MrU3gJ6NykijhpygHAE7dmiW", "fee": 1400000, "feeAssetId": null, "timestamp": 1568325297689, "version": 1, "sender": "3Mu7bwtYrymjrXt1ttcqaQbFc1PqGhZndhv", "senderPublicKey": "BxHnTcjvN9ZtnKfdKYp6aKRdkMB4ZHxHnTDr5dWx5Vz2", "proofs": [ "2wqr7ygQhfkyVxBW811657pt6hmzzGgXic2LMiYttavQyC5Jscm12Y5Qkyd5E9kEgSxyheKnDYtGWDXUpAFNed4w" ], "script": "base64:AAIDAAAAAAAAAAAAAAAAAAAAAwAAAAFpAQAAAAhtYWtlU2VsbAAAAAIAAAAKcHJpY2VBc3NldAAAAAVwcmljZQMDCQEAAAACIT0AAAACBQAAAApwcmljZUFzc2V0AgAAAAVXQVZFUwkBAAAAASEAAAABCQEAAAAJaXNEZWZpbmVkAAAAAQkAA+wAAAABCQACWQAAAAEFAAAACnByaWNlQXNzZXQHCQAAAgAAAAECAAAAI1RoZXJlIGlzIG5vIGFzc2V0IHdpdGggc3BlY2lmaWVkIGlkAwkAAGcAAAACAAAAAAAAAAAABQAAAAVwcmljZQkAAAIAAAABAgAAABZwcmljZSBtdXN0IGJlIHBvc2l0aXZlBAAAAAdwYXltZW50CQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIIBQAAAAFpAAAAB3BheW1lbnQCAAAAEXdoZXJlIGlzIHBheW1lbnQ/AwkAAGcAAAACAAAAAAAAAAAACAUAAAAHcGF5bWVudAAAAAZhbW91bnQJAAACAAAAAQIAAAAXYW1vdW50IG11c3QgYmUgcG9zaXRpdmUEAAAAB29yZGVySWQJAAEsAAAAAgI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AAEsAAAAAgUAAAAHb3JkZXJJZAIAAAAGX3NwZW50CQAAZAAAAAIFAAAABXNwZW50BQAAAAlidXlBbW91bnQFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAACWJ1eUFtb3VudAMJAAAAAAAAAgUAAAALYW1vdW50QXNzZXQCAAAABVdBVkVTBQAAAAR1bml0CQACWQAAAAEFAAAAC2Ftb3VudEFzc2V0CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAABW93bmVyCAUAAAAHcGF5bWVudAAAAAZhbW91bnQDCQAAAAAAAAIFAAAACnByaWNlQXNzZXQCAAAABVdBVkVTBQAAAAR1bml0CQACWQAAAAEFAAAACnByaWNlQXNzZXQFAAAAA25pbAAAAACi/5Q6", "chainId": 84, "height": 673507, "spentComplexity": 0 } View: original | compacted Prev: 1Mh8dJKr6Hedyb3EnSz3RA5LaLFGZjK8NcsfJyA4Pb2 Next: 2o3byrNsvjNQE8iZ2QJxWZ3ZYTwiAyezBtfjabg81wx8 Diff:
OldNewDifferences
8181 else {
8282 let c = getIntegerValue(this, (e + "_price"))
8383 let k = getIntegerValue(this, (e + "_amount"))
84- let l = (d.amount / c)
85- let m = value(addressFromString(getStringValue(this, (e + "_owner"))))
84+ let l = if ((j == "WAVES"))
85+ then 8
86+ else value(assetInfo(fromBase58String(j))).decimals
87+ let m = ((d.amount * pow(10, 0, l, 0, 0, CEILING)) / c)
88+ let n = value(addressFromString(getStringValue(this, (e + "_owner"))))
8689 let f = getStringValue(this, (e + "_amount_asset"))
87- let n = getIntegerValue(this, (e + "_spent"))
88- if ((l > (k - n)))
90+ let o = getIntegerValue(this, (e + "_spent"))
91+ if ((m > (k - o)))
8992 then throw("not enougth asset in order")
90- else ScriptResult(WriteSet([DataEntry((e + "_spent"), (n + l))]), TransferSet([ScriptTransfer(a.caller, l, if ((f == "WAVES"))
93+ else ScriptResult(WriteSet([DataEntry((e + "_spent"), (o + m))]), TransferSet([ScriptTransfer(a.caller, m, if ((f == "WAVES"))
9194 then unit
92- else fromBase58String(f)), ScriptTransfer(m, d.amount, if ((b == "WAVES"))
95+ else fromBase58String(f)), ScriptTransfer(n, d.amount, if ((b == "WAVES"))
9396 then unit
9497 else fromBase58String(b))]))
9598 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(a)
77 func makeSell (b,c) = if (if ((b != "WAVES"))
88 then !(isDefined(assetInfo(fromBase58String(b))))
99 else false)
1010 then throw("There is no asset with specified id")
1111 else if ((0 >= c))
1212 then throw("price must be positive")
1313 else {
1414 let d = valueOrErrorMessage(a.payment, "where is payment?")
1515 if ((0 >= d.amount))
1616 then throw("amount must be positive")
1717 else {
1818 let e = ("sell_" + toBase58String(a.transactionId))
1919 let f = {
2020 let g = d.assetId
2121 if ($isInstanceOf(g, "ByteVector"))
2222 then {
2323 let h = g
2424 toBase58String(h)
2525 }
2626 else "WAVES"
2727 }
2828 WriteSet([DataEntry((e + "_amount"), d.amount), DataEntry((e + "_amount_asset"), f), DataEntry((e + "_price"), c), DataEntry((e + "_price_asset"), b), DataEntry((e + "_owner"), toBase58String(a.caller.bytes)), DataEntry((e + "_spent"), 0)])
2929 }
3030 }
3131
3232
3333
3434 @Callable(a)
3535 func makeBuy (f,c) = if (if ((f != "WAVES"))
3636 then !(isDefined(assetInfo(fromBase58String(f))))
3737 else false)
3838 then throw("There is no asset with specified id")
3939 else if ((0 >= c))
4040 then throw("price must be positive")
4141 else {
4242 let d = valueOrErrorMessage(a.payment, "where is payment?")
4343 if ((0 >= d.amount))
4444 then throw("amount must be positive")
4545 else {
4646 let e = ("buy_" + toBase58String(a.transactionId))
4747 let b = {
4848 let g = d.assetId
4949 if ($isInstanceOf(g, "ByteVector"))
5050 then {
5151 let h = g
5252 toBase58String(h)
5353 }
5454 else "WAVES"
5555 }
5656 WriteSet([DataEntry((e + "_amount"), (d.amount / c)), DataEntry((e + "_amount_asset"), f), DataEntry((e + "_price"), c), DataEntry((e + "_price_asset"), b), DataEntry((e + "_owner"), toBase58String(a.caller.bytes)), DataEntry((e + "_spent"), 0)])
5757 }
5858 }
5959
6060
6161
6262 @Callable(a)
6363 func takeSell (i) = {
6464 let d = valueOrErrorMessage(a.payment, "where is payment?")
6565 if ((0 >= d.amount))
6666 then throw("amount must be positive")
6767 else {
6868 let e = ("sell_" + i)
6969 let j = {
7070 let g = d.assetId
7171 if ($isInstanceOf(g, "ByteVector"))
7272 then {
7373 let h = g
7474 toBase58String(h)
7575 }
7676 else "WAVES"
7777 }
7878 let b = valueOrErrorMessage(getString(this, (e + "_price_asset")), "there is no order with specified id")
7979 if ((b != j))
8080 then throw(("payment asset must be " + b))
8181 else {
8282 let c = getIntegerValue(this, (e + "_price"))
8383 let k = getIntegerValue(this, (e + "_amount"))
84- let l = (d.amount / c)
85- let m = value(addressFromString(getStringValue(this, (e + "_owner"))))
84+ let l = if ((j == "WAVES"))
85+ then 8
86+ else value(assetInfo(fromBase58String(j))).decimals
87+ let m = ((d.amount * pow(10, 0, l, 0, 0, CEILING)) / c)
88+ let n = value(addressFromString(getStringValue(this, (e + "_owner"))))
8689 let f = getStringValue(this, (e + "_amount_asset"))
87- let n = getIntegerValue(this, (e + "_spent"))
88- if ((l > (k - n)))
90+ let o = getIntegerValue(this, (e + "_spent"))
91+ if ((m > (k - o)))
8992 then throw("not enougth asset in order")
90- else ScriptResult(WriteSet([DataEntry((e + "_spent"), (n + l))]), TransferSet([ScriptTransfer(a.caller, l, if ((f == "WAVES"))
93+ else ScriptResult(WriteSet([DataEntry((e + "_spent"), (o + m))]), TransferSet([ScriptTransfer(a.caller, m, if ((f == "WAVES"))
9194 then unit
92- else fromBase58String(f)), ScriptTransfer(m, d.amount, if ((b == "WAVES"))
95+ else fromBase58String(f)), ScriptTransfer(n, d.amount, if ((b == "WAVES"))
9396 then unit
9497 else fromBase58String(b))]))
9598 }
9699 }
97100 }
98101
99102

github/deemru/w8io/169f3d6 
39.20 ms