tx · VwToUbpMaF3Ja1Vg88oE5hU8wf8vkT93ZSqYonPGzWK 3NBbFNBed9tcU5AmsJAuExWvgJyNmJxqjWq: -0.01000000 Waves 2023.06.27 13:46 [2640968] smart account 3NBbFNBed9tcU5AmsJAuExWvgJyNmJxqjWq > SELF 0.00000000 Waves
{ "type": 13, "id": "VwToUbpMaF3Ja1Vg88oE5hU8wf8vkT93ZSqYonPGzWK", "fee": 1000000, "feeAssetId": null, "timestamp": 1687862788545, "version": 2, "chainId": 84, "sender": "3NBbFNBed9tcU5AmsJAuExWvgJyNmJxqjWq", "senderPublicKey": "ERewvWFUFQfR1eCnipNAv9n7SdQhof2ESP6PGVjTueLd", "proofs": [ "2VJAY1PHbjQ1svn8oy2D6xzyav66MVsRYHMfAbbaj47omcZJ7cfWQqQFWzrNwq2b8zpZK9mkiVGupHSjuVscHaNn" ], "script": "base64:BgI4CAISBAoCAQgSABIFCgMIAQgSAwoBARIDCgEBEgMKAQESAwoBARIECgIIARIAEgQKAggBEgMKAQgGAANhcnIJAMwIAgABCQDMCAIAAgkAzAgCAAMJAMwIAgAECQDMCAIABQUDbmlsAARhcnIyCQDMCAIAAQkAzAgCAAIFA25pbAEDc3VtAgFhAWIJAPwHBAkBEUBleHRyTmF0aXZlKDEwNjIpAQIjM04zRG5WZmZuVXladHoyTVJiazVVN2dpTjExMldlbXBNTmQCBmJvcnJvdwkAzAgCAiwyNUZFcUVqUmtxSzZ5Q2tpVDdMejZTQVl6N2dVRkN0eGZDQ2huclZGRDVBVAkAzAgCAMCEPQUDbmlsBQNuaWwBD2dldEN1cnJlbnRQcmljZQEKYXNzZXRJZFN0cgMJAAACBQphc3NldElkU3RyAgVXQVZFUwACCQACAQIFRXJyb3IBCmdldEJhbGFuY2UCCmFzc2V0SWRTdHIHYWRkcmVzcwMJAAACBQphc3NldElkU3RyAgVXQVZFUwgJAO8HAQUHYWRkcmVzcwlhdmFpbGFibGUJAPAHAgUHYWRkcmVzcwkA2QQBBQphc3NldElkU3R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MJANkEAQUKYXNzZXRJZFN0cgUDbmlsAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleY2QSzk=", "height": 2640968, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 65i9ZrN5bhnN63h5N8mpSpGWNrhZeATdyxNkH1cRXBts Next: FyGRmirLtAHHbCKgmYnj2imEf4kLYUYJ1RwHZ2uw46v7 Diff:
Old | New | Differences | |
---|---|---|---|
38 | 38 | let assetAmount = i.payments[0].amount | |
39 | 39 | transferWavesTestInternal(assetIdStr, assetAmount, toString(i.caller)) | |
40 | 40 | } | |
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | @Callable(i) | |
45 | + | func transferWavesTest2 (assetIdStr,assetAmount,address) = [IntegerEntry(((address + "_deposited_") + assetIdStr), assetAmount)] | |
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | @Callable(i) | |
50 | + | func long1x (assetAmount) = { | |
51 | + | let res = invoke(this, "transferWavesTest2", ["WAVES", assetAmount, toString(i.caller)], [AttachedPayment(unit, assetAmount)]) | |
52 | + | if ((res == res)) | |
53 | + | then nil | |
54 | + | else throw("Strict value is not equal to itself.") | |
55 | + | } | |
41 | 56 | ||
42 | 57 | ||
43 | 58 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let arr = [1, 2, 3, 4, 5] | |
5 | 5 | ||
6 | 6 | let arr2 = [1, 2] | |
7 | 7 | ||
8 | 8 | func sum (a,b) = invoke(addressFromStringValue("3N3DnVffnUyZtz2MRbk5U7giN112WempMNd"), "borrow", ["25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT", 1000000], nil) | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func getCurrentPrice (assetIdStr) = if ((assetIdStr == "WAVES")) | |
12 | 12 | then 2 | |
13 | 13 | else throw("Error") | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func getBalance (assetIdStr,address) = if ((assetIdStr == "WAVES")) | |
17 | 17 | then wavesBalance(address).available | |
18 | 18 | else assetBalance(address, fromBase58String(assetIdStr)) | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func transferWavesTestInternal (assetIdStr,assetAmount,address) = [IntegerEntry(((address + "_deposited_") + assetIdStr), assetAmount)] | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | @Callable(i) | |
25 | 25 | func transferWaves (assetAmount,senderAddress) = if ((i.caller != this)) | |
26 | 26 | then throw("only for internal smart contract invocations") | |
27 | 27 | else [ScriptTransfer(this, assetAmount, unit), IntegerEntry((senderAddress + "_deposited_WAVES"), assetAmount)] | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | ||
31 | 31 | @Callable(i) | |
32 | 32 | func transferWavesTest () = if (if ((size(i.payments) != 1)) | |
33 | 33 | then true | |
34 | 34 | else (i.payments[0].amount == 0)) | |
35 | 35 | then throw("1 payment has to be attached") | |
36 | 36 | else { | |
37 | 37 | let assetIdStr = "WAVES" | |
38 | 38 | let assetAmount = i.payments[0].amount | |
39 | 39 | transferWavesTestInternal(assetIdStr, assetAmount, toString(i.caller)) | |
40 | 40 | } | |
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | @Callable(i) | |
45 | + | func transferWavesTest2 (assetIdStr,assetAmount,address) = [IntegerEntry(((address + "_deposited_") + assetIdStr), assetAmount)] | |
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | @Callable(i) | |
50 | + | func long1x (assetAmount) = { | |
51 | + | let res = invoke(this, "transferWavesTest2", ["WAVES", assetAmount, toString(i.caller)], [AttachedPayment(unit, assetAmount)]) | |
52 | + | if ((res == res)) | |
53 | + | then nil | |
54 | + | else throw("Strict value is not equal to itself.") | |
55 | + | } | |
41 | 56 | ||
42 | 57 | ||
43 | 58 | ||
44 | 59 | @Callable(i) | |
45 | 60 | func long2x (assetAmount) = { | |
46 | 61 | let address = toString(i.caller) | |
47 | 62 | let currentAmount = getBalance("WAVES", i.caller) | |
48 | 63 | if ((currentAmount > assetAmount)) | |
49 | 64 | then { | |
50 | 65 | func repeatFunc (accum,next) = { | |
51 | 66 | let transferResult = invoke(this, "transferWaves", [assetAmount, i.caller], nil) | |
52 | 67 | if ((transferResult == transferResult)) | |
53 | 68 | then { | |
54 | 69 | let supplyResult = invoke(addressFromStringValue("3N3DnVffnUyZtz2MRbk5U7giN112WempMNd"), "supply", nil, [AttachedPayment(unit, assetAmount)]) | |
55 | 70 | if ((supplyResult == supplyResult)) | |
56 | 71 | then { | |
57 | 72 | let borrowResult = invoke(addressFromStringValue("3N3DnVffnUyZtz2MRbk5U7giN112WempMNd"), "borrow", ["25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT", ((assetAmount * getCurrentPrice("WAVES")) / 100)], nil) | |
58 | 73 | if ((borrowResult == borrowResult)) | |
59 | 74 | then (accum + next) | |
60 | 75 | else throw("Strict value is not equal to itself.") | |
61 | 76 | } | |
62 | 77 | else throw("Strict value is not equal to itself.") | |
63 | 78 | } | |
64 | 79 | else throw("Strict value is not equal to itself.") | |
65 | 80 | } | |
66 | 81 | ||
67 | 82 | let array = [assetAmount, assetAmount] | |
68 | 83 | let res = { | |
69 | 84 | let $l = array | |
70 | 85 | let $s = size($l) | |
71 | 86 | let $acc0 = 0 | |
72 | 87 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
73 | 88 | then $a | |
74 | 89 | else repeatFunc($a, $l[$i]) | |
75 | 90 | ||
76 | 91 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
77 | 92 | then $a | |
78 | 93 | else throw("List size exceeds 2") | |
79 | 94 | ||
80 | 95 | $f0_2($f0_1($f0_1($acc0, 0), 1), 2) | |
81 | 96 | } | |
82 | 97 | [IntegerEntry(((address + "_borrowed_") + "25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT"), (assetAmount * getCurrentPrice("WAVES"))), ScriptTransfer(i.caller, ((res * getCurrentPrice("WAVES")) / 100), base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT'), ScriptTransfer(this, res, unit)] | |
83 | 98 | } | |
84 | 99 | else throw("Error!") | |
85 | 100 | } | |
86 | 101 | ||
87 | 102 | ||
88 | 103 | ||
89 | 104 | @Callable(i) | |
90 | 105 | func borrow (assetAmount) = { | |
91 | 106 | let address = toString(i.caller) | |
92 | 107 | let res = invoke(addressFromStringValue("3N3DnVffnUyZtz2MRbk5U7giN112WempMNd"), "borrow", ["25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT", assetAmount], nil) | |
93 | 108 | if ((res == res)) | |
94 | 109 | then [ScriptTransfer(i.caller, assetAmount, base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT'), IntegerEntry(((address + "_borrowed_") + "25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT"), assetAmount)] | |
95 | 110 | else throw("Strict value is not equal to itself.") | |
96 | 111 | } | |
97 | 112 | ||
98 | 113 | ||
99 | 114 | ||
100 | 115 | @Callable(i) | |
101 | 116 | func borrow2 (assetAmount) = { | |
102 | 117 | let address = toString(i.caller) | |
103 | 118 | func repeatFunc (accum,next) = { | |
104 | 119 | let result = invoke(addressFromStringValue("3N3DnVffnUyZtz2MRbk5U7giN112WempMNd"), "borrow", ["25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT", assetAmount], nil) | |
105 | 120 | if ((result == result)) | |
106 | 121 | then (accum + next) | |
107 | 122 | else throw("Strict value is not equal to itself.") | |
108 | 123 | } | |
109 | 124 | ||
110 | 125 | let array = [assetAmount, assetAmount] | |
111 | 126 | let res = { | |
112 | 127 | let $l = array | |
113 | 128 | let $s = size($l) | |
114 | 129 | let $acc0 = 0 | |
115 | 130 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
116 | 131 | then $a | |
117 | 132 | else repeatFunc($a, $l[$i]) | |
118 | 133 | ||
119 | 134 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
120 | 135 | then $a | |
121 | 136 | else throw("List size exceeds 2") | |
122 | 137 | ||
123 | 138 | $f0_2($f0_1($f0_1($acc0, 0), 1), 2) | |
124 | 139 | } | |
125 | 140 | [IntegerEntry(((address + "_borrowed_") + "25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT"), assetAmount), ScriptTransfer(i.caller, res, base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT')] | |
126 | 141 | } | |
127 | 142 | ||
128 | 143 | ||
129 | 144 | ||
130 | 145 | @Callable(i) | |
131 | 146 | func borrow5 (assetIdStr,assetAmount) = { | |
132 | 147 | let address = toString(i.caller) | |
133 | 148 | let res = { | |
134 | 149 | let $l = arr | |
135 | 150 | let $s = size($l) | |
136 | 151 | let $acc0 = 0 | |
137 | 152 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
138 | 153 | then $a | |
139 | 154 | else sum($a, $l[$i]) | |
140 | 155 | ||
141 | 156 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
142 | 157 | then $a | |
143 | 158 | else throw("List size exceeds 5") | |
144 | 159 | ||
145 | 160 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
146 | 161 | } | |
147 | 162 | if ((res == res)) | |
148 | 163 | then [IntegerEntry(((address + "_borrowed_") + assetIdStr), assetAmount)] | |
149 | 164 | else throw("Strict value is not equal to itself.") | |
150 | 165 | } | |
151 | 166 | ||
152 | 167 | ||
153 | 168 | ||
154 | 169 | @Callable(i) | |
155 | 170 | func deposit () = { | |
156 | 171 | let address = toString(i.caller) | |
157 | 172 | let res = invoke(addressFromStringValue("3N3DnVffnUyZtz2MRbk5U7giN112WempMNd"), "supply", nil, [AttachedPayment(unit, 1000000)]) | |
158 | 173 | if ((res == res)) | |
159 | 174 | then [IntegerEntry((address + "supply_waves"), 1000000)] | |
160 | 175 | else throw("Strict value is not equal to itself.") | |
161 | 176 | } | |
162 | 177 | ||
163 | 178 | ||
164 | 179 | ||
165 | 180 | @Callable(i) | |
166 | 181 | func withdraw (assetIdStr,assetAmount) = { | |
167 | 182 | let address = toString(i.caller) | |
168 | 183 | let res = invoke(addressFromStringValue("3N3DnVffnUyZtz2MRbk5U7giN112WempMNd"), "withdraw", [assetIdStr, assetAmount], nil) | |
169 | 184 | if ((res == res)) | |
170 | 185 | then [IntegerEntry(((address + "_withdrew_") + assetIdStr), assetAmount)] | |
171 | 186 | else throw("Strict value is not equal to itself.") | |
172 | 187 | } | |
173 | 188 | ||
174 | 189 | ||
175 | 190 | ||
176 | 191 | @Callable(i) | |
177 | 192 | func checkBalance (assetIdStr) = { | |
178 | 193 | let address = i.caller | |
179 | 194 | if ((assetIdStr == "WAVES")) | |
180 | 195 | then [IntegerEntry("Waves Balance", wavesBalance(address).available)] | |
181 | 196 | else [IntegerEntry("Asset Balance", assetBalance(address, fromBase58String(assetIdStr)))] | |
182 | 197 | } | |
183 | 198 | ||
184 | 199 | ||
185 | 200 | @Verifier(tx) | |
186 | 201 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
187 | 202 |
github/deemru/w8io/169f3d6 45.20 ms ◑