tx · GLRY6F4ZQhCYBThEXFtPCAnKmk3Mu6PfDgB1zYNJyyfg 3N4w7wVkViML11XdFL5xNkPofVVg1nLWEmX: -0.01400000 Waves 2019.07.11 12:07 [580829] smart account 3N4w7wVkViML11XdFL5xNkPofVVg1nLWEmX > SELF 0.00000000 Waves
{ "type": 13, "id": "GLRY6F4ZQhCYBThEXFtPCAnKmk3Mu6PfDgB1zYNJyyfg", "fee": 1400000, "feeAssetId": null, "timestamp": 1562836009376, "version": 1, "sender": "3N4w7wVkViML11XdFL5xNkPofVVg1nLWEmX", "senderPublicKey": "EKGwbPjcrwuWgDm8Ed9HAGmxMviCRgqTkQDVt4rYbyre", "proofs": [ "4UbHRq7nurtWBfYdryRuYevr5ryconDwUPpVJpmD3ct5MKc7AEWFgSv2CQKtcVm8WmkAkfVk6Um21idYoSskaJrn" ], "script": "base64:AAIDAAAAAAAAAAAAAAADAAAAAAVvd25lcgEAAAAaAVTvvhtsl5a8uJsx9lmVjj72aCuw5r86MC8AAAAADUxpcXVpZEFzc2V0SWQBAAAAIOko/8ffrEF7C8jHeLG92rw5x2KlLkjVtarJvVMwnDvrAAAAAAdXQVZFU0lEBQAAAAR1bml0AAAAAgAAAApjb250ZXh0T2JqAQAAAAd1bmlzd2FwAAAAAAQAAAALd2F2ZXNBbW91bnQJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMCAAAAC3dhdmVzQW1vdW50BAAAAAxsaXF1aWRBbW91bnQJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMCAAAADGxpcXVpZEFtb3VudAQAAAAHcGF5bWVudAQAAAAHJG1hdGNoMAgFAAAACmNvbnRleHRPYmoAAAAHcGF5bWVudAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPQXR0YWNoZWRQYXltZW50BAAAAAFwBQAAAAckbWF0Y2gwBQAAAAFwCQAAAgAAAAECAAAAFFBheW1lbnQgbm90IGF0dGFjaGVkBAAAAA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TGlxdWlkQmFsYW5jZQUAAAANTGlxdWlkQXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAAKY29udGV4dE9iagAAAAZjYWxsZXIFAAAADFdhdmVzQmFsYW5jZQUAAAAEdW5pdAUAAAADbmlsCQAAAgAAAAECAAAAHVlvdSBhcmUgbm90IGV4Y2hhbmdlcidzIG93bmVyAAAAAQAAAApjb250ZXh0T2JqAQAAAAZ2ZXJpZnkAAAAABh+WEQw=", "chainId": 84, "height": 580829, "spentComplexity": 0 } View: original | compacted Prev: C6BfHa54RubtNkmR6dyt5DTofdEp34i7eBQ2nDi2tWvY Next: 9dHemJ7qqoVPEzfhWYsbpMZ9Upjib3fZGUvRjMi7LwP5 Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let owner = base58'3NBmj1eEDJmrQ16GJkmVU1p31MTURgoV38r' | |
5 | 5 | ||
6 | 6 | let LiquidAssetId = base58'GhAFhXzwCYfvcXQ3GHFaQFnCzAuYCT156qFqiYyzfkzv' | |
7 | 7 | ||
8 | 8 | let WAVESID = unit | |
9 | 9 | ||
10 | 10 | @Callable(contextObj) | |
11 | 11 | func uniswap () = { | |
12 | 12 | let wavesAmount = getIntegerValue(this, "wavesAmount") | |
13 | 13 | let liquidAmount = getIntegerValue(this, "liquidAmount") | |
14 | 14 | let payment = match contextObj.payment { | |
15 | 15 | case p: AttachedPayment => | |
16 | 16 | p | |
17 | 17 | case _ => | |
18 | 18 | throw("Payment not attached") | |
19 | 19 | } | |
20 | 20 | let assetIdReceived = payment.assetId | |
21 | 21 | let tokenReceiveAmount = payment.amount | |
22 | 22 | if ((assetIdReceived == unit)) | |
23 | 23 | then { | |
24 | 24 | let tokenSendAmount = fraction(liquidAmount, tokenReceiveAmount, (tokenReceiveAmount + wavesAmount)) | |
25 | 25 | let assetIdSent = LiquidAssetId | |
26 | 26 | ScriptResult(WriteSet([DataEntry("liquidAmount", (liquidAmount - tokenSendAmount)), DataEntry("wavesAmount", (wavesAmount + tokenReceiveAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)])) | |
27 | 27 | } | |
28 | 28 | else if ((assetIdReceived == LiquidAssetId)) | |
29 | 29 | then { | |
30 | 30 | let tokenSendAmount = fraction(wavesAmount, tokenReceiveAmount, (tokenReceiveAmount + liquidAmount)) | |
31 | 31 | let assetIdSent = unit | |
32 | 32 | ScriptResult(WriteSet([DataEntry("liquidAmofunt", (liquidAmount + tokenReceiveAmount)), DataEntry("wavesAmount", (wavesAmount - tokenSendAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)])) | |
33 | 33 | } | |
34 | 34 | else throw("Asset is not allowed") | |
35 | 35 | } | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | ||
39 | 39 | @Callable(contextObj) | |
40 | 40 | func withdraw () = { | |
41 | 41 | let LiquidBalance = assetBalance(this, LiquidAssetId) | |
42 | 42 | let WavesBalance = wavesBalance(this) | |
43 | 43 | if ((contextObj.caller.bytes == owner)) | |
44 | 44 | then ScriptResult(WriteSet([DataEntry("liquidAmount", "withdrawn"), DataEntry("wavesAmount", "withdrawn")]), TransferSet([ScriptTransfer(contextObj.caller, LiquidBalance, LiquidAssetId), ScriptTransfer(contextObj.caller, WavesBalance, unit)])) | |
45 | 45 | else throw("You are not exchanger's owner") | |
46 | 46 | } | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | @Verifier(contextObj) | |
50 | 50 | func verify () = true | |
51 | 51 |
github/deemru/w8io/026f985 24.41 ms ◑