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:AAIFAAAAAAAAABEIAhIDCgEIEgMKAQgSAwoBCAAAAAgBAAAAEGdldFN0cmluZ09yVGhyb3cAAAACAAAAB2FkZHJlc3MAAAADa2V5CQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQdAAAAAgUAAAAHYWRkcmVzcwUAAAADa2V5CQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAxDYW4ndCByZWFkICcFAAAAA2tleQIAAAANJyBhdCBhZGRyZXNzIAkABCUAAAABBQAAAAdhZGRyZXNzAQAAABNwYXJzZUFkZHJlc3NPclRocm93AAAAAQAAAAxtYXliZUFkZHJlc3MJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABCYAAAABBQAAAAxtYXliZUFkZHJlc3MJAAEsAAAAAgkAASwAAAACAgAAABpDYW4ndCBwYXJzZSBhZGRyZXNzIGZyb20gJwUAAAAMbWF5YmVBZGRyZXNzAgAAAAEnAAAAAAxrZXlfcmVnaXN0cnkCAAAACHJlZ2lzdHJ5AAAAAAhyZWdpc3RyeQkBAAAAE3BhcnNlQWRkcmVzc09yVGhy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AAAARuYW1lAgAAAAEuBAAAAAZsZXZlbHMJAAGQAAAAAQUAAAAGbGFiZWxzBAAAAAVsYWJlbAkAAZEAAAACBQAAAAZsYWJlbHMJAABlAAAAAgUAAAAGbGV2ZWxzAAAAAAAAAAABCQAFFAAAAAIFAAAAA25pbAkBAAAABV9hZGRyAAAAAQUAAAAFbGFiZWwAAAAAxtTgvQ==", "height": 2264920, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EeHr4hgq1yxx3w4mpeeRa7AWjXcgmJqdtssRuCzirVfC Next: 9mtoGRrmmz573QRFkui8M5Hs8GAQSQs1hWSR8esvfum Diff:
OldNewDifferences
1111
1212 let registry = parseAddressOrThrow(getStringOrThrow(this, key_registry))
1313
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) {
1526 case owner: String =>
1627 owner
1728 case _ =>
2031
2132
2233 @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))
2440
2541
2642
3147 else split(name, ".")
3248 let levels = size(labels)
3349 let label = labels[(levels - 1)]
34- $Tuple2(nil, addr(label))
50+ $Tuple2(nil, _addr(label))
3551 }
3652
3753
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func getStringOrThrow (address,key) = valueOrErrorMessage(getString(address, key), ((("Can't read '" + key) + "' at address ") + toString(address)))
55
66
77 func parseAddressOrThrow (maybeAddress) = valueOrErrorMessage(addressFromString(maybeAddress), (("Can't parse address from '" + maybeAddress) + "'"))
88
99
1010 let key_registry = "registry"
1111
1212 let registry = parseAddressOrThrow(getStringOrThrow(this, key_registry))
1313
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) {
1526 case owner: String =>
1627 owner
1728 case _ =>
1829 unit
1930 }
2031
2132
2233 @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))
2440
2541
2642
2743 @Callable(inv)
2844 func resolve (name) = {
2945 let labels = if ((size(name) == 0))
3046 then throw("Name cannot be empty")
3147 else split(name, ".")
3248 let levels = size(labels)
3349 let label = labels[(levels - 1)]
34- $Tuple2(nil, addr(label))
50+ $Tuple2(nil, _addr(label))
3551 }
3652
3753

github/deemru/w8io/169f3d6 
67.75 ms