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