tx · BMXPWUrZNuz1rf9srKZvyfhnD3ShTL7cREM2DvXSpgCU 3N4w7wVkViML11XdFL5xNkPofVVg1nLWEmX: -0.01400000 Waves 2019.07.04 19:06 [570914] smart account 3N4w7wVkViML11XdFL5xNkPofVVg1nLWEmX > SELF 0.00000000 Waves
{ "type": 13, "id": "BMXPWUrZNuz1rf9srKZvyfhnD3ShTL7cREM2DvXSpgCU", "fee": 1400000, "feeAssetId": null, "timestamp": 1562256391903, "version": 1, "sender": "3N4w7wVkViML11XdFL5xNkPofVVg1nLWEmX", "senderPublicKey": "EKGwbPjcrwuWgDm8Ed9HAGmxMviCRgqTkQDVt4rYbyre", "proofs": [ "F1SjtAjvJ1ZWAkFgY1JrZAaHBn4q3xvzVmL9REHXpbi6ft64R7FQsQiADPmnUFNRwquWstHpnBo6vZ7eCDZf2FC" ], "script": "base64:AAIDAAAAAAAAAAAAAAADAAAAAAVvd25lcgEAAAAaAVTvvhtsl5a8uJsx9lmVjj72aCuw5r86MC8AAAAADUxpcXVpZEFzc2V0SWQBAAAAIOko/8ffrEF7C8jHeLG92rw5x2KlLkjVtarJvVMwnDvrAAAAAAdXQVZFU0lEBQAAAAR1bml0AAAAAgAAAApjb250ZXh0T2JqAQAAAAd1bmlzd2FwAAAAAgAAAAljb21pc3Npb24AAAANbWluUHJpY2VMZXZlbAMDCQAAZgAAAAIAAAAAAAAAAAAFAAAACWNvbWlzc2lvbgYJAABmAAAAAgUAAAAJY29taXNzaW9uAAAAAAAAAABkCQAAAgAAAAECAAAAGWluY29ycmVjdCBjb21pc3Npb24gdmFsdWUEAAAAC3dhdmVzQW1vdW50CQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzAgAAAAt3YXZlc0Ftb3VudAQAAAAMbGlxdWlkQW1vdW50CQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzAgAAAAxsaXF1aWRBbW91bnQEAAAAB3BheW1lbnQEAAAAByRtYXRjaDAIBQ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lcgAAAAMIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgUAAAAPdG9rZW5TZW5kQW1vdW50BQAAAAthc3NldElkU2VudAUAAAADbmlsCQAAAgAAAAECAAAAFEFzc2V0IGlzIG5vdCBhbGxvd2VkAAAACmNvbnRleHRPYmoBAAAACHdpdGhkcmF3AAAAAAQAAAANTGlxdWlkQmFsYW5jZQkAA+sAAAACBQAAAAR0aGlzBQAAAA1MaXF1aWRBc3NldElkBAAAAAxXYXZlc0JhbGFuY2UJAQAAAAx3YXZlc0JhbGFuY2UAAAABBQAAAAR0aGlzAwkAAAAAAAACCAgFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyAAAABWJ5dGVzBQAAAAVvd25lcgkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAADGxpcXVpZEFtb3VudAIAAAAJd2l0aGRyYXduCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAt3YXZlc0Ftb3VudAIAAAAJd2l0aGRyYXduBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyBQAAAA1MaXF1aWRCYWxhbmNlBQAAAA1MaXF1aWRBc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgUAAAAMV2F2ZXNCYWxhbmNlBQAAAAR1bml0BQAAAANuaWwJAAACAAAAAQIAAAAdWW91IGFyZSBub3QgZXhjaGFuZ2VyJ3Mgb3duZXIAAAABAAAACmNvbnRleHRPYmoBAAAABnZlcmlmeQAAAAAGEpJBfQ==", "chainId": 84, "height": 570914, "spentComplexity": 0 } View: original | compacted Prev: D3kvAU2yc7xAoovQEq4iZd6FMgHBRMWjsPDbzo6REskx Next: C6BfHa54RubtNkmR6dyt5DTofdEp34i7eBQ2nDi2tWvY Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = base58'3NBmj1eEDJmrQ16GJkmVU1p31MTURgoV38r' | |
5 | + | ||
6 | + | let b = base58'GhAFhXzwCYfvcXQ3GHFaQFnCzAuYCT156qFqiYyzfkzv' | |
7 | + | ||
8 | + | let c = unit | |
9 | + | ||
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") | |
26 | + | } | |
27 | + | let l = i.assetId | |
28 | + | let m = i.amount | |
29 | + | if ((l == unit)) | |
30 | + | 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 | + | } | |
38 | + | } | |
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 | + | } | |
4 | 51 | ||
5 | 52 | ||
6 | - | @Callable(a) | |
7 | - | func uniswap () = { | |
8 | - | let b = base58'GhAFhXzwCYfvcXQ3GHFaQFnCzAuYCT156qFqiYyzfkzv' | |
9 | - | let c = getIntegerValue(this, "wavesAmount") | |
10 | - | let d = getIntegerValue(this, "liquidAmount") | |
11 | - | let e = { | |
12 | - | let f = a.payment | |
13 | - | if ($isInstanceOf(f, "AttachedPayment")) | |
14 | - | then { | |
15 | - | let g = f | |
16 | - | g | |
17 | - | } | |
18 | - | else throw("Payment not attached") | |
19 | - | } | |
20 | - | let h = e.assetId | |
21 | - | let i = e.amount | |
22 | - | if ((h == unit)) | |
23 | - | then { | |
24 | - | let j = fraction(d, i, (i + c)) | |
25 | - | let k = b | |
26 | - | ScriptResult(WriteSet([DataEntry("liquidAmount", (d - j)), DataEntry("wavesAmount", (c + i))]), TransferSet([ScriptTransfer(a.caller, j, k)])) | |
27 | - | } | |
28 | - | else if ((h == b)) | |
29 | - | then { | |
30 | - | let j = fraction(c, i, (i + d)) | |
31 | - | let k = unit | |
32 | - | ScriptResult(WriteSet([DataEntry("liquidAmount", (d + i)), DataEntry("wavesAmount", (c - j))]), TransferSet([ScriptTransfer(a.caller, j, k)])) | |
33 | - | } | |
34 | - | else throw("Asset is not allowed") | |
53 | + | ||
54 | + | @Callable(d) | |
55 | + | func withdraw () = { | |
56 | + | let p = assetBalance(this, b) | |
57 | + | let q = wavesBalance(this) | |
58 | + | if ((d.caller.bytes == a)) | |
59 | + | then ScriptResult(WriteSet([DataEntry("liquidAmount", "withdrawn"), DataEntry("wavesAmount", "withdrawn")]), TransferSet([ScriptTransfer(d.caller, p, b), ScriptTransfer(d.caller, q, unit)])) | |
60 | + | else throw("You are not exchanger's owner") | |
35 | 61 | } | |
36 | 62 | ||
63 | + | ||
64 | + | @Verifier(d) | |
65 | + | func r () = true | |
37 | 66 |
github/deemru/w8io/026f985 22.73 ms ◑