tx · 9bgCno2uV9NBNaan1MSRAjVzoY9Yidpe6MKPf2XUEbae 3N8kB3UEjWWvTRBtGpGUErAevaK2q6u2eCM: -0.01000000 Waves 2023.11.02 16:50 [2825796] smart account 3N8kB3UEjWWvTRBtGpGUErAevaK2q6u2eCM > SELF 0.00000000 Waves
{ "type": 13, "id": "9bgCno2uV9NBNaan1MSRAjVzoY9Yidpe6MKPf2XUEbae", "fee": 1000000, "feeAssetId": null, "timestamp": 1698933033111, "version": 2, "chainId": 84, "sender": "3N8kB3UEjWWvTRBtGpGUErAevaK2q6u2eCM", "senderPublicKey": "6ybktvseycJDGHTjJm3tz9iT2SKaTNtLLCZsJZRemtoM", "proofs": [ "32u2NqZNCHUnUFt9VSFYTuqvBuknCoDmiWE2YN7rYeMuChaHkrF5KjkLFfmuXd3uwpWoPhPo49KAYZGbYyWpFdWe" ], "script": "base64:BgITCAISAwoBAhIAEgMKAQESAwoBAg4AB293bmVyUGsBIFjKQnTzuTU7kMfPWIFrhrNM3EW8gc9F3rO/tY+FuNJcAAtkZW5vbWluYXRvcgCAwtcvAAp0cmFuc2ZlclZrAcQGSYrHhkeDrw+dFMD6Yr/Vrvr2pPyDHCWoMO8w9LxFaQABrVkxqK1PRfgZw0t9bDNsxFEJNHhErc9XHTkkU1OiEYYWiz2VdqW6jQewS86Z3lshxW6Fdf1MU0MDPt1NoikSf2YEIBvI+gscAfqmtvJxZbkVA/Lrr7r+HyVUoZGt1QB46Zv9umeZBwmTWiDHaLPPgOVOWQAVYLMCwpEzEzIdF2C8KzI/CsCeCv3raf56RXmhFAWuJCbMtO6My12PxFQDRv98IWP0FGhY/m6sQ/9r58GInq4bSVYWKlGucbXbayaYF35Fp3o6VaRXVWzJ6FesrH8dS+DxeadscnAN4IQEB4J5YcwZvAX/fjE5JEHNC4WrNfiUe+fe6FAQ4ttHlRgKS+PbN1butH1dDkfQkBKC5Om0WI3D45eaRbN6Taxt7ha5xCUwGVh0LQ+Wf/j9bY+un1Cwur9wx+HmB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T3BzCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJ0eAEGdmVyaWZ5AAQHJG1hdGNoMAUCdHgDCQABAgUHJG1hdGNoMAIUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAWQFByRtYXRjaDAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFB293bmVyUGsDCQABAgUHJG1hdGNoMAIXSW52b2tlU2NyaXB0VHJhbnNhY3Rpb24EAWQFByRtYXRjaDAEByRtYXRjaDEIBQFkCGZ1bmN0aW9uAwkAAAICDXNldE9wZXJhdG9yUGsFByRtYXRjaDEJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFB293bmVyUGsDCQAAAgIIdHJhbnNhY3QFByRtYXRjaDEECm9wZXJhdG9yUGsJAQ1nZXRPcGVyYXRvclBrAAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUKb3BlcmF0b3JQawkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleQfnMd0T", "height": 2825796, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3XQTdkT9vwstyExYtVmb4X6CNQ9ENdDo61WLcryyndAC Next: 955pwN2gQ3KaUdziNw2bwgV3tEjTWLRwvT2BbqbeG6Qz Diff:
Old | New | Differences | |
---|---|---|---|
26 | 26 | ||
27 | 27 | let operatorKey = "OperatorPk" | |
28 | 28 | ||
29 | - | func takeExt (v,from, | |
29 | + | func takeExt (v,from,n) = take(drop(v, from), n) | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func spendDeposit (address,amount) = { | |
105 | 105 | let operatorPk = getOperatorPk() | |
106 | 106 | let operatorAddress = addressFromPublicKey(operatorPk) | |
107 | 107 | let nullifier = takeExt(tx, 0, 32) | |
108 | - | let outCommit = takeExt(tx, 32, | |
109 | - | let assetId = takeExt(tx, 64, | |
110 | - | let delta = takeExt(tx, 96, | |
108 | + | let outCommit = takeExt(tx, 32, 32) | |
109 | + | let assetId = takeExt(tx, 64, 32) | |
110 | + | let delta = takeExt(tx, 96, 32) | |
111 | 111 | let nativeAmount = toInt(takeExt(delta, 0, 8)) | |
112 | - | let nativeEnergy = toInt(takeExt(delta, 8, | |
113 | - | let txIndex = toInt(takeExt(delta, 22, | |
114 | - | let _poolId = takeExt(delta, 28, | |
115 | - | let txProof = takeExt(tx, 128, | |
116 | - | let treeProof = takeExt(tx, 384, | |
117 | - | let rootAfter = takeExt(tx, 640, | |
118 | - | let txType = toInt(takeExt(tx, 672, | |
119 | - | let $ | |
112 | + | let nativeEnergy = toInt(takeExt(delta, 8, 14)) | |
113 | + | let txIndex = toInt(takeExt(delta, 22, 6)) | |
114 | + | let _poolId = takeExt(delta, 28, 3) | |
115 | + | let txProof = takeExt(tx, 128, 256) | |
116 | + | let treeProof = takeExt(tx, 384, 256) | |
117 | + | let rootAfter = takeExt(tx, 640, 32) | |
118 | + | let txType = toInt(takeExt(tx, 672, 2)) | |
119 | + | let $t060316423 = if ((txType == 0)) | |
120 | 120 | then { | |
121 | + | let fullMemo = drop(tx, 674) | |
121 | 122 | let depositDataSize = (32 + 64) | |
122 | 123 | let depositPk = dropRight(takeRight(tx, depositDataSize), 64) | |
123 | 124 | let depositSignature = takeRight(tx, 64) | |
124 | - | $Tuple3(takeExt(tx, 674, (size( | |
125 | + | $Tuple3(takeExt(tx, 674, (size(fullMemo) - depositDataSize)), depositPk, depositSignature) | |
125 | 126 | } | |
126 | - | else $Tuple3( | |
127 | - | let memo = $ | |
128 | - | let depositPk = $ | |
129 | - | let depositSignature = $ | |
127 | + | else $Tuple3(drop(tx, 674), unit, unit) | |
128 | + | let memo = $t060316423._1 | |
129 | + | let depositPk = $t060316423._2 | |
130 | + | let depositSignature = $t060316423._3 | |
130 | 131 | let fee = toInt(takeExt(memo, 0, 8)) | |
131 | 132 | let allMessagesHash = valueOrElse(getBinary(allMessagesHashKey), toBytes(toBigInt(0))) | |
132 | 133 | let memoHash = keccak256(memo) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ownerPk = base58'6ybktvseycJDGHTjJm3tz9iT2SKaTNtLLCZsJZRemtoM' | |
5 | 5 | ||
6 | 6 | let denominator = 100000000 | |
7 | 7 | ||
8 | 8 | let transferVk = base64'SYrHhkeDrw+dFMD6Yr/Vrvr2pPyDHCWoMO8w9LxFaQABrVkxqK1PRfgZw0t9bDNsxFEJNHhErc9XHTkkU1OiEYYWiz2VdqW6jQewS86Z3lshxW6Fdf1MU0MDPt1NoikSf2YEIBvI+gscAfqmtvJxZbkVA/Lrr7r+HyVUoZGt1QB46Zv9umeZBwmTWiDHaLPPgOVOWQAVYLMCwpEzEzIdF2C8KzI/CsCeCv3raf56RXmhFAWuJCbMtO6My12PxFQDRv98IWP0FGhY/m6sQ/9r58GInq4bSVYWKlGucbXbayaYF35Fp3o6VaRXVWzJ6FesrH8dS+DxeadscnAN4IQEB4J5YcwZvAX/fjE5JEHNC4WrNfiUe+fe6FAQ4ttHlRgKS+PbN1butH1dDkfQkBKC5Om0WI3D45eaRbN6Taxt7ha5xCUwGVh0LQ+Wf/j9bY+un1Cwur9wx+HmB6PPGC2pEFLSQhkZjtvNJTs6e1c0i3FAOhFDSNqEjcqORSer2aUGdJMXhB6YEv/XcumUDyQbem+f0wX2qOgtwVFLtGOq7S65sHzNcHpdJP/htHnhqkQErwmjDG/JTs9oc1mu5jOsGAYAAAAovMt7vHGhKq+EA+6JlSFfVMj7aU/V67EpBI64f73xJKTpnqCOEMhaQMegFHTJ/W5Cp9iTd4i3AqnoTQj+L1UOXKmddpvHhg0WJHFbosaPhv8EY7+cAaHmn1JPO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C3Nm1wSKR6xi8NSbjhPZRw0/zChVK9K8ceAO4ijNFpOFuOpTO6aEq0o7spO/E0JTwTStxF0jdD9NCydSTLZi4DdtHHkcph4Sao8AwV4qd50wavb0/hxCXkVWTvErgnIWCgjrfgzQBDfa99z0alUbwyBBd8odwfJU7bERsH/SfhNempxiwEU1uq6TPQ2NxgN3fgXo5i9dHrSaI2ZQd7R9hyJVeMlBaz6uP4gS1XYlt5LkT+TFGT/vidKlcMHQx945x1Iivq728eKgJ4aBI5Ja1nxj7QC7d98xukukQl' | |
11 | 11 | ||
12 | 12 | let initialRoot = toBytes(parseBigIntValue("11469701942666298368112882412133877458305516134926649826543144744382391691533")) | |
13 | 13 | ||
14 | 14 | func getRootKey (index) = ("R:" + toString(index)) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func getNullifierKey (nullifier) = ("N:" + toBase58String(nullifier)) | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func getDepositKey (address) = ("D:" + toBase58String(address)) | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | let poolIndexKey = "PoolIndex" | |
24 | 24 | ||
25 | 25 | let allMessagesHashKey = "AllMessagesHash" | |
26 | 26 | ||
27 | 27 | let operatorKey = "OperatorPk" | |
28 | 28 | ||
29 | - | func takeExt (v,from, | |
29 | + | func takeExt (v,from,n) = take(drop(v, from), n) | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func spendDeposit (address,amount) = { | |
33 | 33 | let currentKey = getDepositKey(address.bytes) | |
34 | 34 | let currentAmount = match getInteger(currentKey) { | |
35 | 35 | case a: Int => | |
36 | 36 | a | |
37 | 37 | case _ => | |
38 | 38 | 0 | |
39 | 39 | } | |
40 | 40 | let newAmount = (currentAmount - amount) | |
41 | 41 | if ((0 > amount)) | |
42 | 42 | then throw("Can't spend negative amount") | |
43 | 43 | else if ((0 > newAmount)) | |
44 | 44 | then throw("Not enough balance") | |
45 | 45 | else [IntegerEntry(currentKey, newAmount)] | |
46 | 46 | } | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func getOperatorPk () = match getBinary(operatorKey) { | |
50 | 50 | case a: ByteVector => | |
51 | 51 | a | |
52 | 52 | case _ => | |
53 | 53 | ownerPk | |
54 | 54 | } | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | @Callable(i) | |
58 | 58 | func setOperatorPk (pk) = if ((size(pk) != 32)) | |
59 | 59 | then throw("Operator public key must be 32 bytes long") | |
60 | 60 | else [BinaryEntry(operatorKey, pk)] | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | ||
64 | 64 | @Callable(i) | |
65 | 65 | func deposit () = { | |
66 | 66 | let pmt = value(i.payments[0]) | |
67 | 67 | if (isDefined(pmt.assetId)) | |
68 | 68 | then throw("Only WAVES is allowed at the moment") | |
69 | 69 | else { | |
70 | 70 | let currentKey = getDepositKey(i.caller.bytes) | |
71 | 71 | let currentAmount = match getInteger(this, currentKey) { | |
72 | 72 | case a: Int => | |
73 | 73 | a | |
74 | 74 | case _ => | |
75 | 75 | 0 | |
76 | 76 | } | |
77 | 77 | let newAmount = (currentAmount + pmt.amount) | |
78 | 78 | [IntegerEntry(currentKey, newAmount)] | |
79 | 79 | } | |
80 | 80 | } | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | ||
84 | 84 | @Callable(i) | |
85 | 85 | func withdraw (amount) = { | |
86 | 86 | let currentKey = getDepositKey(i.caller.bytes) | |
87 | 87 | let currentAmount = match getInteger(this, currentKey) { | |
88 | 88 | case a: Int => | |
89 | 89 | a | |
90 | 90 | case _ => | |
91 | 91 | 0 | |
92 | 92 | } | |
93 | 93 | let newAmount = (currentAmount - amount) | |
94 | 94 | if ((0 > amount)) | |
95 | 95 | then throw("Can't withdraw negative amount") | |
96 | 96 | else if ((0 > newAmount)) | |
97 | 97 | then throw("Not enough balance") | |
98 | 98 | else [IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, amount, unit)] | |
99 | 99 | } | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | ||
103 | 103 | @Callable(i) | |
104 | 104 | func transact (tx) = { | |
105 | 105 | let operatorPk = getOperatorPk() | |
106 | 106 | let operatorAddress = addressFromPublicKey(operatorPk) | |
107 | 107 | let nullifier = takeExt(tx, 0, 32) | |
108 | - | let outCommit = takeExt(tx, 32, | |
109 | - | let assetId = takeExt(tx, 64, | |
110 | - | let delta = takeExt(tx, 96, | |
108 | + | let outCommit = takeExt(tx, 32, 32) | |
109 | + | let assetId = takeExt(tx, 64, 32) | |
110 | + | let delta = takeExt(tx, 96, 32) | |
111 | 111 | let nativeAmount = toInt(takeExt(delta, 0, 8)) | |
112 | - | let nativeEnergy = toInt(takeExt(delta, 8, | |
113 | - | let txIndex = toInt(takeExt(delta, 22, | |
114 | - | let _poolId = takeExt(delta, 28, | |
115 | - | let txProof = takeExt(tx, 128, | |
116 | - | let treeProof = takeExt(tx, 384, | |
117 | - | let rootAfter = takeExt(tx, 640, | |
118 | - | let txType = toInt(takeExt(tx, 672, | |
119 | - | let $ | |
112 | + | let nativeEnergy = toInt(takeExt(delta, 8, 14)) | |
113 | + | let txIndex = toInt(takeExt(delta, 22, 6)) | |
114 | + | let _poolId = takeExt(delta, 28, 3) | |
115 | + | let txProof = takeExt(tx, 128, 256) | |
116 | + | let treeProof = takeExt(tx, 384, 256) | |
117 | + | let rootAfter = takeExt(tx, 640, 32) | |
118 | + | let txType = toInt(takeExt(tx, 672, 2)) | |
119 | + | let $t060316423 = if ((txType == 0)) | |
120 | 120 | then { | |
121 | + | let fullMemo = drop(tx, 674) | |
121 | 122 | let depositDataSize = (32 + 64) | |
122 | 123 | let depositPk = dropRight(takeRight(tx, depositDataSize), 64) | |
123 | 124 | let depositSignature = takeRight(tx, 64) | |
124 | - | $Tuple3(takeExt(tx, 674, (size( | |
125 | + | $Tuple3(takeExt(tx, 674, (size(fullMemo) - depositDataSize)), depositPk, depositSignature) | |
125 | 126 | } | |
126 | - | else $Tuple3( | |
127 | - | let memo = $ | |
128 | - | let depositPk = $ | |
129 | - | let depositSignature = $ | |
127 | + | else $Tuple3(drop(tx, 674), unit, unit) | |
128 | + | let memo = $t060316423._1 | |
129 | + | let depositPk = $t060316423._2 | |
130 | + | let depositSignature = $t060316423._3 | |
130 | 131 | let fee = toInt(takeExt(memo, 0, 8)) | |
131 | 132 | let allMessagesHash = valueOrElse(getBinary(allMessagesHashKey), toBytes(toBigInt(0))) | |
132 | 133 | let memoHash = keccak256(memo) | |
133 | 134 | let hashes = (allMessagesHash + memoHash) | |
134 | 135 | let newAllMessagesHash = keccak256(hashes) | |
135 | 136 | let rootBefore = valueOrElse(getBinary(getRootKey(txIndex)), initialRoot) | |
136 | 137 | if ((rootBefore == rootBefore)) | |
137 | 138 | then { | |
138 | 139 | let poolIndex = valueOrElse(getInteger(poolIndexKey), 0) | |
139 | 140 | let poolRoot = valueOrElse(getBinary(getRootKey(poolIndex)), initialRoot) | |
140 | 141 | let nullifierExists = match getBinary(getNullifierKey(nullifier)) { | |
141 | 142 | case a: Unit => | |
142 | 143 | false | |
143 | 144 | case _ => | |
144 | 145 | true | |
145 | 146 | } | |
146 | 147 | let transferInputs = ((((memoHash + nullifier) + outCommit) + delta) + memoHash) | |
147 | 148 | let treeInputs = ((poolRoot + rootAfter) + outCommit) | |
148 | 149 | let dataOps = [BinaryEntry(getRootKey(txIndex), rootAfter), BinaryEntry(getNullifierKey(nullifier), keccak256((outCommit + delta))), IntegerEntry(poolIndexKey, (poolIndex + 128)), BinaryEntry(allMessagesHashKey, newAllMessagesHash)] | |
149 | 150 | let txOps = match txType { | |
150 | 151 | case _ => | |
151 | 152 | if ((0 == $match0)) | |
152 | 153 | then { | |
153 | 154 | let depositPkValue = value(depositPk) | |
154 | 155 | let depositAddress = addressFromPublicKey(depositPkValue) | |
155 | 156 | if ((0 > nativeAmount)) | |
156 | 157 | then throw("Can't deposit negative amount") | |
157 | 158 | else if (!(sigVerify_8Kb((nullifier + depositPkValue), value(depositSignature), depositPkValue))) | |
158 | 159 | then throw("Invalid deposit signature") | |
159 | 160 | else spendDeposit(depositAddress, (nativeAmount * denominator)) | |
160 | 161 | } | |
161 | 162 | else if ((1 == $match0)) | |
162 | 163 | then if ((nativeAmount != 0)) | |
163 | 164 | then throw("Native amount must be zero for transfers") | |
164 | 165 | else nil | |
165 | 166 | else if ((2 == $match0)) | |
166 | 167 | then { | |
167 | 168 | let withdrawAmount = (toInt(takeExt(memo, 8, 16)) * denominator) | |
168 | 169 | if ((withdrawAmount > 0)) | |
169 | 170 | then throw("Withdraw amount must be positive") | |
170 | 171 | else [ScriptTransfer(i.caller, -(withdrawAmount), unit)] | |
171 | 172 | } | |
172 | 173 | else throw("Unknown tx type") | |
173 | 174 | } | |
174 | 175 | let feeOps = if ((fee > 0)) | |
175 | 176 | then { | |
176 | 177 | let totalFee = (fee * denominator) | |
177 | 178 | [ScriptTransfer(operatorAddress, fee, unit)] | |
178 | 179 | } | |
179 | 180 | else nil | |
180 | 181 | if ((txIndex > poolIndex)) | |
181 | 182 | then throw("Invalid transaction index") | |
182 | 183 | else if (!(bn256Groth16Verify_5inputs(transferVk, txProof, transferInputs))) | |
183 | 184 | then throw("Tx proof is invalid") | |
184 | 185 | else if (!(bn256Groth16Verify_3inputs(treeVk, treeProof, treeInputs))) | |
185 | 186 | then throw("Tree proof is invalid") | |
186 | 187 | else if (nullifierExists) | |
187 | 188 | then throw("Double spend") | |
188 | 189 | else ((txOps ++ dataOps) ++ feeOps) | |
189 | 190 | } | |
190 | 191 | else throw("Strict value is not equal to itself.") | |
191 | 192 | } | |
192 | 193 | ||
193 | 194 | ||
194 | 195 | @Verifier(tx) | |
195 | 196 | func verify () = match tx { | |
196 | 197 | case d: SetScriptTransaction => | |
197 | 198 | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPk) | |
198 | 199 | case d: InvokeScriptTransaction => | |
199 | 200 | match d.function { | |
200 | 201 | case _ => | |
201 | 202 | if (("setOperatorPk" == $match1)) | |
202 | 203 | then sigVerify(tx.bodyBytes, tx.proofs[0], ownerPk) | |
203 | 204 | else if (("transact" == $match1)) | |
204 | 205 | then { | |
205 | 206 | let operatorPk = getOperatorPk() | |
206 | 207 | sigVerify(tx.bodyBytes, tx.proofs[0], operatorPk) | |
207 | 208 | } | |
208 | 209 | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
209 | 210 | } | |
210 | 211 | case _ => | |
211 | 212 | false | |
212 | 213 | } | |
213 | 214 |
github/deemru/w8io/169f3d6 48.62 ms ◑