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