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