tx · 9oBhZPPcv5XoNPH3A8txaYg7ufb6MEw38AfUEzhqNnSo 3Myojf1j7W2S5XSKemGaqErcSYghqCgQ1gp: -0.01400000 Waves 2021.04.14 12:21 [1481939] smart account 3Myojf1j7W2S5XSKemGaqErcSYghqCgQ1gp > SELF 0.00000000 Waves
{ "type": 13, "id": "9oBhZPPcv5XoNPH3A8txaYg7ufb6MEw38AfUEzhqNnSo", "fee": 1400000, "feeAssetId": null, "timestamp": 1618392090416, "version": 2, "chainId": 84, "sender": "3Myojf1j7W2S5XSKemGaqErcSYghqCgQ1gp", "senderPublicKey": "GDR7fuD3XaQrxg1QPmJdTCyjcF7edEaqeUzXdtSDqe39", "proofs": [ "4pTLi2VogcDcxj9HG2U7Lws7uLdvQzDgYNirnmLQ3UAoZiMvDP6Mm452JD6CdY2Wxve9WJ4AR3dn5zpTjS9YoP3b" ], "script": "base64:AAIEAAAAAAAAABUIAhIDCgEIEgUKAwgICBIFCgMICAgAAAAJAAAAAAd2ZXJzaW9uAAAAAAAAAAABAAAAAAlzZXBhcmF0b3ICAAAAA19fXwAAAAALa2V5SW5pdERvbmUCAAAACUlOSVRfRE9ORQAAAAAPa2V5TWFpbk9wZXJhdG9yAgAAAA1NQUlOX09QRVJBVE9SAAAAAAxrZXlQcml2aWxlZ2UCAAAACVBSSVZJTEVHRQEAAAAPaXNBZGRyZXNzU3RyaW5nAAAAAQAAAAxtYXliZUFkZHJlc3MEAAAAByRtYXRjaDAJAAQmAAAAAQUAAAAMbWF5YmVBZGRyZXNzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAdBZGRyZXNzBAAAAAlpc0FkZHJlc3MFAAAAByRtYXRjaDAGBwEAAAANaXNDbGVhclN0cmluZwAAAAEAAAAMc3RyaW5nVG9UZXN0AwkAAAAAAAACCQEAAAAIY29udGFpbnMAAAACBQAAAAxzdHJpbmdUb1Rlc3QFAAAACXNlcGFyYXRvcgcJAAAAAAAAAgkBAAAACGNvbnRhaW5zAAAAAgUAAA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", "height": 1481939, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 4 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let version = 1 | |
5 | + | ||
6 | + | let separator = "___" | |
7 | + | ||
8 | + | let keyInitDone = "INIT_DONE" | |
9 | + | ||
10 | + | let keyMainOperator = "MAIN_OPERATOR" | |
11 | + | ||
12 | + | let keyPrivilege = "PRIVILEGE" | |
13 | + | ||
14 | + | func isAddressString (maybeAddress) = match addressFromString(maybeAddress) { | |
15 | + | case isAddress: Address => | |
16 | + | true | |
17 | + | case _ => | |
18 | + | false | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | func isClearString (stringToTest) = if ((contains(stringToTest, separator) == false)) | |
23 | + | then (contains(stringToTest, " ") == false) | |
24 | + | else false | |
25 | + | ||
26 | + | ||
27 | + | func getFullKeyPrivilege (target,dApp,name) = ((((((keyPrivilege + separator) + target) + separator) + dApp) + separator) + name) | |
28 | + | ||
29 | + | ||
30 | + | func hasPrivilege (callerAddress,privilegeName) = if ((addressFromStringValue(getStringValue(this, keyMainOperator)) == callerAddress)) | |
31 | + | then true | |
32 | + | else match getInteger(this, getFullKeyPrivilege(toBase58String(callerAddress.bytes), toBase58String(this.bytes), privilegeName)) { | |
33 | + | case isInteger: Int => | |
34 | + | true | |
35 | + | case _ => | |
36 | + | false | |
37 | + | } | |
38 | + | ||
39 | + | ||
40 | + | @Callable(i) | |
41 | + | func init (mainOperatorAddress) = if (if ((this != i.caller)) | |
42 | + | then true | |
43 | + | else (valueOrElse(getBoolean(this, keyInitDone), false) != false)) | |
44 | + | then throw("Access denied") | |
45 | + | else match addressFromString(mainOperatorAddress) { | |
46 | + | case isAddress: Address => | |
47 | + | [BooleanEntry(keyInitDone, true), StringEntry(keyMainOperator, mainOperatorAddress)] | |
48 | + | case _ => | |
49 | + | throw("Not an address") | |
50 | + | } | |
51 | + | ||
52 | + | ||
53 | + | ||
54 | + | @Callable(i) | |
55 | + | func addPrivilege (targetAddress,dAppAddress,privilegeName) = if ((hasPrivilege(i.caller, "addPrivilege") != true)) | |
56 | + | then throw("Access denied") | |
57 | + | else if (if ((isAddressString(targetAddress) != true)) | |
58 | + | then true | |
59 | + | else (isAddressString(dAppAddress) != true)) | |
60 | + | then throw("Wrong address") | |
61 | + | else { | |
62 | + | let privilegeNameSize = size(privilegeName) | |
63 | + | if (if ((1 > privilegeNameSize)) | |
64 | + | then true | |
65 | + | else (privilegeNameSize > 32)) | |
66 | + | then throw("privlegeName out-of-range") | |
67 | + | else if (if (if ((isClearString(targetAddress) != true)) | |
68 | + | then true | |
69 | + | else (isClearString(dAppAddress) != true)) | |
70 | + | then true | |
71 | + | else (isClearString(privilegeName) != true)) | |
72 | + | then throw("String not clear") | |
73 | + | else [IntegerEntry(getFullKeyPrivilege(targetAddress, dAppAddress, privilegeName), height)] | |
74 | + | } | |
75 | + | ||
76 | + | ||
77 | + | ||
78 | + | @Callable(i) | |
79 | + | func removePrivilege (targetAddress,dAppAddress,privilegeName) = if ((hasPrivilege(i.caller, "removePrivilege") != true)) | |
80 | + | then throw("Access denied") | |
81 | + | else [DeleteEntry(getFullKeyPrivilege(targetAddress, dAppAddress, privilegeName))] | |
82 | + | ||
83 | + | ||
84 | + | @Verifier(tx) | |
85 | + | func verify () = { | |
86 | + | let publicKey = if ((valueOrElse(getBoolean(this, keyInitDone), false) != true)) | |
87 | + | then tx.senderPublicKey | |
88 | + | else fromBase58String(getStringValue(this, keyMainOperator)) | |
89 | + | sigVerify(tx.bodyBytes, tx.proofs[0], publicKey) | |
90 | + | } | |
91 | + |
github/deemru/w8io/169f3d6 26.40 ms ◑