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