tx · 96JSLTbeBoKDFPw3ZBCdBvewgB2fX28d62cxVbb17sEH 3N7AyMYR2ovan7TNvPE9jMRTejZyXPcV9NP: -0.05000000 Waves 2021.08.23 19:41 [1671228] smart account 3N7AyMYR2ovan7TNvPE9jMRTejZyXPcV9NP > SELF 0.00000000 Waves
{ "type": 13, "id": "96JSLTbeBoKDFPw3ZBCdBvewgB2fX28d62cxVbb17sEH", "fee": 5000000, "feeAssetId": null, "timestamp": 1629736946231, "version": 2, "chainId": 84, "sender": "3N7AyMYR2ovan7TNvPE9jMRTejZyXPcV9NP", "senderPublicKey": "Go3xxijfukFnawU9Jyy1yX4dSyxKT9SYT6Tp3g6iTAjt", "proofs": [ "NvZxLUnQj4VDJ8EaN5J8PboxtYECG2ngqH6QY88jztuQsBDFxtHhPzWxQya19kbZK9DRMKU7P9CneuWBzWT1Jmg" ], "script": "base64:AAIFAAAAAAAAAgQIAhIDCgEBEgQKAgEBGggKAmExEgJXVRoICgJhMhICU1caCAoCYTMSAlNVGgcKAmE0EgFXGgcKAmE1EgFVGgcKAmE2EgFTGgsKAmE3EgVhZG1pbhoMCgJhOBIGc2NhbGU4Gh4KAmE5Ehhjb21taXNzaW9uU2NhbGVEZWxpbWl0ZXIaEAoCYjESCmNvbW1pc3Npb24aCgoCYjISBGZlZXMaCgoCYjMSBGZyb20aCAoCYjQSAnRvGgoKAmI1EgRhbW50GhYKAmI2EhBhbW91bnRXaXRob3V0RmVlGhMKAmI3Eg1hbW91bnRXaXRoRmVlGgcKAmI4EgFpGgkKAmI5EgNtaW4aCQoCYzESA3BtdBoJCgJjMhIDZTFhGgkKAmMzEgNlMWIaCQoCYzQSA2UyYRoJCgJjNRIDZTJiGgkKAmM2EgNlM2EaCQoCYzcSA2UzYhoJCgJjOBIDYmJ1GgkKAmM5EgNiYncaCQoCZDESA2JicxoKCgJkMhIEZGlmdRoKCgJkMxIEZGlmcxoKCgJkNBIEZGlmdxoLCgJkNRIFc3dhcDEaCwoCZDYSBWRpZmZ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WN0CQAAAgAAAAECAAAABnN0cmljdAkAAAIAAAABAgAAAAZzdHJpY3QJAAACAAAAAQIAAAAGc3RyaWN0CQAAAgAAAAECAAAABnN0cmljdAkAAAIAAAABAgAAAAZTdHJpY3QAAAABAAAAAmUzAQAAAAJlNAAAAAAJAAH0AAAAAwgFAAAAAmUzAAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACZTMAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACZTMAAAAPc2VuZGVyUHVibGljS2V58cFcyg==", "height": 1671228, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 71sAFQK4iHoqYqzPGHyaNJUThHUo5UzTmhTU6Eduyn3r Next: GKB8eapyU9gonXmHRYXgrkjQDMYP9DKRjwwnbsYtCzu2 Diff:
Old | New | Differences | |
---|---|---|---|
29 | 29 | ||
30 | 30 | ||
31 | 31 | @Callable(i) | |
32 | - | func call1 ( | |
32 | + | func call1 (min) = if ((i.caller != admin)) | |
33 | 33 | then throw("only admin") | |
34 | 34 | else { | |
35 | + | let pmt = i.payments[0] | |
36 | + | let amnt = pmt.amount | |
35 | 37 | let e1a = getIntegerValue(WU, "A_asset_balance") | |
36 | 38 | if ((e1a == e1a)) | |
37 | 39 | then { | |
59 | 61 | let bbs = assetBalance(this, S) | |
60 | 62 | if ((bbs == bbs)) | |
61 | 63 | then { | |
62 | - | let difu = fees(e1a, e1b, | |
64 | + | let difu = fees(e1a, e1b, amnt) | |
63 | 65 | if ((difu == difu)) | |
64 | 66 | then { | |
65 | 67 | let difs = fees(e2b, e2a, difu) | |
67 | 69 | then { | |
68 | 70 | let difw = fees(e3a, e3b, difs) | |
69 | 71 | if ((difw == difw)) | |
70 | - | then if ((difw > ( | |
72 | + | then if ((difw > (amnt + min))) | |
71 | 73 | then { | |
72 | - | let swap1 = invoke(WU, "exchange", [1], [AttachedPayment(W, | |
74 | + | let swap1 = invoke(WU, "exchange", [1], [AttachedPayment(W, amnt)]) | |
73 | 75 | if ((swap1 == swap1)) | |
74 | 76 | then { | |
75 | 77 | let diffu = (assetBalance(this, U) - bbu) | |
87 | 89 | let diffw = (assetBalance(this, W) - bbw) | |
88 | 90 | if ((diffw == diffw)) | |
89 | 91 | then if ((diffw > min)) | |
90 | - | then [StringEntry("debug", ((((("difu= " + toString(difu)) + " / difs= ") + toString(difs)) + " / difw= ") + toString(difw)))] | |
92 | + | then [ScriptTransfer(i.caller, 0, unit), StringEntry("debug", ((((("difu= " + toString(difu)) + " / difs= ") + toString(difs)) + " / difw= ") + toString(difw)))] | |
91 | 93 | else throw(("diffw" + toString(diffw))) | |
92 | 94 | else throw("Strict value is not equal to itself.") | |
93 | 95 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let WU = addressFromStringValue(value("3NDD3ifAC17cLzxuYqsgXDRY9DTQ5BqmvwL")) | |
5 | 5 | ||
6 | 6 | let SW = addressFromStringValue(value("3NAzES7pSjfoHsKNumP5HRtSt3qadbqnHip")) | |
7 | 7 | ||
8 | 8 | let SU = addressFromStringValue(value("3MrBtdped4oUFs1BvLNu53Dm1AMGiTHkT9B")) | |
9 | 9 | ||
10 | 10 | let W = base58'3Tg4GRpKeek5wWAQRJKH1ucjMuKNom3f2h67WNNu6xVS' | |
11 | 11 | ||
12 | 12 | let U = base58'gAAmMoquySsX6q5EmzciFfB8RecAhZR9W1HKNntNekL' | |
13 | 13 | ||
14 | 14 | let S = base58'89G3XEYzMSztS6RPN5h2da7j43r4zgKufReZWn1MqX7g' | |
15 | 15 | ||
16 | 16 | let admin = addressFromStringValue("3N97G98bPF5ghnZ1iMmQ7tMH6MBsNZnS272") | |
17 | 17 | ||
18 | 18 | let scale8 = 100000000 | |
19 | 19 | ||
20 | 20 | let commissionScaleDelimiter = 1000000 | |
21 | 21 | ||
22 | 22 | let commission = 3000 | |
23 | 23 | ||
24 | 24 | func fees (from,to,amnt) = { | |
25 | 25 | let amountWithoutFee = fraction(to, amnt, (amnt + from)) | |
26 | 26 | let amountWithFee = fraction(amountWithoutFee, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
27 | 27 | (amountWithFee - 1) | |
28 | 28 | } | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | @Callable(i) | |
32 | - | func call1 ( | |
32 | + | func call1 (min) = if ((i.caller != admin)) | |
33 | 33 | then throw("only admin") | |
34 | 34 | else { | |
35 | + | let pmt = i.payments[0] | |
36 | + | let amnt = pmt.amount | |
35 | 37 | let e1a = getIntegerValue(WU, "A_asset_balance") | |
36 | 38 | if ((e1a == e1a)) | |
37 | 39 | then { | |
38 | 40 | let e1b = getIntegerValue(WU, "B_asset_balance") | |
39 | 41 | if ((e1b == e1b)) | |
40 | 42 | then { | |
41 | 43 | let e2a = getIntegerValue(SU, "A_asset_balance") | |
42 | 44 | if ((e2a == e2a)) | |
43 | 45 | then { | |
44 | 46 | let e2b = getIntegerValue(SU, "B_asset_balance") | |
45 | 47 | if ((e2b == e2b)) | |
46 | 48 | then { | |
47 | 49 | let e3a = getIntegerValue(SW, "A_asset_balance") | |
48 | 50 | if ((e3a == e3a)) | |
49 | 51 | then { | |
50 | 52 | let e3b = getIntegerValue(SW, "B_asset_balance") | |
51 | 53 | if ((e3b == e3b)) | |
52 | 54 | then { | |
53 | 55 | let bbu = assetBalance(this, U) | |
54 | 56 | if ((bbu == bbu)) | |
55 | 57 | then { | |
56 | 58 | let bbw = assetBalance(this, W) | |
57 | 59 | if ((bbw == bbw)) | |
58 | 60 | then { | |
59 | 61 | let bbs = assetBalance(this, S) | |
60 | 62 | if ((bbs == bbs)) | |
61 | 63 | then { | |
62 | - | let difu = fees(e1a, e1b, | |
64 | + | let difu = fees(e1a, e1b, amnt) | |
63 | 65 | if ((difu == difu)) | |
64 | 66 | then { | |
65 | 67 | let difs = fees(e2b, e2a, difu) | |
66 | 68 | if ((difs == difs)) | |
67 | 69 | then { | |
68 | 70 | let difw = fees(e3a, e3b, difs) | |
69 | 71 | if ((difw == difw)) | |
70 | - | then if ((difw > ( | |
72 | + | then if ((difw > (amnt + min))) | |
71 | 73 | then { | |
72 | - | let swap1 = invoke(WU, "exchange", [1], [AttachedPayment(W, | |
74 | + | let swap1 = invoke(WU, "exchange", [1], [AttachedPayment(W, amnt)]) | |
73 | 75 | if ((swap1 == swap1)) | |
74 | 76 | then { | |
75 | 77 | let diffu = (assetBalance(this, U) - bbu) | |
76 | 78 | if ((diffu == diffu)) | |
77 | 79 | then { | |
78 | 80 | let swap2 = invoke(SU, "exchange", [1], [AttachedPayment(U, diffu)]) | |
79 | 81 | if ((swap2 == swap2)) | |
80 | 82 | then { | |
81 | 83 | let diffs = (assetBalance(this, S) - bbs) | |
82 | 84 | if ((diffs == diffs)) | |
83 | 85 | then { | |
84 | 86 | let swap3 = invoke(SW, "exchange", [1], [AttachedPayment(S, diffs)]) | |
85 | 87 | if ((swap3 == swap3)) | |
86 | 88 | then { | |
87 | 89 | let diffw = (assetBalance(this, W) - bbw) | |
88 | 90 | if ((diffw == diffw)) | |
89 | 91 | then if ((diffw > min)) | |
90 | - | then [StringEntry("debug", ((((("difu= " + toString(difu)) + " / difs= ") + toString(difs)) + " / difw= ") + toString(difw)))] | |
92 | + | then [ScriptTransfer(i.caller, 0, unit), StringEntry("debug", ((((("difu= " + toString(difu)) + " / difs= ") + toString(difs)) + " / difw= ") + toString(difw)))] | |
91 | 93 | else throw(("diffw" + toString(diffw))) | |
92 | 94 | else throw("Strict value is not equal to itself.") | |
93 | 95 | } | |
94 | 96 | else throw("Strict value is not equal to itself.") | |
95 | 97 | } | |
96 | 98 | else throw("Strict value is not equal to itself.") | |
97 | 99 | } | |
98 | 100 | else throw("Strict value is not equal to itself.") | |
99 | 101 | } | |
100 | 102 | else throw("Strict value is not equal to itself.") | |
101 | 103 | } | |
102 | 104 | else throw("Strict value is not equal to itself.") | |
103 | 105 | } | |
104 | 106 | else throw(((((("difu= " + toString(difu)) + " / difs= ") + toString(difs)) + " / difw= ") + toString(difw))) | |
105 | 107 | else throw("Strict value is not equal to itself.") | |
106 | 108 | } | |
107 | 109 | else throw("Strict value is not equal to itself.") | |
108 | 110 | } | |
109 | 111 | else throw("Strict value is not equal to itself.") | |
110 | 112 | } | |
111 | 113 | else throw("Strict value is not equal to itself.") | |
112 | 114 | } | |
113 | 115 | else throw("Strict value is not equal to itself.") | |
114 | 116 | } | |
115 | 117 | else throw("Strict value is not equal to itself.") | |
116 | 118 | } | |
117 | 119 | else throw("Strict value is not equal to itself.") | |
118 | 120 | } | |
119 | 121 | else throw("Strict value is not equal to itself.") | |
120 | 122 | } | |
121 | 123 | else throw("Strict value is not equal to itself.") | |
122 | 124 | } | |
123 | 125 | else throw("Strict value is not equal to itself.") | |
124 | 126 | } | |
125 | 127 | else throw("Strict value is not equal to itself.") | |
126 | 128 | } | |
127 | 129 | else throw("Strict value is not equal to itself.") | |
128 | 130 | } | |
129 | 131 | ||
130 | 132 | ||
131 | 133 | ||
132 | 134 | @Callable(i) | |
133 | 135 | func call2 (amnt,min) = if ((i.caller != admin)) | |
134 | 136 | then throw("only admin") | |
135 | 137 | else { | |
136 | 138 | let bbu = assetBalance(this, U) | |
137 | 139 | let bbw = assetBalance(this, W) | |
138 | 140 | let bbs = assetBalance(this, S) | |
139 | 141 | if (if (if ((bbu == bbu)) | |
140 | 142 | then (bbw == bbw) | |
141 | 143 | else false) | |
142 | 144 | then (bbs == bbs) | |
143 | 145 | else false) | |
144 | 146 | then { | |
145 | 147 | let swap1 = invoke(SW, "exchange", [1], [AttachedPayment(W, (amnt * scale8))]) | |
146 | 148 | if ((swap1 == swap1)) | |
147 | 149 | then { | |
148 | 150 | let diffs = (assetBalance(this, S) - bbs) | |
149 | 151 | if ((diffs == diffs)) | |
150 | 152 | then { | |
151 | 153 | let swap2 = invoke(SU, "exchange", [1], [AttachedPayment(S, diffs)]) | |
152 | 154 | if ((swap2 == swap2)) | |
153 | 155 | then { | |
154 | 156 | let diffu = (assetBalance(this, U) - bbu) | |
155 | 157 | if ((diffu == diffu)) | |
156 | 158 | then { | |
157 | 159 | let swap3 = invoke(WU, "exchange", [1], [AttachedPayment(U, diffu)]) | |
158 | 160 | if ((swap3 == swap3)) | |
159 | 161 | then { | |
160 | 162 | let diffw = (assetBalance(this, W) - bbw) | |
161 | 163 | if ((diffw == diffw)) | |
162 | 164 | then if ((diffw > min)) | |
163 | 165 | then { | |
164 | 166 | let ok = "ok" | |
165 | 167 | [IntegerEntry("debug", diffw)] | |
166 | 168 | } | |
167 | 169 | else throw(toString(diffw)) | |
168 | 170 | else throw("strict") | |
169 | 171 | } | |
170 | 172 | else throw("strict") | |
171 | 173 | } | |
172 | 174 | else throw("strict") | |
173 | 175 | } | |
174 | 176 | else throw("strict") | |
175 | 177 | } | |
176 | 178 | else throw("strict") | |
177 | 179 | } | |
178 | 180 | else throw("strict") | |
179 | 181 | } | |
180 | 182 | else throw("Strict") | |
181 | 183 | } | |
182 | 184 | ||
183 | 185 | ||
184 | 186 | @Verifier(tx) | |
185 | 187 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
186 | 188 |
github/deemru/w8io/169f3d6 46.49 ms ◑