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