tx · B6NEx1WAvDztKCW8MmrRwn3qzd3G3SmTXN4BVuojC5Eh 3MqRUjjV6oHDeCQxet8TjJ6xP2E15SPvFVf: -0.05000000 Waves 2023.10.06 14:55 [2786728] smart account 3MqRUjjV6oHDeCQxet8TjJ6xP2E15SPvFVf > SELF 0.00000000 Waves
{ "type": 13, "id": "B6NEx1WAvDztKCW8MmrRwn3qzd3G3SmTXN4BVuojC5Eh", "fee": 5000000, "feeAssetId": null, "timestamp": 1696593311335, "version": 1, "sender": "3MqRUjjV6oHDeCQxet8TjJ6xP2E15SPvFVf", "senderPublicKey": "5L2HqxLS2Cz2uj6A87pkYuaXFEvgqB7aYxBJyFXFASKt", "proofs": [ "jqp5H7wRbpXiiqW2Rv7jNZ7uGRXns2rLHcS9MWhs8kQcrUJkzjEiNKuDKRym37o4pNxQFAfmTg4Mu9TadREGiEd" ], "script": "base64:BgIWCAISAwoBCBIDCgEIEgMKAQgSAwoBCA8BC3dyaXRlU3RyaW5nAgNrZXkFdmFsdWUJAQtTdHJpbmdFbnRyeQIFA2tleQUFdmFsdWUBEHdyaXRlQ29uc3RTdHJpbmcCA2tleQV2YWx1ZQMJAQEhAQkBCWlzRGVmaW5lZAEJAJ0IAgUEdGhpcwUDa2V5CQELU3RyaW5nRW50cnkCBQNrZXkFBXZhbHVlCQACAQkArAICAhVhbHJlYWR5IGluaXRpYWxpemVkOiAFA2tleQANY29uZmlnQWRkcmVzcwUEdGhpcwANdm90aW5nUmVzdWx0cwkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCmCAEJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQ1jb25maWdBZGRyZXNzAhZjb250cmFjdF92b3RpbmdfcmVzdWx0AiFjb25maWc6IG5vIGNvbnRyYWN0X3ZvdGluZ19yZXN1bHQCHmludmFsaWQgY29udHJhY3Rfdm90aW5nX3Jlc3VsdAAGSEVJR0hUBQZoZWlnaHQBBmFkdmlzZQAJAKwCAgIIaGVpZ2h0OiA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NEZWZpbmVkAQkAzwgCBQlzZW50aW5lbHMFCHNlbnRpbmVsBQNuaWwJAMwIAgkBC1N0cmluZ0VudHJ5AgUOc2VudGluZWxzU3RvcmUJAKwCAgkArAICCQEFdmFsdWUBBQxzZW50aW5lbHNTdHICASwFCHNlbnRpbmVsBQNuaWwBAnR4AQZ2ZXJpZnkABAdlbmFibGVkCQELdmFsdWVPckVsc2UCCQCbCAIFDWNvbmZpZ0FkZHJlc3MJAQ5vcEFsbG93ZWRTdG9yZQECE2dvdmVybmFuY2VfYXBwbHlfdHgGAwkBASEBBQdlbmFibGVkCQACAQIrdHggYXBwbGljYXRpb24gdGhyb3cgZ292ZXJuYW5jZSBub3QgZW5hYmxlZAQCaWQJANgEAQgFAnR4AmlkBAhieVZvdGluZwkAZwIFBkhFSUdIVAkBEUBleHRyTmF0aXZlKDEwNTApAgUNdm90aW5nUmVzdWx0cwkArAICCQCsAgIJAKwCAgIZcHJvcG9zYWxfYWxsb3dfYnJvYWRjYXN0XwkApQgBBQR0aGlzAgFfBQJpZAMJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkGBQhieVZvdGluZ2qm2MQ=", "chainId": 84, "height": 2786728, "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 = ["mint", "stake", "stakeFor", "unstake", "unstakeFrom", "3P7S8KE5vb65mrvqTvJ1RcjyqFLcG4YRzkC_claimAndStake", "3P3gzCuAkVj6spBcpPJ86ysEU2oJxEz8Bpn_claimAndStake", "3PQvswWeXe9Eniue6AMmcVXhQZ3rqergcR8_claimAndStake", "3PN2vcpyjABTCMvPpkkpatBQPan9dUM8dib_claimAndStake", "3PCi8eHuHPLFHV8gDpvQSxL96sNpwfMDKEU_mintTo", "claimAndStake", "restakeFor", "governance_propose_tx", "governance_vote_tx", "governance_retract_vote", "governance_retract_proposal_tx", "governance_apply_tx", "child_governance_propose_tx", "child_governance_vote_tx", "child_governance_retract_vote", "child_governance_retract_proposal_tx", "child_governance_apply_tx", "project", "commit", "undoCommit", "projectFor", "increraseSkin", "commitFor", "invest", "start", "slash", "complete", "cancel", "undoInvest", "undoCommitFor", "commitForMiner", "initNextPeriod", "startPeriod", "start", "slash", "voting_rewards_next_epoch", "voting_rewards_claim"] | |
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 enabled = valueOrElse(getBoolean(configAddress, opAllowedStore("governance_apply_tx")), true) | |
128 | + | if (!(enabled)) | |
129 | + | then throw("tx application throw governance not enabled") | |
130 | + | else { | |
131 | + | let id = toBase58String(tx.id) | |
132 | + | let byVoting = (HEIGHT >= getIntegerValue(votingResults, ((("proposal_allow_broadcast_" + toString(this)) + "_") + id))) | |
133 | + | if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
134 | + | then true | |
135 | + | else byVoting | |
136 | + | } | |
137 | + | } | |
138 | + |
github/deemru/w8io/026f985 22.45 ms ◑