-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split StorageSlot into TransientSlot (#5239)
Co-authored-by: Hadrien Croubois <[email protected]>
- Loading branch information
1 parent
2bedb02
commit 6325009
Showing
15 changed files
with
434 additions
and
333 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// SPDX-License-Identifier: MIT | ||
// This file was procedurally generated from scripts/generate/templates/TransientSlotMock.js. | ||
|
||
pragma solidity ^0.8.24; | ||
|
||
import {Multicall} from "../utils/Multicall.sol"; | ||
import {TransientSlot} from "../utils/TransientSlot.sol"; | ||
|
||
contract TransientSlotMock is Multicall { | ||
using TransientSlot for *; | ||
|
||
event AddressValue(bytes32 slot, address value); | ||
|
||
function tloadAddress(bytes32 slot) public { | ||
emit AddressValue(slot, slot.asAddress().tload()); | ||
} | ||
|
||
function tstore(bytes32 slot, address value) public { | ||
slot.asAddress().tstore(value); | ||
} | ||
|
||
event BooleanValue(bytes32 slot, bool value); | ||
|
||
function tloadBoolean(bytes32 slot) public { | ||
emit BooleanValue(slot, slot.asBoolean().tload()); | ||
} | ||
|
||
function tstore(bytes32 slot, bool value) public { | ||
slot.asBoolean().tstore(value); | ||
} | ||
|
||
event Bytes32Value(bytes32 slot, bytes32 value); | ||
|
||
function tloadBytes32(bytes32 slot) public { | ||
emit Bytes32Value(slot, slot.asBytes32().tload()); | ||
} | ||
|
||
function tstore(bytes32 slot, bytes32 value) public { | ||
slot.asBytes32().tstore(value); | ||
} | ||
|
||
event Uint256Value(bytes32 slot, uint256 value); | ||
|
||
function tloadUint256(bytes32 slot) public { | ||
emit Uint256Value(slot, slot.asUint256().tload()); | ||
} | ||
|
||
function tstore(bytes32 slot, uint256 value) public { | ||
slot.asUint256().tstore(value); | ||
} | ||
|
||
event Int256Value(bytes32 slot, int256 value); | ||
|
||
function tloadInt256(bytes32 slot) public { | ||
emit Int256Value(slot, slot.asInt256().tload()); | ||
} | ||
|
||
function tstore(bytes32 slot, int256 value) public { | ||
slot.asInt256().tstore(value); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.