tx · 72S48YsSEKC7urFci1L8py3koXBs3DudgdUdt49PVyx6 3NAg879tKUJh949h21umkwiaRQhwZftz1BE: -0.05000000 Waves 2019.09.08 16:04 [667132] smart account 3NAg879tKUJh949h21umkwiaRQhwZftz1BE > SELF 0.00000000 Waves
{ "type": 13, "id": "72S48YsSEKC7urFci1L8py3koXBs3DudgdUdt49PVyx6", "fee": 5000000, "feeAssetId": null, "timestamp": 1567947879147, "version": 1, "sender": "3NAg879tKUJh949h21umkwiaRQhwZftz1BE", "senderPublicKey": "BqY2jhkQCcbidtQdQZu6f9RV3AkFAS8VPToHxwYu1KdJ", "proofs": [ "QdimugxuauFbSw71chNyz6ETPu9hGba4gM7SEg5ftRhqwuZqVj6C2aKNqGhhjx5TTgm12dYKkuDQuAVq9sZgqkn" ], "script": "base64:AAIDAAAAAAAAAAAAAAAeAAAAAAN3dnMAAAAAAAX14QAAAAAAGW5vdFN1cHBvcnRlZEN1cnJlbmN5RXJyb3ICAAAAGzxub3RTdXBwb3J0ZWRDdXJyZW5jeUVycm9yPgAAAAAXaXNzdWVyQWNjZXNzRGVuaWVkRXJyb3ICAAAAGTxpc3N1ZXJBY2Nlc3NEZW5pZWRFcnJvcj4AAAAAFW5vdEVub3VnaFBheW1lbnRFcnJvcgIAAAAXPG5vdEVub3VnaFBheW1lbnRFcnJvcj4AAAAAJHRpY2tlclZhbGlkYXRpb25Ob3RFbm91Z2hSYXRpbmdFcnJvcgIAAAAmPHRpY2tlclZhbGlkYXRpb25Ob3RFbm91Z2hSYXRpbmdFcnJvcj4AAAAAInRpY2tlclZhbGlkYXRpb25UaWNrZXJJc0V4aXN0RXJyb3ICAAAAJDx0aWNrZXJWYWxpZGF0aW9uVGlja2VySXNFeGlzdEVycm9yPgAAAAAgdGlja2VyVmFsaWRhdGlvbldyb25nRm9ybWF0RXJyb3ICAAAAIjx0aWNrZXJWYWxpZGF0aW9uV3JvbmdGb3JtYXRFcnJvcj4AAAAAFW5vbkV4aXN0ZW50QXNzZXR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AAADWlzc3VlckxpbmtLZXkFAAAABGxpbmsFAAAAA25pbAkAAAIAAAABBQAAABdpc3N1ZXJBY2Nlc3NEZW5pZWRFcnJvcgkAAAIAAAABBQAAABVub3RFbm91Z2hQYXltZW50RXJyb3IJAAACAAAAAQUAAAAZbm90U3VwcG9ydGVkQ3VycmVuY3lFcnJvcgAAAAAnBzmb", "chainId": 84, "height": 667132, "spentComplexity": 0 } View: original | compacted Prev: C2hc99UQQvsSa1kNPUao8NaMtvoJwspCXEYGbq83Lr2v Next: HewXGitJ5cEVswicbNLHoFWDSu7nKJuMUNwQ9YMPk6iC Diff:
Old | New | Differences | |
---|---|---|---|
176 | 176 | } | |
177 | 177 | ||
178 | 178 | ||
179 | + | func debug (i,assetId) = { | |
180 | + | let callerAddress = toBase58String(i.caller.bytes) | |
181 | + | let assetIssuerAdress = getAssetIssuerAddressFromAssetId(assetId) | |
182 | + | let result = ((callerAddress + " ") + assetIssuerAdress) | |
183 | + | throw(result) | |
184 | + | } | |
185 | + | ||
186 | + | ||
179 | 187 | @Callable(i) | |
180 | 188 | func updateTicker (assetId,ticker) = { | |
181 | 189 | let issuerTickerKey = ((("issuerTicker_" + "<") + assetId) + ">") | |
182 | - | let isTickerFree = match getString(tickerCatalogueOracleAddress, ticker) { | |
183 | - | case t: String => | |
184 | - | false | |
185 | - | case t: Unit => | |
186 | - | true | |
187 | - | case _ => | |
188 | - | throw() | |
189 | - | } | |
190 | - | if (isPaymentInWaves(i)) | |
191 | - | then if (isEnoughPayment(i, tickerUpdatePrice)) | |
192 | - | then if (isCallerAssetIssuer(i, assetId)) | |
193 | - | then if (isUpdateAllowedByRating(assetId)) | |
194 | - | then if (isTickerFree) | |
195 | - | then if (isValidTicker(ticker)) | |
196 | - | then WriteSet([DataEntry(issuerTickerKey, ticker)]) | |
197 | - | else throw(tickerValidationWrongFormatError) | |
198 | - | else throw(tickerValidationTickerIsExistError) | |
199 | - | else throw(tickerValidationNotEnoughRatingError) | |
200 | - | else throw(issuerAccessDeniedError) | |
201 | - | else throw(notEnoughPaymentError) | |
202 | - | else throw(notSupportedCurrencyError) | |
190 | + | debug(i, assetId) | |
203 | 191 | } | |
204 | 192 | ||
205 | 193 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let wvs = 100000000 | |
5 | 5 | ||
6 | 6 | let notSupportedCurrencyError = "<notSupportedCurrencyError>" | |
7 | 7 | ||
8 | 8 | let issuerAccessDeniedError = "<issuerAccessDeniedError>" | |
9 | 9 | ||
10 | 10 | let notEnoughPaymentError = "<notEnoughPaymentError>" | |
11 | 11 | ||
12 | 12 | let tickerValidationNotEnoughRatingError = "<tickerValidationNotEnoughRatingError>" | |
13 | 13 | ||
14 | 14 | let tickerValidationTickerIsExistError = "<tickerValidationTickerIsExistError>" | |
15 | 15 | ||
16 | 16 | let tickerValidationWrongFormatError = "<tickerValidationWrongFormatError>" | |
17 | 17 | ||
18 | 18 | let nonExistentAssetError = "<nonExistentAssetError>" | |
19 | 19 | ||
20 | 20 | let noPaymentError = "<noPaymentError>" | |
21 | 21 | ||
22 | 22 | let descriptionUpdatePrice = (1 * wvs) | |
23 | 23 | ||
24 | 24 | let linkUpdatePrice = (1 * wvs) | |
25 | 25 | ||
26 | 26 | let tickerUpdatePrice = (2 * wvs) | |
27 | 27 | ||
28 | 28 | let tickerMinLength = 1 | |
29 | 29 | ||
30 | 30 | let tickerMaxLength = 6 | |
31 | 31 | ||
32 | 32 | let tickerAllowedLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
33 | 33 | ||
34 | 34 | let tickerCatalogueOracleAddress = addressFromStringValue("3MxHxW5VWq4KrWcbhFfxKrafXm4mL6rZHfj") | |
35 | 35 | ||
36 | 36 | let tokenRatingOracleAddress = addressFromStringValue("3NADqHoLMbMTfXdP2TeBBSx5mQXePVj3KZm") | |
37 | 37 | ||
38 | 38 | func getIntegerFromAccount (accountAddress,key) = match getInteger(accountAddress, key) { | |
39 | 39 | case i: Int => | |
40 | 40 | i | |
41 | 41 | case _ => | |
42 | 42 | 0 | |
43 | 43 | } | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func isSubstrExist (str,substr) = match indexOf(str, substr) { | |
47 | 47 | case index: Int => | |
48 | 48 | true | |
49 | 49 | case index: Unit => | |
50 | 50 | false | |
51 | 51 | case _ => | |
52 | 52 | throw() | |
53 | 53 | } | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func isValidTicker (ticker) = { | |
57 | 57 | let tickerLetters = split(ticker, "") | |
58 | 58 | let tickerLength = size(tickerLetters) | |
59 | 59 | let isLetter1Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[0]) | |
60 | 60 | let isLetter2Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[1]) | |
61 | 61 | let isLetter3Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[2]) | |
62 | 62 | let isLetter4Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[3]) | |
63 | 63 | let isLetter5Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[4]) | |
64 | 64 | let isLetter6Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[5]) | |
65 | 65 | if ((ticker != "")) | |
66 | 66 | then if (if ((tickerLength >= tickerMinLength)) | |
67 | 67 | then (tickerMaxLength >= tickerLength) | |
68 | 68 | else false) | |
69 | 69 | then if ((1 == tickerLength)) | |
70 | 70 | then isLetter1Valid | |
71 | 71 | else if ((2 == tickerLength)) | |
72 | 72 | then if (isLetter1Valid) | |
73 | 73 | then isLetter2Valid | |
74 | 74 | else false | |
75 | 75 | else if ((3 == tickerLength)) | |
76 | 76 | then if (if (isLetter1Valid) | |
77 | 77 | then isLetter2Valid | |
78 | 78 | else false) | |
79 | 79 | then isLetter3Valid | |
80 | 80 | else false | |
81 | 81 | else if ((4 == tickerLength)) | |
82 | 82 | then if (if (if (isLetter1Valid) | |
83 | 83 | then isLetter2Valid | |
84 | 84 | else false) | |
85 | 85 | then isLetter3Valid | |
86 | 86 | else false) | |
87 | 87 | then isLetter4Valid | |
88 | 88 | else false | |
89 | 89 | else if ((5 == tickerLength)) | |
90 | 90 | then if (if (if (if (isLetter1Valid) | |
91 | 91 | then isLetter2Valid | |
92 | 92 | else false) | |
93 | 93 | then isLetter3Valid | |
94 | 94 | else false) | |
95 | 95 | then isLetter4Valid | |
96 | 96 | else false) | |
97 | 97 | then isLetter5Valid | |
98 | 98 | else false | |
99 | 99 | else if ((6 == tickerLength)) | |
100 | 100 | then if (if (if (if (if (isLetter1Valid) | |
101 | 101 | then isLetter2Valid | |
102 | 102 | else false) | |
103 | 103 | then isLetter3Valid | |
104 | 104 | else false) | |
105 | 105 | then isLetter4Valid | |
106 | 106 | else false) | |
107 | 107 | then isLetter5Valid | |
108 | 108 | else false) | |
109 | 109 | then isLetter6Valid | |
110 | 110 | else false | |
111 | 111 | else false | |
112 | 112 | else false | |
113 | 113 | else false | |
114 | 114 | } | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func isAssetUpdateAllowedByRating (assetId) = { | |
118 | 118 | let assetRatingKey = (("assetRating_" + assetId) + "_1") | |
119 | 119 | let assetRatingValue = getIntegerFromAccount(tokenRatingOracleAddress, assetRatingKey) | |
120 | 120 | let assetRatingTreshold = getIntegerFromAccount(tokenRatingOracleAddress, "tickerRating_1") | |
121 | 121 | (assetRatingValue >= assetRatingTreshold) | |
122 | 122 | } | |
123 | 123 | ||
124 | 124 | ||
125 | 125 | func isAssetUpdateAllowedByWeight (assetId) = { | |
126 | 126 | let assetWeightKey = "assetWeight" | |
127 | 127 | let assetWeightValue = getIntegerFromAccount(tokenRatingOracleAddress, assetWeightKey) | |
128 | 128 | let assetWeightTreshold = getIntegerFromAccount(tokenRatingOracleAddress, "tickerWeight") | |
129 | 129 | (assetWeightValue >= assetWeightTreshold) | |
130 | 130 | } | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | func isAssetUpdateAllowedByVotes (assetId) = { | |
134 | 134 | let assetVotesKey = "assetVotes" | |
135 | 135 | let assetVotesValue = getIntegerFromAccount(tokenRatingOracleAddress, assetVotesKey) | |
136 | 136 | let assetVotesTreshold = getIntegerFromAccount(tokenRatingOracleAddress, "tickerVotes") | |
137 | 137 | (assetVotesValue >= assetVotesTreshold) | |
138 | 138 | } | |
139 | 139 | ||
140 | 140 | ||
141 | 141 | func isUpdateAllowedByRating (assetId) = if (if (isAssetUpdateAllowedByRating(assetId)) | |
142 | 142 | then isAssetUpdateAllowedByWeight(assetId) | |
143 | 143 | else false) | |
144 | 144 | then isAssetUpdateAllowedByVotes(assetId) | |
145 | 145 | else false | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | func getAssetIssuerAddressFromAssetId (assetId) = toString(valueOrErrorMessage(assetInfo(fromBase58String(assetId)), nonExistentAssetError).issuer) | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | func getPayment (i) = valueOrErrorMessage(i.payment, noPaymentError) | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | func isPaymentInWaves (i) = { | |
155 | 155 | let payment = getPayment(i) | |
156 | 156 | if (!(isDefined(payment.assetId))) | |
157 | 157 | then true | |
158 | 158 | else false | |
159 | 159 | } | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | func isEnoughPayment (i,requiredPayment) = { | |
163 | 163 | let payment = getPayment(i) | |
164 | 164 | if ((payment.amount >= requiredPayment)) | |
165 | 165 | then true | |
166 | 166 | else false | |
167 | 167 | } | |
168 | 168 | ||
169 | 169 | ||
170 | 170 | func isCallerAssetIssuer (i,assetId) = { | |
171 | 171 | let callerAddress = toBase58String(i.caller.bytes) | |
172 | 172 | let assetIssuerAdress = getAssetIssuerAddressFromAssetId(assetId) | |
173 | 173 | if ((callerAddress == assetIssuerAdress)) | |
174 | 174 | then true | |
175 | 175 | else false | |
176 | 176 | } | |
177 | 177 | ||
178 | 178 | ||
179 | + | func debug (i,assetId) = { | |
180 | + | let callerAddress = toBase58String(i.caller.bytes) | |
181 | + | let assetIssuerAdress = getAssetIssuerAddressFromAssetId(assetId) | |
182 | + | let result = ((callerAddress + " ") + assetIssuerAdress) | |
183 | + | throw(result) | |
184 | + | } | |
185 | + | ||
186 | + | ||
179 | 187 | @Callable(i) | |
180 | 188 | func updateTicker (assetId,ticker) = { | |
181 | 189 | let issuerTickerKey = ((("issuerTicker_" + "<") + assetId) + ">") | |
182 | - | let isTickerFree = match getString(tickerCatalogueOracleAddress, ticker) { | |
183 | - | case t: String => | |
184 | - | false | |
185 | - | case t: Unit => | |
186 | - | true | |
187 | - | case _ => | |
188 | - | throw() | |
189 | - | } | |
190 | - | if (isPaymentInWaves(i)) | |
191 | - | then if (isEnoughPayment(i, tickerUpdatePrice)) | |
192 | - | then if (isCallerAssetIssuer(i, assetId)) | |
193 | - | then if (isUpdateAllowedByRating(assetId)) | |
194 | - | then if (isTickerFree) | |
195 | - | then if (isValidTicker(ticker)) | |
196 | - | then WriteSet([DataEntry(issuerTickerKey, ticker)]) | |
197 | - | else throw(tickerValidationWrongFormatError) | |
198 | - | else throw(tickerValidationTickerIsExistError) | |
199 | - | else throw(tickerValidationNotEnoughRatingError) | |
200 | - | else throw(issuerAccessDeniedError) | |
201 | - | else throw(notEnoughPaymentError) | |
202 | - | else throw(notSupportedCurrencyError) | |
190 | + | debug(i, assetId) | |
203 | 191 | } | |
204 | 192 | ||
205 | 193 | ||
206 | 194 | ||
207 | 195 | @Callable(i) | |
208 | 196 | func updateDescription (assetId,description) = { | |
209 | 197 | let issuerDescriptionKey = ((("issuerDescription_" + "<") + assetId) + ">") | |
210 | 198 | if (isPaymentInWaves(i)) | |
211 | 199 | then if (isEnoughPayment(i, descriptionUpdatePrice)) | |
212 | 200 | then if (isCallerAssetIssuer(i, assetId)) | |
213 | 201 | then WriteSet([DataEntry(issuerDescriptionKey, description)]) | |
214 | 202 | else throw(issuerAccessDeniedError) | |
215 | 203 | else throw(notEnoughPaymentError) | |
216 | 204 | else throw(notSupportedCurrencyError) | |
217 | 205 | } | |
218 | 206 | ||
219 | 207 | ||
220 | 208 | ||
221 | 209 | @Callable(i) | |
222 | 210 | func updateLink (assetId,link) = { | |
223 | 211 | let issuerLinkKey = ((("issuerLink_" + "<") + assetId) + ">") | |
224 | 212 | if (isPaymentInWaves(i)) | |
225 | 213 | then if (isEnoughPayment(i, linkUpdatePrice)) | |
226 | 214 | then if (isCallerAssetIssuer(i, assetId)) | |
227 | 215 | then WriteSet([DataEntry(issuerLinkKey, link)]) | |
228 | 216 | else throw(issuerAccessDeniedError) | |
229 | 217 | else throw(notEnoughPaymentError) | |
230 | 218 | else throw(notSupportedCurrencyError) | |
231 | 219 | } | |
232 | 220 | ||
233 | 221 |
github/deemru/w8io/169f3d6 50.82 ms ◑