tx · DpHcZfXSbPp16RTjX2UVHe3vTm7EQXXwqWZc4TfCkTPt 3Mx16q4Tisr27xu8f3oLzm9TyUTMmcUJuUo: -0.01400000 Waves 2023.02.20 22:25 [2458389] smart account 3Mx16q4Tisr27xu8f3oLzm9TyUTMmcUJuUo > SELF 0.00000000 Waves
{ "type": 13, "id": "DpHcZfXSbPp16RTjX2UVHe3vTm7EQXXwqWZc4TfCkTPt", "fee": 1400000, "feeAssetId": null, "timestamp": 1676921214103, "version": 2, "chainId": 84, "sender": "3Mx16q4Tisr27xu8f3oLzm9TyUTMmcUJuUo", "senderPublicKey": "9Misq1eiu27cRLC6ZiL9S74JdRAWpX1rykUJzFGzf6Rb", "proofs": [ "5zzjbvJCgzuZKzUZZo6JFTWqZA91kpAgtpVpdz8QETckjFLGdmsoYLTJWWZVBRFd1pvoFiXJPXg2PAceGmeYe5Ef" ], "script": "base64:BgIzCAISBQoDCAgBEgQKAgEIEgQKAgEYEgMKAQgSAwoBCBIAEgASAwoBCBIDCgEIEgQKAgEBHQAJU0VQQVJBVE9SAgJfXwAIS0VZX0lOSVQCBElOSVQADEtFWV9NVUxUSVNJRwIITVVMVElTSUcACktFWV9TVEFUVVMCBlNUQVRVUwALS0VZX01JTlRFUlMCB01JTlRFUlMACUtFWV9BU1NFVAIFQVNTRVQAF0tFWV9TUE9OU09SU0hJUF9NQU5BR0VSAhNTUE9OU09SU0hJUF9NQU5BR0VSAAdNQVhfSU5UAP//////////fwEQX3ZhbGlkYXRlQWRkcmVzcwIIYWRkcmVzc18EZXJyXwQHJG1hdGNoMAkApggBBQhhZGRyZXNzXwMJAAECBQckbWF0Y2gwAgdBZGRyZXNzBAFhBQckbWF0Y2gwBgkAAgEFBGVycl8BDl92YWxpZGF0ZUFzc2V0Aghhc3NldElkXwRlcnJfBAckbWF0Y2gwCQDsBwEJANkEAQUIYXNzZXRJZF8DCQABAgUHJG1hdGNoMAIFQXNzZXQEAWEFByRtYXRjaDAGCQACAQUEZXJyXwEMX3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BwEFBHRoaXMHcmVndWxhcgUUd2F2ZXNSZXF1aXJlZEFtb3VudF8JAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwgFAWkGY2FsbGVyCQBlAggJAO8HAQUEdGhpcwdyZWd1bGFyBRR3YXZlc1JlcXVpcmVkQW1vdW50XwUEdW5pdAUDbmlsBQNuaWwJAJQKAgkAzggCBQdhY3Rpb25zCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgUNc3BvbnNvckFtb3VudAUMc3BvbnNvckFzc2V0CQDMCAIJAQpTcG9uc29yRmVlAgUMc3BvbnNvckFzc2V0BRRtaW5TcG9uc29yZWRBc3NldEZlZQUDbmlsBQ1zcG9uc29yQW1vdW50CQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJ0eAEGdmVyaWZ5AAQHJG1hdGNoMAkAoggBBQxLRVlfTVVMVElTSUcDCQABAgUHJG1hdGNoMAIGU3RyaW5nBAhtdWx0aXNpZwUHJG1hdGNoMAkBC3ZhbHVlT3JFbHNlAgkAmwgCCQERQGV4dHJOYXRpdmUoMTA2MikBBQhtdWx0aXNpZwkAuQkCCQDMCAIFCktFWV9TVEFUVVMJAMwIAgkApQgBBQR0aGlzCQDMCAIJANgEAQgFAnR4AmlkBQNuaWwFCVNFUEFSQVRPUgcJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXnYSOvw", "height": 2458389, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: CwLg6VqHAWFDSr16B2jA5aaMbaqsfBNM5GvMZMADJ9vb Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SEPARATOR = "__" | |
5 | + | ||
6 | + | let KEY_INIT = "INIT" | |
7 | + | ||
8 | + | let KEY_MULTISIG = "MULTISIG" | |
9 | + | ||
10 | + | let KEY_STATUS = "STATUS" | |
11 | + | ||
12 | + | let KEY_MINTERS = "MINTERS" | |
13 | + | ||
14 | + | let KEY_ASSET = "ASSET" | |
15 | + | ||
16 | + | let KEY_SPONSORSHIP_MANAGER = "SPONSORSHIP_MANAGER" | |
17 | + | ||
18 | + | let MAX_INT = 9223372036854775807 | |
19 | + | ||
20 | + | func _validateAddress (address_,err_) = match addressFromString(address_) { | |
21 | + | case a: Address => | |
22 | + | true | |
23 | + | case _ => | |
24 | + | throw(err_) | |
25 | + | } | |
26 | + | ||
27 | + | ||
28 | + | func _validateAsset (assetId_,err_) = match assetInfo(fromBase58String(assetId_)) { | |
29 | + | case a: Asset => | |
30 | + | true | |
31 | + | case _ => | |
32 | + | throw(err_) | |
33 | + | } | |
34 | + | ||
35 | + | ||
36 | + | func _validateInt (val_,lowerBoundary_,upperBoundary_,err_) = if (if ((lowerBoundary_ > val_)) | |
37 | + | then true | |
38 | + | else (val_ > upperBoundary_)) | |
39 | + | then throw(err_) | |
40 | + | else true | |
41 | + | ||
42 | + | ||
43 | + | func _loadInit () = match getBoolean(KEY_INIT) { | |
44 | + | case a: Boolean => | |
45 | + | a | |
46 | + | case _ => | |
47 | + | false | |
48 | + | } | |
49 | + | ||
50 | + | ||
51 | + | func _saveInit (isInit_) = [BooleanEntry(KEY_INIT, isInit_)] | |
52 | + | ||
53 | + | ||
54 | + | func _loadMultisig () = match getString(KEY_MULTISIG) { | |
55 | + | case a: String => | |
56 | + | addressFromStringValue(a) | |
57 | + | case _ => | |
58 | + | Address(base58'') | |
59 | + | } | |
60 | + | ||
61 | + | ||
62 | + | func _saveMultisig (multisig_) = [StringEntry(KEY_MULTISIG, toString(multisig_))] | |
63 | + | ||
64 | + | ||
65 | + | func _loadMinters () = match getString(KEY_MINTERS) { | |
66 | + | case a: String => | |
67 | + | a | |
68 | + | case _ => | |
69 | + | "" | |
70 | + | } | |
71 | + | ||
72 | + | ||
73 | + | func _saveMinters (minters_) = [StringEntry(KEY_MINTERS, minters_)] | |
74 | + | ||
75 | + | ||
76 | + | func _loadAsset () = match getString(KEY_ASSET) { | |
77 | + | case a: String => | |
78 | + | fromBase58String(a) | |
79 | + | case _ => | |
80 | + | base58'' | |
81 | + | } | |
82 | + | ||
83 | + | ||
84 | + | func _saveAsset (assetId_) = [StringEntry(KEY_ASSET, toBase58String(assetId_))] | |
85 | + | ||
86 | + | ||
87 | + | func _loadSponsorshipManager () = match getString(KEY_SPONSORSHIP_MANAGER) { | |
88 | + | case a: String => | |
89 | + | addressFromStringValue(a) | |
90 | + | case _ => | |
91 | + | Address(base58'') | |
92 | + | } | |
93 | + | ||
94 | + | ||
95 | + | func _saveSponsorshipManager (manager_) = [StringEntry(KEY_SPONSORSHIP_MANAGER, toString(manager_))] | |
96 | + | ||
97 | + | ||
98 | + | func _addMinter (minter_) = ((_loadMinters() + minter_) + SEPARATOR) | |
99 | + | ||
100 | + | ||
101 | + | func _removeMinter (minter_) = { | |
102 | + | let minters = _loadMinters() | |
103 | + | let idx = match indexOf(minters, minter_) { | |
104 | + | case a: Int => | |
105 | + | a | |
106 | + | case _ => | |
107 | + | throw("_removeMinter: no such minter") | |
108 | + | } | |
109 | + | (take(minters, idx) + takeRight(minters, ((size(minters) - size(minter_)) - idx))) | |
110 | + | } | |
111 | + | ||
112 | + | ||
113 | + | func _whenMultisigSet () = if ((_loadMultisig() == Address(base58''))) | |
114 | + | then throw("_whenMultisigSet: revert") | |
115 | + | else true | |
116 | + | ||
117 | + | ||
118 | + | func _onlyThisContract (caller_) = if ((caller_ != this)) | |
119 | + | then throw("_onlyThisContract: revert") | |
120 | + | else true | |
121 | + | ||
122 | + | ||
123 | + | func _onlyMinter (caller_) = if (!(contains(_loadMinters(), toString(caller_)))) | |
124 | + | then throw("_onlyMinter: revert") | |
125 | + | else true | |
126 | + | ||
127 | + | ||
128 | + | func _onlySponsorshipManager (caller_) = if ((caller_ != _loadSponsorshipManager())) | |
129 | + | then throw("_onlySponsorshipManager: revert") | |
130 | + | else true | |
131 | + | ||
132 | + | ||
133 | + | func _whenNotInitialized () = if (_loadInit()) | |
134 | + | then throw("_whenNotInitialized: revert") | |
135 | + | else true | |
136 | + | ||
137 | + | ||
138 | + | func _whenInitialized () = if (!(_loadInit())) | |
139 | + | then throw("_whenInitialized: revert") | |
140 | + | else true | |
141 | + | ||
142 | + | ||
143 | + | @Callable(i) | |
144 | + | func init (tokenName_,tokenDescr_,tokenDecimals_) = { | |
145 | + | let err = if (if (if (if (if (_onlyThisContract(i.caller)) | |
146 | + | then _whenNotInitialized() | |
147 | + | else false) | |
148 | + | then _whenMultisigSet() | |
149 | + | else false) | |
150 | + | then _validateInt(size(tokenName_), 4, 16, "init: invalid token name") | |
151 | + | else false) | |
152 | + | then _validateInt(size(tokenDescr_), 0, 255, "init: invalid token description") | |
153 | + | else false) | |
154 | + | then _validateInt(tokenDecimals_, 0, 8, "init: invalid decimals") | |
155 | + | else false | |
156 | + | if ((err == err)) | |
157 | + | then { | |
158 | + | let issue = Issue(tokenName_, tokenDescr_, 0, tokenDecimals_, true) | |
159 | + | let assetId = calculateAssetId(issue) | |
160 | + | $Tuple2(((_saveInit(true) ++ _saveAsset(assetId)) ++ [issue]), unit) | |
161 | + | } | |
162 | + | else throw("Strict value is not equal to itself.") | |
163 | + | } | |
164 | + | ||
165 | + | ||
166 | + | ||
167 | + | @Callable(i) | |
168 | + | func mint (amount_,recipient_) = { | |
169 | + | let err = if (if (if (_whenInitialized()) | |
170 | + | then _onlyMinter(i.caller) | |
171 | + | else false) | |
172 | + | then _validateInt(amount_, 0, MAX_INT, "mint: invalid amount") | |
173 | + | else false) | |
174 | + | then _validateAddress(recipient_, "mint: invalid recipient") | |
175 | + | else false | |
176 | + | if ((err == err)) | |
177 | + | then { | |
178 | + | let asset = _loadAsset() | |
179 | + | $Tuple2([Reissue(asset, amount_, true), ScriptTransfer(addressFromStringValue(recipient_), amount_, asset)], unit) | |
180 | + | } | |
181 | + | else throw("Strict value is not equal to itself.") | |
182 | + | } | |
183 | + | ||
184 | + | ||
185 | + | ||
186 | + | @Callable(i) | |
187 | + | func mintMany (amount_,recipients_) = { | |
188 | + | let err = if (if (_whenInitialized()) | |
189 | + | then _onlyMinter(i.caller) | |
190 | + | else false) | |
191 | + | then _validateInt(amount_, 0, MAX_INT, "mint: invalid amount") | |
192 | + | else false | |
193 | + | if ((err == err)) | |
194 | + | then { | |
195 | + | let asset = _loadAsset() | |
196 | + | func foldfunc (acc_,elem_) = (acc_ :+ ScriptTransfer(addressFromStringValue(elem_), amount_, asset)) | |
197 | + | ||
198 | + | let actions = { | |
199 | + | let $l = recipients_ | |
200 | + | let $s = size($l) | |
201 | + | let $acc0 = nil | |
202 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
203 | + | then $a | |
204 | + | else foldfunc($a, $l[$i]) | |
205 | + | ||
206 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
207 | + | then $a | |
208 | + | else throw("List size exceeds 51") | |
209 | + | ||
210 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($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), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51) | |
211 | + | } | |
212 | + | $Tuple2(([Reissue(asset, (amount_ * size(recipients_)), true)] ++ actions), unit) | |
213 | + | } | |
214 | + | else throw("Strict value is not equal to itself.") | |
215 | + | } | |
216 | + | ||
217 | + | ||
218 | + | ||
219 | + | @Callable(i) | |
220 | + | func addMinter (minter_) = { | |
221 | + | let err = if (if (_onlyThisContract(i.caller)) | |
222 | + | then _whenInitialized() | |
223 | + | else false) | |
224 | + | then _validateAddress(minter_, "init: invalid minter") | |
225 | + | else false | |
226 | + | if ((err == err)) | |
227 | + | then $Tuple2(_saveMinters(_addMinter((minter_ + SEPARATOR))), unit) | |
228 | + | else throw("Strict value is not equal to itself.") | |
229 | + | } | |
230 | + | ||
231 | + | ||
232 | + | ||
233 | + | @Callable(i) | |
234 | + | func removeMinter (minter_) = { | |
235 | + | let err = if (if (_onlyThisContract(i.caller)) | |
236 | + | then _whenInitialized() | |
237 | + | else false) | |
238 | + | then _validateAddress(minter_, "init: invalid minter") | |
239 | + | else false | |
240 | + | if ((err == err)) | |
241 | + | then $Tuple2(_saveMinters(_removeMinter((minter_ + SEPARATOR))), unit) | |
242 | + | else throw("Strict value is not equal to itself.") | |
243 | + | } | |
244 | + | ||
245 | + | ||
246 | + | ||
247 | + | @Callable(i) | |
248 | + | func getAssetId () = $Tuple2(nil, _loadAsset()) | |
249 | + | ||
250 | + | ||
251 | + | ||
252 | + | @Callable(i) | |
253 | + | func getDecimals () = { | |
254 | + | let decimals = match assetInfo(_loadAsset()) { | |
255 | + | case a: Asset => | |
256 | + | a.decimals | |
257 | + | case _ => | |
258 | + | throw("getDecimals: revert") | |
259 | + | } | |
260 | + | $Tuple2(nil, decimals) | |
261 | + | } | |
262 | + | ||
263 | + | ||
264 | + | ||
265 | + | @Callable(i) | |
266 | + | func setMultisig (multisig_) = { | |
267 | + | let err = if (_onlyThisContract(i.caller)) | |
268 | + | then _validateAddress(multisig_, "setMultisig: invalid multisig") | |
269 | + | else false | |
270 | + | if ((err == err)) | |
271 | + | then $Tuple2(_saveMultisig(addressFromStringValue(multisig_)), unit) | |
272 | + | else throw("Strict value is not equal to itself.") | |
273 | + | } | |
274 | + | ||
275 | + | ||
276 | + | ||
277 | + | @Callable(i) | |
278 | + | func setSponsorshipManager (manager_) = { | |
279 | + | let err = if (_onlyThisContract(i.caller)) | |
280 | + | then _validateAddress(manager_, "setSponsorshipManager: invalid manager") | |
281 | + | else false | |
282 | + | if ((err == err)) | |
283 | + | then $Tuple2(_saveSponsorshipManager(addressFromStringValue(manager_)), unit) | |
284 | + | else throw("Strict value is not equal to itself.") | |
285 | + | } | |
286 | + | ||
287 | + | ||
288 | + | ||
289 | + | @Callable(i) | |
290 | + | func updateSponsorship (minSponsoredAssetFee_,wavesRequiredAmount_) = { | |
291 | + | let err = if (if (_onlySponsorshipManager(i.caller)) | |
292 | + | then _validateInt(minSponsoredAssetFee_, 0, MAX_INT, "updateSponsorship: invalid sponsor fee") | |
293 | + | else false) | |
294 | + | then _validateInt(wavesRequiredAmount_, 0, MAX_INT, "updateSponsorship: invalid waves required amount") | |
295 | + | else false | |
296 | + | if ((err == err)) | |
297 | + | then { | |
298 | + | let sponsorAsset = _loadAsset() | |
299 | + | let sponsorAmount = assetBalance(this, sponsorAsset) | |
300 | + | let minSponsoredAssetFee = if ((minSponsoredAssetFee_ == 0)) | |
301 | + | then unit | |
302 | + | else minSponsoredAssetFee_ | |
303 | + | let actions = if ((wavesBalance(this).regular > wavesRequiredAmount_)) | |
304 | + | then [ScriptTransfer(i.caller, (wavesBalance(this).regular - wavesRequiredAmount_), unit)] | |
305 | + | else nil | |
306 | + | $Tuple2((actions ++ [ScriptTransfer(i.caller, sponsorAmount, sponsorAsset), SponsorFee(sponsorAsset, minSponsoredAssetFee)]), sponsorAmount) | |
307 | + | } | |
308 | + | else throw("Strict value is not equal to itself.") | |
309 | + | } | |
310 | + | ||
311 | + | ||
312 | + | @Verifier(tx) | |
313 | + | func verify () = match getString(KEY_MULTISIG) { | |
314 | + | case multisig: String => | |
315 | + | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
316 | + | case _ => | |
317 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
318 | + | } | |
319 | + |
github/deemru/w8io/169f3d6 28.11 ms ◑