tx · 2S2HvreMeWvdiAWVska6q8ECs5FLmXJPx1XVvZmmsR9n 3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9: -0.01400000 Waves 2021.07.14 18:46 [1613493] smart account 3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9 > SELF 0.00000000 Waves
{ "type": 13, "id": "2S2HvreMeWvdiAWVska6q8ECs5FLmXJPx1XVvZmmsR9n", "fee": 1400000, "feeAssetId": null, "timestamp": 1626277537425, "version": 2, "chainId": 84, "sender": "3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9", "senderPublicKey": "D1X9WatF6ARMCmm3jC4Ex5Wd5VQ3LY8i1xbHNqeHqeAa", "proofs": [ "3Rmx9fwwPLVBhiELYLGMMSeqJ9jfMcCA66YQNPGUdEA3YnRFBHiWMZH54Gspu2AySx9fAgqfxqyFs3XLzditdN3s", "4VDNb3T1LWGLqPeejEfu8hSaYqFpXwiNpJ5w9KrkxvFUCKivKZfGSfvJaeQWJXrY7KLQ1PadH75Ejpuy9WfxS8tX" ], "script": "base64:AAIFAAAAAAAAABQIAhIECgIIARIECgIICBIECgIICAAAABYAAAAAEGtleVBvb2xzTGlzdE5hbWUCAAAABXBvb2xzAAAAABFrZXlQcmVmaXhQb29sTmFtZQIAAAAFcG9vbF8AAAAAEmtleVByZWZpeFBvb2xJbmRleAIAAAAGaW5kZXhfAAAAABFrZXlJbml0UG9vbEhlaWdodAIAAAAQaW5pdF9wb29sX2hpZ2h0XwAAAAASa2V5Q29uZmlybWVkQXNzZXRzAgAAABBjb25maXJtZWRfYXNzZXRzAAAAABBrZXlBc3NldFByaW9yaXR5AgAAAA9hc3NldF9wcmlvcml0eV8AAAAAB2tleVBhaXICAAAABXBhaXJfAAAAAAtrZXlBc3NldElkQQIAAAAKQV9hc3NldF9pZAAAAAALa2V5QXNzZXRJZEICAAAACkJfYXNzZXRfaWQAAAAAD2tleUFkbWluUHViS2V5MQIAAAALYWRtaW5fcHViXzEAAAAAD2tleUFk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AAAQAAAAIFAAAAByRtYXRjaDACAAAAF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAZU2V0QXNzZXRTY3JpcHRUcmFuc2FjdGlvbgYDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAE1RyYW5zZmVyVHJhbnNhY3Rpb24GAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNFeGNoYW5nZVRyYW5zYWN0aW9uBgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAXTWFzc1RyYW5zZmVyVHJhbnNhY3Rpb24GAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9CdXJuVHJhbnNhY3Rpb24GCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAElJlaXNzdWVUcmFuc2FjdGlvbgUAAAANc2lnbmVkQnlBZG1pbgkAAAIAAAABAgAAAAtNYXRjaCBlcnJvcvAWFwc=", "height": 1613493, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 67Mtps1YjhhcDCD3CexZ6oKXa7dinBagYY2RF6sGrcnZ Next: 7b1kQaG9ih4onF1uWtrjViPHjN5YpzGc3UWqHnq8aykj Diff:
Old | New | Differences | |
---|---|---|---|
120 | 120 | let adminInvokeSigned = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminInvoke)) | |
121 | 121 | then 1 | |
122 | 122 | else 0 | |
123 | - | let | |
123 | + | let signedByAdminToCallAddPoolOrSetPriority = ((((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) + adminInvokeSigned) >= 1) | |
124 | 124 | match tx { | |
125 | 125 | case inv: InvokeScriptTransaction => | |
126 | 126 | let isSelfInvokeRenamePool = if ((inv.dApp == this)) | |
138 | 138 | then isSelfInvokeRenamePool | |
139 | 139 | else false) | |
140 | 140 | then true | |
141 | - | else if (if ( | |
141 | + | else if (if (signedByAdminToCallAddPoolOrSetPriority) | |
142 | 142 | then (size(inv.payments) == 0) | |
143 | 143 | else false) | |
144 | 144 | then isSelfInvokeAddPool | |
145 | 145 | else false) | |
146 | 146 | then true | |
147 | - | else if (if ( | |
147 | + | else if (if (signedByAdminToCallAddPoolOrSetPriority) | |
148 | 148 | then (size(inv.payments) == 0) | |
149 | 149 | else false) | |
150 | 150 | then isSelfInvokeSetPriority |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let keyPoolsListName = "pools" | |
5 | 5 | ||
6 | 6 | let keyPrefixPoolName = "pool_" | |
7 | 7 | ||
8 | 8 | let keyPrefixPoolIndex = "index_" | |
9 | 9 | ||
10 | 10 | let keyInitPoolHeight = "init_pool_hight_" | |
11 | 11 | ||
12 | 12 | let keyConfirmedAssets = "confirmed_assets" | |
13 | 13 | ||
14 | 14 | let keyAssetPriority = "asset_priority_" | |
15 | 15 | ||
16 | 16 | let keyPair = "pair_" | |
17 | 17 | ||
18 | 18 | let keyAssetIdA = "A_asset_id" | |
19 | 19 | ||
20 | 20 | let keyAssetIdB = "B_asset_id" | |
21 | 21 | ||
22 | 22 | let keyAdminPubKey1 = "admin_pub_1" | |
23 | 23 | ||
24 | 24 | let keyAdminPubKey2 = "admin_pub_2" | |
25 | 25 | ||
26 | 26 | let keyAdminPubKey3 = "admin_pub_3" | |
27 | 27 | ||
28 | 28 | let oracleAdminPool = Address(base58'3N1cPjixuHTujhGvb5HQoFvGt4fkUG8o3KF') | |
29 | 29 | ||
30 | 30 | func getAdminPub (keyAdminPub) = match getString(oracleAdminPool, keyAdminPub) { | |
31 | 31 | case string: String => | |
32 | 32 | fromBase58String(string) | |
33 | 33 | case nothing => | |
34 | 34 | throw("Admin public key is empty") | |
35 | 35 | } | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | let adminPubKey1 = getAdminPub(keyAdminPubKey1) | |
39 | 39 | ||
40 | 40 | let adminPubKey2 = getAdminPub(keyAdminPubKey2) | |
41 | 41 | ||
42 | 42 | let adminPubKey3 = getAdminPub(keyAdminPubKey3) | |
43 | 43 | ||
44 | 44 | let adminInvoke = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
45 | 45 | ||
46 | 46 | let pools = match getString(this, keyPoolsListName) { | |
47 | 47 | case string: String => | |
48 | 48 | split(string, ",") | |
49 | 49 | case nothing => | |
50 | 50 | nil | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | func isSelfCall (i) = if ((i.caller == this)) | |
54 | 54 | then unit | |
55 | 55 | else throw("Only the Oracle itself can invoke this function") | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func getPoolNameIfValid (poolName) = { | |
59 | 59 | let underscoreIndex = valueOrElse(indexOf(poolName, "_"), -1) | |
60 | 60 | let underscoreLastIndex = valueOrElse(lastIndexOf(poolName, "_"), -1) | |
61 | 61 | let hasSingleUnderscore = if (if ((underscoreIndex == underscoreLastIndex)) | |
62 | 62 | then (underscoreIndex > 0) | |
63 | 63 | else false) | |
64 | 64 | then (underscoreIndex != (size(poolName) - 1)) | |
65 | 65 | else false | |
66 | 66 | if (hasSingleUnderscore) | |
67 | 67 | then poolName | |
68 | 68 | else throw("Pool name must consist of two asset names separated by an underscore character") | |
69 | 69 | } | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse \"" + address) + "\" as address"))) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | @Callable(i) | |
76 | 76 | func setPriority (assetId,priority) = valueOrElse(isSelfCall(i), if ((0 > priority)) | |
77 | 77 | then throw("Priority must be positive") | |
78 | 78 | else [IntegerEntry((keyAssetPriority + assetId), priority)]) | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | ||
82 | 82 | @Callable(i) | |
83 | 83 | func addPool (poolAddress,poolName) = valueOrElse(isSelfCall(i), { | |
84 | 84 | let validatedAddress = getAddressIfValid(poolAddress) | |
85 | 85 | let keyName = (keyPrefixPoolName + validatedAddress) | |
86 | 86 | let keyIndex = (keyPrefixPoolIndex + validatedAddress) | |
87 | 87 | let assetIdA = valueOrErrorMessage(getString(value(addressFromString(poolAddress)), keyAssetIdA), "Asset id A is incorrect") | |
88 | 88 | let assetIdB = valueOrErrorMessage(getString(value(addressFromString(poolAddress)), keyAssetIdB), "Asset id B is incorrect") | |
89 | 89 | let possiblyAlreadyAddedPool = getString(this, keyName) | |
90 | 90 | if (isDefined(possiblyAlreadyAddedPool)) | |
91 | 91 | then throw((((("Pool with address \"" + validatedAddress) + "\" is already defined with name \"") + value(possiblyAlreadyAddedPool)) + "\"")) | |
92 | 92 | else [IntegerEntry(keyIndex, size(pools)), IntegerEntry((keyInitPoolHeight + poolAddress), height), StringEntry(keyName, getPoolNameIfValid(poolName)), StringEntry((((keyPair + assetIdA) + "_") + assetIdB), poolAddress), StringEntry(keyPoolsListName, makeString((pools :+ validatedAddress), ","))] | |
93 | 93 | }) | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | ||
97 | 97 | @Callable(i) | |
98 | 98 | func renamePool (poolAddress,newPoolName) = valueOrElse(isSelfCall(i), { | |
99 | 99 | let validatedAddress = getAddressIfValid(poolAddress) | |
100 | 100 | let keyName = (keyPrefixPoolName + validatedAddress) | |
101 | 101 | let possiblyAlreadyAddedPool = getString(this, keyName) | |
102 | 102 | if (isDefined(possiblyAlreadyAddedPool)) | |
103 | 103 | then [StringEntry(keyName, getPoolNameIfValid(newPoolName))] | |
104 | 104 | else throw((("Pool with address \"" + validatedAddress) + "\" has not yet been added")) | |
105 | 105 | }) | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | @Verifier(tx) | |
109 | 109 | func verify () = { | |
110 | 110 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
111 | 111 | then 1 | |
112 | 112 | else 0 | |
113 | 113 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
114 | 114 | then 1 | |
115 | 115 | else 0 | |
116 | 116 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
117 | 117 | then 1 | |
118 | 118 | else 0 | |
119 | 119 | let signedByAdmin = (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
120 | 120 | let adminInvokeSigned = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminInvoke)) | |
121 | 121 | then 1 | |
122 | 122 | else 0 | |
123 | - | let | |
123 | + | let signedByAdminToCallAddPoolOrSetPriority = ((((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) + adminInvokeSigned) >= 1) | |
124 | 124 | match tx { | |
125 | 125 | case inv: InvokeScriptTransaction => | |
126 | 126 | let isSelfInvokeRenamePool = if ((inv.dApp == this)) | |
127 | 127 | then containsElement(["renamePool"], inv.function) | |
128 | 128 | else false | |
129 | 129 | let isSelfInvokeAddPool = if ((inv.dApp == this)) | |
130 | 130 | then containsElement(["addPool"], inv.function) | |
131 | 131 | else false | |
132 | 132 | let isSelfInvokeSetPriority = if ((inv.dApp == this)) | |
133 | 133 | then containsElement(["setPriority"], inv.function) | |
134 | 134 | else false | |
135 | 135 | if (if (if (if (signedByAdmin) | |
136 | 136 | then (size(inv.payments) == 0) | |
137 | 137 | else false) | |
138 | 138 | then isSelfInvokeRenamePool | |
139 | 139 | else false) | |
140 | 140 | then true | |
141 | - | else if (if ( | |
141 | + | else if (if (signedByAdminToCallAddPoolOrSetPriority) | |
142 | 142 | then (size(inv.payments) == 0) | |
143 | 143 | else false) | |
144 | 144 | then isSelfInvokeAddPool | |
145 | 145 | else false) | |
146 | 146 | then true | |
147 | - | else if (if ( | |
147 | + | else if (if (signedByAdminToCallAddPoolOrSetPriority) | |
148 | 148 | then (size(inv.payments) == 0) | |
149 | 149 | else false) | |
150 | 150 | then isSelfInvokeSetPriority | |
151 | 151 | else false | |
152 | 152 | case _: Order|DataTransaction|SponsorFeeTransaction|SetScriptTransaction|CreateAliasTransaction|LeaseCancelTransaction|LeaseTransaction|IssueTransaction|UpdateAssetInfoTransaction|InvokeScriptTransaction|SetAssetScriptTransaction|TransferTransaction|ExchangeTransaction|MassTransferTransaction|BurnTransaction|ReissueTransaction => | |
153 | 153 | signedByAdmin | |
154 | 154 | case _ => | |
155 | 155 | throw("Match error") | |
156 | 156 | } | |
157 | 157 | } | |
158 | 158 |
github/deemru/w8io/169f3d6 93.54 ms ◑