tx · XmxYZEQEVcdr6P8f7WBRQerPDHPqrEXdCeP2nVeopce

3N8kB3UEjWWvTRBtGpGUErAevaK2q6u2eCM:  -0.01000000 Waves

2023.01.19 13:45 [2411709] smart account 3N8kB3UEjWWvTRBtGpGUErAevaK2q6u2eCM > SELF 0.00000000 Waves

{ "type": 13, "id": "XmxYZEQEVcdr6P8f7WBRQerPDHPqrEXdCeP2nVeopce", "fee": 1000000, "feeAssetId": null, "timestamp": 1674125159786, "version": 2, "chainId": 84, "sender": "3N8kB3UEjWWvTRBtGpGUErAevaK2q6u2eCM", "senderPublicKey": "6ybktvseycJDGHTjJm3tz9iT2SKaTNtLLCZsJZRemtoM", "proofs": [ "rkqaT6MZn3fiYXXLCPfjGzmaKNASNXsokP6UuahGa9sSzLHvTmaRCMMKyGmHUafd62sTPV2uocSuQR2wmMf5rvU" ], "script": "base64:BgIOCAISABIDCgEBEgMKAQIMAApvcGVyYXRvclBrASBYykJ087k1O5DHz1iBa4azTNxFvIHPRd6zv7WPhbjSXAAPb3BlcmF0b3JBZGRyZXNzCQCnCAEFCm9wZXJhdG9yUGsAC2Rlbm9taW5hdG9yAIDC1y8ACnRyYW5zZmVyVmsBxAZJiseGR4OvD50UwPpiv9Wu+vak/IMcJagw7zD0vEVpAAGtWTGorU9F+BnDS31sM2zEUQk0eEStz1cdOSRTU6IRhhaLPZV2pbqNB7BLzpneWyHFboV1/UxTQwM+3U2iKRJ/ZgQgG8j6CxwB+qa28nFluRUD8uuvuv4fJVShka3VAHjpm/26Z5kHCZNaIMdos8+A5U5ZABVgswLCkTMTMh0XYLwrMj8KwJ4K/etp/npFeaEUBa4kJsy07ozLXY/EVANG/3whY/QUaFj+bqxD/2vnwYierhtJVhYqUa5xtdtrJpgXfkWnejpVpFdVbMnoV6ysfx1L4PF5p2xycA3ghAQHgnlhzBm8Bf9+MTkkQc0Lhas1+JR7597oUBDi20eVGApL49s3Vu60fV0OR9CQEoLk6bRYjcPjl5pFs3pNrG3uFrnEJTAZWH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ZXgJAAIBAhxUcmFuc2FjdGlvbiBpbmRleCBpcyB0b28gYmlnAwkBASEBCQCWEwMFCnRyYW5zZmVyVmsFB3R4UHJvb2YFDnRyYW5zZmVySW5wdXRzCQACAQITVHggcHJvb2YgaXMgaW52YWxpZAMJAQEhAQkAlBMDBQZ0cmVlVmsFCXRyZWVQcm9vZgUKdHJlZUlucHV0cwkAAgECFVRyZWUgcHJvb2YgaXMgaW52YWxpZAMFD251bGxpZmllckV4aXN0cwkAAgECDERvdWJsZSBzcGVuZAkAzggCCQDOCAIFA3JlcwUHZGF0YVJlcwUGZmVlUmVzCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJ0eAEGdmVyaWZ5AAQHJG1hdGNoMAUCdHgDCQABAgUHJG1hdGNoMAIUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAWQFByRtYXRjaDAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFCm9wZXJhdG9yUGsHWZ+Wcg==", "height": 2411709, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 6VnwRiznJbm2wm3FFpwUmQi9fN8Bo25so8dhNKFFaoJo Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 6 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let operatorPk = base58'6ybktvseycJDGHTjJm3tz9iT2SKaTNtLLCZsJZRemtoM'
5+
6+let operatorAddress = addressFromPublicKey(operatorPk)
7+
8+let denominator = 100000000
9+
10+let transferVk = base64'SYrHhkeDrw+dFMD6Yr/Vrvr2pPyDHCWoMO8w9LxFaQABrVkxqK1PRfgZw0t9bDNsxFEJNHhErc9XHTkkU1OiEYYWiz2VdqW6jQewS86Z3lshxW6Fdf1MU0MDPt1NoikSf2YEIBvI+gscAfqmtvJxZbkVA/Lrr7r+HyVUoZGt1QB46Zv9umeZBwmTWiD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wVXEareR6FvrGlyEdKcFx+vIagiT77lQ3MK/EfxwlNHsEdAy0sWThEjpDykFPiYWG6T5IJWIGtdhrcPdePYv1GX0wCakWmTMh9NWYby1erGRPnDxWxeFcOBN4DPhkSQKg/DMH1LkY/GlCqIdfdX5Mr+0CMQWnmr8oECA5QgeOJ1ZnSQmO18Jg9rclNx9mhqD3iux0b+o293HkYg4d75ZOBeUqLdx63/eIe/VEuwIkGFBs4sU9WHEsdqpx8QKpByl6ZKgiOcx/wrW0cwTvm34cq5pRVGunz+qu90se2PqAjOjiIRoDvrcCR7qlN0iTvBedZRTlOtbOxAiXOb/nwFrsmf8wFiebpKkjbNkNvTiLGRiea53xusmuNwANOZtfYMT03Kwf1bgRFrkM6TqgEVZq1Vl7wjFhGu3CFrk5popRZ0X8zhJqn5IPLt6g/0ImUPee8frB6VtMYYkmQ7ZCWTwKEPGDIgQAAACMoBtyPY40yogNVj5bF/LbEe5QGKZjwyfMj58AY5ocK00CEsC3Nm1wSKR6xi8NSbjhPZRw0/zChVK9K8ceAO4ijNFpOFuOpTO6aEq0o7spO/E0JTwTStxF0jdD9NCydSTLZi4DdtHHkcph4Sao8AwV4qd50wavb0/hxCXkVWTvErgnIWCgjrfgzQBDfa99z0alUbwyBBd8odwfJU7bERsH/SfhNempxiwEU1uq6TPQ2NxgN3fgXo5i9dHrSaI2ZQd7R9hyJVeMlBaz6uP4gS1XYlt5LkT+TFGT/vidKlcMHQx945x1Iivq728eKgJ4aBI5Ja1nxj7QC7d98xukukQl'
13+
14+let initialRoot = toBytes(parseBigIntValue("11469701942666298368112882412133877458305516134926649826543144744382391691533"))
15+
16+func getRootKey (index) = ("R:" + toString(index))
17+
18+
19+func getNullifierKey (nullifier) = ("N:" + toBase58String(nullifier))
20+
21+
22+func getDepositKey (address) = ("D:" + toBase58String(address))
23+
24+
25+let poolIndexKey = "PoolIndex"
26+
27+func takeExt (v,from,to) = drop(take(v, to), from)
28+
29+
30+func spendDeposit (address,amount) = {
31+ let currentKey = getDepositKey(address.bytes)
32+ let currentAmount = match getInteger(currentKey) {
33+ case a: Int =>
34+ a
35+ case _ =>
36+ 0
37+ }
38+ let newAmount = (currentAmount - amount)
39+ if ((0 > amount))
40+ then throw("Can't spend negative amount")
41+ else if ((0 > newAmount))
42+ then throw("Not enough balance")
43+ else [IntegerEntry(currentKey, newAmount)]
44+ }
45+
46+
47+@Callable(i)
48+func deposit () = {
49+ let pmt = value(i.payments[0])
50+ if (isDefined(pmt.assetId))
51+ then throw("Only WAVES is allowed at the moment")
52+ else {
53+ let currentKey = getDepositKey(i.caller.bytes)
54+ let currentAmount = match getInteger(this, currentKey) {
55+ case a: Int =>
56+ a
57+ case _ =>
58+ 0
59+ }
60+ let newAmount = (currentAmount + pmt.amount)
61+[IntegerEntry(currentKey, newAmount)]
62+ }
63+ }
64+
65+
66+
67+@Callable(i)
68+func withdraw (amount) = {
69+ let currentKey = getDepositKey(i.caller.bytes)
70+ let currentAmount = match getInteger(this, currentKey) {
71+ case a: Int =>
72+ a
73+ case _ =>
74+ 0
75+ }
76+ let newAmount = (currentAmount - amount)
77+ if ((0 > amount))
78+ then throw("Can't withdraw negative amount")
79+ else if ((0 > newAmount))
80+ then throw("Not enough balance")
81+ else [IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, amount, unit)]
82+ }
83+
84+
85+
86+@Callable(i)
87+func transact (tx) = {
88+ let nullifier = takeExt(tx, 0, 32)
89+ let outCommit = takeExt(tx, 32, 64)
90+ let assetId = takeExt(tx, 64, 96)
91+ let delta = takeExt(tx, 96, 128)
92+ let nativeAmount = toInt(takeExt(delta, 0, 8))
93+ let nativeEnergy = toInt(takeExt(delta, 8, 22))
94+ let txIndex = toInt(takeExt(delta, 22, 28))
95+ let _poolId = takeExt(delta, 28, 31)
96+ let txProof = takeExt(tx, 128, 384)
97+ let treeProof = takeExt(tx, 384, 640)
98+ let rootAfter = takeExt(tx, 640, 672)
99+ let txType = toInt(takeExt(tx, 672, 674))
100+ let $t052185580 = if ((txType == 0))
101+ then {
102+ let depositDataSize = (32 + 64)
103+ let depositPk = dropRight(takeRight(tx, depositDataSize), 64)
104+ let depositSignature = takeRight(tx, 64)
105+ $Tuple3(takeExt(tx, 674, (size(tx) - depositDataSize)), depositPk, depositSignature)
106+ }
107+ else $Tuple3(takeExt(tx, 674, size(tx)), unit, unit)
108+ let memo = $t052185580._1
109+ let depositPk = $t052185580._2
110+ let depositSignature = $t052185580._3
111+ let fee = toInt(takeExt(memo, 0, 8))
112+ let memoHash = keccak256(memo)
113+ let rootBefore = valueOrElse(getBinary(getRootKey(txIndex)), initialRoot)
114+ if ((rootBefore == rootBefore))
115+ then {
116+ let poolIndex = valueOrElse(getInteger(poolIndexKey), 0)
117+ let poolRoot = valueOrElse(getBinary(getRootKey(poolIndex)), initialRoot)
118+ let nullifierExists = match getBinary(getNullifierKey(nullifier)) {
119+ case a: Unit =>
120+ false
121+ case _ =>
122+ true
123+ }
124+ let transferInputs = ((((memoHash + nullifier) + outCommit) + delta) + memoHash)
125+ let treeInputs = ((poolRoot + rootAfter) + outCommit)
126+ let dataRes = [BinaryEntry(getRootKey(txIndex), rootAfter), BinaryEntry(getNullifierKey(nullifier), keccak256((outCommit + delta))), IntegerEntry(poolIndexKey, (poolIndex + 128))]
127+ let res = match txType {
128+ case _ =>
129+ if ((0 == $match0))
130+ then {
131+ let depositPkValue = value(depositPk)
132+ let depositAddress = addressFromPublicKey(depositPkValue)
133+ if ((0 > nativeAmount))
134+ then throw("Can't deposit negative amount")
135+ else if (!(sigVerify_8Kb((nullifier + depositPkValue), value(depositSignature), depositPkValue)))
136+ then throw("Invalid deposit signature")
137+ else spendDeposit(depositAddress, (nativeAmount * denominator))
138+ }
139+ else if ((1 == $match0))
140+ then if ((nativeAmount != 0))
141+ then throw("Native amount must be zero for transfers")
142+ else nil
143+ else if ((2 == $match0))
144+ then {
145+ let withdrawAmount = (toInt(takeExt(memo, 8, 16)) * denominator)
146+ if ((withdrawAmount > 0))
147+ then throw("Withdraw amount must be positive")
148+ else [ScriptTransfer(i.caller, -(withdrawAmount), unit)]
149+ }
150+ else throw("Unknown tx type")
151+ }
152+ let feeRes = if ((fee > 0))
153+ then {
154+ let totalFee = (fee * denominator)
155+[ScriptTransfer(operatorAddress, fee, unit)]
156+ }
157+ else nil
158+ if ((txIndex > poolIndex))
159+ then throw("Transaction index is too big")
160+ else if (!(bn256Groth16Verify_5inputs(transferVk, txProof, transferInputs)))
161+ then throw("Tx proof is invalid")
162+ else if (!(bn256Groth16Verify_3inputs(treeVk, treeProof, treeInputs)))
163+ then throw("Tree proof is invalid")
164+ else if (nullifierExists)
165+ then throw("Double spend")
166+ else ((res ++ dataRes) ++ feeRes)
167+ }
168+ else throw("Strict value is not equal to itself.")
169+ }
170+
171+
172+@Verifier(tx)
173+func verify () = match tx {
174+ case d: SetScriptTransaction =>
175+ sigVerify(tx.bodyBytes, tx.proofs[0], operatorPk)
176+ case _ =>
177+ false
178+}
179+

github/deemru/w8io/026f985 
40.18 ms