tx · 9ns78H1h3uZ9rdJd1AJbnoGEANuwT1uZ26Jq1tiA9yYm 3MpVFGJWgiGyh5LmE1nxNLsjjtSL3Bgh9NV: -0.01400000 Waves 2019.08.30 16:08 [654026] smart account 3MpVFGJWgiGyh5LmE1nxNLsjjtSL3Bgh9NV > SELF 0.00000000 Waves
{ "type": 13, "id": "9ns78H1h3uZ9rdJd1AJbnoGEANuwT1uZ26Jq1tiA9yYm", "fee": 1400000, "feeAssetId": null, "timestamp": 1567170467078, "version": 1, "sender": "3MpVFGJWgiGyh5LmE1nxNLsjjtSL3Bgh9NV", "senderPublicKey": "854p8BYzrj6yBPRPmfQur3oF1Rjc1AJ548qRp5FT5kDa", "proofs": [ "3a1gWRvwcf8pKPX9DGDgeDu27TsiJcMvXxNZjdDx31mvBP6k1fNmETv5xvMQi6DwbpgUmAgpjRRko4NjD56hS5wm" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAAAAAAVvd25lcgEAAAAaAVRFbm0V+EOCq2NTOJsSE2133z0GcAjjvP8AAAAADWFzc2V0SWRUb2tlbkEBAAAAIEMzbeDGHf4oU+zuHGjXevUoBPuFN8LOz9CQD8ug/yo1AAAAAA1hc3NldElkVG9rZW5CAQAAACCqoUHYIr+9N/tCdWkhfZ3SevjX3HPTosOWNfoRj9syOgAAAAAJY29taXNzaW9uAAAAAAAAAAAKAAAABAAAAApjb250ZXh0T2JqAQAAAARmdW5kAAAAAAQAAAAHcGF5bWVudAQAAAAHJG1hdGNoMAgFAAAACmNvbnRleHRPYmoAAAAHcGF5bWVudAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPQXR0YWNoZWRQYXltZW50BAAAAAFwBQAAAAckbWF0Y2gwBQAAAAFwCQAAAgAAAAECAAAAFFBheW1lbnQgbm90IGF0dGFjaGVkBAAAAA9hc3NldElkUmVjZWl2ZWQIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQEAAAAEnRva2VuUmVjZWl2ZUFtb3VudAgFAAAAB3BheW1lb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AQAAAApjb250ZXh0T2JqAQAAAAZ2ZXJpZnkAAAAABm1XTIM=", "chainId": 84, "height": 654026, "spentComplexity": 0 } View: original | compacted Prev: 7N4UBN22zGYXZFsWzXE3XLQyiJayH2jtZk79tcBCM2YU Next: 89GMYyqTFG1YxNE81JHxnRb9KEb53Niv6P4srhuA8Lm8 Diff:
Old | New | Differences | |
---|---|---|---|
22 | 22 | } | |
23 | 23 | let i = f.assetId | |
24 | 24 | let j = f.amount | |
25 | - | if (if ((i == b)) | |
26 | - | then !(isDefined(getBoolean(this, "fundA"))) | |
27 | - | else false) | |
25 | + | if ((i == b)) | |
28 | 26 | then WriteSet([DataEntry("amountTokenA", j), DataEntry("fundA", true)]) | |
29 | 27 | else if (if ((i == c)) | |
30 | 28 | then !(isDefined(getBoolean(this, "fundB"))) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'3MvFCghS4jJ7E5QuJfKa4LwCoHJiAcsDQrA' | |
5 | 5 | ||
6 | 6 | let b = base58'5XKoQDZphxtgtXxm36qhXrYo1F6mRLa9M8QHUDPWQ4mi' | |
7 | 7 | ||
8 | 8 | let c = base58'CV4vfjkevn3aJ4tKaMn9gPHugYztu6RhDw2ete34SxiV' | |
9 | 9 | ||
10 | 10 | let d = 10 | |
11 | 11 | ||
12 | 12 | @Callable(e) | |
13 | 13 | func fund () = { | |
14 | 14 | let f = { | |
15 | 15 | let g = e.payment | |
16 | 16 | if ($isInstanceOf(g, "AttachedPayment")) | |
17 | 17 | then { | |
18 | 18 | let h = g | |
19 | 19 | h | |
20 | 20 | } | |
21 | 21 | else throw("Payment not attached") | |
22 | 22 | } | |
23 | 23 | let i = f.assetId | |
24 | 24 | let j = f.amount | |
25 | - | if (if ((i == b)) | |
26 | - | then !(isDefined(getBoolean(this, "fundA"))) | |
27 | - | else false) | |
25 | + | if ((i == b)) | |
28 | 26 | then WriteSet([DataEntry("amountTokenA", j), DataEntry("fundA", true)]) | |
29 | 27 | else if (if ((i == c)) | |
30 | 28 | then !(isDefined(getBoolean(this, "fundB"))) | |
31 | 29 | else false) | |
32 | 30 | then WriteSet([DataEntry("amountTokenB", j), DataEntry("fundB", true)]) | |
33 | 31 | else throw("already funded or you try to fund with incorrect asset") | |
34 | 32 | } | |
35 | 33 | ||
36 | 34 | ||
37 | 35 | ||
38 | 36 | @Callable(e) | |
39 | 37 | func replenishment () = { | |
40 | 38 | let f = { | |
41 | 39 | let g = e.payment | |
42 | 40 | if ($isInstanceOf(g, "AttachedPayment")) | |
43 | 41 | then { | |
44 | 42 | let h = g | |
45 | 43 | h | |
46 | 44 | } | |
47 | 45 | else throw("Payment not attached") | |
48 | 46 | } | |
49 | 47 | let i = f.assetId | |
50 | 48 | let j = f.amount | |
51 | 49 | if (if ((i == b)) | |
52 | 50 | then isDefined(getBoolean(this, "fundA")) | |
53 | 51 | else false) | |
54 | 52 | then { | |
55 | 53 | let k = getIntegerValue(this, "amountTokenA") | |
56 | 54 | WriteSet([DataEntry("amountTokenA", (k + j))]) | |
57 | 55 | } | |
58 | 56 | else if (if ((i == c)) | |
59 | 57 | then isDefined(getBoolean(this, "fundB")) | |
60 | 58 | else false) | |
61 | 59 | then { | |
62 | 60 | let l = getIntegerValue(this, "amountTokenB") | |
63 | 61 | WriteSet([DataEntry("amountTokenA", (l + j))]) | |
64 | 62 | } | |
65 | 63 | else throw("there was an error in the replenishment") | |
66 | 64 | } | |
67 | 65 | ||
68 | 66 | ||
69 | 67 | ||
70 | 68 | @Callable(e) | |
71 | 69 | func exchanger (m) = if (if ((0 > d)) | |
72 | 70 | then true | |
73 | 71 | else (d > 100)) | |
74 | 72 | then throw("incorrect comission value") | |
75 | 73 | else { | |
76 | 74 | let l = getIntegerValue(this, "amountTokenB") | |
77 | 75 | let k = getIntegerValue(this, "amountTokenA") | |
78 | 76 | let f = { | |
79 | 77 | let g = e.payment | |
80 | 78 | if ($isInstanceOf(g, "AttachedPayment")) | |
81 | 79 | then { | |
82 | 80 | let h = g | |
83 | 81 | h | |
84 | 82 | } | |
85 | 83 | else throw("Payment not attached") | |
86 | 84 | } | |
87 | 85 | let i = f.assetId | |
88 | 86 | let j = f.amount | |
89 | 87 | if ((i == c)) | |
90 | 88 | then { | |
91 | 89 | let n = ((fraction(k, j, (j + l)) * (100 - d)) / 100) | |
92 | 90 | if ((m > n)) | |
93 | 91 | then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level") | |
94 | 92 | else { | |
95 | 93 | let o = b | |
96 | 94 | ScriptResult(WriteSet([DataEntry("amountTokenA", (k - n)), DataEntry("amountTokenB", (l + j))]), TransferSet([ScriptTransfer(e.caller, n, o)])) | |
97 | 95 | } | |
98 | 96 | } | |
99 | 97 | else if ((i == b)) | |
100 | 98 | then { | |
101 | 99 | let n = ((fraction(l, j, (j + k)) * (100 - d)) / 100) | |
102 | 100 | if ((m > n)) | |
103 | 101 | then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level") | |
104 | 102 | else { | |
105 | 103 | let o = c | |
106 | 104 | ScriptResult(WriteSet([DataEntry("amountTokenA", (k + j)), DataEntry("amountTokenB", (l - n))]), TransferSet([ScriptTransfer(e.caller, n, o)])) | |
107 | 105 | } | |
108 | 106 | } | |
109 | 107 | else throw("Asset is not allowed") | |
110 | 108 | } | |
111 | 109 | ||
112 | 110 | ||
113 | 111 | ||
114 | 112 | @Callable(e) | |
115 | 113 | func withdraw () = { | |
116 | 114 | let p = assetBalance(this, b) | |
117 | 115 | let q = assetBalance(this, c) | |
118 | 116 | if ((e.caller.bytes == a)) | |
119 | 117 | then ScriptResult(WriteSet([DataEntry("amountTokenA", "withdrawn"), DataEntry("amountTokenB", "withdrawn")]), TransferSet([ScriptTransfer(e.caller, p, b), ScriptTransfer(e.caller, q, c)])) | |
120 | 118 | else throw("You are not exchanger's owner") | |
121 | 119 | } | |
122 | 120 | ||
123 | 121 | ||
124 | 122 | @Verifier(e) | |
125 | 123 | func r () = true | |
126 | 124 |
github/deemru/w8io/026f985 40.66 ms ◑