tx · GUXXVYoen7RdGU11So66hnAs3iGrWCP5QwvuPVcVsiMQ

3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL:  -0.01400000 Waves

2019.08.20 18:38 [639639] smart account 3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL > SELF 0.00000000 Waves

{ "type": 13, "id": "GUXXVYoen7RdGU11So66hnAs3iGrWCP5QwvuPVcVsiMQ", "fee": 1400000, "feeAssetId": null, "timestamp": 1566315497447, "version": 1, "sender": "3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL", "senderPublicKey": "3RTmBp69DqXiohzMXcmVU1pMFssmztWoibFARiKrgTr7", "proofs": [ "xyXYAMvizvo6cpPvUouHJrnNgctU5HKnZZPc8PnZHJA3Jw9ieYmHXi9GqUvhAADpkUBgQMQYXtKZDGFvr8spvVj" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAAAAAAVvd25lcgEAAAAaAVSTOHBLt7RyJdugRiL5k8zovFc+bobXqh8AAAAADWFzc2V0SWRUb2tlbkEBAAAAIHtxzCCjiO5MvMQa1Azqp+Y2rXgVKpJSDL3j5MzZkFIFAAAAAA1hc3NldElkVG9rZW5CBQAAAAR1bml0AAAAAAljb21pc3Npb24AAAAAAAAAAAUAAAACAAAACmNvbnRleHRPYmoBAAAACWV4Y2hhbmdlcgAAAAEAAAAPbWluVG9rZW5SZWNpZXZlAwMJAABmAAAAAgAAAAAAAAAAAAUAAAAJY29taXNzaW9uBgkAAGYAAAACBQAAAAljb21pc3Npb24AAAAAAAAAAGQJAAACAAAAAQIAAAAZaW5jb3JyZWN0IGNvbWlzc2lvbiB2YWx1ZQQAAAAMYW1vdW50VG9rZW5CCQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzAgAAAAxhbW91bnRUb2tlbkIEAAAADGFtb3VudFRva2VuQQkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGhpcwIAAAAMQW1vdW50VG9rZW5BB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ARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyBQAAAA90b2tlblNlbmRBbW91bnQFAAAAC2Fzc2V0SWRTZW50BQAAAANuaWwJAAACAAAAAQIAAAAUQXNzZXQgaXMgbm90IGFsbG93ZWQAAAAKY29udGV4dE9iagEAAAAId2l0aGRyYXcAAAAABAAAAA1CYWxhbmNlVG9rZW5BCQAD6wAAAAIFAAAABHRoaXMFAAAADWFzc2V0SWRUb2tlbkEEAAAADUJhbGFuY2VUb2tlbkIJAAPrAAAAAgUAAAAEdGhpcwUAAAANYXNzZXRJZFRva2VuQgMJAAAAAAAAAggIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgAAAAVieXRlcwUAAAAFb3duZXIJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAxhbW91bnRUb2tlbkECAAAACXdpdGhkcmF3bgkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAMYW1vdW50VG9rZW5CAgAAAAl3aXRoZHJhd24FAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAAKY29udGV4dE9iagAAAAZjYWxsZXIFAAAADUJhbGFuY2VUb2tlbkEFAAAADWFzc2V0SWRUb2tlbkEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyBQAAAA1CYWxhbmNlVG9rZW5CBQAAAA1hc3NldElkVG9rZW5CBQAAAANuaWwJAAACAAAAAQIAAAAdWW91IGFyZSBub3QgZXhjaGFuZ2VyJ3Mgb3duZXIAAAABAAAACmNvbnRleHRPYmoBAAAABnZlcmlmeQAAAAAGYchSBA==", "chainId": 84, "height": 639639, "spentComplexity": 0 } View: original | compacted Prev: DbarVWahmHKnZ4pjSotr4EwuTX2CGDxeXhugfuqN5nPu Next: CxZu6qchnXvWZWdMLKcz5NMsg3uSY8idisQZTqu65tPC Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let a = base58'BaBy2y5tGsuQZPMM7JHU89zmahR7yybXaVMXpnZ589An'
4+let a = base58'3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL'
55
6-let b = unit
6+let b = base58'9Jsnot7RWQmTsfXtezQN7igoS2q1QF1jsotaxwh8Fxp4'
77
8-@Callable(c)
9-func exchange () = {
10- let d = getIntegerValue(this, "amountA")
11- let e = getIntegerValue(this, "amountB")
12- let f = {
13- let g = c.payment
14- if ($isInstanceOf(g, "AttachedPayment"))
8+let c = unit
9+
10+let d = 5
11+
12+@Callable(e)
13+func exchanger (f) = if (if ((0 > d))
14+ then true
15+ else (d > 100))
16+ then throw("incorrect comission value")
17+ else {
18+ let g = getIntegerValue(this, "amountTokenB")
19+ let h = getIntegerValue(this, "AmountTokenA")
20+ let i = {
21+ let j = e.payment
22+ if ($isInstanceOf(j, "AttachedPayment"))
23+ then {
24+ let k = j
25+ k
26+ }
27+ else throw("Payment not attached")
28+ }
29+ let l = i.assetId
30+ let m = i.amount
31+ if ((l == unit))
1532 then {
16- let h = g
17- h
33+ let n = ((fraction(h, m, (m + g)) * (100 - d)) / 100)
34+ if ((f > n))
35+ then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
36+ else {
37+ let o = b
38+ ScriptResult(WriteSet([DataEntry("amountTokenA", (h - n)), DataEntry("amountTokenB", (g + m))]), TransferSet([ScriptTransfer(e.caller, n, o)]))
39+ }
1840 }
19- else throw("Payment not attached")
41+ else if ((l == b))
42+ then {
43+ let n = ((fraction(g, m, (m + h)) * (100 - d)) / 100)
44+ if ((f > n))
45+ then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
46+ else {
47+ let o = unit
48+ ScriptResult(WriteSet([DataEntry("amountTokenA", (h + m)), DataEntry("amountTokenB", (g - n))]), TransferSet([ScriptTransfer(e.caller, n, o)]))
49+ }
50+ }
51+ else throw("Asset is not allowed")
2052 }
21- let i = f.assetId
22- let j = f.amount
23- if ((i == b))
24- then {
25- let k = fraction(e, j, (j + d))
26- let l = a
27- ScriptResult(WriteSet([DataEntry("amountB", (e - k)), DataEntry("amountA", (d + j))]), TransferSet([ScriptTransfer(c.caller, k, l)]))
28- }
29- else if ((i == a))
30- then {
31- let k = fraction(d, j, (j + e))
32- let l = unit
33- ScriptResult(WriteSet([DataEntry("amountB", (e + j)), DataEntry("amountA", (d - k))]), TransferSet([ScriptTransfer(c.caller, k, l)]))
34- }
35- else throw("Asset is not allowed")
53+
54+
55+
56+@Callable(e)
57+func withdraw () = {
58+ let p = assetBalance(this, b)
59+ let q = assetBalance(this, c)
60+ if ((e.caller.bytes == a))
61+ then ScriptResult(WriteSet([DataEntry("amountTokenA", "withdrawn"), DataEntry("amountTokenB", "withdrawn")]), TransferSet([ScriptTransfer(e.caller, p, b), ScriptTransfer(e.caller, q, c)]))
62+ else throw("You are not exchanger's owner")
3663 }
3764
65+
66+@Verifier(e)
67+func r () = true
3868

github/deemru/w8io/169f3d6 
38.13 ms