tx · 3UVsrMNfPVpEWMPfpTjD4vUcaeNo5EP1YgCKYSyBzG3Z 3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9: -0.01000000 Waves 2022.09.09 13:07 [2221428] smart account 3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9 > SELF 0.00000000 Waves
{ "type": 13, "id": "3UVsrMNfPVpEWMPfpTjD4vUcaeNo5EP1YgCKYSyBzG3Z", "fee": 1000000, "feeAssetId": null, "timestamp": 1662718034887, "version": 2, "chainId": 84, "sender": "3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9", "senderPublicKey": "D1X9WatF6ARMCmm3jC4Ex5Wd5VQ3LY8i1xbHNqeHqeAa", "proofs": [ "4Z26iCEo6wnDG6LF6iRdXqESTuWBof42fgPGFXCp5eTjpKgzECp9DRhdM8MwpHq3ifKCnRcyK7Vrtw1X5BP3hgd", "FwTCaMc4JxVXKftcXYYcUANswexkeTfR84q4VQA64wSV1TdL15edPtaTjoDRK9mHnKsUiTwbYSv1Rt98ww6vHny" ], "script": "base64:BgIfCAISABIECgIICBIECgIICBIDCgEEEgMKAQgSAwoBCBEAD2tQcmVmaXhQb29sTmFtZQIFcG9vbF8ABWtQYWlyAgVwYWlyXwAJa0Fzc2V0SWRBAgpBX2Fzc2V0X2lkAAlrQXNzZXRJZEICCkJfYXNzZXRfaWQAH2tMYXVuY2hwYWREYXRhVHJhbnNhY3Rpb25TdGF0dXMCIWxhdW5jaHBhZF9kYXRhX3RyYW5zYWN0aW9uX3N0YXR1cwANa0FkbWluUHViS2V5MQILYWRtaW5fcHViXzEADWtBZG1pblB1YktleTICC2FkbWluX3B1Yl8yAA1rQWRtaW5QdWJLZXkzAgthZG1pbl9wdWJfMwASa0FkbWluSW52b2tlUHViS2V5AhBhZG1pbl9pbnZva2VfcHViABRrQWNoaWV2ZW1lbnRzV3JpdGVycwIUYWNoaWV2ZW1lbnRzX3dyaXRlcnMADGFkbWluUHViS2V5MQEg4qeMQDuGzRfmt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Fuc2FjdGlvbgYDCQABAgUHJG1hdGNoMAIZU2V0QXNzZXRTY3JpcHRUcmFuc2FjdGlvbgYDCQABAgUHJG1hdGNoMAITVHJhbnNmZXJUcmFuc2FjdGlvbgYDCQABAgUHJG1hdGNoMAITRXhjaGFuZ2VUcmFuc2FjdGlvbgYDCQABAgUHJG1hdGNoMAIXTWFzc1RyYW5zZmVyVHJhbnNhY3Rpb24GAwkAAQIFByRtYXRjaDACD0J1cm5UcmFuc2FjdGlvbgYJAAECBQckbWF0Y2gwAhJSZWlzc3VlVHJhbnNhY3Rpb24FDXNpZ25lZEJ5QWRtaW4JAAIBAgtNYXRjaCBlcnJvcnHIYdo=", "height": 2221428, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 37TExifogww359RfURTGDrep7n1gNyn53g5hGEQsSndX Next: 2qFuQqzD9B5T9YcgyS87Yz4rdLamFfQSFhNef1pTb2oc Diff:
Old | New | Differences | |
---|---|---|---|
34 | 34 | else throw("Only the Oracle itself can invoke this function") | |
35 | 35 | ||
36 | 36 | ||
37 | - | func getPoolNameIfValid (poolName) = { | |
38 | - | let underscoreIndex = valueOrElse(indexOf(poolName, "_"), -1) | |
39 | - | let underscoreLastIndex = valueOrElse(lastIndexOf(poolName, "_"), -1) | |
40 | - | let hasSingleUnderscore = if (if ((underscoreIndex == underscoreLastIndex)) | |
41 | - | then (underscoreIndex > 0) | |
42 | - | else false) | |
43 | - | then (underscoreIndex != (size(poolName) - 1)) | |
44 | - | else false | |
45 | - | if (hasSingleUnderscore) | |
46 | - | then poolName | |
47 | - | else throw("Pool name must consist of two asset names separated by an underscore character") | |
48 | - | } | |
49 | - | ||
50 | - | ||
51 | 37 | func getPoolType (poolAddress) = { | |
52 | 38 | let version = valueOrErrorMessage(getString(poolAddress, "version"), "Pool is not initialized") | |
53 | 39 | if ((version == "1.0.0")) | |
75 | 61 | let possiblyAlreadyAddedPool = getString(this, keyName) | |
76 | 62 | if (isDefined(possiblyAlreadyAddedPool)) | |
77 | 63 | then throw((((("Pool with address \"" + validatedAddress) + "\" is already defined with name \"") + value(possiblyAlreadyAddedPool)) + "\"")) | |
78 | - | else ([StringEntry(keyName, | |
64 | + | else ([StringEntry(keyName, poolName)] ++ (if ((getPoolType(value(addressFromString(poolAddress))) == "multycurve")) | |
79 | 65 | then nil | |
80 | 66 | else { | |
81 | 67 | let assetIdA = valueOrErrorMessage(getString(value(addressFromString(poolAddress)), kAssetIdA), "Asset id A is incorrect") | |
92 | 78 | let keyName = (kPrefixPoolName + validatedAddress) | |
93 | 79 | let possiblyAlreadyAddedPool = getString(this, keyName) | |
94 | 80 | if (isDefined(possiblyAlreadyAddedPool)) | |
95 | - | then [StringEntry(keyName, | |
81 | + | then [StringEntry(keyName, newPoolName)] | |
96 | 82 | else throw((("Pool with address \"" + validatedAddress) + "\" has not yet been added")) | |
97 | 83 | }) | |
98 | 84 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let kPrefixPoolName = "pool_" | |
5 | 5 | ||
6 | 6 | let kPair = "pair_" | |
7 | 7 | ||
8 | 8 | let kAssetIdA = "A_asset_id" | |
9 | 9 | ||
10 | 10 | let kAssetIdB = "B_asset_id" | |
11 | 11 | ||
12 | 12 | let kLaunchpadDataTransactionStatus = "launchpad_data_transaction_status" | |
13 | 13 | ||
14 | 14 | let kAdminPubKey1 = "admin_pub_1" | |
15 | 15 | ||
16 | 16 | let kAdminPubKey2 = "admin_pub_2" | |
17 | 17 | ||
18 | 18 | let kAdminPubKey3 = "admin_pub_3" | |
19 | 19 | ||
20 | 20 | let kAdminInvokePubKey = "admin_invoke_pub" | |
21 | 21 | ||
22 | 22 | let kAchievementsWriters = "achievements_writers" | |
23 | 23 | ||
24 | 24 | let adminPubKey1 = base58'GFmKZ2naZFRoCvNbwKAQVGmLb1uBeWGDgFabdGBuZiuy' | |
25 | 25 | ||
26 | 26 | let adminPubKey2 = base58'GmJXRyhRA79g8yUGgKBAVdnFfQFDMjQG98b1MmLDh5kk' | |
27 | 27 | ||
28 | 28 | let adminPubKey3 = base58'CFhbV6h41hVjbGHudGtS3fYUv7QAKRxFQzKNtx4B5PqP' | |
29 | 29 | ||
30 | 30 | let adminPubKeyInvoke = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
31 | 31 | ||
32 | 32 | func isSelfCall (i) = if ((i.caller == this)) | |
33 | 33 | then unit | |
34 | 34 | else throw("Only the Oracle itself can invoke this function") | |
35 | 35 | ||
36 | 36 | ||
37 | - | func getPoolNameIfValid (poolName) = { | |
38 | - | let underscoreIndex = valueOrElse(indexOf(poolName, "_"), -1) | |
39 | - | let underscoreLastIndex = valueOrElse(lastIndexOf(poolName, "_"), -1) | |
40 | - | let hasSingleUnderscore = if (if ((underscoreIndex == underscoreLastIndex)) | |
41 | - | then (underscoreIndex > 0) | |
42 | - | else false) | |
43 | - | then (underscoreIndex != (size(poolName) - 1)) | |
44 | - | else false | |
45 | - | if (hasSingleUnderscore) | |
46 | - | then poolName | |
47 | - | else throw("Pool name must consist of two asset names separated by an underscore character") | |
48 | - | } | |
49 | - | ||
50 | - | ||
51 | 37 | func getPoolType (poolAddress) = { | |
52 | 38 | let version = valueOrErrorMessage(getString(poolAddress, "version"), "Pool is not initialized") | |
53 | 39 | if ((version == "1.0.0")) | |
54 | 40 | then "cpmm" | |
55 | 41 | else if ((version == "2.0.0")) | |
56 | 42 | then "flat" | |
57 | 43 | else if ((version == "3.0.0")) | |
58 | 44 | then "multycurve" | |
59 | 45 | else throw("Unknown version of pool") | |
60 | 46 | } | |
61 | 47 | ||
62 | 48 | ||
63 | 49 | func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse \"" + address) + "\" as address"))) | |
64 | 50 | ||
65 | 51 | ||
66 | 52 | @Callable(i) | |
67 | 53 | func setAdmin () = valueOrElse(isSelfCall(i), [StringEntry(kAdminPubKey1, toBase58String(adminPubKey1)), StringEntry(kAdminPubKey2, toBase58String(adminPubKey2)), StringEntry(kAdminPubKey3, toBase58String(adminPubKey3)), StringEntry(kAdminInvokePubKey, toBase58String(adminPubKeyInvoke))]) | |
68 | 54 | ||
69 | 55 | ||
70 | 56 | ||
71 | 57 | @Callable(i) | |
72 | 58 | func addPool (poolAddress,poolName) = valueOrElse(isSelfCall(i), { | |
73 | 59 | let validatedAddress = getAddressIfValid(poolAddress) | |
74 | 60 | let keyName = (kPrefixPoolName + validatedAddress) | |
75 | 61 | let possiblyAlreadyAddedPool = getString(this, keyName) | |
76 | 62 | if (isDefined(possiblyAlreadyAddedPool)) | |
77 | 63 | then throw((((("Pool with address \"" + validatedAddress) + "\" is already defined with name \"") + value(possiblyAlreadyAddedPool)) + "\"")) | |
78 | - | else ([StringEntry(keyName, | |
64 | + | else ([StringEntry(keyName, poolName)] ++ (if ((getPoolType(value(addressFromString(poolAddress))) == "multycurve")) | |
79 | 65 | then nil | |
80 | 66 | else { | |
81 | 67 | let assetIdA = valueOrErrorMessage(getString(value(addressFromString(poolAddress)), kAssetIdA), "Asset id A is incorrect") | |
82 | 68 | let assetIdB = valueOrErrorMessage(getString(value(addressFromString(poolAddress)), kAssetIdB), "Asset id B is incorrect") | |
83 | 69 | [StringEntry((((kPair + assetIdA) + "_") + assetIdB), poolAddress)] | |
84 | 70 | })) | |
85 | 71 | }) | |
86 | 72 | ||
87 | 73 | ||
88 | 74 | ||
89 | 75 | @Callable(i) | |
90 | 76 | func renamePool (poolAddress,newPoolName) = valueOrElse(isSelfCall(i), { | |
91 | 77 | let validatedAddress = getAddressIfValid(poolAddress) | |
92 | 78 | let keyName = (kPrefixPoolName + validatedAddress) | |
93 | 79 | let possiblyAlreadyAddedPool = getString(this, keyName) | |
94 | 80 | if (isDefined(possiblyAlreadyAddedPool)) | |
95 | - | then [StringEntry(keyName, | |
81 | + | then [StringEntry(keyName, newPoolName)] | |
96 | 82 | else throw((("Pool with address \"" + validatedAddress) + "\" has not yet been added")) | |
97 | 83 | }) | |
98 | 84 | ||
99 | 85 | ||
100 | 86 | ||
101 | 87 | @Callable(i) | |
102 | 88 | func launchpadDataTransactionStatus (status) = valueOrElse(isSelfCall(i), [BooleanEntry(kLaunchpadDataTransactionStatus, status)]) | |
103 | 89 | ||
104 | 90 | ||
105 | 91 | ||
106 | 92 | @Callable(i) | |
107 | 93 | func addAchievementsWriter (address) = valueOrElse(isSelfCall(i), { | |
108 | 94 | let writers = valueOrElse(getString(this, kAchievementsWriters), "") | |
109 | 95 | let data = if ((writers == "")) | |
110 | 96 | then nil | |
111 | 97 | else split(writers, ",") | |
112 | 98 | [StringEntry(kAchievementsWriters, makeString((data :+ address), ","))] | |
113 | 99 | }) | |
114 | 100 | ||
115 | 101 | ||
116 | 102 | ||
117 | 103 | @Callable(i) | |
118 | 104 | func removeAchievementsWriter (address) = valueOrElse(isSelfCall(i), { | |
119 | 105 | let writers = split(valueOrElse(getString(this, kAchievementsWriters), ""), ",") | |
120 | 106 | let index = valueOrErrorMessage(indexOf(writers, address), "Can't find address in the list") | |
121 | 107 | [StringEntry(kAchievementsWriters, makeString(removeByIndex(writers, index), ","))] | |
122 | 108 | }) | |
123 | 109 | ||
124 | 110 | ||
125 | 111 | @Verifier(tx) | |
126 | 112 | func verify () = { | |
127 | 113 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
128 | 114 | then 1 | |
129 | 115 | else 0 | |
130 | 116 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
131 | 117 | then 1 | |
132 | 118 | else 0 | |
133 | 119 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
134 | 120 | then 1 | |
135 | 121 | else 0 | |
136 | 122 | let signedByAdmin = (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
137 | 123 | let signedByAdminToCallAddPool = (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 1) | |
138 | 124 | match tx { | |
139 | 125 | case inv: InvokeScriptTransaction => | |
140 | 126 | let isSelfInvokeRenamePool = if ((inv.dApp == this)) | |
141 | 127 | then containsElement(["renamePool"], inv.function) | |
142 | 128 | else false | |
143 | 129 | let isSelfInvokeSetAdmin = if ((inv.dApp == this)) | |
144 | 130 | then containsElement(["setAdmin"], inv.function) | |
145 | 131 | else false | |
146 | 132 | let isSelfInvokeAddPool = if ((inv.dApp == this)) | |
147 | 133 | then containsElement(["addPool"], inv.function) | |
148 | 134 | else false | |
149 | 135 | let isSelfInvokeLaunchpadDataTxStatus = if ((inv.dApp == this)) | |
150 | 136 | then containsElement(["launchpadDataTransactionStatus"], inv.function) | |
151 | 137 | else false | |
152 | 138 | let isSelfInvokeAddAchievementsWriter = if ((inv.dApp == this)) | |
153 | 139 | then containsElement(["addAchievementsWriter"], inv.function) | |
154 | 140 | else false | |
155 | 141 | let isSelfInvokeRemoveAchievementsWriter = if ((inv.dApp == this)) | |
156 | 142 | then containsElement(["removeAchievementsWriter"], inv.function) | |
157 | 143 | else false | |
158 | 144 | if (if (if (if (if (if (if (signedByAdmin) | |
159 | 145 | then (size(inv.payments) == 0) | |
160 | 146 | else false) | |
161 | 147 | then isSelfInvokeRenamePool | |
162 | 148 | else false) | |
163 | 149 | then true | |
164 | 150 | else if (if (signedByAdminToCallAddPool) | |
165 | 151 | then (size(inv.payments) == 0) | |
166 | 152 | else false) | |
167 | 153 | then isSelfInvokeAddPool | |
168 | 154 | else false) | |
169 | 155 | then true | |
170 | 156 | else if (if (signedByAdmin) | |
171 | 157 | then (size(inv.payments) == 0) | |
172 | 158 | else false) | |
173 | 159 | then isSelfInvokeSetAdmin | |
174 | 160 | else false) | |
175 | 161 | then true | |
176 | 162 | else if (if (signedByAdmin) | |
177 | 163 | then (size(inv.payments) == 0) | |
178 | 164 | else false) | |
179 | 165 | then isSelfInvokeLaunchpadDataTxStatus | |
180 | 166 | else false) | |
181 | 167 | then true | |
182 | 168 | else if (if (signedByAdmin) | |
183 | 169 | then (size(inv.payments) == 0) | |
184 | 170 | else false) | |
185 | 171 | then isSelfInvokeAddAchievementsWriter | |
186 | 172 | else false) | |
187 | 173 | then true | |
188 | 174 | else if (if (signedByAdmin) | |
189 | 175 | then (size(inv.payments) == 0) | |
190 | 176 | else false) | |
191 | 177 | then isSelfInvokeRemoveAchievementsWriter | |
192 | 178 | else false | |
193 | 179 | case _: Order|DataTransaction|SponsorFeeTransaction|SetScriptTransaction|CreateAliasTransaction|LeaseCancelTransaction|LeaseTransaction|IssueTransaction|InvokeExpressionTransaction|UpdateAssetInfoTransaction|InvokeScriptTransaction|SetAssetScriptTransaction|TransferTransaction|ExchangeTransaction|MassTransferTransaction|BurnTransaction|ReissueTransaction => | |
194 | 180 | signedByAdmin | |
195 | 181 | case _ => | |
196 | 182 | throw("Match error") | |
197 | 183 | } | |
198 | 184 | } | |
199 | 185 |
github/deemru/w8io/169f3d6 39.47 ms ◑