tx · eRxGEJS7CwTN94owiyWe2ntedNWegeJxrf9DaU29xFE
3MrF6QFGLaSKfoNPMd8L3u7KYNm7cE43Ydw: -0.00200000 Waves
2022.10.09 17:29 [2264920] smart account 3MrF6QFGLaSKfoNPMd8L3u7KYNm7cE43Ydw > SELF 0.00000000 Waves
{
"type": 13,
"id": "eRxGEJS7CwTN94owiyWe2ntedNWegeJxrf9DaU29xFE",
"fee": 200000,
"feeAssetId": null,
"timestamp": 1665325739742,
"version": 2,
"chainId": 84,
"sender": "3MrF6QFGLaSKfoNPMd8L3u7KYNm7cE43Ydw",
"senderPublicKey": "6NSakbUsm1WyESQ8yj3qpc1kQUfHWNd5C6CHVpbs4X7c",
"proofs": [
"4cKEVUaTKYPuKCn477V4DbBSfgHw7Kt1vKcWLCGS21ECdDeNG2dH11LYdg8bajoZMozrVDzxFTLrckmA6EuTom6a"
],
"script": "base64:AAIFAAAAAAAAABEIAhIDCgEIEgMKAQgSAwoBCAAAAAgBAAAAEGdldFN0cmluZ09yVGhyb3cAAAACAAAAB2FkZHJlc3MAAAADa2V5CQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQdAAAAAgUAAAAHYWRkcmVzcwUAAAADa2V5CQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAxDYW4ndCByZWFkICcFAAAAA2tleQIAAAANJyBhdCBhZGRyZXNzIAkABCUAAAABBQAAAAdhZGRyZXNzAQAAABNwYXJzZUFkZHJlc3NPclRocm93AAAAAQAAAAxtYXliZUFkZHJlc3MJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABCYAAAABBQAAAAxtYXliZUFkZHJlc3MJAAEsAAAAAgkAASwAAAACAgAAABpDYW4ndCBwYXJzZSBhZGRyZXNzIGZyb20gJwUAAAAMbWF5YmVBZGRyZXNzAgAAAAEnAAAAAAxrZXlfcmVnaXN0cnkCAAAACHJlZ2lzdHJ5AAAAAAhyZWdpc3RyeQkBAAAAE3BhcnNlQWRkcm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ABLUAAAACBQAAAARuYW1lAgAAAAEuBAAAAAZsZXZlbHMJAAGQAAAAAQUAAAAGbGFiZWxzBAAAAAVsYWJlbAkAAZEAAAACBQAAAAZsYWJlbHMJAABlAAAAAgUAAAAGbGV2ZWxzAAAAAAAAAAABCQAFFAAAAAIFAAAAA25pbAkBAAAABV9hZGRyAAAAAQUAAAAFbGFiZWwAAAAAxtTgvQ==",
"height": 2264920,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: EeHr4hgq1yxx3w4mpeeRa7AWjXcgmJqdtssRuCzirVfC
Next: 9mtoGRrmmz573QRFkui8M5Hs8GAQSQs1hWSR8esvfum
Diff:
Old | New | | Differences |
---|
11 | 11 | | |
---|
12 | 12 | | let registry = parseAddressOrThrow(getStringOrThrow(this, key_registry)) |
---|
13 | 13 | | |
---|
14 | | - | func addr (label) = match invoke(registry, "owner", [label], nil) { |
---|
| 14 | + | func isAdmin (inv) = (inv.caller == this) |
---|
| 15 | + | |
---|
| 16 | + | |
---|
| 17 | + | func modifiers (validations) = unit |
---|
| 18 | + | |
---|
| 19 | + | |
---|
| 20 | + | func onlyAdmin (inv) = if (isAdmin(inv)) |
---|
| 21 | + | then unit |
---|
| 22 | + | else throw("Permission denied") |
---|
| 23 | + | |
---|
| 24 | + | |
---|
| 25 | + | func _addr (label) = match invoke(registry, "owner", [label], nil) { |
---|
15 | 26 | | case owner: String => |
---|
16 | 27 | | owner |
---|
17 | 28 | | case _ => |
---|
|
20 | 31 | | |
---|
21 | 32 | | |
---|
22 | 33 | | @Callable(inv) |
---|
23 | | - | func init (registryAddress) = [StringEntry(key_registry, registryAddress)] |
---|
| 34 | + | func init (registryAddress) = valueOrElse(modifiers([onlyAdmin(inv)]), [StringEntry(key_registry, registryAddress)]) |
---|
| 35 | + | |
---|
| 36 | + | |
---|
| 37 | + | |
---|
| 38 | + | @Callable(inv) |
---|
| 39 | + | func addr (label) = $Tuple2(nil, _addr(label)) |
---|
24 | 40 | | |
---|
25 | 41 | | |
---|
26 | 42 | | |
---|
|
31 | 47 | | else split(name, ".") |
---|
32 | 48 | | let levels = size(labels) |
---|
33 | 49 | | let label = labels[(levels - 1)] |
---|
34 | | - | $Tuple2(nil, addr(label)) |
---|
| 50 | + | $Tuple2(nil, _addr(label)) |
---|
35 | 51 | | } |
---|
36 | 52 | | |
---|
37 | 53 | | |
---|
Full:
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 parseAddressOrThrow (maybeAddress) = valueOrErrorMessage(addressFromString(maybeAddress), (("Can't parse address from '" + maybeAddress) + "'")) |
---|
8 | 8 | | |
---|
9 | 9 | | |
---|
10 | 10 | | let key_registry = "registry" |
---|
11 | 11 | | |
---|
12 | 12 | | let registry = parseAddressOrThrow(getStringOrThrow(this, key_registry)) |
---|
13 | 13 | | |
---|
14 | | - | func addr (label) = match invoke(registry, "owner", [label], nil) { |
---|
| 14 | + | func isAdmin (inv) = (inv.caller == this) |
---|
| 15 | + | |
---|
| 16 | + | |
---|
| 17 | + | func modifiers (validations) = unit |
---|
| 18 | + | |
---|
| 19 | + | |
---|
| 20 | + | func onlyAdmin (inv) = if (isAdmin(inv)) |
---|
| 21 | + | then unit |
---|
| 22 | + | else throw("Permission denied") |
---|
| 23 | + | |
---|
| 24 | + | |
---|
| 25 | + | func _addr (label) = match invoke(registry, "owner", [label], nil) { |
---|
15 | 26 | | case owner: String => |
---|
16 | 27 | | owner |
---|
17 | 28 | | case _ => |
---|
18 | 29 | | unit |
---|
19 | 30 | | } |
---|
20 | 31 | | |
---|
21 | 32 | | |
---|
22 | 33 | | @Callable(inv) |
---|
23 | | - | func init (registryAddress) = [StringEntry(key_registry, registryAddress)] |
---|
| 34 | + | func init (registryAddress) = valueOrElse(modifiers([onlyAdmin(inv)]), [StringEntry(key_registry, registryAddress)]) |
---|
| 35 | + | |
---|
| 36 | + | |
---|
| 37 | + | |
---|
| 38 | + | @Callable(inv) |
---|
| 39 | + | func addr (label) = $Tuple2(nil, _addr(label)) |
---|
24 | 40 | | |
---|
25 | 41 | | |
---|
26 | 42 | | |
---|
27 | 43 | | @Callable(inv) |
---|
28 | 44 | | func resolve (name) = { |
---|
29 | 45 | | let labels = if ((size(name) == 0)) |
---|
30 | 46 | | then throw("Name cannot be empty") |
---|
31 | 47 | | else split(name, ".") |
---|
32 | 48 | | let levels = size(labels) |
---|
33 | 49 | | let label = labels[(levels - 1)] |
---|
34 | | - | $Tuple2(nil, addr(label)) |
---|
| 50 | + | $Tuple2(nil, _addr(label)) |
---|
35 | 51 | | } |
---|
36 | 52 | | |
---|
37 | 53 | | |
---|