Created
November 30, 2018 06:24
-
-
Save quocle108/e00cd3234c99bbdec0d8b6f8097923e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class sample : eosio::contract{ | |
| public: | |
| sample(account_name account) :eosio::contract(account),_global(_self, _self){} | |
| void freeze(uint64_t frozen) { | |
| require_auth(_self); | |
| _global.set(global_item{frozen}, N(global)); | |
| } | |
| // any public actions | |
| void action(...) { | |
| eosio_assert(isFrozen() != 1, "Contract is frozen!"); | |
| ... | |
| } | |
| private: | |
| struct global_item { | |
| uint64_t frozen; | |
| }; | |
| typedef singleton<N(global), global_item> global_table; | |
| global_table _global; | |
| uint64_t isFrozen() { | |
| return _global.get().frozen; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment