tx · En95CHJCtSGsfW6AxB3Ku1SyxD2iQPLrw4BaqnCzFavk 3MrxLwKyT9TFqGxsGfsnVqijZFb7hRtBqgp: -0.01400000 Waves 2024.02.16 10:30 [2978461] smart account 3MrxLwKyT9TFqGxsGfsnVqijZFb7hRtBqgp > SELF 0.00000000 Waves
{ "type": 13, "id": "En95CHJCtSGsfW6AxB3Ku1SyxD2iQPLrw4BaqnCzFavk", "fee": 1400000, "feeAssetId": null, "timestamp": 1708068646320, "version": 2, "chainId": 84, "sender": "3MrxLwKyT9TFqGxsGfsnVqijZFb7hRtBqgp", "senderPublicKey": "jqG5iLDVsyrR44uMDTGYuDQdJmMDcUXeiedXT98KMRJ", "proofs": [ "4ame24WmcP23hcvUMEbo3vBjLgemSZN8RRAB2MJADDwhqZ2fRj9xa28XTTrTqSSGXf98PzSimasf1URDxbtJ4dtA" ], "script": "base64:BwJACAISBAoCCAgSBAoCCAESBAoCCAQSBAoCCAISAwoBCBIFCgMCAQQSBAoCAgESBQoDAgECEgUKAwISERIECgICARcAB2NoYWluSWQJAMkBAgkAygECCAUEdGhpcwVieXRlcwABAAEACGNoYWluSWRUAQFUAAhjaGFpbklkVwEBVwELbXVzdEFkZHJlc3MCAWkHYWRkcmVzcwMJAAACCAUBaQZjYWxsZXIFB2FkZHJlc3MGCQACAQIRcGVybWlzc2lvbiBkZW5pZWQAA1NFUAICX18ABVdBVkVTAgVXQVZFUwAQY29udHJhY3RGaWxlbmFtZQIPd3hkYW9fbG9jay5yaWRlAQd3cmFwRXJyAQFzCQCsAgIJAKwCAgUQY29udHJhY3RGaWxlbmFtZQICOiAFAXMBCHRocm93RXJyAQFzCQACAQkBB3dyYXBFcnIBBQFzAQ9zdHJpbmdUb0Fzc2V0SWQBAXMDCQAAAgUBcwUFV0FWRVMFBHVuaXQJANkEAQUBcwEUa2V5Q2FsY3VsYXRvckFkZHJlc3MAAhUlc19fY2FsY3VsYXRvckFkZHJlc3MBEWtleUZhY3RvcnlBZGRyZXNzAAISJ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c3NldHNMaXN0CgACJHMJAJADAQUCJGwKAAUkYWNjMAkAlAoCBQNuaWwAAAoBBSRmMF8xAgIkYQIkaQMJAGcCBQIkaQUCJHMFAiRhCQEOYWRkTmV3VHJhbnNmZXICBQIkYQkAkQMCBQIkbAUCJGkKAQUkZjBfMgICJGECJGkDCQBnAgUCJGkFAiRzBQIkYQkAAgECFExpc3Qgc2l6ZSBleGNlZWRzIDEwCQEFJGYwXzICCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECBQUkYWNjMAAAAAEAAgADAAQABQAGAAcACAAJAAoED2Fzc2V0c1RyYW5zZmVycwgFCyR0MDM0ODUzNTY2Al8xBApfbGFzdEluZGV4CAULJHQwMzQ4NTM1NjYCXzIJAJQKAgUPYXNzZXRzVHJhbnNmZXJzBQR1bml0CQCUCgIFA25pbAUEdW5pdAFpAQ10cmFuc2ZlcldhdmVzAg5yZWNpcGllbnRCeXRlcwZhbW91bnQDCQEOb25seUNhbGN1bGF0b3IBBQFpCQCUCgIJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwkBB0FkZHJlc3MBBQ5yZWNpcGllbnRCeXRlcwUGYW1vdW50BQR1bml0BQNuaWwFBmFtb3VudAkAlAoCBQNuaWwFBHVuaXQBAnR4AQZ2ZXJpZnkACQAAAgUHY2hhaW5JZAUIY2hhaW5JZFQoh9NW", "height": 2978461, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Hz26it8kpWBd6B4QRT8qmAN44tmRRWjkxLrQtp8yAMY Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 7 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let chainId = take(drop(this.bytes, 1), 1) | |
5 | 5 | ||
6 | 6 | let chainIdT = base58'2T' | |
7 | 7 | ||
8 | 8 | let chainIdW = base58'2W' | |
9 | 9 | ||
10 | 10 | func mustAddress (i,address) = if ((i.caller == address)) | |
11 | 11 | then true | |
12 | 12 | else throw("permission denied") | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | let SEP = "__" | |
16 | 16 | ||
17 | 17 | let WAVES = "WAVES" | |
18 | 18 | ||
19 | 19 | let contractFilename = "wxdao_lock.ride" | |
20 | 20 | ||
21 | 21 | func wrapErr (s) = ((contractFilename + ": ") + s) | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func throwErr (s) = throw(wrapErr(s)) | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func stringToAssetId (s) = if ((s == WAVES)) | |
28 | 28 | then unit | |
29 | 29 | else fromBase58String(s) | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func keyCalculatorAddress () = "%s__calculatorAddress" | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func keyFactoryAddress () = "%s__factoryAddress" | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func keyCurrentPeriod () = makeString(["%s", "currentPeriod"], SEP) | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func keyStartHeightByPeriod (period) = makeString(["%s%d", "startHeight", toString(period)], SEP) | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func keyPeriodLength () = makeString(["%s", "periodLength"], SEP) | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func keyTreasuryValueByPeriod (period) = makeString(["%s%d", "treasuryValue", toString(period)], SEP) | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | let factoryAddressOption = match getString(this, keyFactoryAddress()) { | |
51 | 51 | case s: String => | |
52 | 52 | addressFromString(s) | |
53 | 53 | case _: Unit => | |
54 | 54 | unit | |
55 | 55 | case _ => | |
56 | 56 | throw("Match error") | |
57 | 57 | } | |
58 | 58 | ||
59 | 59 | let factoryAddressOrFail = valueOrErrorMessage(factoryAddressOption, wrapErr("invalid factory address")) | |
60 | 60 | ||
61 | 61 | let calculatorAddressOption = match getString(factoryAddressOrFail, keyCalculatorAddress()) { | |
62 | 62 | case s: String => | |
63 | 63 | addressFromString(s) | |
64 | 64 | case _: Unit => | |
65 | 65 | unit | |
66 | 66 | case _ => | |
67 | 67 | throw("Match error") | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 | let calculatorAddressOrFail = valueOrErrorMessage(calculatorAddressOption, wrapErr("invalid calculator address")) | |
71 | 71 | ||
72 | 72 | func onlyAddress (i,address) = if ((i.caller == address)) | |
73 | 73 | then true | |
74 | 74 | else throwErr("permission denied") | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func onlyThis (i) = onlyAddress(i, this) | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func onlyCalculator (i) = onlyAddress(i, calculatorAddressOrFail) | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | @Callable(i) | |
84 | 84 | func stringEntry (key,val) = if (onlyCalculator(i)) | |
85 | 85 | then $Tuple2([StringEntry(key, val)], key) | |
86 | 86 | else $Tuple2(nil, unit) | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | ||
90 | 90 | @Callable(i) | |
91 | 91 | func integerEntry (key,val) = if (onlyCalculator(i)) | |
92 | 92 | then $Tuple2([IntegerEntry(key, val)], key) | |
93 | 93 | else $Tuple2(nil, unit) | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | ||
97 | 97 | @Callable(i) | |
98 | 98 | func booleanEntry (key,val) = if (onlyCalculator(i)) | |
99 | 99 | then $Tuple2([BooleanEntry(key, val)], key) | |
100 | 100 | else $Tuple2(nil, unit) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | ||
104 | 104 | @Callable(i) | |
105 | 105 | func binaryEntry (key,val) = if (onlyCalculator(i)) | |
106 | 106 | then $Tuple2([BinaryEntry(key, val)], key) | |
107 | 107 | else $Tuple2(nil, unit) | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | ||
111 | 111 | @Callable(i) | |
112 | 112 | func deleteEntry (key) = if (onlyCalculator(i)) | |
113 | 113 | then $Tuple2([DeleteEntry(key)], key) | |
114 | 114 | else $Tuple2(nil, unit) | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | ||
118 | 118 | @Callable(i) | |
119 | 119 | func reissue (assetId,amount,reissuable) = if (onlyCalculator(i)) | |
120 | 120 | then $Tuple2([Reissue(assetId, amount, reissuable)], amount) | |
121 | 121 | else $Tuple2(nil, unit) | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | ||
125 | 125 | @Callable(i) | |
126 | 126 | func burn (assetId,amount) = if (onlyCalculator(i)) | |
127 | 127 | then $Tuple2([Burn(assetId, amount)], amount) | |
128 | 128 | else $Tuple2(nil, unit) | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | ||
132 | 132 | @Callable(i) | |
133 | 133 | func transferAsset (recipientBytes,amount,assetId) = if (onlyCalculator(i)) | |
134 | 134 | then $Tuple2([ScriptTransfer(Address(recipientBytes), amount, assetId)], amount) | |
135 | 135 | else $Tuple2(nil, unit) | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | ||
139 | 139 | @Callable(i) | |
140 | 140 | func transferAssets (recipientBytes,assetsList,amountsList) = if (onlyCalculator(i)) | |
141 | 141 | then { | |
142 | 142 | func addNewTransfer (acc,nextAssetId) = { | |
143 | 143 | let $t032353259 = acc | |
144 | 144 | let transfers = $t032353259._1 | |
145 | 145 | let j = $t032353259._2 | |
146 | 146 | let newTransfer = ScriptTransfer(Address(recipientBytes), amountsList[j], assetsList[j]) | |
147 | 147 | let updatedTransfers = (transfers :+ newTransfer) | |
148 | 148 | $Tuple2(updatedTransfers, (j + 1)) | |
149 | 149 | } | |
150 | 150 | ||
151 | 151 | let $t034853566 = { | |
152 | 152 | let $l = assetsList | |
153 | 153 | let $s = size($l) | |
154 | 154 | let $acc0 = $Tuple2(nil, 0) | |
155 | 155 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
156 | 156 | then $a | |
157 | 157 | else addNewTransfer($a, $l[$i]) | |
158 | 158 | ||
159 | 159 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
160 | 160 | then $a | |
161 | 161 | else throw("List size exceeds 10") | |
162 | 162 | ||
163 | 163 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
164 | 164 | } | |
165 | 165 | let assetsTransfers = $t034853566._1 | |
166 | 166 | let _lastIndex = $t034853566._2 | |
167 | 167 | $Tuple2(assetsTransfers, unit) | |
168 | 168 | } | |
169 | 169 | else $Tuple2(nil, unit) | |
170 | 170 | ||
171 | 171 | ||
172 | 172 | ||
173 | 173 | @Callable(i) | |
174 | 174 | func transferWaves (recipientBytes,amount) = if (onlyCalculator(i)) | |
175 | 175 | then $Tuple2([ScriptTransfer(Address(recipientBytes), amount, unit)], amount) | |
176 | 176 | else $Tuple2(nil, unit) | |
177 | 177 | ||
178 | 178 | ||
179 | 179 | @Verifier(tx) | |
180 | 180 | func verify () = (chainId == chainIdT) | |
181 | 181 |
github/deemru/w8io/026f985 46.03 ms ◑