Skip to content

Commit 340ffbb

Browse files
committed
Merge branches 'dcmt/tempo-expansion' and 'jparklev/changelog-usdd-psm'
3 parents fce81ae + 489cf61 + 6482b60 commit 340ffbb

File tree

7 files changed

+82
-53
lines changed

7 files changed

+82
-53
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,18 @@
1818
* EkuboV2 VIP actions `EKUBO_VIP` and `METATXN_EKUBO_VIP` are not
1919
supported anymore and were removed from `ISettlerActions.sol`.
2020
* Add new `CHECK_SLIPPAGE` action to taker-submitted Settlers
21+
* Add USDD full PSM support (USDT/USDD pair) to the `MAKERPSM` action on Mainnet
2122
* Update the following chains to the Osaka EVM hardfork:
2223
* Arbitrum
2324
* Polygon
2425
* Monad
2526
* Scroll
27+
* Add the following liquidity on Tempo
28+
* RFQ
29+
* UniswapV2
30+
* VelodromeV2
31+
* UniswapV3
32+
* UniswapV4
2633

2734
## 2026-03-17
2835

src/SettlerBase.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ abstract contract SettlerBase is ISettlerBase, Basic, RfqOrderSettlement, Uniswa
114114
}
115115
}
116116

117-
function _dispatch(uint256, uint256 action, bytes calldata data, AllowedSlippage memory slippage)
117+
function _dispatch(uint256, uint256 action, bytes calldata data, AllowedSlippage memory)
118118
internal
119119
virtual
120120
override

src/chains/Tempo/Common.sol

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,58 +5,54 @@ import {SettlerBase} from "../../SettlerBase.sol";
55

66
import {IERC20} from "@forge-std/interfaces/IERC20.sol";
77
import {FreeMemory} from "../../utils/FreeMemory.sol";
8-
import {SafeTransferLib} from "../../vendor/SafeTransferLib.sol";
9-
import {Ternary} from "../../utils/Ternary.sol";
8+
9+
import {UniswapV4} from "../../core/UniswapV4.sol";
10+
import {IPoolManager} from "../../core/UniswapV4Types.sol";
1011

1112
import {ISettlerActions} from "../../ISettlerActions.sol";
1213
import {ISignatureTransfer} from "@permit2/interfaces/ISignatureTransfer.sol";
1314
import {revertUnknownForkId} from "../../core/SettlerErrors.sol";
1415

16+
import {
17+
uniswapV3TempoFactory,
18+
uniswapV3InitHash,
19+
uniswapV3ForkId,
20+
IUniswapV3Callback
21+
} from "../../core/univ3forks/UniswapV3.sol";
22+
23+
import {TEMPO_POOL_MANAGER} from "../../core/UniswapV4Addresses.sol";
24+
1525
// Solidity inheritance is stupid
1626
import {SettlerSwapAbstract} from "../../SettlerAbstract.sol";
1727
import {Permit2PaymentAbstract} from "../../core/Permit2PaymentAbstract.sol";
1828

19-
abstract contract TempoMixin is FreeMemory, SettlerBase {
20-
using Ternary for bool;
21-
using SafeTransferLib for IERC20;
22-
using SafeTransferLib for address payable;
23-
29+
abstract contract TempoMixin is FreeMemory, SettlerBase, UniswapV4 {
2430
constructor() {
2531
assert(block.chainid == 4217 || block.chainid == 31337);
2632
}
2733

2834
function _dispatch(uint256 i, uint256 action, bytes calldata data, AllowedSlippage memory slippage)
2935
internal
3036
virtual
31-
override(/* SettlerSwapAbstract, */ SettlerBase)
37+
override(SettlerSwapAbstract, SettlerBase)
3238
DANGEROUS_freeMemory
3339
returns (bool)
3440
{
35-
// This does not make use of `super._dispatch`. This chain's Settler is extremely
36-
// stripped-down and has almost no capabilities
37-
if (action == uint32(ISettlerActions.BASIC.selector)) {
38-
(IERC20 sellToken, uint256 bps, address pool, uint256 offset, bytes memory _data) =
39-
abi.decode(data, (IERC20, uint256, address, uint256, bytes));
41+
if (super._dispatch(i, action, data, slippage)) {
42+
return true;
43+
} else if (action == uint32(ISettlerActions.UNISWAPV4.selector)) {
44+
(
45+
address recipient,
46+
IERC20 sellToken,
47+
uint256 bps,
48+
bool feeOnTransfer,
49+
uint256 hashMul,
50+
uint256 hashMod,
51+
bytes memory fills,
52+
uint256 amountOutMin
53+
) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256));
4054

41-
basicSellToPool(sellToken, bps, pool, offset, _data);
42-
} else if (action == uint32(ISettlerActions.POSITIVE_SLIPPAGE.selector)) {
43-
(address payable recipient, IERC20 token, uint256 expectedAmount, uint256 maxBps) =
44-
abi.decode(data, (address, IERC20, uint256, uint256));
45-
bool isETH = (token == ETH_ADDRESS);
46-
uint256 balance = isETH ? address(this).balance : token.fastBalanceOf(address(this));
47-
if (balance > expectedAmount) {
48-
uint256 cap;
49-
unchecked {
50-
cap = balance * maxBps / BASIS;
51-
balance -= expectedAmount;
52-
}
53-
balance = (balance > cap).ternary(cap, balance);
54-
if (isETH) {
55-
recipient.safeTransferETH(balance);
56-
} else {
57-
token.safeTransfer(recipient, balance);
58-
}
59-
}
55+
sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin);
6056
} else {
6157
return false;
6258
}
@@ -69,14 +65,24 @@ abstract contract TempoMixin is FreeMemory, SettlerBase {
6965
override
7066
returns (address factory, bytes32 initHash, uint32 callbackSelector)
7167
{
72-
revertUnknownForkId(forkId);
68+
if (forkId == uniswapV3ForkId) {
69+
factory = uniswapV3TempoFactory;
70+
initHash = uniswapV3InitHash;
71+
callbackSelector = uint32(IUniswapV3Callback.uniswapV3SwapCallback.selector);
72+
} else {
73+
revertUnknownForkId(forkId);
74+
}
75+
}
76+
77+
function _POOL_MANAGER() internal pure override returns (IPoolManager) {
78+
return TEMPO_POOL_MANAGER;
7379
}
7480

7581
// I hate Solidity inheritance
7682
function _fallback(bytes calldata data)
7783
internal
7884
virtual
79-
override(Permit2PaymentAbstract)
85+
override(Permit2PaymentAbstract, UniswapV4)
8086
returns (bool success, bytes memory returndata)
8187
{
8288
return super._fallback(data);

src/chains/Tempo/MetaTxn.sol

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,22 @@ contract TempoSettlerMetaTxn is SettlerMetaTxn, TempoMixin {
2525
DANGEROUS_freeMemory
2626
returns (bool)
2727
{
28-
// This does not make use of `super._dispatchVIP`. This chain's Settler is extremely
29-
// stripped-down and has almost no capabilities
30-
if (action == uint32(ISettlerActions.METATXN_TRANSFER_FROM.selector)) {
31-
(address recipient, ISignatureTransfer.PermitTransferFrom memory permit) =
32-
abi.decode(data, (address, ISignatureTransfer.PermitTransferFrom));
33-
(ISignatureTransfer.SignatureTransferDetails memory transferDetails,) =
34-
_permitToTransferDetails(permit, recipient);
28+
if (super._dispatchVIP(action, data, sig)) {
29+
return true;
30+
} else if (action == uint32(ISettlerActions.METATXN_UNISWAPV4_VIP.selector)) {
31+
(
32+
address recipient,
33+
ISignatureTransfer.PermitTransferFrom memory permit,
34+
bool feeOnTransfer,
35+
uint256 hashMul,
36+
uint256 hashMod,
37+
bytes memory fills,
38+
uint256 amountOutMin
39+
) = abi.decode(
40+
data, (address, ISignatureTransfer.PermitTransferFrom, bool, uint256, uint256, bytes, uint256)
41+
);
3542

36-
// We simultaneously transfer-in the taker's tokens and authenticate the
37-
// metatransaction.
38-
_transferFrom(permit, transferDetails, sig);
43+
sellToUniswapV4VIP(recipient, feeOnTransfer, hashMul, hashMod, fills, permit, sig, amountOutMin);
3944
} else {
4045
return false;
4146
}

src/chains/Tempo/TakerSubmitted.sol

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,23 @@ contract TempoSettler is Settler, TempoMixin {
1818
constructor(bytes20 gitCommit) SettlerBase(gitCommit) {}
1919

2020
function _dispatchVIP(uint256 action, bytes calldata data) internal override DANGEROUS_freeMemory returns (bool) {
21-
// This does not make use of `super._dispatchVIP`. This chain's Settler is extremely
22-
// stripped-down and has almost no capabilities
23-
if (action == uint32(ISettlerActions.TRANSFER_FROM.selector)) {
24-
(address recipient, ISignatureTransfer.PermitTransferFrom memory permit, bytes memory sig) =
25-
abi.decode(data, (address, ISignatureTransfer.PermitTransferFrom, bytes));
26-
(ISignatureTransfer.SignatureTransferDetails memory transferDetails,) =
27-
_permitToTransferDetails(permit, recipient);
28-
_transferFrom(permit, transferDetails, sig);
21+
if (super._dispatchVIP(action, data)) {
22+
return true;
23+
} else if (action == uint32(ISettlerActions.UNISWAPV4_VIP.selector)) {
24+
(
25+
address recipient,
26+
ISignatureTransfer.PermitTransferFrom memory permit,
27+
bool feeOnTransfer,
28+
uint256 hashMul,
29+
uint256 hashMod,
30+
bytes memory fills,
31+
bytes memory sig,
32+
uint256 amountOutMin
33+
) = abi.decode(
34+
data, (address, ISignatureTransfer.PermitTransferFrom, bool, uint256, uint256, bytes, bytes, uint256)
35+
);
36+
37+
sellToUniswapV4VIP(recipient, feeOnTransfer, hashMul, hashMod, fills, permit, sig, amountOutMin);
2938
} else {
3039
return false;
3140
}

src/core/UniswapV4Addresses.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ IPoolManager constant INK_POOL_MANAGER = IPoolManager(0x360E68faCcca8cA495c1B759
1515
IPoolManager constant UNICHAIN_POOL_MANAGER = IPoolManager(0x1F98400000000000000000000000000000000004); // https://github.com/Uniswap/contracts/blob/main/deployments/130.md#wed-jan-22-2025
1616
IPoolManager constant SEPOLIA_POOL_MANAGER = IPoolManager(0xE03A1074c86CFeDd5C142C4F04F1a1536e203543);
1717
IPoolManager constant MONAD_POOL_MANAGER = IPoolManager(0x188d586Ddcf52439676Ca21A244753fA19F9Ea8e);
18+
IPoolManager constant TEMPO_POOL_MANAGER = IPoolManager(0x33620f62C5b9B2086dD6b62F4A297A9f30347029);

src/core/univ3forks/UniswapV3.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ address constant uniswapV3UnichainFactory = 0x1F98400000000000000000000000000000
1616
address constant uniswapV3PlasmaFactory = 0xcb2436774C3e191c85056d248EF4260ce5f27A9D;
1717
address constant uniswapV3MonadFactory = 0x204FAca1764B154221e35c0d20aBb3c525710498;
1818
address constant uniswapV3AbstractFactory = 0xA1160e73B63F322ae88cC2d8E700833e71D0b2a1;
19+
address constant uniswapV3TempoFactory = 0x24a3d4757E330890A8b8978028c9e58E04611fd6;
1920

2021
bytes32 constant uniswapV3InitHash = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54;
2122
// This isn't a "hash" inasmuch as it's a versioned discriminator

0 commit comments

Comments
 (0)