tx · CwLg6VqHAWFDSr16B2jA5aaMbaqsfBNM5GvMZMADJ9vb

3Mx16q4Tisr27xu8f3oLzm9TyUTMmcUJuUo:  -0.01400000 Waves

2023.02.23 23:56 [2462813] smart account 3Mx16q4Tisr27xu8f3oLzm9TyUTMmcUJuUo > SELF 0.00000000 Waves

{ "type": 13, "id": "CwLg6VqHAWFDSr16B2jA5aaMbaqsfBNM5GvMZMADJ9vb", "fee": 1400000, "feeAssetId": null, "timestamp": 1677184465662, "version": 2, "chainId": 84, "sender": "3Mx16q4Tisr27xu8f3oLzm9TyUTMmcUJuUo", "senderPublicKey": "9Misq1eiu27cRLC6ZiL9S74JdRAWpX1rykUJzFGzf6Rb", "proofs": [ "aENEeMqXXLEikNEzTo6HZUraWs9gZBEAzWyJUaJiJDJz96XosUMoiBd6P4Hwp3ERJYaPW6XZHRB1LUhZWrQjpM4" ], "script": "base64:BgIzCAISBQoDCAgBEgQKAgEIEgQKAgEYEgMKAQgSAwoBCBIAEgASAwoBCBIECgIBARIDCgEIGwAJU0VQQVJBVE9SAgJfXwAIS0VZX0lOSVQCBElOSVQADEtFWV9NVUxUSVNJRwIITVVMVElTSUcACktFWV9TVEFUVVMCBlNUQVRVUwAKS0VZX01JTlRFUgIGTUlOVEVSAAlLRVlfQVNTRVQCBUFTU0VUABdLRVlfU1BPTlNPUlNISVBfTUFOQUdFUgITU1BPTlNPUlNISVBfTUFOQUdFUgAHTUFYX0lOVAD//////////38BEF92YWxpZGF0ZUFkZHJlc3MCCGFkZHJlc3NfBGVycl8EByRtYXRjaDAJAKYIAQUIYWRkcmVzc18DCQABAgUHJG1hdGNoMAIHQWRkcmVzcwQBYQUHJG1hdGNoMAYJAAIBBQRlcnJfAQ5fdmFsaWRhdGVBc3NldAIIYXNzZXRJZF8EZXJyXwQHJG1hdGNoMAkA7AcBCQDZBAEFCGFzc2V0SWRfAwkAAQIFByRtYXRjaDACBUFzc2V0BAFhBQckbWF0Y2gwBgkAAgEFBGVycl8BDF92YWxp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AgkBDV9zYXZlTXVsdGlzaWcBCQERQGV4dHJOYXRpdmUoMTA2MikBBQltdWx0aXNpZ18FBHVuaXQJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAnR4AQZ2ZXJpZnkABAckbWF0Y2gwCQCiCAEFDEtFWV9NVUxUSVNJRwMJAAECBQckbWF0Y2gwAgZTdHJpbmcECG11bHRpc2lnBQckbWF0Y2gwCQELdmFsdWVPckVsc2UCCQCbCAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEFCG11bHRpc2lnCQC5CQIJAMwIAgUKS0VZX1NUQVRVUwkAzAgCCQClCAEFBHRoaXMJAMwIAgkA2AQBCAUCdHgCaWQFA25pbAUJU0VQQVJBVE9SBwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleeGfu0U=", "height": 2462813, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DpHcZfXSbPp16RTjX2UVHe3vTm7EQXXwqWZc4TfCkTPt Next: none Diff:
OldNewDifferences
99
1010 let KEY_STATUS = "STATUS"
1111
12-let KEY_MINTERS = "MINTERS"
12+let KEY_MINTER = "MINTER"
1313
1414 let KEY_ASSET = "ASSET"
1515
6262 func _saveMultisig (multisig_) = [StringEntry(KEY_MULTISIG, toString(multisig_))]
6363
6464
65-func _loadMinters () = match getString(KEY_MINTERS) {
66- case a: String =>
65+func _loadMinter (minter_) = match getBoolean(makeString([KEY_MINTER, toString(minter_)], SEPARATOR)) {
66+ case a: Boolean =>
6767 a
6868 case _ =>
69- ""
69+ false
7070 }
7171
7272
73-func _saveMinters (minters_) = [StringEntry(KEY_MINTERS, minters_)]
73+func _saveMinter (minter_,val_) = [BooleanEntry(makeString([KEY_MINTER, toString(minter_)], SEPARATOR), val_)]
7474
7575
7676 func _loadAsset () = match getString(KEY_ASSET) {
9595 func _saveSponsorshipManager (manager_) = [StringEntry(KEY_SPONSORSHIP_MANAGER, toString(manager_))]
9696
9797
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-
11398 func _whenMultisigSet () = if ((_loadMultisig() == Address(base58'')))
11499 then throw("_whenMultisigSet: revert")
115100 else true
120105 else true
121106
122107
123-func _onlyMinter (caller_) = if (!(contains(_loadMinters(), toString(caller_))))
108+func _onlyMinter (caller_) = if (!(_loadMinter(caller_)))
124109 then throw("_onlyMinter: revert")
125110 else true
126111
224209 then _validateAddress(minter_, "init: invalid minter")
225210 else false
226211 if ((err == err))
227- then $Tuple2(_saveMinters(_addMinter((minter_ + SEPARATOR))), unit)
212+ then $Tuple2(_saveMinter(addressFromStringValue(minter_), true), unit)
228213 else throw("Strict value is not equal to itself.")
229214 }
230215
238223 then _validateAddress(minter_, "init: invalid minter")
239224 else false
240225 if ((err == err))
241- then $Tuple2(_saveMinters(_removeMinter((minter_ + SEPARATOR))), unit)
226+ then $Tuple2(_saveMinter(addressFromStringValue(minter_), false), unit)
242227 else throw("Strict value is not equal to itself.")
243228 }
244229
258243 throw("getDecimals: revert")
259244 }
260245 $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.")
273246 }
274247
275248
309282 }
310283
311284
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+
312297 @Verifier(tx)
313298 func verify () = match getString(KEY_MULTISIG) {
314299 case multisig: String =>
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEPARATOR = "__"
55
66 let KEY_INIT = "INIT"
77
88 let KEY_MULTISIG = "MULTISIG"
99
1010 let KEY_STATUS = "STATUS"
1111
12-let KEY_MINTERS = "MINTERS"
12+let KEY_MINTER = "MINTER"
1313
1414 let KEY_ASSET = "ASSET"
1515
1616 let KEY_SPONSORSHIP_MANAGER = "SPONSORSHIP_MANAGER"
1717
1818 let MAX_INT = 9223372036854775807
1919
2020 func _validateAddress (address_,err_) = match addressFromString(address_) {
2121 case a: Address =>
2222 true
2323 case _ =>
2424 throw(err_)
2525 }
2626
2727
2828 func _validateAsset (assetId_,err_) = match assetInfo(fromBase58String(assetId_)) {
2929 case a: Asset =>
3030 true
3131 case _ =>
3232 throw(err_)
3333 }
3434
3535
3636 func _validateInt (val_,lowerBoundary_,upperBoundary_,err_) = if (if ((lowerBoundary_ > val_))
3737 then true
3838 else (val_ > upperBoundary_))
3939 then throw(err_)
4040 else true
4141
4242
4343 func _loadInit () = match getBoolean(KEY_INIT) {
4444 case a: Boolean =>
4545 a
4646 case _ =>
4747 false
4848 }
4949
5050
5151 func _saveInit (isInit_) = [BooleanEntry(KEY_INIT, isInit_)]
5252
5353
5454 func _loadMultisig () = match getString(KEY_MULTISIG) {
5555 case a: String =>
5656 addressFromStringValue(a)
5757 case _ =>
5858 Address(base58'')
5959 }
6060
6161
6262 func _saveMultisig (multisig_) = [StringEntry(KEY_MULTISIG, toString(multisig_))]
6363
6464
65-func _loadMinters () = match getString(KEY_MINTERS) {
66- case a: String =>
65+func _loadMinter (minter_) = match getBoolean(makeString([KEY_MINTER, toString(minter_)], SEPARATOR)) {
66+ case a: Boolean =>
6767 a
6868 case _ =>
69- ""
69+ false
7070 }
7171
7272
73-func _saveMinters (minters_) = [StringEntry(KEY_MINTERS, minters_)]
73+func _saveMinter (minter_,val_) = [BooleanEntry(makeString([KEY_MINTER, toString(minter_)], SEPARATOR), val_)]
7474
7575
7676 func _loadAsset () = match getString(KEY_ASSET) {
7777 case a: String =>
7878 fromBase58String(a)
7979 case _ =>
8080 base58''
8181 }
8282
8383
8484 func _saveAsset (assetId_) = [StringEntry(KEY_ASSET, toBase58String(assetId_))]
8585
8686
8787 func _loadSponsorshipManager () = match getString(KEY_SPONSORSHIP_MANAGER) {
8888 case a: String =>
8989 addressFromStringValue(a)
9090 case _ =>
9191 Address(base58'')
9292 }
9393
9494
9595 func _saveSponsorshipManager (manager_) = [StringEntry(KEY_SPONSORSHIP_MANAGER, toString(manager_))]
9696
9797
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-
11398 func _whenMultisigSet () = if ((_loadMultisig() == Address(base58'')))
11499 then throw("_whenMultisigSet: revert")
115100 else true
116101
117102
118103 func _onlyThisContract (caller_) = if ((caller_ != this))
119104 then throw("_onlyThisContract: revert")
120105 else true
121106
122107
123-func _onlyMinter (caller_) = if (!(contains(_loadMinters(), toString(caller_))))
108+func _onlyMinter (caller_) = if (!(_loadMinter(caller_)))
124109 then throw("_onlyMinter: revert")
125110 else true
126111
127112
128113 func _onlySponsorshipManager (caller_) = if ((caller_ != _loadSponsorshipManager()))
129114 then throw("_onlySponsorshipManager: revert")
130115 else true
131116
132117
133118 func _whenNotInitialized () = if (_loadInit())
134119 then throw("_whenNotInitialized: revert")
135120 else true
136121
137122
138123 func _whenInitialized () = if (!(_loadInit()))
139124 then throw("_whenInitialized: revert")
140125 else true
141126
142127
143128 @Callable(i)
144129 func init (tokenName_,tokenDescr_,tokenDecimals_) = {
145130 let err = if (if (if (if (if (_onlyThisContract(i.caller))
146131 then _whenNotInitialized()
147132 else false)
148133 then _whenMultisigSet()
149134 else false)
150135 then _validateInt(size(tokenName_), 4, 16, "init: invalid token name")
151136 else false)
152137 then _validateInt(size(tokenDescr_), 0, 255, "init: invalid token description")
153138 else false)
154139 then _validateInt(tokenDecimals_, 0, 8, "init: invalid decimals")
155140 else false
156141 if ((err == err))
157142 then {
158143 let issue = Issue(tokenName_, tokenDescr_, 0, tokenDecimals_, true)
159144 let assetId = calculateAssetId(issue)
160145 $Tuple2(((_saveInit(true) ++ _saveAsset(assetId)) ++ [issue]), unit)
161146 }
162147 else throw("Strict value is not equal to itself.")
163148 }
164149
165150
166151
167152 @Callable(i)
168153 func mint (amount_,recipient_) = {
169154 let err = if (if (if (_whenInitialized())
170155 then _onlyMinter(i.caller)
171156 else false)
172157 then _validateInt(amount_, 0, MAX_INT, "mint: invalid amount")
173158 else false)
174159 then _validateAddress(recipient_, "mint: invalid recipient")
175160 else false
176161 if ((err == err))
177162 then {
178163 let asset = _loadAsset()
179164 $Tuple2([Reissue(asset, amount_, true), ScriptTransfer(addressFromStringValue(recipient_), amount_, asset)], unit)
180165 }
181166 else throw("Strict value is not equal to itself.")
182167 }
183168
184169
185170
186171 @Callable(i)
187172 func mintMany (amount_,recipients_) = {
188173 let err = if (if (_whenInitialized())
189174 then _onlyMinter(i.caller)
190175 else false)
191176 then _validateInt(amount_, 0, MAX_INT, "mint: invalid amount")
192177 else false
193178 if ((err == err))
194179 then {
195180 let asset = _loadAsset()
196181 func foldfunc (acc_,elem_) = (acc_ :+ ScriptTransfer(addressFromStringValue(elem_), amount_, asset))
197182
198183 let actions = {
199184 let $l = recipients_
200185 let $s = size($l)
201186 let $acc0 = nil
202187 func $f0_1 ($a,$i) = if (($i >= $s))
203188 then $a
204189 else foldfunc($a, $l[$i])
205190
206191 func $f0_2 ($a,$i) = if (($i >= $s))
207192 then $a
208193 else throw("List size exceeds 51")
209194
210195 $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)
211196 }
212197 $Tuple2(([Reissue(asset, (amount_ * size(recipients_)), true)] ++ actions), unit)
213198 }
214199 else throw("Strict value is not equal to itself.")
215200 }
216201
217202
218203
219204 @Callable(i)
220205 func addMinter (minter_) = {
221206 let err = if (if (_onlyThisContract(i.caller))
222207 then _whenInitialized()
223208 else false)
224209 then _validateAddress(minter_, "init: invalid minter")
225210 else false
226211 if ((err == err))
227- then $Tuple2(_saveMinters(_addMinter((minter_ + SEPARATOR))), unit)
212+ then $Tuple2(_saveMinter(addressFromStringValue(minter_), true), unit)
228213 else throw("Strict value is not equal to itself.")
229214 }
230215
231216
232217
233218 @Callable(i)
234219 func removeMinter (minter_) = {
235220 let err = if (if (_onlyThisContract(i.caller))
236221 then _whenInitialized()
237222 else false)
238223 then _validateAddress(minter_, "init: invalid minter")
239224 else false
240225 if ((err == err))
241- then $Tuple2(_saveMinters(_removeMinter((minter_ + SEPARATOR))), unit)
226+ then $Tuple2(_saveMinter(addressFromStringValue(minter_), false), unit)
242227 else throw("Strict value is not equal to itself.")
243228 }
244229
245230
246231
247232 @Callable(i)
248233 func getAssetId () = $Tuple2(nil, _loadAsset())
249234
250235
251236
252237 @Callable(i)
253238 func getDecimals () = {
254239 let decimals = match assetInfo(_loadAsset()) {
255240 case a: Asset =>
256241 a.decimals
257242 case _ =>
258243 throw("getDecimals: revert")
259244 }
260245 $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.")
273246 }
274247
275248
276249
277250 @Callable(i)
278251 func setSponsorshipManager (manager_) = {
279252 let err = if (_onlyThisContract(i.caller))
280253 then _validateAddress(manager_, "setSponsorshipManager: invalid manager")
281254 else false
282255 if ((err == err))
283256 then $Tuple2(_saveSponsorshipManager(addressFromStringValue(manager_)), unit)
284257 else throw("Strict value is not equal to itself.")
285258 }
286259
287260
288261
289262 @Callable(i)
290263 func updateSponsorship (minSponsoredAssetFee_,wavesRequiredAmount_) = {
291264 let err = if (if (_onlySponsorshipManager(i.caller))
292265 then _validateInt(minSponsoredAssetFee_, 0, MAX_INT, "updateSponsorship: invalid sponsor fee")
293266 else false)
294267 then _validateInt(wavesRequiredAmount_, 0, MAX_INT, "updateSponsorship: invalid waves required amount")
295268 else false
296269 if ((err == err))
297270 then {
298271 let sponsorAsset = _loadAsset()
299272 let sponsorAmount = assetBalance(this, sponsorAsset)
300273 let minSponsoredAssetFee = if ((minSponsoredAssetFee_ == 0))
301274 then unit
302275 else minSponsoredAssetFee_
303276 let actions = if ((wavesBalance(this).regular > wavesRequiredAmount_))
304277 then [ScriptTransfer(i.caller, (wavesBalance(this).regular - wavesRequiredAmount_), unit)]
305278 else nil
306279 $Tuple2((actions ++ [ScriptTransfer(i.caller, sponsorAmount, sponsorAsset), SponsorFee(sponsorAsset, minSponsoredAssetFee)]), sponsorAmount)
307280 }
308281 else throw("Strict value is not equal to itself.")
309282 }
310283
311284
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+
312297 @Verifier(tx)
313298 func verify () = match getString(KEY_MULTISIG) {
314299 case multisig: String =>
315300 valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false)
316301 case _ =>
317302 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
318303 }
319304

github/deemru/w8io/169f3d6 
53.07 ms