tx · AQ7n3yEj4bGJBsaUYq1eBKRvD4QdQcZsC7WSgkB8AWtE 3N7GWjbchsxSQmwt6iqbdMmQ7SXpSAjMqni: -0.01400000 Waves 2023.04.18 16:39 [2540055] smart account 3N7GWjbchsxSQmwt6iqbdMmQ7SXpSAjMqni > SELF 0.00000000 Waves
{ "type": 13, "id": "AQ7n3yEj4bGJBsaUYq1eBKRvD4QdQcZsC7WSgkB8AWtE", "fee": 1400000, "feeAssetId": null, "timestamp": 1681825238147, "version": 2, "chainId": 84, "sender": "3N7GWjbchsxSQmwt6iqbdMmQ7SXpSAjMqni", "senderPublicKey": "Gmgw3FDL8Dc84uAtYypzfucooknSGuMoh5wCYhSs2FSH", "proofs": [ "5fKGKitYHsNrssHYLcBXo5h9bXxmVtXCUWviSQKzKtjoqUeB3im62Na7CEhu6ct3JBHo5L3skSkUZWjDsnAqTQHy" ], "script": "base64:BgIzCAISBQoDCAgBEgQKAgEIEgQKAgEYEgMKAQgSAwoBCBIAEgASAwoBCBIECgIBARIDCgEIGwAJU0VQQVJBVE9SAgJfXwAIS0VZX0lOSVQCBElOSVQADEtFWV9NVUxUSVNJRwIITVVMVElTSUcACktFWV9TVEFUVVMCBlNUQVRVUwAKS0VZX01JTlRFUgIGTUlOVEVSAAlLRVlfQVNTRVQCBUFTU0VUABdLRVlfU1BPTlNPUlNISVBfTUFOQUdFUgITU1BPTlNPUlNISVBfTUFOQUdFUgAHTUFYX0lOVAD//////////38BEF92YWxpZGF0ZUFkZHJlc3MCCGFkZHJlc3NfBGVycl8EByRtYXRjaDAJAKYIAQUIYWRkcmVzc18DCQABAgUHJG1hdGNoMAIHQWRkcmVzcwQBYQUHJG1hdGNoMAYJAAIBBQRlcnJfAQ5fdmFsaWRhdGVBc3NldAIIYXNzZXRJZF8EZXJyXwQHJG1hdGNoMAkA7AcBCQDZBAEFCGFzc2V0SWRfAwkAAQIFByRtYXRjaDACBUFzc2V0BAFhBQckbWF0Y2gwBgkAAgEFBGVycl8BDF92YWx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KAgkBDV9zYXZlTXVsdGlzaWcBCQERQGV4dHJOYXRpdmUoMTA2MikBBQltdWx0aXNpZ18FBHVuaXQJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAnR4AQZ2ZXJpZnkABAckbWF0Y2gwCQCiCAEFDEtFWV9NVUxUSVNJRwMJAAECBQckbWF0Y2gwAgZTdHJpbmcECG11bHRpc2lnBQckbWF0Y2gwCQELdmFsdWVPckVsc2UCCQCbCAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEFCG11bHRpc2lnCQC5CQIJAMwIAgUKS0VZX1NUQVRVUwkAzAgCCQClCAEFBHRoaXMJAMwIAgkA2AQBCAUCdHgCaWQFA25pbAUJU0VQQVJBVE9SBwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleeGfu0U=", "height": 2540055, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none 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_MINTER = "MINTER" | |
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 _loadMinter (minter_) = match getBoolean(makeString([KEY_MINTER, toString(minter_)], SEPARATOR)) { | |
66 | + | case a: Boolean => | |
67 | + | a | |
68 | + | case _ => | |
69 | + | false | |
70 | + | } | |
71 | + | ||
72 | + | ||
73 | + | func _saveMinter (minter_,val_) = [BooleanEntry(makeString([KEY_MINTER, toString(minter_)], SEPARATOR), val_)] | |
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 _whenMultisigSet () = if ((_loadMultisig() == Address(base58''))) | |
99 | + | then throw("_whenMultisigSet: revert") | |
100 | + | else true | |
101 | + | ||
102 | + | ||
103 | + | func _onlyThisContract (caller_) = if ((caller_ != this)) | |
104 | + | then throw("_onlyThisContract: revert") | |
105 | + | else true | |
106 | + | ||
107 | + | ||
108 | + | func _onlyMinter (caller_) = if (!(_loadMinter(caller_))) | |
109 | + | then throw("_onlyMinter: revert") | |
110 | + | else true | |
111 | + | ||
112 | + | ||
113 | + | func _onlySponsorshipManager (caller_) = if ((caller_ != _loadSponsorshipManager())) | |
114 | + | then throw("_onlySponsorshipManager: revert") | |
115 | + | else true | |
116 | + | ||
117 | + | ||
118 | + | func _whenNotInitialized () = if (_loadInit()) | |
119 | + | then throw("_whenNotInitialized: revert") | |
120 | + | else true | |
121 | + | ||
122 | + | ||
123 | + | func _whenInitialized () = if (!(_loadInit())) | |
124 | + | then throw("_whenInitialized: revert") | |
125 | + | else true | |
126 | + | ||
127 | + | ||
128 | + | @Callable(i) | |
129 | + | func init (tokenName_,tokenDescr_,tokenDecimals_) = { | |
130 | + | let err = if (if (if (if (if (_onlyThisContract(i.caller)) | |
131 | + | then _whenNotInitialized() | |
132 | + | else false) | |
133 | + | then _whenMultisigSet() | |
134 | + | else false) | |
135 | + | then _validateInt(size(tokenName_), 4, 16, "init: invalid token name") | |
136 | + | else false) | |
137 | + | then _validateInt(size(tokenDescr_), 0, 255, "init: invalid token description") | |
138 | + | else false) | |
139 | + | then _validateInt(tokenDecimals_, 0, 8, "init: invalid decimals") | |
140 | + | else false | |
141 | + | if ((err == err)) | |
142 | + | then { | |
143 | + | let issue = Issue(tokenName_, tokenDescr_, 0, tokenDecimals_, true) | |
144 | + | let assetId = calculateAssetId(issue) | |
145 | + | $Tuple2(((_saveInit(true) ++ _saveAsset(assetId)) ++ [issue]), unit) | |
146 | + | } | |
147 | + | else throw("Strict value is not equal to itself.") | |
148 | + | } | |
149 | + | ||
150 | + | ||
151 | + | ||
152 | + | @Callable(i) | |
153 | + | func mint (amount_,recipient_) = { | |
154 | + | let err = if (if (if (_whenInitialized()) | |
155 | + | then _onlyMinter(i.caller) | |
156 | + | else false) | |
157 | + | then _validateInt(amount_, 0, MAX_INT, "mint: invalid amount") | |
158 | + | else false) | |
159 | + | then _validateAddress(recipient_, "mint: invalid recipient") | |
160 | + | else false | |
161 | + | if ((err == err)) | |
162 | + | then { | |
163 | + | let asset = _loadAsset() | |
164 | + | $Tuple2([Reissue(asset, amount_, true), ScriptTransfer(addressFromStringValue(recipient_), amount_, asset)], unit) | |
165 | + | } | |
166 | + | else throw("Strict value is not equal to itself.") | |
167 | + | } | |
168 | + | ||
169 | + | ||
170 | + | ||
171 | + | @Callable(i) | |
172 | + | func mintMany (amount_,recipients_) = { | |
173 | + | let err = if (if (_whenInitialized()) | |
174 | + | then _onlyMinter(i.caller) | |
175 | + | else false) | |
176 | + | then _validateInt(amount_, 0, MAX_INT, "mint: invalid amount") | |
177 | + | else false | |
178 | + | if ((err == err)) | |
179 | + | then { | |
180 | + | let asset = _loadAsset() | |
181 | + | func foldfunc (acc_,elem_) = (acc_ :+ ScriptTransfer(addressFromStringValue(elem_), amount_, asset)) | |
182 | + | ||
183 | + | let actions = { | |
184 | + | let $l = recipients_ | |
185 | + | let $s = size($l) | |
186 | + | let $acc0 = nil | |
187 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
188 | + | then $a | |
189 | + | else foldfunc($a, $l[$i]) | |
190 | + | ||
191 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
192 | + | then $a | |
193 | + | else throw("List size exceeds 51") | |
194 | + | ||
195 | + | $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) | |
196 | + | } | |
197 | + | $Tuple2(([Reissue(asset, (amount_ * size(recipients_)), true)] ++ actions), unit) | |
198 | + | } | |
199 | + | else throw("Strict value is not equal to itself.") | |
200 | + | } | |
201 | + | ||
202 | + | ||
203 | + | ||
204 | + | @Callable(i) | |
205 | + | func addMinter (minter_) = { | |
206 | + | let err = if (if (_onlyThisContract(i.caller)) | |
207 | + | then _whenInitialized() | |
208 | + | else false) | |
209 | + | then _validateAddress(minter_, "init: invalid minter") | |
210 | + | else false | |
211 | + | if ((err == err)) | |
212 | + | then $Tuple2(_saveMinter(addressFromStringValue(minter_), true), unit) | |
213 | + | else throw("Strict value is not equal to itself.") | |
214 | + | } | |
215 | + | ||
216 | + | ||
217 | + | ||
218 | + | @Callable(i) | |
219 | + | func removeMinter (minter_) = { | |
220 | + | let err = if (if (_onlyThisContract(i.caller)) | |
221 | + | then _whenInitialized() | |
222 | + | else false) | |
223 | + | then _validateAddress(minter_, "init: invalid minter") | |
224 | + | else false | |
225 | + | if ((err == err)) | |
226 | + | then $Tuple2(_saveMinter(addressFromStringValue(minter_), false), unit) | |
227 | + | else throw("Strict value is not equal to itself.") | |
228 | + | } | |
229 | + | ||
230 | + | ||
231 | + | ||
232 | + | @Callable(i) | |
233 | + | func getAssetId () = $Tuple2(nil, _loadAsset()) | |
234 | + | ||
235 | + | ||
236 | + | ||
237 | + | @Callable(i) | |
238 | + | func getDecimals () = { | |
239 | + | let decimals = match assetInfo(_loadAsset()) { | |
240 | + | case a: Asset => | |
241 | + | a.decimals | |
242 | + | case _ => | |
243 | + | throw("getDecimals: revert") | |
244 | + | } | |
245 | + | $Tuple2(nil, decimals) | |
246 | + | } | |
247 | + | ||
248 | + | ||
249 | + | ||
250 | + | @Callable(i) | |
251 | + | func setSponsorshipManager (manager_) = { | |
252 | + | let err = if (_onlyThisContract(i.caller)) | |
253 | + | then _validateAddress(manager_, "setSponsorshipManager: invalid manager") | |
254 | + | else false | |
255 | + | if ((err == err)) | |
256 | + | then $Tuple2(_saveSponsorshipManager(addressFromStringValue(manager_)), unit) | |
257 | + | else throw("Strict value is not equal to itself.") | |
258 | + | } | |
259 | + | ||
260 | + | ||
261 | + | ||
262 | + | @Callable(i) | |
263 | + | func updateSponsorship (minSponsoredAssetFee_,wavesRequiredAmount_) = { | |
264 | + | let err = if (if (_onlySponsorshipManager(i.caller)) | |
265 | + | then _validateInt(minSponsoredAssetFee_, 0, MAX_INT, "updateSponsorship: invalid sponsor fee") | |
266 | + | else false) | |
267 | + | then _validateInt(wavesRequiredAmount_, 0, MAX_INT, "updateSponsorship: invalid waves required amount") | |
268 | + | else false | |
269 | + | if ((err == err)) | |
270 | + | then { | |
271 | + | let sponsorAsset = _loadAsset() | |
272 | + | let sponsorAmount = assetBalance(this, sponsorAsset) | |
273 | + | let minSponsoredAssetFee = if ((minSponsoredAssetFee_ == 0)) | |
274 | + | then unit | |
275 | + | else minSponsoredAssetFee_ | |
276 | + | let actions = if ((wavesBalance(this).regular > wavesRequiredAmount_)) | |
277 | + | then [ScriptTransfer(i.caller, (wavesBalance(this).regular - wavesRequiredAmount_), unit)] | |
278 | + | else nil | |
279 | + | $Tuple2((actions ++ [ScriptTransfer(i.caller, sponsorAmount, sponsorAsset), SponsorFee(sponsorAsset, minSponsoredAssetFee)]), sponsorAmount) | |
280 | + | } | |
281 | + | else throw("Strict value is not equal to itself.") | |
282 | + | } | |
283 | + | ||
284 | + | ||
285 | + | ||
286 | + | @Callable(i) | |
287 | + | func setMultisig (multisig_) = { | |
288 | + | let err = if (_onlyThisContract(i.caller)) | |
289 | + | then _validateAddress(multisig_, "setMultisig: invalid multisig") | |
290 | + | else false | |
291 | + | if ((err == err)) | |
292 | + | then $Tuple2(_saveMultisig(addressFromStringValue(multisig_)), unit) | |
293 | + | else throw("Strict value is not equal to itself.") | |
294 | + | } | |
295 | + | ||
296 | + | ||
297 | + | @Verifier(tx) | |
298 | + | func verify () = match getString(KEY_MULTISIG) { | |
299 | + | case multisig: String => | |
300 | + | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
301 | + | case _ => | |
302 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
303 | + | } | |
304 | + |
github/deemru/w8io/169f3d6 64.18 ms ◑