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