tx · C6BfHa54RubtNkmR6dyt5DTofdEp34i7eBQ2nDi2tWvY 3N4w7wVkViML11XdFL5xNkPofVVg1nLWEmX: -0.01400000 Waves 2019.07.11 12:03 [580826] smart account 3N4w7wVkViML11XdFL5xNkPofVVg1nLWEmX > SELF 0.00000000 Waves
{ "type": 13, "id": "C6BfHa54RubtNkmR6dyt5DTofdEp34i7eBQ2nDi2tWvY", "fee": 1400000, "feeAssetId": null, "timestamp": 1562835818424, "version": 1, "sender": "3N4w7wVkViML11XdFL5xNkPofVVg1nLWEmX", "senderPublicKey": "EKGwbPjcrwuWgDm8Ed9HAGmxMviCRgqTkQDVt4rYbyre", "proofs": [ "LuMyKuQTNsP1MzR1b6uTqPM2JAFNDNaNe42ouUoD8qZrDqpiFMASYoptMZRTmhC6qy2kr4Cf9468uVsXdng8Xd8" ], "script": "base64:AAIDAAAAAAAAAAAAAAADAAAAAAVvd25lcgEAAAAaAVTvvhtsl5a8uJsx9lmVjj72aCuw5r86MC8AAAAADUxpcXVpZEFzc2V0SWQBAAAAIOko/8ffrEF7C8jHeLG92rw5x2KlLkjVtarJvVMwnDvrAAAAAAdXQVZFU0lEBQAAAAR1bml0AAAAAgAAAApjb250ZXh0T2JqAQAAAAd1bmlzd2FwAAAAAAQAAAALd2F2ZXNBbW91bnQJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMCAAAAC3dhdmVzQW1vdW50BAAAAAxsaXF1aWRBbW91bnQJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMCAAAADGxpcXVpZEFtb3VudAQAAAAHcGF5bWVudAQAAAAHJG1hdGNoMAgFAAAACmNvbnRleHRPYmoAAAAHcGF5bWVudAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPQXR0YWNoZWRQYXltZW50BAAAAAFwBQAAAAckbWF0Y2gwBQAAAAFwCQAAAgAAAAECAAAAFFBheW1lbnQgbm90IGF0dGFjaGVkBAAAAA9hc3N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WlkQmFsYW5jZQUAAAANTGlxdWlkQXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAAKY29udGV4dE9iagAAAAZjYWxsZXIFAAAADFdhdmVzQmFsYW5jZQUAAAAEdW5pdAUAAAADbmlsCQAAAgAAAAECAAAAHVlvdSBhcmUgbm90IGV4Y2hhbmdlcidzIG93bmVyAAAAAQAAAApjb250ZXh0T2JqAQAAAAZ2ZXJpZnkAAAAABh+WEQw=", "chainId": 84, "height": 580826, "spentComplexity": 0 } View: original | compacted Prev: BMXPWUrZNuz1rf9srKZvyfhnD3ShTL7cREM2DvXSpgCU Next: GLRY6F4ZQhCYBThEXFtPCAnKmk3Mu6PfDgB1zYNJyyfg Diff:
Old | New | Differences | |
---|---|---|---|
8 | 8 | let c = unit | |
9 | 9 | ||
10 | 10 | @Callable(d) | |
11 | - | func uniswap (e,f) = if (if ((0 > e)) | |
12 | - | then true | |
13 | - | else (e > 100)) | |
14 | - | then throw("incorrect comission value") | |
15 | - | else { | |
16 | - | let g = getIntegerValue(this, "wavesAmount") | |
17 | - | let h = getIntegerValue(this, "liquidAmount") | |
18 | - | let i = { | |
19 | - | let j = d.payment | |
20 | - | if ($isInstanceOf(j, "AttachedPayment")) | |
21 | - | then { | |
22 | - | let k = j | |
23 | - | k | |
24 | - | } | |
25 | - | else throw("Payment not attached") | |
11 | + | func uniswap () = { | |
12 | + | let e = getIntegerValue(this, "wavesAmount") | |
13 | + | let f = getIntegerValue(this, "liquidAmount") | |
14 | + | let g = { | |
15 | + | let h = d.payment | |
16 | + | if ($isInstanceOf(h, "AttachedPayment")) | |
17 | + | then { | |
18 | + | let i = h | |
19 | + | i | |
20 | + | } | |
21 | + | else throw("Payment not attached") | |
22 | + | } | |
23 | + | let j = g.assetId | |
24 | + | let k = g.amount | |
25 | + | if ((j == unit)) | |
26 | + | then { | |
27 | + | let l = fraction(f, k, (k + e)) | |
28 | + | let m = b | |
29 | + | ScriptResult(WriteSet([DataEntry("liquidAmount", (f - l)), DataEntry("wavesAmount", (e + k))]), TransferSet([ScriptTransfer(d.caller, l, m)])) | |
26 | 30 | } | |
27 | - | let l = i.assetId | |
28 | - | let m = i.amount | |
29 | - | if ((l == unit)) | |
31 | + | else if ((j == b)) | |
30 | 32 | then { | |
31 | - | let n = ((fraction(h, m, (m + g)) * (100 - e)) / 100) | |
32 | - | if ((f > n)) | |
33 | - | then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level") | |
34 | - | else { | |
35 | - | let o = b | |
36 | - | ScriptResult(WriteSet([DataEntry("liquidAmount", (h - n)), DataEntry("wavesAmount", (g + m))]), TransferSet([ScriptTransfer(d.caller, n, o)])) | |
37 | - | } | |
33 | + | let l = fraction(e, k, (k + f)) | |
34 | + | let m = unit | |
35 | + | ScriptResult(WriteSet([DataEntry("liquidAmofunt", (f + k)), DataEntry("wavesAmount", (e - l))]), TransferSet([ScriptTransfer(d.caller, l, m)])) | |
38 | 36 | } | |
39 | - | else if ((l == b)) | |
40 | - | then { | |
41 | - | let n = ((fraction(g, m, (m + h)) * (100 - e)) / 100) | |
42 | - | if ((f > n)) | |
43 | - | then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level") | |
44 | - | else { | |
45 | - | let o = unit | |
46 | - | ScriptResult(WriteSet([DataEntry("liquidAmount", (h + m)), DataEntry("wavesAmount", (g - n))]), TransferSet([ScriptTransfer(d.caller, n, o)])) | |
47 | - | } | |
48 | - | } | |
49 | - | else throw("Asset is not allowed") | |
50 | - | } | |
37 | + | else throw("Asset is not allowed") | |
38 | + | } | |
51 | 39 | ||
52 | 40 | ||
53 | 41 | ||
54 | 42 | @Callable(d) | |
55 | 43 | func withdraw () = { | |
56 | - | let | |
57 | - | let | |
44 | + | let n = assetBalance(this, b) | |
45 | + | let o = wavesBalance(this) | |
58 | 46 | if ((d.caller.bytes == a)) | |
59 | - | then ScriptResult(WriteSet([DataEntry("liquidAmount", "withdrawn"), DataEntry("wavesAmount", "withdrawn")]), TransferSet([ScriptTransfer(d.caller, | |
47 | + | then ScriptResult(WriteSet([DataEntry("liquidAmount", "withdrawn"), DataEntry("wavesAmount", "withdrawn")]), TransferSet([ScriptTransfer(d.caller, n, b), ScriptTransfer(d.caller, o, unit)])) | |
60 | 48 | else throw("You are not exchanger's owner") | |
61 | 49 | } | |
62 | 50 | ||
63 | 51 | ||
64 | 52 | @Verifier(d) | |
65 | - | func | |
53 | + | func p () = true | |
66 | 54 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'3NBmj1eEDJmrQ16GJkmVU1p31MTURgoV38r' | |
5 | 5 | ||
6 | 6 | let b = base58'GhAFhXzwCYfvcXQ3GHFaQFnCzAuYCT156qFqiYyzfkzv' | |
7 | 7 | ||
8 | 8 | let c = unit | |
9 | 9 | ||
10 | 10 | @Callable(d) | |
11 | - | func uniswap (e,f) = if (if ((0 > e)) | |
12 | - | then true | |
13 | - | else (e > 100)) | |
14 | - | then throw("incorrect comission value") | |
15 | - | else { | |
16 | - | let g = getIntegerValue(this, "wavesAmount") | |
17 | - | let h = getIntegerValue(this, "liquidAmount") | |
18 | - | let i = { | |
19 | - | let j = d.payment | |
20 | - | if ($isInstanceOf(j, "AttachedPayment")) | |
21 | - | then { | |
22 | - | let k = j | |
23 | - | k | |
24 | - | } | |
25 | - | else throw("Payment not attached") | |
11 | + | func uniswap () = { | |
12 | + | let e = getIntegerValue(this, "wavesAmount") | |
13 | + | let f = getIntegerValue(this, "liquidAmount") | |
14 | + | let g = { | |
15 | + | let h = d.payment | |
16 | + | if ($isInstanceOf(h, "AttachedPayment")) | |
17 | + | then { | |
18 | + | let i = h | |
19 | + | i | |
20 | + | } | |
21 | + | else throw("Payment not attached") | |
22 | + | } | |
23 | + | let j = g.assetId | |
24 | + | let k = g.amount | |
25 | + | if ((j == unit)) | |
26 | + | then { | |
27 | + | let l = fraction(f, k, (k + e)) | |
28 | + | let m = b | |
29 | + | ScriptResult(WriteSet([DataEntry("liquidAmount", (f - l)), DataEntry("wavesAmount", (e + k))]), TransferSet([ScriptTransfer(d.caller, l, m)])) | |
26 | 30 | } | |
27 | - | let l = i.assetId | |
28 | - | let m = i.amount | |
29 | - | if ((l == unit)) | |
31 | + | else if ((j == b)) | |
30 | 32 | then { | |
31 | - | let n = ((fraction(h, m, (m + g)) * (100 - e)) / 100) | |
32 | - | if ((f > n)) | |
33 | - | then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level") | |
34 | - | else { | |
35 | - | let o = b | |
36 | - | ScriptResult(WriteSet([DataEntry("liquidAmount", (h - n)), DataEntry("wavesAmount", (g + m))]), TransferSet([ScriptTransfer(d.caller, n, o)])) | |
37 | - | } | |
33 | + | let l = fraction(e, k, (k + f)) | |
34 | + | let m = unit | |
35 | + | ScriptResult(WriteSet([DataEntry("liquidAmofunt", (f + k)), DataEntry("wavesAmount", (e - l))]), TransferSet([ScriptTransfer(d.caller, l, m)])) | |
38 | 36 | } | |
39 | - | else if ((l == b)) | |
40 | - | then { | |
41 | - | let n = ((fraction(g, m, (m + h)) * (100 - e)) / 100) | |
42 | - | if ((f > n)) | |
43 | - | then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level") | |
44 | - | else { | |
45 | - | let o = unit | |
46 | - | ScriptResult(WriteSet([DataEntry("liquidAmount", (h + m)), DataEntry("wavesAmount", (g - n))]), TransferSet([ScriptTransfer(d.caller, n, o)])) | |
47 | - | } | |
48 | - | } | |
49 | - | else throw("Asset is not allowed") | |
50 | - | } | |
37 | + | else throw("Asset is not allowed") | |
38 | + | } | |
51 | 39 | ||
52 | 40 | ||
53 | 41 | ||
54 | 42 | @Callable(d) | |
55 | 43 | func withdraw () = { | |
56 | - | let | |
57 | - | let | |
44 | + | let n = assetBalance(this, b) | |
45 | + | let o = wavesBalance(this) | |
58 | 46 | if ((d.caller.bytes == a)) | |
59 | - | then ScriptResult(WriteSet([DataEntry("liquidAmount", "withdrawn"), DataEntry("wavesAmount", "withdrawn")]), TransferSet([ScriptTransfer(d.caller, | |
47 | + | then ScriptResult(WriteSet([DataEntry("liquidAmount", "withdrawn"), DataEntry("wavesAmount", "withdrawn")]), TransferSet([ScriptTransfer(d.caller, n, b), ScriptTransfer(d.caller, o, unit)])) | |
60 | 48 | else throw("You are not exchanger's owner") | |
61 | 49 | } | |
62 | 50 | ||
63 | 51 | ||
64 | 52 | @Verifier(d) | |
65 | - | func | |
53 | + | func p () = true | |
66 | 54 |
github/deemru/w8io/026f985 25.03 ms ◑