tx · EzM7JFCChnSPcJ6cwjiy3547Rx5mrB6zqq66oREF6D71 3N5cEBCfqPzk4A6hNBTPLb5K5M8fe5daC1j: -0.00300000 Waves 2023.12.06 17:41 [2874921] smart account 3N5cEBCfqPzk4A6hNBTPLb5K5M8fe5daC1j > SELF 0.00000000 Waves
{ "type": 13, "id": "EzM7JFCChnSPcJ6cwjiy3547Rx5mrB6zqq66oREF6D71", "fee": 300000, "feeAssetId": null, "timestamp": 1701873736278, "version": 2, "chainId": 84, "sender": "3N5cEBCfqPzk4A6hNBTPLb5K5M8fe5daC1j", "senderPublicKey": "Fbi4znRWhnfTpM66UtwDaUYYDVsTFApLCrhXNEPunc3E", "proofs": [ "2z4dgsjWGkQdNW8ugQubnvXFoRb4JcTeca2eowNRZJoEv6krzstbb38EjsBCbLoSofQb1UUFBW1kRdYaHUwsVGLR" ], "script": "base64:BgInCAISBAoCCAgSBAoCCAESBQoDAgECEgQKAgIBEgQKAgICEgQKAggYEwAJc2VwYXJhdG9yAgJfXwAHY2hhaW5JZAkAyQECCQDKAQIIBQR0aGlzBWJ5dGVzAAEAAQAIY2hhaW5JZFQBAVQACGNoYWluSWRXAQFXAQttdXN0QWRkcmVzcwIBaQdhZGRyZXNzAwkAAAIIBQFpBmNhbGxlcgUHYWRkcmVzcwYJAAIBAhFwZXJtaXNzaW9uIGRlbmllZAEIbXVzdFRoaXMBAWkJAQttdXN0QWRkcmVzcwIFAWkFBHRoaXMAEWtGYWN0b3J5UHVibGljS2V5AhQlc19fZmFjdG9yeVB1YmxpY0tleQARa1NlcnZpY2VQdWJsaWNLZXkCFCVzX19zZXJ2aWNlUHVibGljS2V5AA9rT3duZXJQdWJsaWNLZXkCEiVzX19vd25lclB1YmxpY0tleQANa0JvdFB1YmxpY0tleQIQJXNfX2JvdFB1YmxpY0tleQEaa0FjY291bnRBZGRyZXNzVG9SZXF1ZXN0SWQBDmFjY291bnRBZGRyZXNzCQC5CQIJAMwIAgIEJXMlcwkAzAgCCQClCAEFDm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2FsbGVyBAZyZXN1bHQJAP0HBAUOc2VydmljZUFkZHJlc3MFCGZ1bmN0aW9uCQDMCAIFBGFyZ3MFA25pbAgFAWkIcGF5bWVudHMJAJQKAgUDbmlsBQZyZXN1bHQJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAnR4AQZ2ZXJpZnkABAxib3RQdWJsaWNLZXkJARFAZXh0ck5hdGl2ZSgxMDUyKQIFDmZhY3RvcnlBZGRyZXNzBQ1rQm90UHVibGljS2V5BAckbWF0Y2gwBQJ0eAMJAAECBQckbWF0Y2gwAgVPcmRlcgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUMYm90UHVibGljS2V5AwkAAQIFByRtYXRjaDACF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uAwkBCWlzRGVmaW5lZAEJAJwIAgUEdGhpcwURa0ZhY3RvcnlQdWJsaWNLZXkHCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5AwkAAAIFB2NoYWluSWQFCGNoYWluSWRXBwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tled78w9w=", "height": 2874921, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let separator = "__" | |
5 | + | ||
6 | + | let chainId = take(drop(this.bytes, 1), 1) | |
7 | + | ||
8 | + | let chainIdT = base58'2T' | |
9 | + | ||
10 | + | let chainIdW = base58'2W' | |
11 | + | ||
12 | + | func mustAddress (i,address) = if ((i.caller == address)) | |
13 | + | then true | |
14 | + | else throw("permission denied") | |
15 | + | ||
16 | + | ||
17 | + | func mustThis (i) = mustAddress(i, this) | |
18 | + | ||
19 | + | ||
20 | + | let kFactoryPublicKey = "%s__factoryPublicKey" | |
21 | + | ||
22 | + | let kServicePublicKey = "%s__servicePublicKey" | |
23 | + | ||
24 | + | let kOwnerPublicKey = "%s__ownerPublicKey" | |
25 | + | ||
26 | + | let kBotPublicKey = "%s__botPublicKey" | |
27 | + | ||
28 | + | func kAccountAddressToRequestId (accountAddress) = makeString(["%s%s", toString(accountAddress), "accountAddressToRequestId"], separator) | |
29 | + | ||
30 | + | ||
31 | + | func kAccountOwner (accountId) = makeString(["%s%s", accountId, "ownerPublicKey"], separator) | |
32 | + | ||
33 | + | ||
34 | + | let factoryAddress = addressFromPublicKey(getBinaryValue(this, kFactoryPublicKey)) | |
35 | + | ||
36 | + | let serviceAddress = addressFromPublicKey(getBinaryValue(factoryAddress, kServicePublicKey)) | |
37 | + | ||
38 | + | let accountId = getStringValue(factoryAddress, kAccountAddressToRequestId(this)) | |
39 | + | ||
40 | + | let ownerPublicKey = getBinaryValue(factoryAddress, kAccountOwner(accountId)) | |
41 | + | ||
42 | + | let ownerAddress = addressFromPublicKey(ownerPublicKey) | |
43 | + | ||
44 | + | func mustService (i) = mustAddress(i, serviceAddress) | |
45 | + | ||
46 | + | ||
47 | + | func mustOwner (i) = mustAddress(i, ownerAddress) | |
48 | + | ||
49 | + | ||
50 | + | @Callable(i) | |
51 | + | func stringEntry (key,val) = if (mustService(i)) | |
52 | + | then $Tuple2([StringEntry(key, val)], key) | |
53 | + | else $Tuple2(nil, unit) | |
54 | + | ||
55 | + | ||
56 | + | ||
57 | + | @Callable(i) | |
58 | + | func integerEntry (key,val) = if (mustService(i)) | |
59 | + | then $Tuple2([IntegerEntry(key, val)], key) | |
60 | + | else $Tuple2(nil, unit) | |
61 | + | ||
62 | + | ||
63 | + | ||
64 | + | @Callable(i) | |
65 | + | func transferAsset (recipientBytes,amount,assetId) = if (mustService(i)) | |
66 | + | then $Tuple2([ScriptTransfer(Address(recipientBytes), amount, assetId)], amount) | |
67 | + | else $Tuple2(nil, unit) | |
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | @Callable(i) | |
72 | + | func transferWaves (recipientBytes,amount) = if (mustService(i)) | |
73 | + | then $Tuple2([ScriptTransfer(Address(recipientBytes), amount, unit)], amount) | |
74 | + | else $Tuple2(nil, unit) | |
75 | + | ||
76 | + | ||
77 | + | ||
78 | + | @Callable(i) | |
79 | + | func init (factoryPublicKey,creatorPublicKey) = { | |
80 | + | let checkCaller = mustThis(i) | |
81 | + | if ((checkCaller == checkCaller)) | |
82 | + | then { | |
83 | + | let completeRequest = invoke(addressFromPublicKey(factoryPublicKey), "addAccount", [creatorPublicKey], nil) | |
84 | + | if ((completeRequest == completeRequest)) | |
85 | + | then $Tuple2([BinaryEntry(kFactoryPublicKey, factoryPublicKey)], unit) | |
86 | + | else throw("Strict value is not equal to itself.") | |
87 | + | } | |
88 | + | else throw("Strict value is not equal to itself.") | |
89 | + | } | |
90 | + | ||
91 | + | ||
92 | + | ||
93 | + | @Callable(i) | |
94 | + | func call (function,args) = { | |
95 | + | let checkCaller = mustOwner(i) | |
96 | + | if ((checkCaller == checkCaller)) | |
97 | + | then { | |
98 | + | let result = reentrantInvoke(serviceAddress, function, [args], i.payments) | |
99 | + | $Tuple2(nil, result) | |
100 | + | } | |
101 | + | else throw("Strict value is not equal to itself.") | |
102 | + | } | |
103 | + | ||
104 | + | ||
105 | + | @Verifier(tx) | |
106 | + | func verify () = { | |
107 | + | let botPublicKey = getBinaryValue(factoryAddress, kBotPublicKey) | |
108 | + | match tx { | |
109 | + | case _: Order => | |
110 | + | sigVerify(tx.bodyBytes, tx.proofs[0], botPublicKey) | |
111 | + | case _: InvokeScriptTransaction => | |
112 | + | if (isDefined(getBinary(this, kFactoryPublicKey))) | |
113 | + | then false | |
114 | + | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
115 | + | case _ => | |
116 | + | if ((chainId == chainIdW)) | |
117 | + | then false | |
118 | + | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
119 | + | } | |
120 | + | } | |
121 | + |
github/deemru/w8io/026f985 17.82 ms ◑