tx · AFvGKuoWjA1HJCdg2uPy6DJU1dALUhjbjhs1MfLKDrkD 3NAg879tKUJh949h21umkwiaRQhwZftz1BE: -0.05000000 Waves 2019.09.04 11:26 [661005] smart account 3NAg879tKUJh949h21umkwiaRQhwZftz1BE > SELF 0.00000000 Waves
{ "type": 13, "id": "AFvGKuoWjA1HJCdg2uPy6DJU1dALUhjbjhs1MfLKDrkD", "fee": 5000000, "feeAssetId": null, "timestamp": 1567585585083, "version": 1, "sender": "3NAg879tKUJh949h21umkwiaRQhwZftz1BE", "senderPublicKey": "BqY2jhkQCcbidtQdQZu6f9RV3AkFAS8VPToHxwYu1KdJ", "proofs": [ "47vm1qDTCVKGakgu6dNKeUQs57mPd1azszV1iH5HKnjLJ5Qt5Pm2rqhXmG3vSRKreuHG88v5tQTBmqSpPAtQHeDL" ], "script": "base64:AAIDAAAAAAAAAAAAAAARAAAAAAN3dnMAAAAAAAX14QAAAAAAFmRlc2NyaXB0aW9uVXBkYXRlUHJpY2UJAABoAAAAAgAAAAAAAAAAAQUAAAADd3ZzAAAAAA9saW5rVXBkYXRlUHJpY2UJAABoAAAAAgAAAAAAAAAAAQUAAAADd3ZzAAAAABF0aWNrZXJVcGRhdGVQcmljZQkAAGgAAAACAAAAAAAAAAACBQAAAAN3dnMAAAAAD3RpY2tlck1pbkxlbmd0aAAAAAAAAAAAAQAAAAAPdGlja2VyTWF4TGVuZ3RoAAAAAAAAAAAGAAAAABR0aWNrZXJBbGxvd2VkTGV0dGVycwIAAAAaQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVoAAAAAHHRpY2tlckNhdGFsb2d1ZU9yYWNsZUFkZHJlc3MJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQIAAAAjM014SHhXNVZXcTRLcldjYmhGZnhLcmFmWG00bUw2clpIZmoAAAAAGHRva2VuUmF0aW5nT3JhY2xlQWRkcmVzcwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZ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XltZW50AAAABmFtb3VudAUAAAAPbGlua1VwZGF0ZVByaWNlAwkAAAAAAAACBQAAAA1jYWxsZXJBZGRyZXNzBQAAABFhc3NldElzc3VlckFkcmVzcwkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAANaXNzdWVyTGlua0tleQUAAAAEbGluawUAAAADbmlsCQAAAgAAAAECAAAAMGVycm9yIzYuIE9ubHkgYXNzZXQgaXNzdWVyIGNhbiB1cGRhdGUgYXNzZXQgbGluawkAAAIAAAABAgAAADxlcnJvciM3LiBJbnN1ZmZpY2llbnQgcGF5bWVudCBmb3IgYXNzZXQgbGluayB1cGRhdGUgc2VydmljZS4JAAACAAAAAQIAAAAuZXJyb3IjMS4gVGhlIHNlcnZpY2UgY2FuIG9ubHkgYmUgcGFpZCBpbiB3YXZlcwAAAABJqXV4", "chainId": 84, "height": 661005, "spentComplexity": 0 } View: original | compacted Prev: Ef9JmDLAzcP1P8TfkmSayKu6iYbb4uofS6Xj9BipsdBN Next: 76gfZMPzFjQFJbtoWMDQSFWvCK9JNCFwtFLwvABUBj6v Diff:
Old | New | Differences | |
---|---|---|---|
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let wvs = 100000000 | |
5 | - | ||
6 | - | let tickerAllowedLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
7 | - | ||
8 | - | let tickerExample = "BTC" | |
9 | - | ||
10 | - | let tickerMinLength = 1 | |
11 | - | ||
12 | - | let tickerMaxLength = 6 | |
13 | 5 | ||
14 | 6 | let descriptionUpdatePrice = (1 * wvs) | |
15 | 7 | ||
16 | 8 | let linkUpdatePrice = (1 * wvs) | |
17 | 9 | ||
18 | 10 | let tickerUpdatePrice = (2 * wvs) | |
11 | + | ||
12 | + | let tickerMinLength = 1 | |
13 | + | ||
14 | + | let tickerMaxLength = 6 | |
15 | + | ||
16 | + | let tickerAllowedLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
19 | 17 | ||
20 | 18 | let tickerCatalogueOracleAddress = addressFromStringValue("3MxHxW5VWq4KrWcbhFfxKrafXm4mL6rZHfj") | |
21 | 19 | ||
37 | 35 | case _ => | |
38 | 36 | throw() | |
39 | 37 | } | |
40 | - | ||
41 | - | ||
42 | - | func assetIdFromString (assetId) = if (if ((assetId == "WAVES")) | |
43 | - | then true | |
44 | - | else (assetId == "")) | |
45 | - | then unit | |
46 | - | else fromBase58String(assetId) | |
47 | 38 | ||
48 | 39 | ||
49 | 40 | func isValidTicker (ticker) = { | |
138 | 129 | else false | |
139 | 130 | ||
140 | 131 | ||
141 | - | func getAssetIssuerFromAssetId (assetId) = match assetInfo(fromBase58String(assetId)) { | |
142 | - | case a: Asset => | |
143 | - | a | |
144 | - | case _ => | |
145 | - | unit | |
146 | - | } | |
132 | + | func getAssetIssuerAddressFromAssetId (assetId) = toString(valueOrErrorMessage(assetInfo(fromBase58String(assetId)), "error#6. there is no asset with such id").issuer) | |
147 | 133 | ||
148 | 134 | ||
149 | 135 | @Callable(i) | |
152 | 138 | let callerAddress = toBase58String(i.caller.bytes) | |
153 | 139 | let issuerTickerKey = ((("issuerTicker_" + "<") + assetId) + ">") | |
154 | 140 | let tickerFromOracle = getString(tickerCatalogueOracleAddress, ticker) | |
155 | - | let assetIssuerAdress = | |
141 | + | let assetIssuerAdress = getAssetIssuerAddressFromAssetId(assetId) | |
156 | 142 | if (!(isDefined(payment.assetId))) | |
157 | 143 | then if ((payment.amount >= tickerUpdatePrice)) | |
158 | 144 | then if ((callerAddress == assetIssuerAdress)) | |
175 | 161 | let payment = extract(i.payment) | |
176 | 162 | let callerAddress = toBase58String(i.caller.bytes) | |
177 | 163 | let issuerDescriptionKey = ((("issuerDescription_" + "<") + assetId) + ">") | |
178 | - | let assetIssuerAdress = | |
164 | + | let assetIssuerAdress = getAssetIssuerAddressFromAssetId(assetId) | |
179 | 165 | if (!(isDefined(payment.assetId))) | |
180 | 166 | then if ((payment.amount >= descriptionUpdatePrice)) | |
181 | 167 | then if ((callerAddress == assetIssuerAdress)) | |
192 | 178 | let payment = extract(i.payment) | |
193 | 179 | let callerAddress = toBase58String(i.caller.bytes) | |
194 | 180 | let issuerLinkKey = ((("issuerLink_" + "<") + assetId) + ">") | |
195 | - | let assetIssuerAdress = | |
181 | + | let assetIssuerAdress = getAssetIssuerAddressFromAssetId(assetId) | |
196 | 182 | if (!(isDefined(payment.assetId))) | |
197 | 183 | then if ((payment.amount >= linkUpdatePrice)) | |
198 | 184 | then if ((callerAddress == assetIssuerAdress)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let wvs = 100000000 | |
5 | - | ||
6 | - | let tickerAllowedLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
7 | - | ||
8 | - | let tickerExample = "BTC" | |
9 | - | ||
10 | - | let tickerMinLength = 1 | |
11 | - | ||
12 | - | let tickerMaxLength = 6 | |
13 | 5 | ||
14 | 6 | let descriptionUpdatePrice = (1 * wvs) | |
15 | 7 | ||
16 | 8 | let linkUpdatePrice = (1 * wvs) | |
17 | 9 | ||
18 | 10 | let tickerUpdatePrice = (2 * wvs) | |
11 | + | ||
12 | + | let tickerMinLength = 1 | |
13 | + | ||
14 | + | let tickerMaxLength = 6 | |
15 | + | ||
16 | + | let tickerAllowedLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
19 | 17 | ||
20 | 18 | let tickerCatalogueOracleAddress = addressFromStringValue("3MxHxW5VWq4KrWcbhFfxKrafXm4mL6rZHfj") | |
21 | 19 | ||
22 | 20 | let tokenRatingOracleAddress = addressFromStringValue("3NADqHoLMbMTfXdP2TeBBSx5mQXePVj3KZm") | |
23 | 21 | ||
24 | 22 | func getIntegerFromAccount (accountAddress,key) = match getInteger(accountAddress, key) { | |
25 | 23 | case i: Int => | |
26 | 24 | i | |
27 | 25 | case _ => | |
28 | 26 | 0 | |
29 | 27 | } | |
30 | 28 | ||
31 | 29 | ||
32 | 30 | func isSubstrExist (str,substr) = match indexOf(str, substr) { | |
33 | 31 | case index: Int => | |
34 | 32 | true | |
35 | 33 | case index: Unit => | |
36 | 34 | false | |
37 | 35 | case _ => | |
38 | 36 | throw() | |
39 | 37 | } | |
40 | - | ||
41 | - | ||
42 | - | func assetIdFromString (assetId) = if (if ((assetId == "WAVES")) | |
43 | - | then true | |
44 | - | else (assetId == "")) | |
45 | - | then unit | |
46 | - | else fromBase58String(assetId) | |
47 | 38 | ||
48 | 39 | ||
49 | 40 | func isValidTicker (ticker) = { | |
50 | 41 | let tickerLetters = split(ticker, "") | |
51 | 42 | let tickerLength = size(tickerLetters) | |
52 | 43 | let isLetter1Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[0]) | |
53 | 44 | let isLetter2Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[1]) | |
54 | 45 | let isLetter3Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[2]) | |
55 | 46 | let isLetter4Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[3]) | |
56 | 47 | let isLetter5Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[4]) | |
57 | 48 | let isLetter6Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[5]) | |
58 | 49 | if ((ticker != "")) | |
59 | 50 | then if (if ((tickerLength >= tickerMinLength)) | |
60 | 51 | then (tickerMaxLength >= tickerLength) | |
61 | 52 | else false) | |
62 | 53 | then if ((1 == tickerLength)) | |
63 | 54 | then isLetter1Valid | |
64 | 55 | else if ((2 == tickerLength)) | |
65 | 56 | then if (isLetter1Valid) | |
66 | 57 | then isLetter2Valid | |
67 | 58 | else false | |
68 | 59 | else if ((3 == tickerLength)) | |
69 | 60 | then if (if (isLetter1Valid) | |
70 | 61 | then isLetter2Valid | |
71 | 62 | else false) | |
72 | 63 | then isLetter3Valid | |
73 | 64 | else false | |
74 | 65 | else if ((4 == tickerLength)) | |
75 | 66 | then if (if (if (isLetter1Valid) | |
76 | 67 | then isLetter2Valid | |
77 | 68 | else false) | |
78 | 69 | then isLetter3Valid | |
79 | 70 | else false) | |
80 | 71 | then isLetter4Valid | |
81 | 72 | else false | |
82 | 73 | else if ((5 == tickerLength)) | |
83 | 74 | then if (if (if (if (isLetter1Valid) | |
84 | 75 | then isLetter2Valid | |
85 | 76 | else false) | |
86 | 77 | then isLetter3Valid | |
87 | 78 | else false) | |
88 | 79 | then isLetter4Valid | |
89 | 80 | else false) | |
90 | 81 | then isLetter5Valid | |
91 | 82 | else false | |
92 | 83 | else if ((6 == tickerLength)) | |
93 | 84 | then if (if (if (if (if (isLetter1Valid) | |
94 | 85 | then isLetter2Valid | |
95 | 86 | else false) | |
96 | 87 | then isLetter3Valid | |
97 | 88 | else false) | |
98 | 89 | then isLetter4Valid | |
99 | 90 | else false) | |
100 | 91 | then isLetter5Valid | |
101 | 92 | else false) | |
102 | 93 | then isLetter6Valid | |
103 | 94 | else false | |
104 | 95 | else false | |
105 | 96 | else false | |
106 | 97 | else false | |
107 | 98 | } | |
108 | 99 | ||
109 | 100 | ||
110 | 101 | func isAssetUpdateAllowedByRating (assetId) = { | |
111 | 102 | let assetRatingKey = (("assetRating_" + assetId) + "_1") | |
112 | 103 | let assetRatingValue = getIntegerFromAccount(tokenRatingOracleAddress, assetRatingKey) | |
113 | 104 | let assetRatingTreshold = getIntegerFromAccount(tokenRatingOracleAddress, "tickerRating_1") | |
114 | 105 | (assetRatingValue >= assetRatingTreshold) | |
115 | 106 | } | |
116 | 107 | ||
117 | 108 | ||
118 | 109 | func isAssetUpdateAllowedByWeight (assetId) = { | |
119 | 110 | let assetWeightKey = "assetWeight" | |
120 | 111 | let assetWeightValue = getIntegerFromAccount(tokenRatingOracleAddress, assetWeightKey) | |
121 | 112 | let assetWeightTreshold = getIntegerFromAccount(tokenRatingOracleAddress, "tickerWeight") | |
122 | 113 | (assetWeightValue >= assetWeightTreshold) | |
123 | 114 | } | |
124 | 115 | ||
125 | 116 | ||
126 | 117 | func isAssetUpdateAllowedByVotes (assetId) = { | |
127 | 118 | let assetVotesKey = "assetVotes" | |
128 | 119 | let assetVotesValue = getIntegerFromAccount(tokenRatingOracleAddress, assetVotesKey) | |
129 | 120 | let assetVotesTreshold = getIntegerFromAccount(tokenRatingOracleAddress, "tickerVotes") | |
130 | 121 | (assetVotesValue >= assetVotesTreshold) | |
131 | 122 | } | |
132 | 123 | ||
133 | 124 | ||
134 | 125 | func isUpdateAllowedByRating (assetId) = if (if (isAssetUpdateAllowedByRating(assetId)) | |
135 | 126 | then isAssetUpdateAllowedByWeight(assetId) | |
136 | 127 | else false) | |
137 | 128 | then isAssetUpdateAllowedByVotes(assetId) | |
138 | 129 | else false | |
139 | 130 | ||
140 | 131 | ||
141 | - | func getAssetIssuerFromAssetId (assetId) = match assetInfo(fromBase58String(assetId)) { | |
142 | - | case a: Asset => | |
143 | - | a | |
144 | - | case _ => | |
145 | - | unit | |
146 | - | } | |
132 | + | func getAssetIssuerAddressFromAssetId (assetId) = toString(valueOrErrorMessage(assetInfo(fromBase58String(assetId)), "error#6. there is no asset with such id").issuer) | |
147 | 133 | ||
148 | 134 | ||
149 | 135 | @Callable(i) | |
150 | 136 | func updateTicker (assetId,ticker) = { | |
151 | 137 | let payment = extract(i.payment) | |
152 | 138 | let callerAddress = toBase58String(i.caller.bytes) | |
153 | 139 | let issuerTickerKey = ((("issuerTicker_" + "<") + assetId) + ">") | |
154 | 140 | let tickerFromOracle = getString(tickerCatalogueOracleAddress, ticker) | |
155 | - | let assetIssuerAdress = | |
141 | + | let assetIssuerAdress = getAssetIssuerAddressFromAssetId(assetId) | |
156 | 142 | if (!(isDefined(payment.assetId))) | |
157 | 143 | then if ((payment.amount >= tickerUpdatePrice)) | |
158 | 144 | then if ((callerAddress == assetIssuerAdress)) | |
159 | 145 | then if (isUpdateAllowedByRating(assetId)) | |
160 | 146 | then if ((tickerFromOracle == unit)) | |
161 | 147 | then if (isValidTicker(ticker)) | |
162 | 148 | then WriteSet([DataEntry(issuerTickerKey, ticker)]) | |
163 | 149 | else throw("error#5. Ticker should consist of 1-6 capital Latin characters.") | |
164 | 150 | else throw("error#4. Asset with such ticker is already exist") | |
165 | 151 | else throw("error#3. Too little rating") | |
166 | 152 | else throw("error#2. Only asset issuer can update asset ticker") | |
167 | 153 | else throw("error#2. Insufficient payment for asset ticker update service.") | |
168 | 154 | else throw("error#1. The service can only be paid in waves") | |
169 | 155 | } | |
170 | 156 | ||
171 | 157 | ||
172 | 158 | ||
173 | 159 | @Callable(i) | |
174 | 160 | func updateDescription (assetId,description) = { | |
175 | 161 | let payment = extract(i.payment) | |
176 | 162 | let callerAddress = toBase58String(i.caller.bytes) | |
177 | 163 | let issuerDescriptionKey = ((("issuerDescription_" + "<") + assetId) + ">") | |
178 | - | let assetIssuerAdress = | |
164 | + | let assetIssuerAdress = getAssetIssuerAddressFromAssetId(assetId) | |
179 | 165 | if (!(isDefined(payment.assetId))) | |
180 | 166 | then if ((payment.amount >= descriptionUpdatePrice)) | |
181 | 167 | then if ((callerAddress == assetIssuerAdress)) | |
182 | 168 | then WriteSet([DataEntry(issuerDescriptionKey, description)]) | |
183 | 169 | else throw("error#6. Only asset issuer can update asset description") | |
184 | 170 | else throw("error#7. Insufficient payment for asset description update service.") | |
185 | 171 | else throw("error#1. The service can only be paid in waves") | |
186 | 172 | } | |
187 | 173 | ||
188 | 174 | ||
189 | 175 | ||
190 | 176 | @Callable(i) | |
191 | 177 | func updateLink (assetId,link) = { | |
192 | 178 | let payment = extract(i.payment) | |
193 | 179 | let callerAddress = toBase58String(i.caller.bytes) | |
194 | 180 | let issuerLinkKey = ((("issuerLink_" + "<") + assetId) + ">") | |
195 | - | let assetIssuerAdress = | |
181 | + | let assetIssuerAdress = getAssetIssuerAddressFromAssetId(assetId) | |
196 | 182 | if (!(isDefined(payment.assetId))) | |
197 | 183 | then if ((payment.amount >= linkUpdatePrice)) | |
198 | 184 | then if ((callerAddress == assetIssuerAdress)) | |
199 | 185 | then WriteSet([DataEntry(issuerLinkKey, link)]) | |
200 | 186 | else throw("error#6. Only asset issuer can update asset link") | |
201 | 187 | else throw("error#7. Insufficient payment for asset link update service.") | |
202 | 188 | else throw("error#1. The service can only be paid in waves") | |
203 | 189 | } | |
204 | 190 | ||
205 | 191 |
github/deemru/w8io/169f3d6 75.22 ms ◑