tx · AdfbHKt54m7jJkCh6ENyEiKLWa8SScd7MzWRjYxA5QsR 3MuQJ2by8GXusfNAEdX1jYW2WMQbjVzwxzX: -0.01000000 Waves 2023.09.27 14:41 [2773766] smart account 3MuQJ2by8GXusfNAEdX1jYW2WMQbjVzwxzX > SELF 0.00000000 Waves
{ "type": 13, "id": "AdfbHKt54m7jJkCh6ENyEiKLWa8SScd7MzWRjYxA5QsR", "fee": 1000000, "feeAssetId": null, "timestamp": 1695814938123, "version": 2, "chainId": 84, "sender": "3MuQJ2by8GXusfNAEdX1jYW2WMQbjVzwxzX", "senderPublicKey": "DCZ3si1pk7A23sVSwzZtghP1jZR2YyYEH2WaMxvELct9", "proofs": [ "5dpEoVXuBy2AN6H47BvzbxHu25E16KKoUm5x1jsZ2jxe8PjsDkHqwRr23rkKCDB5owVe1vvMKioFFyahcuoByAfB" ], "script": "base64:BgIqCAISBAoCCAgSBAoCCAESBQoDAgECEgQKAgIBEgUKAwICAhIAEgQKAggYDwARa0ZhY3RvcnlQdWJsaWNLZXkCFCVzX19mYWN0b3J5UHVibGljS2V5ABFrU2VydmljZVB1YmxpY0tleQIUJXNfX3NlcnZpY2VQdWJsaWNLZXkAD2tPd25lclB1YmxpY0tleQISJXNfX293bmVyUHVibGljS2V5ABFrQ3JlYXRvclB1YmxpY0tleQIUJXNfX2NyZWF0b3JQdWJsaWNLZXkADWtCb3RQdWJsaWNLZXkCECVzX19ib3RQdWJsaWNLZXkACWtWZXJpZmllZAIMJXNfX3ZlcmlmaWVkAQh2ZXJpZmllZAAJAQt2YWx1ZU9yRWxzZQIJAJsIAgUEdGhpcwUJa1ZlcmlmaWVkBwAOZmFjdG9yeUFkZHJlc3MJAKcIAQkBEUBleHRyTmF0aXZlKDEwNTIpAgUEdGhpcwURa0ZhY3RvcnlQdWJsaWNLZXkADnNlcnZpY2VBZGRyZXNzCQCnCAEJARFAZXh0ck5hdGl2ZSgxMDUyKQIFDmZhY3RvcnlBZGRyZXNzBRFrU2VydmljZV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AAAIJAMkBAgkAygECCAUEdGhpcwVieXRlcwABAAEBAVQEDGJvdFB1YmxpY0tleQkBEUBleHRyTmF0aXZlKDEwNTIpAgUOZmFjdG9yeUFkZHJlc3MFDWtCb3RQdWJsaWNLZXkEByRtYXRjaDAFAnR4AwkAAQIFByRtYXRjaDACBU9yZGVyCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQxib3RQdWJsaWNLZXkDCQABAgUHJG1hdGNoMAIXSW52b2tlU2NyaXB0VHJhbnNhY3Rpb24DCQEIdmVyaWZpZWQABwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleQMJAQEhAQUHdGVzdG5ldAcJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXm2ZHf2", "height": 2773766, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: A93abH4KnwxCCo7Xa8KZfQcUD84QCCL1j2WHXj36txEw Next: HsUUp1ReSHsakkfUcTNA5kkzjLqJcirj3PAywnoztoYH Diff:
Old | New | Differences | |
---|---|---|---|
7 | 7 | ||
8 | 8 | let kOwnerPublicKey = "%s__ownerPublicKey" | |
9 | 9 | ||
10 | + | let kCreatorPublicKey = "%s__creatorPublicKey" | |
11 | + | ||
10 | 12 | let kBotPublicKey = "%s__botPublicKey" | |
11 | 13 | ||
12 | 14 | let kVerified = "%s__verified" | |
15 | + | ||
16 | + | func verified () = valueOrElse(getBoolean(this, kVerified), false) | |
17 | + | ||
13 | 18 | ||
14 | 19 | let factoryAddress = addressFromPublicKey(getBinaryValue(this, kFactoryPublicKey)) | |
15 | 20 | ||
16 | 21 | let serviceAddress = addressFromPublicKey(getBinaryValue(factoryAddress, kServicePublicKey)) | |
17 | 22 | ||
18 | 23 | let ownerAddress = addressFromPublicKey(getBinaryValue(this, kOwnerPublicKey)) | |
19 | - | ||
20 | - | let isReady = if (if (isDefined(getBinary(this, kFactoryPublicKey))) | |
21 | - | then isDefined(getBinary(this, kOwnerPublicKey)) | |
22 | - | else false) | |
23 | - | then valueOrElse(getBoolean(this, kVerified), false) | |
24 | - | else false | |
25 | 24 | ||
26 | 25 | func mustAddress (i,address) = if ((i.caller == address)) | |
27 | 26 | then true | |
69 | 68 | ||
70 | 69 | ||
71 | 70 | @Callable(i) | |
72 | - | func init (factoryPublicKey,ownerPublicKey) = { | |
71 | + | func init (factoryPublicKey,ownerPublicKey,creatorPublicKey) = { | |
73 | 72 | let checkCaller = mustThis(i) | |
74 | 73 | if ((checkCaller == checkCaller)) | |
75 | - | then $Tuple2([BinaryEntry(kFactoryPublicKey, factoryPublicKey), BinaryEntry(kOwnerPublicKey, ownerPublicKey)], unit) | |
76 | - | else throw("Strict value is not equal to itself.") | |
77 | - | } | |
78 | - | ||
79 | - | ||
80 | - | ||
81 | - | @Callable(i) | |
82 | - | func complete (requestId,recipientPublicKey) = { | |
83 | - | let checkCaller = mustThis(i) | |
84 | - | if ((checkCaller == checkCaller)) | |
85 | - | then { | |
86 | - | let result = reentrantInvoke(factoryAddress, "complete", [requestId, recipientPublicKey], nil) | |
87 | - | $Tuple2(nil, result) | |
88 | - | } | |
74 | + | then $Tuple2([BinaryEntry(kFactoryPublicKey, factoryPublicKey), BinaryEntry(kOwnerPublicKey, ownerPublicKey), BinaryEntry(kCreatorPublicKey, creatorPublicKey)], unit) | |
89 | 75 | else throw("Strict value is not equal to itself.") | |
90 | 76 | } | |
91 | 77 | ||
121 | 107 | case _: Order => | |
122 | 108 | sigVerify(tx.bodyBytes, tx.proofs[0], botPublicKey) | |
123 | 109 | case _: InvokeScriptTransaction => | |
124 | - | if ( | |
110 | + | if (verified()) | |
125 | 111 | then false | |
126 | 112 | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
127 | 113 | case _ => |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let kFactoryPublicKey = "%s__factoryPublicKey" | |
5 | 5 | ||
6 | 6 | let kServicePublicKey = "%s__servicePublicKey" | |
7 | 7 | ||
8 | 8 | let kOwnerPublicKey = "%s__ownerPublicKey" | |
9 | 9 | ||
10 | + | let kCreatorPublicKey = "%s__creatorPublicKey" | |
11 | + | ||
10 | 12 | let kBotPublicKey = "%s__botPublicKey" | |
11 | 13 | ||
12 | 14 | let kVerified = "%s__verified" | |
15 | + | ||
16 | + | func verified () = valueOrElse(getBoolean(this, kVerified), false) | |
17 | + | ||
13 | 18 | ||
14 | 19 | let factoryAddress = addressFromPublicKey(getBinaryValue(this, kFactoryPublicKey)) | |
15 | 20 | ||
16 | 21 | let serviceAddress = addressFromPublicKey(getBinaryValue(factoryAddress, kServicePublicKey)) | |
17 | 22 | ||
18 | 23 | let ownerAddress = addressFromPublicKey(getBinaryValue(this, kOwnerPublicKey)) | |
19 | - | ||
20 | - | let isReady = if (if (isDefined(getBinary(this, kFactoryPublicKey))) | |
21 | - | then isDefined(getBinary(this, kOwnerPublicKey)) | |
22 | - | else false) | |
23 | - | then valueOrElse(getBoolean(this, kVerified), false) | |
24 | - | else false | |
25 | 24 | ||
26 | 25 | func mustAddress (i,address) = if ((i.caller == address)) | |
27 | 26 | then true | |
28 | 27 | else throw() | |
29 | 28 | ||
30 | 29 | ||
31 | 30 | func mustThis (i) = mustAddress(i, this) | |
32 | 31 | ||
33 | 32 | ||
34 | 33 | func mustService (i) = mustAddress(i, serviceAddress) | |
35 | 34 | ||
36 | 35 | ||
37 | 36 | func mustOwner (i) = mustAddress(i, ownerAddress) | |
38 | 37 | ||
39 | 38 | ||
40 | 39 | func mustFactory (i) = mustAddress(i, factoryAddress) | |
41 | 40 | ||
42 | 41 | ||
43 | 42 | @Callable(i) | |
44 | 43 | func stringEntry (key,val) = if (mustService(i)) | |
45 | 44 | then $Tuple2([StringEntry(key, val)], key) | |
46 | 45 | else $Tuple2(nil, unit) | |
47 | 46 | ||
48 | 47 | ||
49 | 48 | ||
50 | 49 | @Callable(i) | |
51 | 50 | func integerEntry (key,val) = if (mustService(i)) | |
52 | 51 | then $Tuple2([IntegerEntry(key, val)], key) | |
53 | 52 | else $Tuple2(nil, unit) | |
54 | 53 | ||
55 | 54 | ||
56 | 55 | ||
57 | 56 | @Callable(i) | |
58 | 57 | func transferAsset (recipientBytes,amount,assetId) = if (mustService(i)) | |
59 | 58 | then $Tuple2([ScriptTransfer(Address(recipientBytes), amount, assetId)], amount) | |
60 | 59 | else $Tuple2(nil, unit) | |
61 | 60 | ||
62 | 61 | ||
63 | 62 | ||
64 | 63 | @Callable(i) | |
65 | 64 | func transferWaves (recipientBytes,amount) = if (mustService(i)) | |
66 | 65 | then $Tuple2([ScriptTransfer(Address(recipientBytes), amount, unit)], amount) | |
67 | 66 | else $Tuple2(nil, unit) | |
68 | 67 | ||
69 | 68 | ||
70 | 69 | ||
71 | 70 | @Callable(i) | |
72 | - | func init (factoryPublicKey,ownerPublicKey) = { | |
71 | + | func init (factoryPublicKey,ownerPublicKey,creatorPublicKey) = { | |
73 | 72 | let checkCaller = mustThis(i) | |
74 | 73 | if ((checkCaller == checkCaller)) | |
75 | - | then $Tuple2([BinaryEntry(kFactoryPublicKey, factoryPublicKey), BinaryEntry(kOwnerPublicKey, ownerPublicKey)], unit) | |
76 | - | else throw("Strict value is not equal to itself.") | |
77 | - | } | |
78 | - | ||
79 | - | ||
80 | - | ||
81 | - | @Callable(i) | |
82 | - | func complete (requestId,recipientPublicKey) = { | |
83 | - | let checkCaller = mustThis(i) | |
84 | - | if ((checkCaller == checkCaller)) | |
85 | - | then { | |
86 | - | let result = reentrantInvoke(factoryAddress, "complete", [requestId, recipientPublicKey], nil) | |
87 | - | $Tuple2(nil, result) | |
88 | - | } | |
74 | + | then $Tuple2([BinaryEntry(kFactoryPublicKey, factoryPublicKey), BinaryEntry(kOwnerPublicKey, ownerPublicKey), BinaryEntry(kCreatorPublicKey, creatorPublicKey)], unit) | |
89 | 75 | else throw("Strict value is not equal to itself.") | |
90 | 76 | } | |
91 | 77 | ||
92 | 78 | ||
93 | 79 | ||
94 | 80 | @Callable(i) | |
95 | 81 | func approve () = { | |
96 | 82 | let checkCaller = mustFactory(i) | |
97 | 83 | if ((checkCaller == checkCaller)) | |
98 | 84 | then $Tuple2([BooleanEntry(kVerified, true)], unit) | |
99 | 85 | else throw("Strict value is not equal to itself.") | |
100 | 86 | } | |
101 | 87 | ||
102 | 88 | ||
103 | 89 | ||
104 | 90 | @Callable(i) | |
105 | 91 | func call (function,args) = { | |
106 | 92 | let checkCaller = mustOwner(i) | |
107 | 93 | if ((checkCaller == checkCaller)) | |
108 | 94 | then { | |
109 | 95 | let result = reentrantInvoke(serviceAddress, function, [args], i.payments) | |
110 | 96 | $Tuple2(nil, result) | |
111 | 97 | } | |
112 | 98 | else throw("Strict value is not equal to itself.") | |
113 | 99 | } | |
114 | 100 | ||
115 | 101 | ||
116 | 102 | @Verifier(tx) | |
117 | 103 | func verify () = { | |
118 | 104 | let testnet = (take(drop(this.bytes, 1), 1) == base58'2T') | |
119 | 105 | let botPublicKey = getBinaryValue(factoryAddress, kBotPublicKey) | |
120 | 106 | match tx { | |
121 | 107 | case _: Order => | |
122 | 108 | sigVerify(tx.bodyBytes, tx.proofs[0], botPublicKey) | |
123 | 109 | case _: InvokeScriptTransaction => | |
124 | - | if ( | |
110 | + | if (verified()) | |
125 | 111 | then false | |
126 | 112 | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
127 | 113 | case _ => | |
128 | 114 | if (!(testnet)) | |
129 | 115 | then false | |
130 | 116 | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
131 | 117 | } | |
132 | 118 | } | |
133 | 119 |
github/deemru/w8io/169f3d6 33.32 ms ◑