Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Master list of UniV3 forks:
### Non-breaking changes

* Add Aerodrome Slipstream V3.1 UniswapV3 fork to Base
* Added UNDERPAYMENT_CHECK action to BridgeSettlerBase.

## 2025-10-02

Expand Down
4 changes: 2 additions & 2 deletions src/bridge/BridgeSettler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {revertActionInvalid} from "../core/SettlerErrors.sol";
import {CalldataDecoder} from "../SettlerBase.sol";
import {UnsafeMath} from "../utils/UnsafeMath.sol";
import {ISignatureTransfer} from "@permit2/interfaces/ISignatureTransfer.sol";
import {ISettlerActions} from "../ISettlerActions.sol";
import {IBridgeSettlerActions} from "./IBridgeSettlerActions.sol";
import {Permit2PaymentTakerSubmitted} from "../core/Permit2Payment.sol";

interface IBridgeSettlerTakerSubmitted {
Expand All @@ -22,7 +22,7 @@ abstract contract BridgeSettler is IBridgeSettlerTakerSubmitted, Permit2PaymentT
}

function _dispatchVIP(uint256 action, bytes calldata data) internal virtual returns (bool) {
if (action == uint32(ISettlerActions.TRANSFER_FROM.selector)) {
if (action == uint32(IBridgeSettlerActions.TRANSFER_FROM.selector)) {
(address recipient, ISignatureTransfer.PermitTransferFrom memory permit, bytes memory sig) =
abi.decode(data, (address, ISignatureTransfer.PermitTransferFrom, bytes));
(ISignatureTransfer.SignatureTransferDetails memory transferDetails,) =
Expand Down
11 changes: 11 additions & 0 deletions src/bridge/BridgeSettlerBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {FastDeployer} from "../deployer/FastDeployer.sol";
import {Basic} from "../core/Basic.sol";
import {Relay} from "../core/Relay.sol";
import {LayerZeroOFT} from "../core/LayerZeroOFT.sol";
import {Underpayment} from "../core/SettlerErrors.sol";

abstract contract BridgeSettlerBase is Basic, Relay, LayerZeroOFT {
using SafeTransferLib for IERC20;
Expand Down Expand Up @@ -89,6 +90,16 @@ abstract contract BridgeSettlerBase is Basic, Relay, LayerZeroOFT {
} else if (action == uint32(IBridgeSettlerActions.BRIDGE_TO_LAYER_ZERO_OFT.selector)) {
(IERC20 token, uint256 nativeFee, address oft, bytes memory sendData) = abi.decode(data, (IERC20, uint256, address, bytes));
bridgeLayerZeroOFT(token, nativeFee, oft, sendData);
} else if (action == uint32(IBridgeSettlerActions.UNDERPAYMENT_CHECK.selector)) {
(uint256 msgValueMin) = abi.decode(data, (uint256));
if (msg.value < msgValueMin) {
assembly ("memory-safe") {
mstore(0x00, 0xd17e444b) // selector for `Underpayment(uint256,uint256)`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this error to SettlerErrors.sol and import it at the top of this file

mstore(0x20, msgValueMin)
mstore(0x40, callvalue())
revert(0x1c, 0x44)
}
}
} else {
return false;
}
Expand Down
3 changes: 3 additions & 0 deletions src/bridge/IBridgeSettlerActions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ interface IBridgeSettlerActions {
/// @dev Execute swaps in Settler
function SETTLER_SWAP(address token, uint256 amount, address settler, bytes calldata settlerData) external;

/// @dev msgValueMin is interpreted as an lower bound on the expected msg.value, not as an exact specification
function UNDERPAYMENT_CHECK(uint256 msgValueMin) external;

/// @dev Bridge through a Bridge that follows the approval, transferFrom(msg.sender) interaction
/// Pre-req: Funded
function BASIC(address bridgeToken, uint256 bps, address pool, uint256 offset, bytes calldata data) external;
Expand Down
3 changes: 3 additions & 0 deletions src/core/SettlerErrors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,6 @@ error NotConverged();
/// @notice Thrown when the encoded pool manager ID as part of PancakeSwap Infinity fill is not on
/// the list of recognized pool managers.
error UnknownPoolManagerId(uint8 poolManagerId);

/// @notice Thrown when the `msg.value` is less than the minimum expected value.
error Underpayment(uint256 msgValueMin, uint256 msgValueActual);