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