feat: update solc and add V4Router into UniswapV4Executor

This commit is contained in:
royvardhan
2025-02-10 20:21:59 +05:30
parent 24d4e762a2
commit bdd3daffba
27 changed files with 86 additions and 84 deletions

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.28;
pragma solidity ^0.8.26;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

View File

@@ -1,58 +1,44 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.28;
pragma solidity ^0.8.26;
library LibSwap {
/// Returns the InToken index into an array of tokens
function tokenInIndex(bytes calldata swap)
internal
pure
returns (uint8 res)
{
function tokenInIndex(
bytes calldata swap
) internal pure returns (uint8 res) {
res = uint8(swap[0]);
}
/// The OutToken index into an array of tokens
function tokenOutIndex(bytes calldata swap)
internal
pure
returns (uint8 res)
{
function tokenOutIndex(
bytes calldata swap
) internal pure returns (uint8 res) {
res = uint8(swap[1]);
}
/// The relative amount of token quantity routed into this swap
function splitPercentage(bytes calldata swap)
internal
pure
returns (uint24 res)
{
function splitPercentage(
bytes calldata swap
) internal pure returns (uint24 res) {
res = uint24(bytes3(swap[2:5]));
}
/// The address of the executor contract
function executor(bytes calldata swap)
internal
pure
returns (address res)
{
function executor(bytes calldata swap) internal pure returns (address res) {
res = address(uint160(bytes20(swap[5:25])));
}
/// The selector to be used of the executor contract
function executorSelector(bytes calldata swap)
internal
pure
returns (bytes4 res)
{
function executorSelector(
bytes calldata swap
) internal pure returns (bytes4 res) {
res = bytes4(swap[25:29]);
}
/// Remaining bytes are interpreted as protocol data
function protocolData(bytes calldata swap)
internal
pure
returns (bytes calldata res)
{
function protocolData(
bytes calldata swap
) internal pure returns (bytes calldata res) {
res = swap[29:];
}
}

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.28;
pragma solidity ^0.8.26;
/**
* @title Propellerheads PrefixLengthEncoded Byte Array Library
@@ -16,11 +16,9 @@ library LibPrefixLengthEncodedByteArray {
/**
* @dev Pop the first element of an array and returns it with the remaining data.
*/
function next(bytes calldata encoded)
internal
pure
returns (bytes calldata elem, bytes calldata res)
{
function next(
bytes calldata encoded
) internal pure returns (bytes calldata elem, bytes calldata res) {
assembly {
switch iszero(encoded.length)
case 1 {
@@ -46,7 +44,11 @@ library LibPrefixLengthEncodedByteArray {
assembly {
let offset := encoded.offset
let end := add(encoded.offset, encoded.length)
for {} lt(offset, end) {} {
for {
} lt(offset, end) {
} {
offset := add(offset, add(shr(240, calldataload(offset)), 2))
s := add(s, 1)
}
@@ -56,11 +58,9 @@ library LibPrefixLengthEncodedByteArray {
/**
* @dev Cast an encoded array into a Solidity array.
*/
function toArray(bytes calldata encoded)
internal
pure
returns (bytes[] memory arr)
{
function toArray(
bytes calldata encoded
) internal pure returns (bytes[] memory arr) {
bytes calldata elem;
uint256 idx = 0;
arr = new bytes[](LibPrefixLengthEncodedByteArray.size(encoded));

Submodule foundry/lib/v4-periphery added at cf451c4f55