tx · 6sqhkPor8Z35qph7Qgos3gpnv69H9UoiuSFZyMg4iXWA

3Mu7bwtYrymjrXt1ttcqaQbFc1PqGhZndhv:  -0.01400000 Waves

2019.09.13 02:24 [673601] smart account 3Mu7bwtYrymjrXt1ttcqaQbFc1PqGhZndhv > SELF 0.00000000 Waves

{ "type": 13, "id": "6sqhkPor8Z35qph7Qgos3gpnv69H9UoiuSFZyMg4iXWA", "fee": 1400000, "feeAssetId": null, "timestamp": 1568330667279, "version": 1, "sender": "3Mu7bwtYrymjrXt1ttcqaQbFc1PqGhZndhv", "senderPublicKey": "BxHnTcjvN9ZtnKfdKYp6aKRdkMB4ZHxHnTDr5dWx5Vz2", "proofs": [ "4bsShiMoGPEyr5233CNCHrnXteECVp4ccuTtUn9Wn2XPdHNytNvHmseeQegxVuD2Jbo9aZFJiGDX8NaUjUCAL35j" ], "script": "base64:AAIDAAAAAAAAAAAAAAAAAAAABAAAAAFpAQAAAAhtYWtlU2VsbAAAAAIAAAAKcHJpY2VBc3NldAAAAAVwcmljZQMDCQEAAAACIT0AAAACBQAAAApwcmljZUFzc2V0AgAAAAVXQVZFUwkBAAAAASEAAAABCQEAAAAJaXNEZWZpbmVkAAAAAQkAA+wAAAABCQACWQAAAAEFAAAACnByaWNlQXNzZXQHCQAAAgAAAAECAAAAI1RoZXJlIGlzIG5vIGFzc2V0IHdpdGggc3BlY2lmaWVkIGlkAwkAAGcAAAACAAAAAAAAAAAABQAAAAVwcmljZQkAAAIAAAABAgAAABZwcmljZSBtdXN0IGJlIHBvc2l0aXZlBAAAAAdwYXltZW50CQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIIBQAAAAFpAAAAB3BheW1lbnQCAAAAEXdoZXJlIGlzIHBheW1lbnQ/AwkAAGcAAAACAAAAAAAAAAAACAUAAAAHcGF5bWVudAAAAAZhbW91bnQJAAACAAAAAQIAAAAXYW1vdW50IG11c3QgYmUgcG9zaXRpdmUEAAAAB29yZGVySWQJAAEsAAAAAgIAAA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V0AgAAAAVXQVZFUwUAAAAEdW5pdAkAAlkAAAABBQAAAApwcmljZUFzc2V0CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAABW93bmVyCAUAAAAHcGF5bWVudAAAAAZhbW91bnQDCQAAAAAAAAIFAAAAC2Ftb3VudEFzc2V0AgAAAAVXQVZFUwUAAAAEdW5pdAkAAlkAAAABBQAAAAthbW91bnRBc3NldAUAAAADbmlsAAAAAGARwyI=", "chainId": 84, "height": 673601, "spentComplexity": 0 } View: original | compacted Prev: AyGhNRRjwJZeotFT4HmhjTvzj2ueVujUtM4XZXAjGA8E Next: DedBPVVigRYPHNEpZNmitxWCkqH4y8y8F9uiRR4Ty9Qy Diff:
OldNewDifferences
5353 }
5454 else "WAVES"
5555 }
56- 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)])
56+ let i = if ((f == "WAVES"))
57+ then 8
58+ else value(assetInfo(fromBase58String(f))).decimals
59+ let j = ((d.amount * pow(10, 0, i, 0, 0, CEILING)) / c)
60+ if ((j == 0))
61+ then throw("invalid buy amount")
62+ else WriteSet([DataEntry((e + "_amount"), j), 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)])
5763 }
5864 }
5965
6066
6167
6268 @Callable(a)
63-func takeSell (i) = {
69+func takeSell (k) = {
6470 let d = valueOrErrorMessage(a.payment, "where is payment?")
6571 if ((0 >= d.amount))
6672 then throw("amount must be positive")
6773 else {
68- let e = ("sell_" + i)
69- let j = {
74+ let e = ("sell_" + k)
75+ let l = {
7076 let g = d.assetId
7177 if ($isInstanceOf(g, "ByteVector"))
7278 then {
7682 else "WAVES"
7783 }
7884 let b = valueOrErrorMessage(getString(this, (e + "_price_asset")), "there is no order with specified id")
79- if ((b != j))
85+ if ((b != l))
8086 then throw(("payment asset must be " + b))
8187 else {
8288 let c = getIntegerValue(this, (e + "_price"))
83- let k = getIntegerValue(this, (e + "_amount"))
89+ let m = getIntegerValue(this, (e + "_amount"))
8490 let f = getStringValue(this, (e + "_amount_asset"))
85- let l = if ((j == "WAVES"))
86- then 8
87- else value(assetInfo(fromBase58String(j))).decimals
88- let m = if ((f == "WAVES"))
91+ let i = if ((f == "WAVES"))
8992 then 8
9093 else value(assetInfo(fromBase58String(f))).decimals
91- let n = ((d.amount * pow(10, 0, m, 0, 0, CEILING)) / c)
92- if ((n == 0))
94+ let j = ((d.amount * pow(10, 0, i, 0, 0, CEILING)) / c)
95+ if ((j == 0))
9396 then throw("invalid amount")
9497 else {
95- let o = value(addressFromString(getStringValue(this, (e + "_owner"))))
96- let p = getIntegerValue(this, (e + "_spent"))
97- if ((n > (k - p)))
98+ let n = value(addressFromString(getStringValue(this, (e + "_owner"))))
99+ let o = getIntegerValue(this, (e + "_spent"))
100+ if ((j > (m - o)))
98101 then throw("not enougth asset in order")
99- else ScriptResult(WriteSet([DataEntry((e + "_spent"), (p + n))]), TransferSet([ScriptTransfer(a.caller, n, if ((f == "WAVES"))
102+ else ScriptResult(WriteSet([DataEntry((e + "_spent"), (o + j))]), TransferSet([ScriptTransfer(a.caller, j, if ((f == "WAVES"))
100103 then unit
101- else fromBase58String(f)), ScriptTransfer(o, d.amount, if ((b == "WAVES"))
104+ else fromBase58String(f)), ScriptTransfer(n, d.amount, if ((b == "WAVES"))
102105 then unit
103106 else fromBase58String(b))]))
107+ }
108+ }
109+ }
110+ }
111+
112+
113+
114+@Callable(a)
115+func takeBuy (k) = {
116+ let d = valueOrErrorMessage(a.payment, "where is payment?")
117+ if ((0 >= d.amount))
118+ then throw("amount must be positive")
119+ else {
120+ let e = ("buy_" + k)
121+ let l = {
122+ let g = d.assetId
123+ if ($isInstanceOf(g, "ByteVector"))
124+ then {
125+ let h = g
126+ toBase58String(h)
127+ }
128+ else "WAVES"
129+ }
130+ let f = valueOrErrorMessage(getString(this, (e + "_amount_asset")), "there is no order with specified id")
131+ if ((f != l))
132+ then throw(("payment asset must be " + f))
133+ else {
134+ let c = getIntegerValue(this, (e + "_price"))
135+ let m = getIntegerValue(this, (e + "_amount"))
136+ let b = getStringValue(this, (e + "_price_asset"))
137+ let i = if ((f == "WAVES"))
138+ then 8
139+ else value(assetInfo(fromBase58String(f))).decimals
140+ let j = ((d.amount * c) / pow(10, 0, i, 0, 0, CEILING))
141+ if ((j == 0))
142+ then throw("invalid amount")
143+ else {
144+ let n = value(addressFromString(getStringValue(this, (e + "_owner"))))
145+ let o = getIntegerValue(this, (e + "_spent"))
146+ if ((j > (m - o)))
147+ then throw("not enougth asset in order")
148+ else ScriptResult(WriteSet([DataEntry((e + "_spent"), (o + j))]), TransferSet([ScriptTransfer(a.caller, j, if ((b == "WAVES"))
149+ then unit
150+ else fromBase58String(b)), ScriptTransfer(n, d.amount, if ((f == "WAVES"))
151+ then unit
152+ else fromBase58String(f))]))
104153 }
105154 }
106155 }
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 }
56- 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)])
56+ let i = if ((f == "WAVES"))
57+ then 8
58+ else value(assetInfo(fromBase58String(f))).decimals
59+ let j = ((d.amount * pow(10, 0, i, 0, 0, CEILING)) / c)
60+ if ((j == 0))
61+ then throw("invalid buy amount")
62+ else WriteSet([DataEntry((e + "_amount"), j), 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)])
5763 }
5864 }
5965
6066
6167
6268 @Callable(a)
63-func takeSell (i) = {
69+func takeSell (k) = {
6470 let d = valueOrErrorMessage(a.payment, "where is payment?")
6571 if ((0 >= d.amount))
6672 then throw("amount must be positive")
6773 else {
68- let e = ("sell_" + i)
69- let j = {
74+ let e = ("sell_" + k)
75+ let l = {
7076 let g = d.assetId
7177 if ($isInstanceOf(g, "ByteVector"))
7278 then {
7379 let h = g
7480 toBase58String(h)
7581 }
7682 else "WAVES"
7783 }
7884 let b = valueOrErrorMessage(getString(this, (e + "_price_asset")), "there is no order with specified id")
79- if ((b != j))
85+ if ((b != l))
8086 then throw(("payment asset must be " + b))
8187 else {
8288 let c = getIntegerValue(this, (e + "_price"))
83- let k = getIntegerValue(this, (e + "_amount"))
89+ let m = getIntegerValue(this, (e + "_amount"))
8490 let f = getStringValue(this, (e + "_amount_asset"))
85- let l = if ((j == "WAVES"))
86- then 8
87- else value(assetInfo(fromBase58String(j))).decimals
88- let m = if ((f == "WAVES"))
91+ let i = if ((f == "WAVES"))
8992 then 8
9093 else value(assetInfo(fromBase58String(f))).decimals
91- let n = ((d.amount * pow(10, 0, m, 0, 0, CEILING)) / c)
92- if ((n == 0))
94+ let j = ((d.amount * pow(10, 0, i, 0, 0, CEILING)) / c)
95+ if ((j == 0))
9396 then throw("invalid amount")
9497 else {
95- let o = value(addressFromString(getStringValue(this, (e + "_owner"))))
96- let p = getIntegerValue(this, (e + "_spent"))
97- if ((n > (k - p)))
98+ let n = value(addressFromString(getStringValue(this, (e + "_owner"))))
99+ let o = getIntegerValue(this, (e + "_spent"))
100+ if ((j > (m - o)))
98101 then throw("not enougth asset in order")
99- else ScriptResult(WriteSet([DataEntry((e + "_spent"), (p + n))]), TransferSet([ScriptTransfer(a.caller, n, if ((f == "WAVES"))
102+ else ScriptResult(WriteSet([DataEntry((e + "_spent"), (o + j))]), TransferSet([ScriptTransfer(a.caller, j, if ((f == "WAVES"))
100103 then unit
101- else fromBase58String(f)), ScriptTransfer(o, d.amount, if ((b == "WAVES"))
104+ else fromBase58String(f)), ScriptTransfer(n, d.amount, if ((b == "WAVES"))
102105 then unit
103106 else fromBase58String(b))]))
107+ }
108+ }
109+ }
110+ }
111+
112+
113+
114+@Callable(a)
115+func takeBuy (k) = {
116+ let d = valueOrErrorMessage(a.payment, "where is payment?")
117+ if ((0 >= d.amount))
118+ then throw("amount must be positive")
119+ else {
120+ let e = ("buy_" + k)
121+ let l = {
122+ let g = d.assetId
123+ if ($isInstanceOf(g, "ByteVector"))
124+ then {
125+ let h = g
126+ toBase58String(h)
127+ }
128+ else "WAVES"
129+ }
130+ let f = valueOrErrorMessage(getString(this, (e + "_amount_asset")), "there is no order with specified id")
131+ if ((f != l))
132+ then throw(("payment asset must be " + f))
133+ else {
134+ let c = getIntegerValue(this, (e + "_price"))
135+ let m = getIntegerValue(this, (e + "_amount"))
136+ let b = getStringValue(this, (e + "_price_asset"))
137+ let i = if ((f == "WAVES"))
138+ then 8
139+ else value(assetInfo(fromBase58String(f))).decimals
140+ let j = ((d.amount * c) / pow(10, 0, i, 0, 0, CEILING))
141+ if ((j == 0))
142+ then throw("invalid amount")
143+ else {
144+ let n = value(addressFromString(getStringValue(this, (e + "_owner"))))
145+ let o = getIntegerValue(this, (e + "_spent"))
146+ if ((j > (m - o)))
147+ then throw("not enougth asset in order")
148+ else ScriptResult(WriteSet([DataEntry((e + "_spent"), (o + j))]), TransferSet([ScriptTransfer(a.caller, j, if ((b == "WAVES"))
149+ then unit
150+ else fromBase58String(b)), ScriptTransfer(n, d.amount, if ((f == "WAVES"))
151+ then unit
152+ else fromBase58String(f))]))
104153 }
105154 }
106155 }
107156 }
108157
109158

github/deemru/w8io/169f3d6 
61.45 ms