Skip to content

Commit

Permalink
Merge and update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
shuhuiluo committed May 17, 2024
2 parents 68d3322 + 6786fd4 commit dd77e47
Show file tree
Hide file tree
Showing 96 changed files with 2,317 additions and 511 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
151104
153643
2 changes: 1 addition & 1 deletion .forge-snapshots/addLiquidity CA fee.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
329428
331619
2 changes: 1 addition & 1 deletion .forge-snapshots/addLiquidity with empty hook.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
284069
286612
2 changes: 1 addition & 1 deletion .forge-snapshots/addLiquidity with native token.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
141237
143853
1 change: 0 additions & 1 deletion .forge-snapshots/addLiquidity.snap

This file was deleted.

1 change: 1 addition & 0 deletions .forge-snapshots/calculateSwapFee.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
33
Original file line number Diff line number Diff line change
@@ -1 +1 @@
299616
302131
2 changes: 1 addition & 1 deletion .forge-snapshots/donate gas with 1 token.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
108687
107894
2 changes: 1 addition & 1 deletion .forge-snapshots/donate gas with 2 tokens.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
149222
148384
2 changes: 1 addition & 1 deletion .forge-snapshots/erc20 collect protocol fees.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
57354
57275
1 change: 1 addition & 0 deletions .forge-snapshots/extsload getFeeGrowthGlobals.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1344
1 change: 1 addition & 0 deletions .forge-snapshots/extsload getFeeGrowthInside.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
446
1 change: 1 addition & 0 deletions .forge-snapshots/extsload getLiquidity.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
446
1 change: 1 addition & 0 deletions .forge-snapshots/extsload getPositionInfo.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1606
1 change: 1 addition & 0 deletions .forge-snapshots/extsload getPositionLiquidity.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
446
1 change: 1 addition & 0 deletions .forge-snapshots/extsload getSlot0.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
446
1 change: 1 addition & 0 deletions .forge-snapshots/extsload getTickBitmap.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
446
1 change: 1 addition & 0 deletions .forge-snapshots/extsload getTickFeeGrowthOutside.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1344
1 change: 1 addition & 0 deletions .forge-snapshots/extsload getTickInfo.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1606
1 change: 1 addition & 0 deletions .forge-snapshots/extsload getTickLiquidity.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
446
1 change: 1 addition & 0 deletions .forge-snapshots/getReserves.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1198
2 changes: 1 addition & 1 deletion .forge-snapshots/initialize.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
62245
61862
2 changes: 1 addition & 1 deletion .forge-snapshots/native collect protocol fees.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
59587
59520
2 changes: 1 addition & 1 deletion .forge-snapshots/poolManager bytecode size.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23656
21796
2 changes: 1 addition & 1 deletion .forge-snapshots/removeLiquidity CA fee.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
184915
187085
2 changes: 1 addition & 1 deletion .forge-snapshots/removeLiquidity with empty hook.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
120959
123453
2 changes: 1 addition & 1 deletion .forge-snapshots/removeLiquidity with native token.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
117734
120240
1 change: 0 additions & 1 deletion .forge-snapshots/removeLiquidity.snap

This file was deleted.

1 change: 1 addition & 0 deletions .forge-snapshots/set protocol fee.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
32415
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
104932
1 change: 1 addition & 0 deletions .forge-snapshots/simple addLiquidity.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
167734
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
98529
1 change: 1 addition & 0 deletions .forge-snapshots/simple removeLiquidity.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
90879
2 changes: 1 addition & 1 deletion .forge-snapshots/simple swap with native.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
117109
116827
2 changes: 1 addition & 1 deletion .forge-snapshots/simple swap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
132348
131988
2 changes: 1 addition & 1 deletion .forge-snapshots/swap CA custom curve + swap noop.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
135860
134432
2 changes: 1 addition & 1 deletion .forge-snapshots/swap CA fee on unspecified.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
184579
183126
Original file line number Diff line number Diff line change
@@ -1 +1 @@
113651
112548
2 changes: 1 addition & 1 deletion .forge-snapshots/swap against liquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
125072
123891
2 changes: 1 addition & 1 deletion .forge-snapshots/swap burn 6909 for input.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
137049
135923
2 changes: 1 addition & 1 deletion .forge-snapshots/swap burn native 6909 for input.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
126242
125140
2 changes: 1 addition & 1 deletion .forge-snapshots/swap mint native output as 6909.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
148295
147180
2 changes: 1 addition & 1 deletion .forge-snapshots/swap mint output as 6909.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
164972
163842
Original file line number Diff line number Diff line change
@@ -1 +1 @@
224322
222199
2 changes: 1 addition & 1 deletion .forge-snapshots/swap with dynamic fee.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
149239
148043
2 changes: 1 addition & 1 deletion .forge-snapshots/swap with hooks.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
125084
123903
2 changes: 1 addition & 1 deletion .forge-snapshots/swap with lp fee and protocol fee.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
181561
180223
1 change: 1 addition & 0 deletions .forge-snapshots/swap with return dynamic fee.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
155902
2 changes: 1 addition & 1 deletion .forge-snapshots/update dynamic fee in before swap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
159792
158505
7 changes: 6 additions & 1 deletion src/Extsload.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import {IExtsload} from "./interfaces/IExtsload.sol";
/// @notice Enables public storage access for efficient state retrieval by external contracts.
/// https://eips.ethereum.org/EIPS/eip-2330#rationale
abstract contract Extsload is IExtsload {
/// @inheritdoc IExtsload
function extsload(bytes32 slot) external view returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
value := sload(slot)
}
}

/// @inheritdoc IExtsload
function extsload(bytes32 startSlot, uint256 nSlots) external view returns (bytes memory) {
bytes memory value = new bytes(32 * nSlots);

Expand All @@ -26,8 +28,11 @@ abstract contract Extsload is IExtsload {
return value;
}

/// @dev since the function is external and enters a new call context and exits right after execution, Solidity's memory management convention can be disregarded and a direct slice of memory can be returned
/// @inheritdoc IExtsload
function extsload(bytes32[] calldata slots) external view returns (bytes32[] memory) {
// since the function is external and enters a new call context and exits right
// after execution, Solidity's memory management convention can be disregarded
// and a direct slice of memory can be returned
assembly ("memory-safe") {
// abi offset for dynamic array
mstore(0, 0x20)
Expand Down
38 changes: 38 additions & 0 deletions src/Exttload.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24;

import {IExttload} from "./interfaces/IExttload.sol";

/// @notice Enables public transient storage access for efficient state retrieval by external contracts.
/// https://eips.ethereum.org/EIPS/eip-2330#rationale
abstract contract Exttload is IExttload {
/// @inheritdoc IExttload
function exttload(bytes32 slot) external view returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
value := tload(slot)
}
}

/// @inheritdoc IExttload
function exttload(bytes32[] calldata slots) external view returns (bytes32[] memory) {
// since the function is external and enters a new call context and exits right
// after execution, Solidity's memory management convention can be disregarded
// and a direct slice of memory can be returned
assembly ("memory-safe") {
// abi offset for dynamic array
mstore(0, 0x20)
mstore(0x20, slots.length)
let end := add(0x40, shl(5, slots.length))
let memptr := 0x40
let calldataptr := slots.offset
for {} 1 {} {
mstore(memptr, tload(calldataload(calldataptr)))
memptr := add(memptr, 0x20)
calldataptr := add(calldataptr, 0x20)
if iszero(lt(memptr, end)) { break }
}
return(0, end)
}
}
}
Loading

0 comments on commit dd77e47

Please sign in to comment.