tx · DNKsq9YSMbw8oKTkueroW2MBr9MtcSmb4xdGsJNjhtsM 3MzfWTz6oukwgSkLZZ1PaXJ5G4Hs1SbY1EL: -0.01400000 Waves 2021.02.02 14:52 [1380504] smart account 3MzfWTz6oukwgSkLZZ1PaXJ5G4Hs1SbY1EL > SELF 0.00000000 Waves
{ "type": 13, "id": "DNKsq9YSMbw8oKTkueroW2MBr9MtcSmb4xdGsJNjhtsM", "fee": 1400000, "feeAssetId": null, "timestamp": 1612266806256, "version": 2, "chainId": 84, "sender": "3MzfWTz6oukwgSkLZZ1PaXJ5G4Hs1SbY1EL", "senderPublicKey": "BNd7hiKD3bj6sP3wADPJJW1tzLQ1UZeg1uDQC3HrELMF", "proofs": [ "2zt2nRTP2uDzdb7Kix9XEajn9HyiKqMX72zY8xiVfwmvc9uCjtQVghWRFMoJnBkSDmCXPexLUXQtqq1kp6eYDHW3" ], "script": "base64:AAIEAAAAAAAAAAwIAhIDCgEIEgMKAQgAAAALAAAAAAROT05FAgAAAARub25lAAAAAAZBQ1RJVkUCAAAABmFjdGl2ZQAAAAAHZGFwcEtleQIAAAAEZGFwcAAAAAAIb3duZXJLZXkCAAAABW93bmVyAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FAQAAABFnZXRFeHROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQM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ga2V5IGlzc3VlcgMDCQEAAAACIT0AAAACBQAAAAlvd25lckFkZHIIBQAAAAFpAAAABmNhbGxlcgkBAAAAAiE9AAAAAgUAAAAIZGFwcEFkZHIIBQAAAAFpAAAABmNhbGxlcgcJAAACAAAAAQIAAAANTm90IHBlcm1pdHRlZAMJAQAAAAIhPQAAAAIJAQAAAAhuZnRWYWx1ZQAAAAEFAAAABWtleUlEBQAAAAROT05FCQAAAgAAAAECAAAAHFRoaXMga2V5IGlzIGFscmVhZHkgYXNzaWduZWQJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkBAAAABm5mdEtleQAAAAEFAAAABWtleUlEBQAAAAZBQ1RJVkUFAAAAA25pbAAAAAFpAQAAAAlyZW1vdmVLZXkAAAABAAAABWtleUlEBAAAAAhkYXBwQWRkcgkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQkBAAAAC2dldFN0ckJ5S2V5AAAAAQUAAAAHZGFwcEtleQQAAAAJb3duZXJBZGRyCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABCQEAAAALZ2V0U3RyQnlLZXkAAAABBQAAAAhvd25lcktleQMDCQEAAAACIT0AAAACBQAAAAlvd25lckFkZHIIBQAAAAFpAAAABmNhbGxlcgkBAAAAAiE9AAAAAgUAAAAIZGFwcEFkZHIIBQAAAAFpAAAABmNhbGxlcgcJAAACAAAAAQIAAAANTm90IHBlcm1pdHRlZAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAAGbmZ0S2V5AAAAAQUAAAAFa2V5SUQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V56FLaHA==", "height": 1380504, "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 NONE = "none" | |
5 | + | ||
6 | + | let ACTIVE = "active" | |
7 | + | ||
8 | + | let dappKey = "dapp" | |
9 | + | ||
10 | + | let ownerKey = "owner" | |
11 | + | ||
12 | + | func getNumberByKey (key) = match getInteger(this, key) { | |
13 | + | case a: Int => | |
14 | + | a | |
15 | + | case _ => | |
16 | + | 0 | |
17 | + | } | |
18 | + | ||
19 | + | ||
20 | + | func getStrByKey (key) = match getString(this, key) { | |
21 | + | case a: String => | |
22 | + | a | |
23 | + | case _ => | |
24 | + | NONE | |
25 | + | } | |
26 | + | ||
27 | + | ||
28 | + | func getExtNumberByKey (key) = match getInteger(this, key) { | |
29 | + | case a: Int => | |
30 | + | a | |
31 | + | case _ => | |
32 | + | 0 | |
33 | + | } | |
34 | + | ||
35 | + | ||
36 | + | func getExtStrByKey (addr,key) = match getString(addr, key) { | |
37 | + | case a: String => | |
38 | + | a | |
39 | + | case _ => | |
40 | + | NONE | |
41 | + | } | |
42 | + | ||
43 | + | ||
44 | + | func nftKey (nft) = ("key_" + nft) | |
45 | + | ||
46 | + | ||
47 | + | func nftValue (nft) = getStrByKey(nftKey(nft)) | |
48 | + | ||
49 | + | ||
50 | + | func getAssetInfo (asset) = match assetInfo(asset) { | |
51 | + | case t: Asset => | |
52 | + | t | |
53 | + | case _ => | |
54 | + | throw("Not a key") | |
55 | + | } | |
56 | + | ||
57 | + | ||
58 | + | @Callable(i) | |
59 | + | func addKey (keyID) = { | |
60 | + | let callerAddress = toBase58String(i.caller.bytes) | |
61 | + | let keyInfo = getAssetInfo(fromBase58String(keyID)) | |
62 | + | let dappAddr = addressFromStringValue(getStrByKey(dappKey)) | |
63 | + | let ownerAddr = addressFromStringValue(getStrByKey(ownerKey)) | |
64 | + | if ((keyInfo.issuer != dappAddr)) | |
65 | + | then throw("Wrong key issuer") | |
66 | + | else if (if ((ownerAddr != i.caller)) | |
67 | + | then (dappAddr != i.caller) | |
68 | + | else false) | |
69 | + | then throw("Not permitted") | |
70 | + | else if ((nftValue(keyID) != NONE)) | |
71 | + | then throw("This key is already assigned") | |
72 | + | else [StringEntry(nftKey(keyID), ACTIVE)] | |
73 | + | } | |
74 | + | ||
75 | + | ||
76 | + | ||
77 | + | @Callable(i) | |
78 | + | func removeKey (keyID) = { | |
79 | + | let dappAddr = addressFromStringValue(getStrByKey(dappKey)) | |
80 | + | let ownerAddr = addressFromStringValue(getStrByKey(ownerKey)) | |
81 | + | if (if ((ownerAddr != i.caller)) | |
82 | + | then (dappAddr != i.caller) | |
83 | + | else false) | |
84 | + | then throw("Not permitted") | |
85 | + | else [DeleteEntry(nftKey(keyID))] | |
86 | + | } | |
87 | + | ||
88 | + | ||
89 | + | @Verifier(tx) | |
90 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
91 | + |
github/deemru/w8io/169f3d6 14.82 ms ◑