tx · 6PhuUpNa9j7NF6xGXe35tR3Pxh4ScukzJ6u1Y2rY9Kts 3NAg879tKUJh949h21umkwiaRQhwZftz1BE: -0.05000000 Waves 2019.09.03 16:00 [659835] smart account 3NAg879tKUJh949h21umkwiaRQhwZftz1BE > SELF 0.00000000 Waves
{ "type": 13, "id": "6PhuUpNa9j7NF6xGXe35tR3Pxh4ScukzJ6u1Y2rY9Kts", "fee": 5000000, "feeAssetId": null, "timestamp": 1567515615371, "version": 1, "sender": "3NAg879tKUJh949h21umkwiaRQhwZftz1BE", "senderPublicKey": "BqY2jhkQCcbidtQdQZu6f9RV3AkFAS8VPToHxwYu1KdJ", "proofs": [ "BE3gEB9kipHBZbMrkFvnzHjc1WQj2HMgUnHjqLSLyZ5Agkso3a3dS1ft5fuxDbSBxbdxtkro5Ng7iHgFa2t92t5" ], "script": "base64:AAIDAAAAAAAAAAAAAAASAAAAAAN3dnMAAAAAAAX14QAAAAAAFHRpY2tlckFsbG93ZWRMZXR0ZXJzAgAAABpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWgAAAAANdGlja2VyRXhhbXBsZQIAAAADQlRDAAAAAA90aWNrZXJNaW5MZW5ndGgAAAAAAAAAAAEAAAAAD3RpY2tlck1heExlbmd0aAAAAAAAAAAABgAAAAAWZGVzY3JpcHRpb25VcGRhdGVQcmljZQkAAGgAAAACAAAAAAAAAAABBQAAAAN3dnMAAAAAD2xpbmtVcGRhdGVQcmljZQkAAGgAAAACAAAAAAAAAAABBQAAAAN3dnMAAAAAEXRpY2tlclVwZGF0ZVByaWNlCQAAaAAAAAIAAAAAAAAAAAIFAAAAA3d2cwAAAAAcdGlja2VyQ2F0YWxvZ3VlT3JhY2xlQWRkcmVzcwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABAgAAACMzTXhIeFc1VldxNEtyV2NiaEZmeEtyYWZYbTRtTDZyWkhmagAAAAAYdG9rZW5SYXRpbmdPcmFjbGVBZGRyZXNzCQEAA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VudHJ5AAAAAgUAAAAPaXNzdWVyVGlja2VyS2V5BQAAAAZ0aWNrZXIFAAAAA25pbAkAAAIAAAABAgAAAD9lcnJvciM1LiBUaWNrZXIgc2hvdWxkIGNvbnNpc3Qgb2YgMS02IGNhcGl0YWwgTGF0aW4gY2hhcmFjdGVycy4JAAACAAAAAQIAAAAwZXJyb3IjNC4gQXNzZXQgd2l0aCBzdWNoIHRpY2tlciBpcyBhbHJlYWR5IGV4aXN0CQAAAgAAAAECAAAAGmVycm9yIzMuIFRvbyBsaXR0bGUgcmF0aW5nCQAAAgAAAAECAAAAMmVycm9yIzIuIE9ubHkgYXNzZXQgaXNzdWVyIGNhbiB1cGRhdGUgYXNzZXQgdGlja2VyCQAAAgAAAAECAAAAPmVycm9yIzIuIEluc3VmZmljaWVudCBwYXltZW50IGZvciBhc3NldCB0aWNrZXIgdXBkYXRlIHNlcnZpY2UuCQAAAgAAAAECAAAALmVycm9yIzEuIFRoZSBzZXJ2aWNlIGNhbiBvbmx5IGJlIHBhaWQgaW4gd2F2ZXMAAAAAm9537A==", "chainId": 84, "height": 659835, "spentComplexity": 0 } View: original | compacted Prev: H62QpgvHt1zZWvrDPPhVGRenYP4o4ehkCLZvmTxmkXbd Next: 7Y2YBguTGHyXmEUHTZgbTFtoRukTvNPfUiwjesLCxf2s Diff:
Old | New | Differences | |
---|---|---|---|
145 | 145 | let callerAddress = toBase58String(i.caller.bytes) | |
146 | 146 | let issuerTickerKey = ((("issuerTicker_" + "<") + assetId) + ">") | |
147 | 147 | let tickerFromOracle = getStringFromAccount(tickerCatalogueOracleAddress, ticker) | |
148 | - | if (isDefined(payment.assetId)) | |
149 | - | then throw("error#1. The service can only be paid in waves") | |
150 | - | else if ((payment.amount >= tickerUpdatePrice)) | |
148 | + | if (!(isDefined(payment.assetId))) | |
149 | + | then if ((payment.amount >= tickerUpdatePrice)) | |
151 | 150 | then if ((callerAddress == issuerAddress)) | |
152 | 151 | then if (isUpdateAllowedByRating(assetId)) | |
153 | 152 | then if ((tickerFromOracle == unit)) | |
158 | 157 | else throw("error#3. Too little rating") | |
159 | 158 | else throw("error#2. Only asset issuer can update asset ticker") | |
160 | 159 | else throw("error#2. Insufficient payment for asset ticker update service.") | |
160 | + | else throw("error#1. The service can only be paid in waves") | |
161 | 161 | } | |
162 | 162 | ||
163 | 163 |
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 tickerAllowedLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
7 | 7 | ||
8 | 8 | let tickerExample = "BTC" | |
9 | 9 | ||
10 | 10 | let tickerMinLength = 1 | |
11 | 11 | ||
12 | 12 | let tickerMaxLength = 6 | |
13 | 13 | ||
14 | 14 | let descriptionUpdatePrice = (1 * wvs) | |
15 | 15 | ||
16 | 16 | let linkUpdatePrice = (1 * wvs) | |
17 | 17 | ||
18 | 18 | let tickerUpdatePrice = (2 * wvs) | |
19 | 19 | ||
20 | 20 | let tickerCatalogueOracleAddress = addressFromStringValue("3MxHxW5VWq4KrWcbhFfxKrafXm4mL6rZHfj") | |
21 | 21 | ||
22 | 22 | let tokenRatingOracleAddress = addressFromStringValue("3NADqHoLMbMTfXdP2TeBBSx5mQXePVj3KZm") | |
23 | 23 | ||
24 | 24 | func getStringFromAccount (accountAddress,key) = match getString(accountAddress, key) { | |
25 | 25 | case s: String => | |
26 | 26 | s | |
27 | 27 | case _ => | |
28 | 28 | unit | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func getIntegerFromAccount (accountAddress,key) = match getInteger(accountAddress, key) { | |
33 | 33 | case i: Int => | |
34 | 34 | i | |
35 | 35 | case _ => | |
36 | 36 | 0 | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func isSubstrExist (str,substr) = match indexOf(str, substr) { | |
41 | 41 | case index: Int => | |
42 | 42 | true | |
43 | 43 | case index: Unit => | |
44 | 44 | false | |
45 | 45 | case _ => | |
46 | 46 | throw() | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func isValidTicker (ticker) = { | |
51 | 51 | let tickerLetters = split(ticker, "") | |
52 | 52 | let tickerLength = size(tickerLetters) | |
53 | 53 | let isLetter1Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[0]) | |
54 | 54 | let isLetter2Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[1]) | |
55 | 55 | let isLetter3Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[2]) | |
56 | 56 | let isLetter4Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[3]) | |
57 | 57 | let isLetter5Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[4]) | |
58 | 58 | let isLetter6Valid = isSubstrExist(tickerAllowedLetters, tickerLetters[5]) | |
59 | 59 | if ((ticker != "")) | |
60 | 60 | then if (if ((tickerLength >= tickerMinLength)) | |
61 | 61 | then (tickerMaxLength >= tickerLength) | |
62 | 62 | else false) | |
63 | 63 | then if ((1 == tickerLength)) | |
64 | 64 | then isLetter1Valid | |
65 | 65 | else if ((2 == tickerLength)) | |
66 | 66 | then if (isLetter1Valid) | |
67 | 67 | then isLetter2Valid | |
68 | 68 | else false | |
69 | 69 | else if ((3 == tickerLength)) | |
70 | 70 | then if (if (isLetter1Valid) | |
71 | 71 | then isLetter2Valid | |
72 | 72 | else false) | |
73 | 73 | then isLetter3Valid | |
74 | 74 | else false | |
75 | 75 | else if ((4 == tickerLength)) | |
76 | 76 | then if (if (if (isLetter1Valid) | |
77 | 77 | then isLetter2Valid | |
78 | 78 | else false) | |
79 | 79 | then isLetter3Valid | |
80 | 80 | else false) | |
81 | 81 | then isLetter4Valid | |
82 | 82 | else false | |
83 | 83 | else if ((5 == tickerLength)) | |
84 | 84 | then if (if (if (if (isLetter1Valid) | |
85 | 85 | then isLetter2Valid | |
86 | 86 | else false) | |
87 | 87 | then isLetter3Valid | |
88 | 88 | else false) | |
89 | 89 | then isLetter4Valid | |
90 | 90 | else false) | |
91 | 91 | then isLetter5Valid | |
92 | 92 | else false | |
93 | 93 | else if ((6 == tickerLength)) | |
94 | 94 | then if (if (if (if (if (isLetter1Valid) | |
95 | 95 | then isLetter2Valid | |
96 | 96 | else false) | |
97 | 97 | then isLetter3Valid | |
98 | 98 | else false) | |
99 | 99 | then isLetter4Valid | |
100 | 100 | else false) | |
101 | 101 | then isLetter5Valid | |
102 | 102 | else false) | |
103 | 103 | then isLetter6Valid | |
104 | 104 | else false | |
105 | 105 | else false | |
106 | 106 | else false | |
107 | 107 | else false | |
108 | 108 | } | |
109 | 109 | ||
110 | 110 | ||
111 | 111 | func isAssetUpdateAllowedByRating (assetId) = { | |
112 | 112 | let assetRatingKey = (("assetRating_" + assetId) + "_1") | |
113 | 113 | let assetRatingValue = getIntegerFromAccount(tokenRatingOracleAddress, assetRatingKey) | |
114 | 114 | let assetRatingTreshold = getIntegerFromAccount(tokenRatingOracleAddress, "assetRating_1") | |
115 | 115 | (assetRatingValue >= assetRatingTreshold) | |
116 | 116 | } | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func isAssetUpdateAllowedByWeight (assetId) = { | |
120 | 120 | let assetWeightKey = "assetWeight" | |
121 | 121 | let assetWeightValue = getIntegerFromAccount(tokenRatingOracleAddress, assetWeightKey) | |
122 | 122 | let assetWeightTreshold = getIntegerFromAccount(tokenRatingOracleAddress, "assetWeight") | |
123 | 123 | (assetWeightValue >= assetWeightTreshold) | |
124 | 124 | } | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func isAssetUpdateAllowedByVotes (assetId) = { | |
128 | 128 | let assetVotesKey = "assetVotes" | |
129 | 129 | let assetVotesValue = getIntegerFromAccount(tokenRatingOracleAddress, assetVotesKey) | |
130 | 130 | let assetVotesTreshold = getIntegerFromAccount(tokenRatingOracleAddress, "assetVotes") | |
131 | 131 | (assetVotesValue >= assetVotesTreshold) | |
132 | 132 | } | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | func isUpdateAllowedByRating (assetId) = if (if (isAssetUpdateAllowedByRating(assetId)) | |
136 | 136 | then isAssetUpdateAllowedByWeight(assetId) | |
137 | 137 | else false) | |
138 | 138 | then isAssetUpdateAllowedByVotes(assetId) | |
139 | 139 | else false | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | @Callable(i) | |
143 | 143 | func updateTicker (assetId,issuerAddress,ticker) = { | |
144 | 144 | let payment = extract(i.payment) | |
145 | 145 | let callerAddress = toBase58String(i.caller.bytes) | |
146 | 146 | let issuerTickerKey = ((("issuerTicker_" + "<") + assetId) + ">") | |
147 | 147 | let tickerFromOracle = getStringFromAccount(tickerCatalogueOracleAddress, ticker) | |
148 | - | if (isDefined(payment.assetId)) | |
149 | - | then throw("error#1. The service can only be paid in waves") | |
150 | - | else if ((payment.amount >= tickerUpdatePrice)) | |
148 | + | if (!(isDefined(payment.assetId))) | |
149 | + | then if ((payment.amount >= tickerUpdatePrice)) | |
151 | 150 | then if ((callerAddress == issuerAddress)) | |
152 | 151 | then if (isUpdateAllowedByRating(assetId)) | |
153 | 152 | then if ((tickerFromOracle == unit)) | |
154 | 153 | then if (isValidTicker(ticker)) | |
155 | 154 | then WriteSet([DataEntry(issuerTickerKey, ticker)]) | |
156 | 155 | else throw("error#5. Ticker should consist of 1-6 capital Latin characters.") | |
157 | 156 | else throw("error#4. Asset with such ticker is already exist") | |
158 | 157 | else throw("error#3. Too little rating") | |
159 | 158 | else throw("error#2. Only asset issuer can update asset ticker") | |
160 | 159 | else throw("error#2. Insufficient payment for asset ticker update service.") | |
160 | + | else throw("error#1. The service can only be paid in waves") | |
161 | 161 | } | |
162 | 162 | ||
163 | 163 |
github/deemru/w8io/169f3d6 48.31 ms ◑