tx · 98aJXBwkB6LwXbGfASM3CZZVzreBYBFA1Eghu4HVYD85

3Mv3BEQ8WS2wzrEXuSfxDm7U9UKb5qLSnUc:  -0.01400000 Waves

2019.08.10 17:04 [625025] smart account 3Mv3BEQ8WS2wzrEXuSfxDm7U9UKb5qLSnUc > SELF 0.00000000 Waves

{ "type": 13, "id": "98aJXBwkB6LwXbGfASM3CZZVzreBYBFA1Eghu4HVYD85", "fee": 1400000, "feeAssetId": null, "timestamp": 1565445816635, "version": 1, "sender": "3Mv3BEQ8WS2wzrEXuSfxDm7U9UKb5qLSnUc", "senderPublicKey": "BoKgJQhf9RWMmneqYEhyMKeUXMCYRJRhaBTDd2w1Rtx", "proofs": [ "58cpm3fRmztJxGM4T9gLJLG4Lt8KA5BuzZyxigNAEntBvN1Eskkr3w5Pod5aXTMYbq93mVbbneo9eRekCTfTwqTM" ], "script": "base64:AAIDAAAAAAAAAAAAAAACAAAAAApWU1RBc3NldElEAQAAACCucYFuBYSotpFz1qoINfKJVo0JlR9XCghLbxw/TM2XswAAAAANZWlnaHREZWNpbWFscwAAAAAABfXhAAAAAAYAAAABaQEAAAALbWFrZVNlbGxWU1QAAAABAAAABXByaWNlAwkAAGcAAAACAAAAAAAAAAAABQAAAAVwcmljZQkAAAIAAAABAgAAABZwcmljZSBtdXN0IGJlIHBvc2l0aXZlBAAAAAdwYXltZW50CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQEAAAACIT0AAAACCAUAAAAHcGF5bWVudAAAAAdhc3NldElkBQAAAApWU1RBc3NldElECQAAAgAAAAEJAAEsAAAAAgIAAAARYXNzZXQgaWQgbXVzdCBiZSAJAAJYAAAAAQUAAAAKVlNUQXNzZXRJRAQAAAAHb3JkZXJJZAkAASwAAAACAgAAAAVzZWxsXwkAAlgAAAABCAUAAAABaQAAAA10cmFuc2FjdGlvbklkCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQ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KQAAAAIFAAAABHRoaXMJAAEsAAAAAgUAAAAHb3JkZXJJZAIAAAAGX293bmVyAwkBAAAAAiE9AAAAAgUAAAAFb3duZXIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwkAAAIAAAABAgAAACZyZXR1cm4gc2hvdWxkIGJlIGNhbGxlZCBieSBvcmRlciBvd25lcgQAAAAGYW1vdW50CQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzCQABLAAAAAIFAAAAB29yZGVySWQCAAAAB19hbW91bnQEAAAABXNwZW50CQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzCQABLAAAAAIFAAAAB29yZGVySWQCAAAABl9zcGVudAQAAAAMcmV0dXJuQW1vdW50CQAAZQAAAAIFAAAABmFtb3VudAUAAAAFc3BlbnQDCQAAZwAAAAIAAAAAAAAAAAAFAAAADHJldHVybkFtb3VudAkAAAIAAAABAgAAABFub3RoaW5nIHRvIHJldHVybgkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAAHb3JkZXJJZAIAAAAGX3NwZW50BQAAAAZhbW91bnQFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADHJldHVybkFtb3VudAUAAAAKVlNUQXNzZXRJRAUAAAADbmlsAAAAAAIg1N8=", "chainId": 84, "height": 625025, "spentComplexity": 0 } View: original | compacted Prev: ECMx6uzT9saTaxjDdHWmqWSdMQW8EPTvK3RCuD75K7mu Next: 684Jd7wUnqqTo5wKTkMtaRD7MH8ywJuPvpkJrMW9RGVL Diff:
OldNewDifferences
4242 if ((e.assetId != unit))
4343 then throw("asset must be WAVES")
4444 else {
45+ let h = getStringValue(this, (f + "_owner"))
4546 let d = getIntegerValue(this, (f + "_price"))
46- let h = e.amount
47- let i = ((h * d) / b)
48- let j = getIntegerValue(this, (f + "_amount"))
49- let k = getIntegerValue(this, (f + "_spent"))
50- let l = (k + i)
51- if ((l > j))
47+ let i = e.amount
48+ let j = ((i * d) / b)
49+ let k = getIntegerValue(this, (f + "_amount"))
50+ let l = getIntegerValue(this, (f + "_spent"))
51+ let m = (l + j)
52+ if ((m > k))
5253 then throw("not enougth asset in order")
53- else ScriptResult(WriteSet([DataEntry((f + "_spent"), l)]), TransferSet([ScriptTransfer(c.caller, i, a)]))
54+ else ScriptResult(WriteSet([DataEntry((f + "_spent"), m)]), TransferSet([ScriptTransfer(c.caller, j, a), ScriptTransfer(extract(addressFromString(h)), i, unit)]))
5455 }
5556 }
5657
6364 if ((e.assetId != a))
6465 then throw(("asset must be " + toBase58String(a)))
6566 else {
67+ let h = getStringValue(this, (f + "_owner"))
6668 let d = getIntegerValue(this, (f + "_price"))
67- let i = e.amount
68- let h = ((i * b) / d)
69- let j = getIntegerValue(this, (f + "_amount"))
70- let k = getIntegerValue(this, (f + "_spent"))
71- let l = (k + i)
72- if ((l > j))
69+ let j = e.amount
70+ let i = ((j * b) / d)
71+ let k = getIntegerValue(this, (f + "_amount"))
72+ let l = getIntegerValue(this, (f + "_spent"))
73+ let m = (l + j)
74+ if ((m > k))
7375 then throw("not enougth asset in order")
74- else ScriptResult(WriteSet([DataEntry((f + "_spent"), l)]), TransferSet([ScriptTransfer(c.caller, h, unit)]))
76+ else ScriptResult(WriteSet([DataEntry((f + "_spent"), m)]), TransferSet([ScriptTransfer(c.caller, i, unit), ScriptTransfer(extract(addressFromString(h)), j, a)]))
7577 }
7678 }
7779
8082 @Callable(c)
8183 func returnBuyVST (g) = {
8284 let f = ("buy_" + g)
83- let m = getStringValue(this, (f + "_owner"))
84- if ((m != toBase58String(c.caller.bytes)))
85+ let h = getStringValue(this, (f + "_owner"))
86+ if ((h != toBase58String(c.caller.bytes)))
8587 then throw("return should be called by order owner")
8688 else {
87- let j = getIntegerValue(this, (f + "_amount"))
88- let k = getIntegerValue(this, (f + "_spent"))
89+ let k = getIntegerValue(this, (f + "_amount"))
90+ let l = getIntegerValue(this, (f + "_spent"))
8991 let d = getIntegerValue(this, (f + "_price"))
90- let n = (((j - k) * b) / d)
92+ let n = (((k - l) * b) / d)
9193 if ((0 >= n))
9294 then throw("nothing to return")
93- else ScriptResult(WriteSet([DataEntry((f + "_spent"), j)]), TransferSet([ScriptTransfer(c.caller, n, unit)]))
95+ else ScriptResult(WriteSet([DataEntry((f + "_spent"), k)]), TransferSet([ScriptTransfer(c.caller, n, unit)]))
9496 }
9597 }
9698
99101 @Callable(c)
100102 func returnSellVST (g) = {
101103 let f = ("sell_" + g)
102- let m = getStringValue(this, (f + "_owner"))
103- if ((m != toBase58String(c.caller.bytes)))
104+ let h = getStringValue(this, (f + "_owner"))
105+ if ((h != toBase58String(c.caller.bytes)))
104106 then throw("return should be called by order owner")
105107 else {
106- let j = getIntegerValue(this, (f + "_amount"))
107- let k = getIntegerValue(this, (f + "_spent"))
108- let n = (j - k)
108+ let k = getIntegerValue(this, (f + "_amount"))
109+ let l = getIntegerValue(this, (f + "_spent"))
110+ let n = (k - l)
109111 if ((0 >= n))
110112 then throw("nothing to return")
111- else ScriptResult(WriteSet([DataEntry((f + "_spent"), j)]), TransferSet([ScriptTransfer(c.caller, n, a)]))
113+ else ScriptResult(WriteSet([DataEntry((f + "_spent"), k)]), TransferSet([ScriptTransfer(c.caller, n, a)]))
112114 }
113115 }
114116
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = base58'CjxKp2kfytghpfforkYLSoXHzJyJ5QYKLYQYgN7pQV4E'
55
66 let b = 100000000
77
88 @Callable(c)
99 func makeSellVST (d) = if ((0 >= d))
1010 then throw("price must be positive")
1111 else {
1212 let e = extract(c.payment)
1313 if ((e.assetId != a))
1414 then throw(("asset id must be " + toBase58String(a)))
1515 else {
1616 let f = ("sell_" + toBase58String(c.transactionId))
1717 WriteSet([DataEntry((f + "_amount"), e.amount), DataEntry((f + "_price"), d), DataEntry((f + "_owner"), toBase58String(c.caller.bytes)), DataEntry((f + "_spent"), 0)])
1818 }
1919 }
2020
2121
2222
2323 @Callable(c)
2424 func makeBuyVST (d) = if ((0 >= d))
2525 then throw("price must be positive")
2626 else {
2727 let e = extract(c.payment)
2828 if ((e.assetId != unit))
2929 then throw("asset id must be WAVES")
3030 else {
3131 let f = ("buy_" + toBase58String(c.transactionId))
3232 WriteSet([DataEntry((f + "_amount"), ((e.amount * d) / b)), DataEntry((f + "_price"), d), DataEntry((f + "_owner"), toBase58String(c.caller.bytes)), DataEntry((f + "_spent"), 0)])
3333 }
3434 }
3535
3636
3737
3838 @Callable(c)
3939 func takeSellVST (g) = {
4040 let f = ("sell_" + g)
4141 let e = extract(c.payment)
4242 if ((e.assetId != unit))
4343 then throw("asset must be WAVES")
4444 else {
45+ let h = getStringValue(this, (f + "_owner"))
4546 let d = getIntegerValue(this, (f + "_price"))
46- let h = e.amount
47- let i = ((h * d) / b)
48- let j = getIntegerValue(this, (f + "_amount"))
49- let k = getIntegerValue(this, (f + "_spent"))
50- let l = (k + i)
51- if ((l > j))
47+ let i = e.amount
48+ let j = ((i * d) / b)
49+ let k = getIntegerValue(this, (f + "_amount"))
50+ let l = getIntegerValue(this, (f + "_spent"))
51+ let m = (l + j)
52+ if ((m > k))
5253 then throw("not enougth asset in order")
53- else ScriptResult(WriteSet([DataEntry((f + "_spent"), l)]), TransferSet([ScriptTransfer(c.caller, i, a)]))
54+ else ScriptResult(WriteSet([DataEntry((f + "_spent"), m)]), TransferSet([ScriptTransfer(c.caller, j, a), ScriptTransfer(extract(addressFromString(h)), i, unit)]))
5455 }
5556 }
5657
5758
5859
5960 @Callable(c)
6061 func takeBuyVST (g) = {
6162 let f = ("buy_" + g)
6263 let e = extract(c.payment)
6364 if ((e.assetId != a))
6465 then throw(("asset must be " + toBase58String(a)))
6566 else {
67+ let h = getStringValue(this, (f + "_owner"))
6668 let d = getIntegerValue(this, (f + "_price"))
67- let i = e.amount
68- let h = ((i * b) / d)
69- let j = getIntegerValue(this, (f + "_amount"))
70- let k = getIntegerValue(this, (f + "_spent"))
71- let l = (k + i)
72- if ((l > j))
69+ let j = e.amount
70+ let i = ((j * b) / d)
71+ let k = getIntegerValue(this, (f + "_amount"))
72+ let l = getIntegerValue(this, (f + "_spent"))
73+ let m = (l + j)
74+ if ((m > k))
7375 then throw("not enougth asset in order")
74- else ScriptResult(WriteSet([DataEntry((f + "_spent"), l)]), TransferSet([ScriptTransfer(c.caller, h, unit)]))
76+ else ScriptResult(WriteSet([DataEntry((f + "_spent"), m)]), TransferSet([ScriptTransfer(c.caller, i, unit), ScriptTransfer(extract(addressFromString(h)), j, a)]))
7577 }
7678 }
7779
7880
7981
8082 @Callable(c)
8183 func returnBuyVST (g) = {
8284 let f = ("buy_" + g)
83- let m = getStringValue(this, (f + "_owner"))
84- if ((m != toBase58String(c.caller.bytes)))
85+ let h = getStringValue(this, (f + "_owner"))
86+ if ((h != toBase58String(c.caller.bytes)))
8587 then throw("return should be called by order owner")
8688 else {
87- let j = getIntegerValue(this, (f + "_amount"))
88- let k = getIntegerValue(this, (f + "_spent"))
89+ let k = getIntegerValue(this, (f + "_amount"))
90+ let l = getIntegerValue(this, (f + "_spent"))
8991 let d = getIntegerValue(this, (f + "_price"))
90- let n = (((j - k) * b) / d)
92+ let n = (((k - l) * b) / d)
9193 if ((0 >= n))
9294 then throw("nothing to return")
93- else ScriptResult(WriteSet([DataEntry((f + "_spent"), j)]), TransferSet([ScriptTransfer(c.caller, n, unit)]))
95+ else ScriptResult(WriteSet([DataEntry((f + "_spent"), k)]), TransferSet([ScriptTransfer(c.caller, n, unit)]))
9496 }
9597 }
9698
9799
98100
99101 @Callable(c)
100102 func returnSellVST (g) = {
101103 let f = ("sell_" + g)
102- let m = getStringValue(this, (f + "_owner"))
103- if ((m != toBase58String(c.caller.bytes)))
104+ let h = getStringValue(this, (f + "_owner"))
105+ if ((h != toBase58String(c.caller.bytes)))
104106 then throw("return should be called by order owner")
105107 else {
106- let j = getIntegerValue(this, (f + "_amount"))
107- let k = getIntegerValue(this, (f + "_spent"))
108- let n = (j - k)
108+ let k = getIntegerValue(this, (f + "_amount"))
109+ let l = getIntegerValue(this, (f + "_spent"))
110+ let n = (k - l)
109111 if ((0 >= n))
110112 then throw("nothing to return")
111- else ScriptResult(WriteSet([DataEntry((f + "_spent"), j)]), TransferSet([ScriptTransfer(c.caller, n, a)]))
113+ else ScriptResult(WriteSet([DataEntry((f + "_spent"), k)]), TransferSet([ScriptTransfer(c.caller, n, a)]))
112114 }
113115 }
114116
115117

github/deemru/w8io/026f985 
64.47 ms