tx · 37TP2HGXh4WHhv6JsS97atS8hJvgwDQdt3oZZ5nj6N5f 3N7qDfVLtK6WzUGnMe7SKJo4Z5krbQAvuWP: -0.00400000 Waves 2024.09.24 00:02 [3296749] smart account 3N7qDfVLtK6WzUGnMe7SKJo4Z5krbQAvuWP > SELF 0.00000000 Waves
{ "type": 13, "id": "37TP2HGXh4WHhv6JsS97atS8hJvgwDQdt3oZZ5nj6N5f", "fee": 400000, "feeAssetId": null, "timestamp": 1727125377947, "version": 2, "chainId": 84, "sender": "3N7qDfVLtK6WzUGnMe7SKJo4Z5krbQAvuWP", "senderPublicKey": "CW4UxavA4VQuHC35gsPpNHvDChPSW1BdEhBAhD2ez35N", "proofs": [ "5E7eVq9pELejYCLT2NLE72sgDZbD8Kg3KGbWjj9MLD7wdbr3rmMA6jB43HKXVHjWhQv2Kd7Vxszv1HezhqDZLxZR" ], "script": "base64:BgIWCAISAwoBCBIDCgEIEgMKAQgSAwoBCA8BC3dyaXRlU3RyaW5nAgNrZXkFdmFsdWUJAQtTdHJpbmdFbnRyeQIFA2tleQUFdmFsdWUBEHdyaXRlQ29uc3RTdHJpbmcCA2tleQV2YWx1ZQMJAQEhAQkBCWlzRGVmaW5lZAEJAJ0IAgUEdGhpcwUDa2V5CQELU3RyaW5nRW50cnkCBQNrZXkFBXZhbHVlCQACAQkArAICAhVhbHJlYWR5IGluaXRpYWxpemVkOiAFA2tleQANY29uZmlnQWRkcmVzcwUEdGhpcwANdm90aW5nUmVzdWx0cwkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCmCAEJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQ1jb25maWdBZGRyZXNzAhZjb250cmFjdF92b3RpbmdfcmVzdWx0AiFjb25maWc6IG5vIGNvbnRyYWN0X3ZvdGluZ19yZXN1bHQCHmludmFsaWQgY29udHJhY3Rfdm90aW5nX3Jlc3VsdAAGSEVJR0hUBQZoZWlnaHQBBmFkdmlzZQAJAKwCAgIIaGVpZ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scwUIc2VudGluZWwFA25pbAkAzAgCCQELU3RyaW5nRW50cnkCBQ5zZW50aW5lbHNTdG9yZQkArAICCQCsAgIJAQV2YWx1ZQEFDHNlbnRpbmVsc1N0cgIBLAUIc2VudGluZWwFA25pbAECdHgBBnZlcmlmeQAECGJ5Vm90aW5nBAdlbmFibGVkCQELdmFsdWVPckVsc2UCCQCbCAIFDWNvbmZpZ0FkZHJlc3MJAQ5vcEFsbG93ZWRTdG9yZQECE2dvdmVybmFuY2VfYXBwbHlfdHgGAwkBASEBBQdlbmFibGVkCQACAQIrdHggYXBwbGljYXRpb24gdGhyb3cgZ292ZXJuYW5jZSBub3QgZW5hYmxlZAQCaWQJANgEAQgFAnR4AmlkCQBnAgUGSEVJR0hUCQERQGV4dHJOYXRpdmUoMTA1MCkCBQ12b3RpbmdSZXN1bHRzCQCsAgIJAKwCAgkArAICAhlwcm9wb3NhbF9hbGxvd19icm9hZGNhc3RfCQClCAEFBHRoaXMCAV8FAmlkAwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleQYFCGJ5Vm90aW5nZ+1vnw==", "height": 3296749, "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 | + | func writeString (key,value) = StringEntry(key, value) | |
5 | + | ||
6 | + | ||
7 | + | func writeConstString (key,value) = if (!(isDefined(getString(this, key)))) | |
8 | + | then StringEntry(key, value) | |
9 | + | else throw(("already initialized: " + key)) | |
10 | + | ||
11 | + | ||
12 | + | let configAddress = this | |
13 | + | ||
14 | + | let votingResults = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(configAddress, "contract_voting_result"), "config: no contract_voting_result")), "invalid contract_voting_result") | |
15 | + | ||
16 | + | let HEIGHT = height | |
17 | + | ||
18 | + | func advise () = ("height: " + toString(HEIGHT)) | |
19 | + | ||
20 | + | ||
21 | + | let ops = ["stake", "unstake", "governance_propose_tx", "governance_edit_attachments", "governance_vote_tx", "governance_retract_vote", "governance_retract_proposal_tx", "governance_apply_tx"] | |
22 | + | ||
23 | + | let systemControlStore = "system_allowed" | |
24 | + | ||
25 | + | func opAllowedStore (op) = if (isDefined(indexOf(ops, op))) | |
26 | + | then (("op_" + op) + "_allowed") | |
27 | + | else throw((("Invalid argument: op. " + op) + " operation is not registered")) | |
28 | + | ||
29 | + | ||
30 | + | func opUnpauseStore (op) = (("op_" + op) + "_unpaused_by") | |
31 | + | ||
32 | + | ||
33 | + | let sentinelsStore = "sentinels" | |
34 | + | ||
35 | + | let sentinelsStr = getString(this, sentinelsStore) | |
36 | + | ||
37 | + | let sentinels = if (isDefined(sentinelsStr)) | |
38 | + | then split(value(sentinelsStr), ",") | |
39 | + | else nil | |
40 | + | ||
41 | + | func assertSentinel (s) = valueOrErrorMessage(indexOf(sentinels, toString(s)), "pauseOp denied") | |
42 | + | ||
43 | + | ||
44 | + | func quorum () = { | |
45 | + | let all = size(sentinels) | |
46 | + | if ((3 > all)) | |
47 | + | then 1 | |
48 | + | else ((all / 2) + 1) | |
49 | + | } | |
50 | + | ||
51 | + | ||
52 | + | @Callable(i) | |
53 | + | func opAllowed (op) = { | |
54 | + | let store = opAllowedStore(op) | |
55 | + | if (contains(valueOrElse(getString(this, "stoplist"), ""), toString(i.originCaller))) | |
56 | + | then throw("operation paused by stoplist") | |
57 | + | else if (contains(valueOrElse(getString(this, "exc"), ""), toString(i.originCaller))) | |
58 | + | then $Tuple2(nil, true) | |
59 | + | else { | |
60 | + | let enabled0 = valueOrElse(getBoolean(this, systemControlStore), true) | |
61 | + | let enabled1 = valueOrElse(getBoolean(this, store), true) | |
62 | + | if (!(enabled0)) | |
63 | + | then throw((("operation paused by " + systemControlStore) + "=false")) | |
64 | + | else if (!(enabled1)) | |
65 | + | then throw((("operation paused by " + store) + "=false")) | |
66 | + | else $Tuple2(nil, true) | |
67 | + | } | |
68 | + | } | |
69 | + | ||
70 | + | ||
71 | + | ||
72 | + | @Callable(i) | |
73 | + | func pauseOp (op) = { | |
74 | + | let s = assertSentinel(i.caller) | |
75 | + | if ((s == s)) | |
76 | + | then [BooleanEntry(opAllowedStore(op), false)] | |
77 | + | else throw("Strict value is not equal to itself.") | |
78 | + | } | |
79 | + | ||
80 | + | ||
81 | + | ||
82 | + | @Callable(i) | |
83 | + | func unpauseOp (op) = { | |
84 | + | let s = assertSentinel(i.caller) | |
85 | + | if ((s == s)) | |
86 | + | then { | |
87 | + | let store = opAllowedStore(op) | |
88 | + | if (valueOrElse(getBoolean(this, store), true)) | |
89 | + | then throw("unpauseOp: invalid operation") | |
90 | + | else { | |
91 | + | let sentinel = toString(i.caller) | |
92 | + | let unpausedByStore = opUnpauseStore(op) | |
93 | + | let unpausedByStr = getString(this, unpausedByStore) | |
94 | + | let q = quorum() | |
95 | + | if (isDefined(unpausedByStr)) | |
96 | + | then { | |
97 | + | let unpausedByValue = value(unpausedByStr) | |
98 | + | let unpausedBy = split(unpausedByValue, ",") | |
99 | + | if (isDefined(indexOf(unpausedBy, sentinel))) | |
100 | + | then throw("duplicate unpause") | |
101 | + | else if (((size(unpausedBy) + 1) == q)) | |
102 | + | then [DeleteEntry(store), DeleteEntry(unpausedByStore)] | |
103 | + | else [StringEntry(unpausedByStore, ((unpausedByValue + ",") + sentinel))] | |
104 | + | } | |
105 | + | else if ((q == 1)) | |
106 | + | then [DeleteEntry(store)] | |
107 | + | else [StringEntry(unpausedByStore, sentinel)] | |
108 | + | } | |
109 | + | } | |
110 | + | else throw("Strict value is not equal to itself.") | |
111 | + | } | |
112 | + | ||
113 | + | ||
114 | + | ||
115 | + | @Callable(i) | |
116 | + | func addSentinel (sentinel) = if ((i.caller != this)) | |
117 | + | then throw("only self can add sentinel") | |
118 | + | else if (!(isDefined(sentinelsStr))) | |
119 | + | then [StringEntry(sentinelsStore, sentinel)] | |
120 | + | else if (isDefined(indexOf(sentinels, sentinel))) | |
121 | + | then nil | |
122 | + | else [StringEntry(sentinelsStore, ((value(sentinelsStr) + ",") + sentinel))] | |
123 | + | ||
124 | + | ||
125 | + | @Verifier(tx) | |
126 | + | func verify () = { | |
127 | + | let byVoting = { | |
128 | + | let enabled = valueOrElse(getBoolean(configAddress, opAllowedStore("governance_apply_tx")), true) | |
129 | + | if (!(enabled)) | |
130 | + | then throw("tx application throw governance not enabled") | |
131 | + | else { | |
132 | + | let id = toBase58String(tx.id) | |
133 | + | (HEIGHT >= getIntegerValue(votingResults, ((("proposal_allow_broadcast_" + toString(this)) + "_") + id))) | |
134 | + | } | |
135 | + | } | |
136 | + | if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
137 | + | then true | |
138 | + | else byVoting | |
139 | + | } | |
140 | + |
github/deemru/w8io/026f985 17.21 ms ◑