tx · BRmubh4Q92AmW1tpUFNqioS1MbM8pPkpKjCyJme88h88 3MxquWQhzpqXgbqunnFqHFJXTjasEznd1tN: -0.00300000 Waves 2022.10.09 09:14 [2264408] smart account 3MxquWQhzpqXgbqunnFqHFJXTjasEznd1tN > SELF 0.00000000 Waves
{ "type": 13, "id": "BRmubh4Q92AmW1tpUFNqioS1MbM8pPkpKjCyJme88h88", "fee": 300000, "feeAssetId": null, "timestamp": 1665296082836, "version": 2, "chainId": 84, "sender": "3MxquWQhzpqXgbqunnFqHFJXTjasEznd1tN", "senderPublicKey": "GDjexdefwEhShjRTvHgazn3gTrDo74eHpJCAz14cAEeh", "proofs": [ "55k8YA8Ls7eifbYbdegUtZ9fkNjp9csePbx9vWC3ygNajUcqV2z8BG3KEW3s26mhsN4xainPCc3MtRgHGLRBYQt3" ], "script": "base64:AAIFAAAAAAAAAB8IAhIECgIICBIDCgEIEgQKAggIEgMKAQgSBQoDCAgIAAAAEAEAAAAQZ2V0U3RyaW5nT3JUaHJvdwAAAAIAAAAHYWRkcmVzcwAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAADENhbid0IHJlYWQgJwUAAAADa2V5AgAAAA0nIGF0IGFkZHJlc3MgCQAEJQAAAAEFAAAAB2FkZHJlc3MBAAAAEWdldEludGVnZXJPclRocm93AAAAAgAAAAdhZGRyZXNzAAAAA2tleQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEGgAAAAIFAAAAB2FkZHJlc3MFAAAAA2tleQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAMQ2FuJ3QgcmVhZCAnBQAAAANrZXkCAAAADScgYXQgYWRkcmVzcyAJAAQlAAAAAQUAAAAHYWRkcmVzcwEAAAATcGFyc2VBZGRyZXNzT3JUaHJvdwAAAAEAAAAMbWF5YmVBZGRyZ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AAAJX2dldE93bmVyAAAAAQUAAAAEbm9kZQAAAANpbnYBAAAAC3NldFJlc29sdmVyAAAAAgAAAARub2RlAAAACHJlc29sdmVyCQEAAAALdmFsdWVPckVsc2UAAAACCQEAAAAJbW9kaWZpZXJzAAAAAQkABEwAAAACCQEAAAAJb25seU93bmVyAAAAAgUAAAADaW52BQAAAARub2RlBQAAAANuaWwJAQAAAAxfc2V0UmVzb2x2ZXIAAAACBQAAAARub2RlBQAAAAhyZXNvbHZlcgAAAANpbnYBAAAACHJlc29sdmVyAAAAAQAAAARub2RlCQAFFAAAAAIFAAAAA25pbAkBAAAADF9nZXRSZXNvbHZlcgAAAAEFAAAABG5vZGUAAAADaW52AQAAAAlzZXRSZWNvcmQAAAADAAAABG5vZGUAAAAFb3duZXIAAAAIcmVzb2x2ZXIJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAQAAAAltb2RpZmllcnMAAAABCQAETAAAAAIJAQAAAAlvbmx5QWRtaW4AAAABBQAAAANpbnYFAAAAA25pbAkABE4AAAACCQEAAAAJX3NldE93bmVyAAAAAgUAAAAEbm9kZQUAAAAFb3duZXIJAQAAAAxfc2V0UmVzb2x2ZXIAAAACBQAAAARub2RlBQAAAAhyZXNvbHZlcgAAAAA4X+YD", "height": 2264408, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DqfoVpmRY8jiWmQd4x9YTAHCdspbkS51CjLQz6QLLuRh Next: 2DKr2Yn8WA1WGyyLRdQiHUfaEbSP3uBy5s6tXkPrBKMZ Diff:
Old | New | Differences | |
---|---|---|---|
22 | 22 | func key_Records_ttl (node) = key_entity("Records", node, "ttl") | |
23 | 23 | ||
24 | 24 | ||
25 | - | func _getOwner (node) = | |
25 | + | func _getOwner (node) = getString(this, key_Records_owner(node)) | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func _setOwner (node,owner) = [StringEntry(key_Records_owner(node), owner)] | |
29 | 29 | ||
30 | 30 | ||
31 | + | func _getResolver (node) = getString(this, key_Records_resolver(node)) | |
32 | + | ||
33 | + | ||
31 | 34 | func _setResolver (node,resolver) = [StringEntry(key_Records_resolver(node), resolver)] | |
32 | 35 | ||
33 | 36 | ||
34 | - | func _setTTL (node,ttl) = [IntegerEntry(key_Records_ttl(node), ttl)] | |
37 | + | func isAdmin (inv) = (inv.caller == this) | |
38 | + | ||
39 | + | ||
40 | + | func isOwner (inv,node) = (toString(inv.caller) == valueOrErrorMessage(_getOwner(node), (("Owner for the `" + node) + "` was not found"))) | |
35 | 41 | ||
36 | 42 | ||
37 | 43 | func modifiers (validations) = unit | |
38 | 44 | ||
39 | 45 | ||
40 | - | func | |
46 | + | func onlyAdmin (inv) = if (isAdmin(inv)) | |
41 | 47 | then unit | |
42 | 48 | else throw("Permission denied") | |
43 | 49 | ||
44 | 50 | ||
45 | - | func isSelfOrOwnerCall (inv,node) = if (isDefined(indexOf([this, parseAddressOrThrow(_getOwner(node))], inv.caller))) | |
51 | + | func onlyOwner (inv,node) = if (if (isAdmin(inv)) | |
52 | + | then true | |
53 | + | else isOwner(inv, node)) | |
46 | 54 | then unit | |
47 | 55 | else throw("Permission denied") | |
48 | 56 | ||
49 | 57 | ||
50 | 58 | @Callable(inv) | |
51 | - | func setOwner (node,owner) = valueOrElse(modifiers([ | |
59 | + | func setOwner (node,owner) = valueOrElse(modifiers([onlyOwner(inv, node)]), _setOwner(node, owner)) | |
52 | 60 | ||
53 | 61 | ||
54 | 62 | ||
58 | 66 | ||
59 | 67 | ||
60 | 68 | @Callable(inv) | |
61 | - | func setResolver (node,resolver) = valueOrElse(modifiers([ | |
69 | + | func setResolver (node,resolver) = valueOrElse(modifiers([onlyOwner(inv, node)]), _setResolver(node, resolver)) | |
62 | 70 | ||
63 | 71 | ||
64 | 72 | ||
65 | 73 | @Callable(inv) | |
66 | - | func resolver (node) = $Tuple2(nil, | |
74 | + | func resolver (node) = $Tuple2(nil, _getResolver(node)) | |
67 | 75 | ||
68 | 76 | ||
69 | 77 | ||
70 | 78 | @Callable(inv) | |
71 | - | func setTTL (node,ttl) = valueOrElse(modifiers([isSelfOrOwnerCall(inv, node)]), _setTTL(node, ttl)) | |
72 | - | ||
73 | - | ||
74 | - | ||
75 | - | @Callable(inv) | |
76 | - | func ttl (node) = $Tuple2(nil, getIntegerOrThrow(this, key_Records_ttl(node))) | |
77 | - | ||
78 | - | ||
79 | - | ||
80 | - | @Callable(inv) | |
81 | - | func setRecord (node,owner,resolver,ttl) = valueOrElse(modifiers([isSelfCall(inv)]), ((_setOwner(node, owner) ++ _setResolver(node, resolver)) ++ _setTTL(node, ttl))) | |
79 | + | func setRecord (node,owner,resolver) = valueOrElse(modifiers([onlyAdmin(inv)]), (_setOwner(node, owner) ++ _setResolver(node, resolver))) | |
82 | 80 | ||
83 | 81 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getStringOrThrow (address,key) = valueOrErrorMessage(getString(address, key), ((("Can't read '" + key) + "' at address ") + toString(address))) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func getIntegerOrThrow (address,key) = valueOrErrorMessage(getInteger(address, key), ((("Can't read '" + key) + "' at address ") + toString(address))) | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | func parseAddressOrThrow (maybeAddress) = valueOrErrorMessage(addressFromString(maybeAddress), (("Can't parse address from '" + maybeAddress) + "'")) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func key_entity (name,pk,property) = ((((name + "_") + pk) + "_") + property) | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func key_Records_owner (node) = key_entity("Records", node, "owner") | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func key_Records_resolver (node) = key_entity("Records", node, "resolver") | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func key_Records_ttl (node) = key_entity("Records", node, "ttl") | |
23 | 23 | ||
24 | 24 | ||
25 | - | func _getOwner (node) = | |
25 | + | func _getOwner (node) = getString(this, key_Records_owner(node)) | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func _setOwner (node,owner) = [StringEntry(key_Records_owner(node), owner)] | |
29 | 29 | ||
30 | 30 | ||
31 | + | func _getResolver (node) = getString(this, key_Records_resolver(node)) | |
32 | + | ||
33 | + | ||
31 | 34 | func _setResolver (node,resolver) = [StringEntry(key_Records_resolver(node), resolver)] | |
32 | 35 | ||
33 | 36 | ||
34 | - | func _setTTL (node,ttl) = [IntegerEntry(key_Records_ttl(node), ttl)] | |
37 | + | func isAdmin (inv) = (inv.caller == this) | |
38 | + | ||
39 | + | ||
40 | + | func isOwner (inv,node) = (toString(inv.caller) == valueOrErrorMessage(_getOwner(node), (("Owner for the `" + node) + "` was not found"))) | |
35 | 41 | ||
36 | 42 | ||
37 | 43 | func modifiers (validations) = unit | |
38 | 44 | ||
39 | 45 | ||
40 | - | func | |
46 | + | func onlyAdmin (inv) = if (isAdmin(inv)) | |
41 | 47 | then unit | |
42 | 48 | else throw("Permission denied") | |
43 | 49 | ||
44 | 50 | ||
45 | - | func isSelfOrOwnerCall (inv,node) = if (isDefined(indexOf([this, parseAddressOrThrow(_getOwner(node))], inv.caller))) | |
51 | + | func onlyOwner (inv,node) = if (if (isAdmin(inv)) | |
52 | + | then true | |
53 | + | else isOwner(inv, node)) | |
46 | 54 | then unit | |
47 | 55 | else throw("Permission denied") | |
48 | 56 | ||
49 | 57 | ||
50 | 58 | @Callable(inv) | |
51 | - | func setOwner (node,owner) = valueOrElse(modifiers([ | |
59 | + | func setOwner (node,owner) = valueOrElse(modifiers([onlyOwner(inv, node)]), _setOwner(node, owner)) | |
52 | 60 | ||
53 | 61 | ||
54 | 62 | ||
55 | 63 | @Callable(inv) | |
56 | 64 | func owner (node) = $Tuple2(nil, _getOwner(node)) | |
57 | 65 | ||
58 | 66 | ||
59 | 67 | ||
60 | 68 | @Callable(inv) | |
61 | - | func setResolver (node,resolver) = valueOrElse(modifiers([ | |
69 | + | func setResolver (node,resolver) = valueOrElse(modifiers([onlyOwner(inv, node)]), _setResolver(node, resolver)) | |
62 | 70 | ||
63 | 71 | ||
64 | 72 | ||
65 | 73 | @Callable(inv) | |
66 | - | func resolver (node) = $Tuple2(nil, | |
74 | + | func resolver (node) = $Tuple2(nil, _getResolver(node)) | |
67 | 75 | ||
68 | 76 | ||
69 | 77 | ||
70 | 78 | @Callable(inv) | |
71 | - | func setTTL (node,ttl) = valueOrElse(modifiers([isSelfOrOwnerCall(inv, node)]), _setTTL(node, ttl)) | |
72 | - | ||
73 | - | ||
74 | - | ||
75 | - | @Callable(inv) | |
76 | - | func ttl (node) = $Tuple2(nil, getIntegerOrThrow(this, key_Records_ttl(node))) | |
77 | - | ||
78 | - | ||
79 | - | ||
80 | - | @Callable(inv) | |
81 | - | func setRecord (node,owner,resolver,ttl) = valueOrElse(modifiers([isSelfCall(inv)]), ((_setOwner(node, owner) ++ _setResolver(node, resolver)) ++ _setTTL(node, ttl))) | |
79 | + | func setRecord (node,owner,resolver) = valueOrElse(modifiers([onlyAdmin(inv)]), (_setOwner(node, owner) ++ _setResolver(node, resolver))) | |
82 | 80 | ||
83 | 81 |
github/deemru/w8io/026f985 84.40 ms ◑