You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No function decorators if the decorator would be equivalent to a simple function call (see Owner::require_owner). We're trying to stay away from Solidity-style implementations in favor of Rust.
Flags should be implemented as an enum, similar to how roles are for Rbac.
It is probably worth investigating whether bit packing (e.g. using bitflags) is as gas-efficient as checking for storage key existence. If flags are not purely binary, then this point is moot (bit packing is impossible). For example, bit packing would be impossible:
enumMyFlags{PausedOne(u8),PausedTwo,}
Proposed Usage
(derives on MyFlags as of yet undetermined)
enumMyFlags{PausedOne,PausedTwo,}#[derive(Flags)]#[flags(flags = "MyFlags", storage_key = "StorageKey::Flags")]structContract{// ...}implContract{fnone(&self){Self::require_flag_unset(MyFlags::PausedOne);// ...}fnset_one(&self,on:bool){if on {Self::set_flag(MyFlags::PausedOne);}else{Self::unset_flag(MyFlags::PausedOne);}}// similar for MyFlags::PausedTwo}
The text was updated successfully, but these errors were encountered:
@ryancwalsh Allow you to pause individual functions instead of the contract as a whole. That's the inspiration, but bit flags have a huge range of use cases.
Support multiple, binary state flags.
Inspired by the functionality of the pause component in Aurora's NEAR plugins repo: https://github.com/aurora-is-near/near-plugins#pausable
Discussion Points
Owner::require_owner
). We're trying to stay away from Solidity-style implementations in favor of Rust.Rbac
.Proposed Usage
(derives on
MyFlags
as of yet undetermined)The text was updated successfully, but these errors were encountered: