tx · CAwvpc4nKLND1DSMzkNcaDhVQpVe1ijtyqTx2fVdDexm 3MsEYrugWRGMvdKBKChVCjg2qoKea8Ko9vY: -0.00300000 Waves 2022.07.07 13:35 [2129155] smart account 3MsEYrugWRGMvdKBKChVCjg2qoKea8Ko9vY > SELF 0.00000000 Waves
{ "type": 13, "id": "CAwvpc4nKLND1DSMzkNcaDhVQpVe1ijtyqTx2fVdDexm", "fee": 300000, "feeAssetId": null, "timestamp": 1657190176796, "version": 2, "chainId": 84, "sender": "3MsEYrugWRGMvdKBKChVCjg2qoKea8Ko9vY", "senderPublicKey": "A8DvbFTEjyHFvpK57CmHu6QKczzymTB5sgqq8xxjNsXG", "proofs": [ "5ZarYsp8No4VJoaMFjo4UimTpnFdEpkzLGL25CjQABYPyGMfzMFPf9Gs2J9Kujhj8arxjynNEWsfnHnwFqHyMc7S" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEIAAAACAAAAAADU0VQAgAAAAJfXwAAAAAFTVVMVDgAAAAAAAX14QABAAAAFWtleUJlbmVmaWNpYXJ5QWRkcmVzcwAAAAACAAAAHSVzJXNfX2NmZ19fYmVuZWZpY2lhcnlBZGRyZXNzAQAAABZrZXlDb25zdHJ1Y3RvckludGVydmFsAAAAAAIAAAAhJXMlc19fY2ZnX19ub2RlQ29udHJ1Y3RvckludGVydmFsAQAAABNrZXlMYXN0VXBkYXRlSGVpZ2h0AAAAAAIAAAAVJXNfX2xhc3RVcGRhdGVkSGVpZ2h0AQAAABNrZXlTY3JpcHRVcGRhdGVIYXNoAAAAAAIAAAAdJXMlc19fbWluZXJfX3NjcmlwdFVwZGF0ZUhhc2gBAAAAGGtleVNjcmlwdFVwZGF0ZUFsbG93YW5jZQAAAAACAAAAIiVzJXNfX21pbmVyX19zY3JpcHRVcGRhdGVBbGxvd2FuY2UAAAAADG5vZGVSZWdpc3RyeQkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQIAAAAjM01zVTkzNmJyaXFRMlhaTXBraFd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0eAAAAANmZWUJAABpAAAAAgkAAGgAAAACAAAAAAAAAAACBQAAAAVNVUxUOAAAAAAAAAAACgkAAAIAAAABCQABLAAAAAICAAAAP1NldFNjcmlwdFRyYW5zYWN0aW9uIC0gZmVlIGFtb3VudCBpcyBncmVhdGVyIHRoYW4gbWF4IGFsbG93ZWQ6IAkAAaQAAAABCAUAAAADc3R4AAAAA2ZlZQQAAAALc2NyaXB0Qnl0ZXMJAQAAAAV2YWx1ZQAAAAEIBQAAAANzdHgAAAAGc2NyaXB0BAAAAARoYXNoCQACWAAAAAEJAArxAAAAAQUAAAALc2NyaXB0Qnl0ZXMEAAAAC2FsbG93ZWRIYXNoCQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAADG5vZGVSZWdpc3RyeQkBAAAAE2tleVNjcmlwdFVwZGF0ZUhhc2gAAAAAAgAAAAAEAAAAC3ZhbGlkQnlIYXNoAwkBAAAAAiE9AAAAAgUAAAALYWxsb3dlZEhhc2gCAAAAAAkAAAAAAAACBQAAAAthbGxvd2VkSGFzaAUAAAAEaGFzaAcEAAAADWFsbG93VG9VcGRhdGUJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQbAAAAAgUAAAAMbm9kZVJlZ2lzdHJ5CQEAAAAYa2V5U2NyaXB0VXBkYXRlQWxsb3dhbmNlAAAAAAcDBQAAAA1hbGxvd1RvVXBkYXRlBQAAAAt2YWxpZEJ5SGFzaAcJAAACAAAAAQIAAAALbm90IGFsbG93ZWQLxE0X", "height": 2129155, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CSBoRczciNow8QSq5YFuNwKweECUXb7joYJX41uGJvky Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let MULT8 = 100000000 | |
7 | 7 | ||
8 | 8 | func keyBeneficiaryAddress () = "%s%s__cfg__beneficiaryAddress" | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func keyConstructorInterval () = "%s%s__cfg__nodeContructorInterval" | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | func keyLastUpdateHeight () = "%s__lastUpdatedHeight" | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func keyScriptUpdateHash () = "%s%s__miner__scriptUpdateHash" | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func keyScriptUpdateAllowance () = "%s%s__miner__scriptUpdateAllowance" | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | let nodeRegistry = addressFromStringValue("3MsU936briqQ2XZMpkhWdrV8EsNwm5iCuRY") | |
24 | 24 | ||
25 | 25 | @Callable(i) | |
26 | 26 | func constructor (beneficiaryAddressStr58) = if ((this != i.caller)) | |
27 | 27 | then throw("permissions denied") | |
28 | 28 | else { | |
29 | 29 | let beneficiaryAddress = addressFromStringValue(beneficiaryAddressStr58) | |
30 | 30 | if ((beneficiaryAddress == this)) | |
31 | 31 | then throw("mining node address is not allowed as a beneficiaryAddress") | |
32 | 32 | else [StringEntry(keyBeneficiaryAddress(), toString(beneficiaryAddress)), IntegerEntry(keyLastUpdateHeight(), height)] | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | @Verifier(tx) | |
37 | 37 | func verify () = match tx { | |
38 | 38 | case inv: InvokeScriptTransaction => | |
39 | 39 | if ((inv.fee > ((5 * MULT8) / 1000))) | |
40 | 40 | then throw(("InvokeScriptTransaction - fee amount is greater than max allowed: " + toString(inv.fee))) | |
41 | 41 | else if (isDefined(inv.feeAssetId)) | |
42 | 42 | then throw("InvokeScriptTransaction - only WAVES is allowed as feeAssetId") | |
43 | 43 | else if ((addressFromRecipient(inv.dApp) == nodeRegistry)) | |
44 | 44 | then true | |
45 | 45 | else if ((addressFromRecipient(inv.dApp) == this)) | |
46 | 46 | then { | |
47 | 47 | let lastUpdatedHeight = valueOrElse(getInteger(this, keyLastUpdateHeight()), 0) | |
48 | 48 | let constrInterval = valueOrElse(getInteger(nodeRegistry, keyConstructorInterval()), 43200) | |
49 | 49 | if ((constrInterval > (height - lastUpdatedHeight))) | |
50 | 50 | then throw("InvokeScriptTransaction - impossible to call constructor very often") | |
51 | 51 | else sigVerify_32Kb(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
52 | 52 | } | |
53 | 53 | else throw("InvokeScriptTransaction - invalid dapp address") | |
54 | 54 | case stx: SetScriptTransaction => | |
55 | 55 | if ((stx.fee > ((2 * MULT8) / 10))) | |
56 | 56 | then throw(("SetScriptTransaction - fee amount is greater than max allowed: " + toString(stx.fee))) | |
57 | 57 | else { | |
58 | 58 | let scriptBytes = value(stx.script) | |
59 | 59 | let hash = toBase58String(blake2b256_32Kb(scriptBytes)) | |
60 | 60 | let allowedHash = valueOrElse(getString(nodeRegistry, keyScriptUpdateHash()), "") | |
61 | 61 | let validByHash = if ((allowedHash != "")) | |
62 | 62 | then (allowedHash == hash) | |
63 | 63 | else false | |
64 | 64 | let allowToUpdate = valueOrElse(getBoolean(nodeRegistry, keyScriptUpdateAllowance()), false) | |
65 | 65 | if (allowToUpdate) | |
66 | 66 | then validByHash | |
67 | 67 | else false | |
68 | 68 | } | |
69 | 69 | case _ => | |
70 | 70 | throw("not allowed") | |
71 | 71 | } | |
72 | 72 |
github/deemru/w8io/169f3d6 27.08 ms ◑