tx · ER7VviJafYeNnoqZMvSHHHzEDsvcVg84HuXT6Qt6s6XG 3N5a16cABKGmRmXHNnbHsbGkuDSEmP3GG94: -0.00200000 Waves 2022.08.17 13:25 [2188348] smart account 3N5a16cABKGmRmXHNnbHsbGkuDSEmP3GG94 > SELF 0.00000000 Waves
{ "type": 13, "id": "ER7VviJafYeNnoqZMvSHHHzEDsvcVg84HuXT6Qt6s6XG", "fee": 200000, "feeAssetId": null, "timestamp": 1660731944040, "version": 2, "chainId": 84, "sender": "3N5a16cABKGmRmXHNnbHsbGkuDSEmP3GG94", "senderPublicKey": "6zFiRnwkNngmowXMn1N6zP6qtNcZHA42siuJJxa3Pk4Z", "proofs": [ "4PMprVcHws4MqJDZybnf3s3oahBiY76au4vW7V1wyKjTsxHnksduAtAHSBQMQ1Z6JHdjwsPS8pW2Cb2GKskfbvxB" ], "script": "base64:BgIHCAISAwoBCAgAA1NFUAICX18ABU1VTFQ4AIDC1y8BFWtleUJlbmVmaWNpYXJ5QWRkcmVzcwACHSVzJXNfX2NmZ19fYmVuZWZpY2lhcnlBZGRyZXNzARZrZXlDb25zdHJ1Y3RvckludGVydmFsAAIhJXMlc19fY2ZnX19ub2RlQ29udHJ1Y3RvckludGVydmFsARNrZXlMYXN0VXBkYXRlSGVpZ2h0AAIVJXNfX2xhc3RVcGRhdGVkSGVpZ2h0ARNrZXlTY3JpcHRVcGRhdGVIYXNoAAIdJXMlc19fbWluZXJfX3NjcmlwdFVwZGF0ZUhhc2gBGGtleVNjcmlwdFVwZGF0ZUFsbG93YW5jZQACIiVzJXNfX21pbmVyX19zY3JpcHRVcGRhdGVBbGxvd2FuY2UADG5vZGVSZWdpc3RyeQkBEUBleHRyTmF0aXZlKDEwNjIpAQIjM012OGY5dFNOSkhXRXplSjc5WWJTVFNBQXVvQ2pSdzR1eVABAWkBC2NvbnN0cnVjdG9yARdiZW5lZmljaWFyeUFkZHJlc3NTdHI1OAMJAQIhPQIFBHRoaXMIBQFpBmNhbGxlcgkAA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IGNhbGwgY29uc3RydWN0b3IgdmVyeSBvZnRlbgkAxhMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleQkAAgECLkludm9rZVNjcmlwdFRyYW5zYWN0aW9uIC0gaW52YWxpZCBkYXBwIGFkZHJlc3MDCQABAgUHJG1hdGNoMAIUU2V0U2NyaXB0VHJhbnNhY3Rpb24EA3N0eAUHJG1hdGNoMAQLc2NyaXB0Qnl0ZXMJAQV2YWx1ZQEIBQNzdHgGc2NyaXB0BARoYXNoCQDYBAEJAPEVAQULc2NyaXB0Qnl0ZXMEC2FsbG93ZWRIYXNoCQELdmFsdWVPckVsc2UCCQCdCAIFDG5vZGVSZWdpc3RyeQkBE2tleVNjcmlwdFVwZGF0ZUhhc2gAAgAEC3ZhbGlkQnlIYXNoAwkBAiE9AgULYWxsb3dlZEhhc2gCAAkAAAIFC2FsbG93ZWRIYXNoBQRoYXNoBwQNYWxsb3dUb1VwZGF0ZQkBC3ZhbHVlT3JFbHNlAgkAmwgCBQxub2RlUmVnaXN0cnkJARhrZXlTY3JpcHRVcGRhdGVBbGxvd2FuY2UABwMFDWFsbG93VG9VcGRhdGUFC3ZhbGlkQnlIYXNoBwkAAgECC25vdCBhbGxvd2VkdoOJLQ==", "height": 2188348, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
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("3Mv8f9tSNJHWEzeJ79YbSTSAAuoCjRw4uyP") | |
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 (isDefined(inv.feeAssetId)) | |
40 | + | then throw("InvokeScriptTransaction - only WAVES is allowed as feeAssetId") | |
41 | + | else if ((addressFromRecipient(inv.dApp) == nodeRegistry)) | |
42 | + | then true | |
43 | + | else if ((addressFromRecipient(inv.dApp) == this)) | |
44 | + | then { | |
45 | + | let lastUpdatedHeight = valueOrElse(getInteger(this, keyLastUpdateHeight()), 0) | |
46 | + | let constrInterval = valueOrElse(getInteger(nodeRegistry, keyConstructorInterval()), 1) | |
47 | + | if ((constrInterval > (height - lastUpdatedHeight))) | |
48 | + | then throw("InvokeScriptTransaction - impossible to call constructor very often") | |
49 | + | else sigVerify_32Kb(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
50 | + | } | |
51 | + | else throw("InvokeScriptTransaction - invalid dapp address") | |
52 | + | case stx: SetScriptTransaction => | |
53 | + | let scriptBytes = value(stx.script) | |
54 | + | let hash = toBase58String(blake2b256_32Kb(scriptBytes)) | |
55 | + | let allowedHash = valueOrElse(getString(nodeRegistry, keyScriptUpdateHash()), "") | |
56 | + | let validByHash = if ((allowedHash != "")) | |
57 | + | then (allowedHash == hash) | |
58 | + | else false | |
59 | + | let allowToUpdate = valueOrElse(getBoolean(nodeRegistry, keyScriptUpdateAllowance()), false) | |
60 | + | if (allowToUpdate) | |
61 | + | then validByHash | |
62 | + | else false | |
63 | + | case _ => | |
64 | + | throw("not allowed") | |
65 | + | } | |
66 | + |
github/deemru/w8io/026f985 22.10 ms ◑