tx · BYtDoefGebw2rDcRFkGaQUeKGDJvtKuy3x6DLUHGeqvm 3Ms15jMahygot2dU4d9vZK2yQ4kJ3j37zxR: -0.01000000 Waves 2020.01.21 15:35 [864023] smart account 3Ms15jMahygot2dU4d9vZK2yQ4kJ3j37zxR > SELF 0.00000000 Waves
{ "type": 13, "id": "BYtDoefGebw2rDcRFkGaQUeKGDJvtKuy3x6DLUHGeqvm", "fee": 1000000, "feeAssetId": null, "timestamp": 1579610145941, "version": 1, "sender": "3Ms15jMahygot2dU4d9vZK2yQ4kJ3j37zxR", "senderPublicKey": "BijNtTVLH52twEssRLfGWAMvM8ZSxkZ7sFewe227z2Ci", "proofs": [ "3or1N17toWv9kfbgHuLE7BmEsw24wj7e4EnAbvKEyA7ojRNcqSR9WzNwRBzQTGL95sr1ity4gCy5agTvrfpCJgX2" ], "script": "base64:AAIDAAAAAAAAAAQIARIAAAAAMAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAEAAAAOZ2V0U3RyaW5nQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAAAQAAAAxnZXRCb29sQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBsAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAB0Jvb2xlYW4EAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEHAQAAABhnZXROdW1iZXJCeUFkZHJlc3NBbmRLZXkAAAACAAAAB2FkZHJlc3MAAAADa2V5BAAAAAckbWF0Y2gw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EFAAAAE3ByaWNlUHJvdmlkaW5nQ291bnQCAAAAASkDAwkAAGcAAAACBQAAAAhuZXdQcmljZQkAAGQAAAACBQAAAAVwcmljZQkAAGkAAAACCQAAaAAAAAIFAAAABXByaWNlBQAAABJwZXJjZW50UHJpY2VPZmZzZXQAAAAAAAAAAGQGCQAAZwAAAAIJAABlAAAAAgUAAAAFcHJpY2UJAABpAAAAAgkAAGgAAAACBQAAAAVwcmljZQUAAAAScGVyY2VudFByaWNlT2Zmc2V0AAAAAAAAAABkBQAAAAhuZXdQcmljZQkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAMSXNCbG9ja2VkS2V5BgkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAFWdldEJsYWNrU3dhcm1QcmljZUtleQAAAAEFAAAABmhlaWdodAUAAAAIbmV3UHJpY2UFAAAAA25pbAQAAAANbmV3UHJpY2VJbmRleAkAAGQAAAACBQAAAApwcmljZUluZGV4AAAAAAAAAAABCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAhQcmljZUtleQUAAAAIbmV3UHJpY2UJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABJnZXRQcmljZUhpc3RvcnlLZXkAAAABBQAAAAZoZWlnaHQFAAAACG5ld1ByaWNlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAA1QcmljZUluZGV4S2V5BQAAAA1uZXdQcmljZUluZGV4CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAYZ2V0SGVpZ2h0UHJpY2VCeUluZGV4S2V5AAAAAQUAAAANbmV3UHJpY2VJbmRleAUAAAAGaGVpZ2h0BQAAAANuaWwAAAAAIV5hQw==", "chainId": 84, "height": 864023, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func getNumberByKey (key) = match getInteger(this, key) { | |
5 | + | case a: Int => | |
6 | + | a | |
7 | + | case _ => | |
8 | + | 0 | |
9 | + | } | |
10 | + | ||
11 | + | ||
12 | + | func getStringByKey (key) = match getString(this, key) { | |
13 | + | case a: String => | |
14 | + | a | |
15 | + | case _ => | |
16 | + | "" | |
17 | + | } | |
18 | + | ||
19 | + | ||
20 | + | func getBoolByKey (key) = match getBoolean(this, key) { | |
21 | + | case a: Boolean => | |
22 | + | a | |
23 | + | case _ => | |
24 | + | false | |
25 | + | } | |
26 | + | ||
27 | + | ||
28 | + | func getNumberByAddressAndKey (address,key) = match getInteger(address, key) { | |
29 | + | case a: Int => | |
30 | + | a | |
31 | + | case _ => | |
32 | + | 0 | |
33 | + | } | |
34 | + | ||
35 | + | ||
36 | + | func getStringByAddressAndKey (address,key) = match getString(address, key) { | |
37 | + | case a: String => | |
38 | + | a | |
39 | + | case _ => | |
40 | + | "" | |
41 | + | } | |
42 | + | ||
43 | + | ||
44 | + | func dropElementInJsonArray (array,element) = { | |
45 | + | let splitedArray = split(array, element) | |
46 | + | if ((take(splitedArray[1], 1) == ",")) | |
47 | + | then (splitedArray[0] + drop(splitedArray[1], 1)) | |
48 | + | else (dropRight(splitedArray[0], 1) + splitedArray[1]) | |
49 | + | } | |
50 | + | ||
51 | + | ||
52 | + | func convertJsonArrayToList (jsonArray) = split(jsonArray, ",") | |
53 | + | ||
54 | + | ||
55 | + | let BLOCK = "block" | |
56 | + | ||
57 | + | let UNBLOCK = "unblock" | |
58 | + | ||
59 | + | let UPDATE = "update" | |
60 | + | ||
61 | + | let OraclesKey = "oracles" | |
62 | + | ||
63 | + | let AdminsKey = "admins" | |
64 | + | ||
65 | + | let VoteIntervalKey = "vote_interval" | |
66 | + | ||
67 | + | let CoefficientOracleKey = "coefficient_oracle" | |
68 | + | ||
69 | + | let CoefficientAdminKey = "coefficient_admin" | |
70 | + | ||
71 | + | let ScriptUpdateIntervalKey = "script_update_interval" | |
72 | + | ||
73 | + | let PriceOffsetKey = "price_offset" | |
74 | + | ||
75 | + | let PriceKey = "price" | |
76 | + | ||
77 | + | let IsBlockedKey = "is_blocked" | |
78 | + | ||
79 | + | let BlockExpireVoteKey = "vote_expire_block" | |
80 | + | ||
81 | + | let ScriptUpdateBlockKey = "script_update_block" | |
82 | + | ||
83 | + | let PriceIndexKey = "price_index" | |
84 | + | ||
85 | + | func getAdminVoteKey (owner) = ("admin_vote_" + owner) | |
86 | + | ||
87 | + | ||
88 | + | func getAdminVoteActionKey (owner) = ((getAdminVoteKey(owner) + "_") + "action") | |
89 | + | ||
90 | + | ||
91 | + | func getBlackSwarmPriceKey (block) = (("black_swarm_price" + "_") + toString(block)) | |
92 | + | ||
93 | + | ||
94 | + | func getPriceHistoryKey (block) = ((PriceKey + "_") + toString(block)) | |
95 | + | ||
96 | + | ||
97 | + | func getHeightPriceByIndexKey (index) = ((PriceIndexKey + "_") + toString(index)) | |
98 | + | ||
99 | + | ||
100 | + | func getOracleProvidePriceKey (height) = ("price_" + toString(height)) | |
101 | + | ||
102 | + | ||
103 | + | let price = getNumberByKey(PriceKey) | |
104 | + | ||
105 | + | let priceIndex = getNumberByKey(PriceIndexKey) | |
106 | + | ||
107 | + | let blockExpireVote = getNumberByKey(BlockExpireVoteKey) | |
108 | + | ||
109 | + | let scriptUpdateBlock = getNumberByKey(ScriptUpdateBlockKey) | |
110 | + | ||
111 | + | let scriptUpdateInterval = getNumberByKey(ScriptUpdateIntervalKey) | |
112 | + | ||
113 | + | let isBlocked = getBoolByKey(IsBlockedKey) | |
114 | + | ||
115 | + | let bftCoefficientOracle = getNumberByKey(CoefficientOracleKey) | |
116 | + | ||
117 | + | let bftCoefficientAdmin = getNumberByKey(CoefficientAdminKey) | |
118 | + | ||
119 | + | let percentPriceOffset = getNumberByKey(PriceOffsetKey) | |
120 | + | ||
121 | + | let voteInterval = getNumberByKey(VoteIntervalKey) | |
122 | + | ||
123 | + | let oracles = getStringByKey(OraclesKey) | |
124 | + | ||
125 | + | let oraclesList = convertJsonArrayToList(oracles) | |
126 | + | ||
127 | + | func getAdminVoteAction (owner) = getStringByKey(getAdminVoteActionKey(owner)) | |
128 | + | ||
129 | + | ||
130 | + | func getOracleProvideHeight (owner,height) = getNumberByAddressAndKey(addressFromStringValue(owner), getOracleProvidePriceKey(height)) | |
131 | + | ||
132 | + | ||
133 | + | func getPriceHistory (height) = getNumberByKey(getPriceHistoryKey(height)) | |
134 | + | ||
135 | + | ||
136 | + | func isOracle (address) = isDefined(indexOf(oracles, address)) | |
137 | + | ||
138 | + | ||
139 | + | func filterAdminsVoteByAction (result,address,action) = address :: result | |
140 | + | ||
141 | + | ||
142 | + | func filterAdminsVoteByBlockAction (result,address) = filterAdminsVoteByAction(result, address, BLOCK) | |
143 | + | ||
144 | + | ||
145 | + | func filterAdminsVoteByUnblockAction (result,address) = filterAdminsVoteByAction(result, address, UNBLOCK) | |
146 | + | ||
147 | + | ||
148 | + | func filterAdminsVoteByUpdateAction (result,address) = filterAdminsVoteByAction(result, address, UPDATE) | |
149 | + | ||
150 | + | ||
151 | + | @Callable(i) | |
152 | + | func finalizeCurrentPrice () = { | |
153 | + | let prices = [getOracleProvideHeight(oraclesList[0], height), getOracleProvideHeight(oraclesList[1], height), getOracleProvideHeight(oraclesList[2], height), getOracleProvideHeight(oraclesList[3], height), getOracleProvideHeight(oraclesList[4], height)] | |
154 | + | let priceProvidingCount = (((((if ((prices[0] != 0)) | |
155 | + | then 1 | |
156 | + | else 0) + (if ((prices[1] != 0)) | |
157 | + | then 1 | |
158 | + | else 0)) + (if ((prices[2] != 0)) | |
159 | + | then 1 | |
160 | + | else 0)) + (if ((prices[3] != 0)) | |
161 | + | then 1 | |
162 | + | else 0)) + (if ((prices[4] != 0)) | |
163 | + | then 1 | |
164 | + | else 0)) | |
165 | + | let priceSum = ((((prices[0] + prices[1]) + prices[2]) + prices[3]) + prices[4]) | |
166 | + | let newPrice = (priceSum / priceProvidingCount) | |
167 | + | if (isBlocked) | |
168 | + | then throw("contract is blocked") | |
169 | + | else if ((getPriceHistory(height) != 0)) | |
170 | + | then throw("wait next block") | |
171 | + | else if ((bftCoefficientOracle > priceProvidingCount)) | |
172 | + | then throw((((toString(bftCoefficientOracle) + "/5 oracles need to set a price (") + toString(priceProvidingCount)) + ")")) | |
173 | + | else if (if ((newPrice >= (price + ((price * percentPriceOffset) / 100)))) | |
174 | + | then true | |
175 | + | else ((price - ((price * percentPriceOffset) / 100)) >= newPrice)) | |
176 | + | then WriteSet([DataEntry(IsBlockedKey, true), DataEntry(getBlackSwarmPriceKey(height), newPrice)]) | |
177 | + | else { | |
178 | + | let newPriceIndex = (priceIndex + 1) | |
179 | + | WriteSet([DataEntry(PriceKey, newPrice), DataEntry(getPriceHistoryKey(height), newPrice), DataEntry(PriceIndexKey, newPriceIndex), DataEntry(getHeightPriceByIndexKey(newPriceIndex), height)]) | |
180 | + | } | |
181 | + | } | |
182 | + | ||
183 | + |
github/deemru/w8io/169f3d6 23.57 ms ◑