Switchable
component that can be used to add a switch that can be either on or off.
It contains a storage variable switchable_value
, a function switch
and an event Switch
.
ISwitchableComponent<TContractState>
)_init
internal function and call it from the contract’s constructor. In the previous example, the _off
function will be used this way.
Ownable
, Upgradeable
, … ~able
).
This is why we called the component in the above example Switchable
, and not Switch
; the contract is switchable, it does not have a switch.Switchable
component:
Mock
contract that has the only purpose of testing the component.
To test the Switchable
component, we can use the previous SwitchableContract
: