Skip to content

Instantly share code, notes, and snippets.

@quocle108
Created November 30, 2018 06:24
Show Gist options
  • Select an option

  • Save quocle108/e00cd3234c99bbdec0d8b6f8097923e2 to your computer and use it in GitHub Desktop.

Select an option

Save quocle108/e00cd3234c99bbdec0d8b6f8097923e2 to your computer and use it in GitHub Desktop.
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