TransientSlot
TransientSlot
contract Lock {
using TransientSlot for *;
// Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
bytes32 internal constant _LOCK_SLOT = 0xf4678858b2b588224636b8522b729e7722d32fc491da849ed75b3fdf3c84f542;
modifier locked() {
require(!_LOCK_SLOT.asBoolean().tload());
_LOCK_SLOT.asBoolean().tstore(true);
_;
_LOCK_SLOT.asBoolean().tstore(false);
}
}AddressSlot
asAddress
BooleanSlot
asBoolean
Bytes32Slot
asBytes32
Uint256Slot
asUint256
Int256Slot
asInt256
tload
tstore
tload
tstore
tload
tstore
tload
tstore
tload
tstore
Last updated