Skip to content

Commit

Permalink
Merge branch 'dcmt/balv3-more-chains'
Browse files Browse the repository at this point in the history
  • Loading branch information
duncancmt committed Feb 12, 2025
2 parents 737f199 + 82c9187 commit ed3a62a
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Master list of UniV3 forks:
* Add UniswapV3 UniV3 fork to Monad Testnet
* Add UniswapV4 actions to Sepolia
* Add UniswapV4 actions to Ink
* Add BalancerV3 actions to Base
* Add BalancerV3 actions to Arbitrum

## 2025-02-12

Expand Down
25 changes: 24 additions & 1 deletion src/chains/Arbitrum/Common.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {DodoV1, IDodoV1} from "../../core/DodoV1.sol";
import {DodoV2, IDodoV2} from "../../core/DodoV2.sol";
import {UniswapV4} from "../../core/UniswapV4.sol";
import {IPoolManager} from "../../core/UniswapV4Types.sol";
import {BalancerV3} from "../../core/BalancerV3.sol";
import {FreeMemory} from "../../utils/FreeMemory.sol";

import {ISettlerActions} from "../../ISettlerActions.sol";
Expand Down Expand Up @@ -44,7 +45,16 @@ import {ARBITRUM_POOL_MANAGER} from "../../core/UniswapV4Addresses.sol";
// Solidity inheritance is stupid
import {SettlerAbstract} from "../../SettlerAbstract.sol";

abstract contract ArbitrumMixin is FreeMemory, SettlerBase, MaverickV2, CurveTricrypto, DodoV1, DodoV2, UniswapV4 {
abstract contract ArbitrumMixin is
FreeMemory,
SettlerBase,
MaverickV2,
CurveTricrypto,
DodoV1,
DodoV2,
UniswapV4,
BalancerV3
{
constructor() {
assert(block.chainid == 42161 || block.chainid == 31337);
}
Expand All @@ -71,6 +81,19 @@ abstract contract ArbitrumMixin is FreeMemory, SettlerBase, MaverickV2, CurveTri
) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256));

sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin);
} else if (action == uint32(ISettlerActions.BALANCERV3.selector)) {
(
address recipient,
IERC20 sellToken,
uint256 bps,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
uint256 amountOutMin
) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256));

sellToBalancerV3(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin);
} else if (action == uint32(ISettlerActions.MAVERICKV2.selector)) {
(
address recipient,
Expand Down
14 changes: 14 additions & 0 deletions src/chains/Arbitrum/MetaTxn.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ contract ArbitrumSettlerMetaTxn is SettlerMetaTxn, ArbitrumMixin {
);

sellToUniswapV4VIP(recipient, feeOnTransfer, hashMul, hashMod, fills, permit, sig, amountOutMin);
} else if (action == uint32(ISettlerActions.METATXN_BALANCERV3_VIP.selector)) {
(
address recipient,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
ISignatureTransfer.PermitTransferFrom memory permit,
uint256 amountOutMin
) = abi.decode(
data, (address, bool, uint256, uint256, bytes, ISignatureTransfer.PermitTransferFrom, uint256)
);

sellToBalancerV3VIP(recipient, feeOnTransfer, hashMul, hashMod, fills, permit, sig, amountOutMin);
} else if (action == uint32(ISettlerActions.METATXN_MAVERICKV2_VIP.selector)) {
(
address recipient,
Expand Down
15 changes: 15 additions & 0 deletions src/chains/Arbitrum/TakerSubmitted.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ contract ArbitrumSettler is Settler, ArbitrumMixin {
);

sellToUniswapV4VIP(recipient, feeOnTransfer, hashMul, hashMod, fills, permit, sig, amountOutMin);
} else if (action == uint32(ISettlerActions.BALANCERV3_VIP.selector)) {
(
address recipient,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
ISignatureTransfer.PermitTransferFrom memory permit,
bytes memory sig,
uint256 amountOutMin
) = abi.decode(
data, (address, bool, uint256, uint256, bytes, ISignatureTransfer.PermitTransferFrom, bytes, uint256)
);

sellToBalancerV3VIP(recipient, feeOnTransfer, hashMul, hashMod, fills, permit, sig, amountOutMin);
} else if (action == uint32(ISettlerActions.MAVERICKV2_VIP.selector)) {
(
address recipient,
Expand Down
16 changes: 15 additions & 1 deletion src/chains/Base/Common.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {DodoV2, IDodoV2} from "../../core/DodoV2.sol";
import {MaverickV2, IMaverickV2Pool} from "../../core/MaverickV2.sol";
import {UniswapV4} from "../../core/UniswapV4.sol";
import {IPoolManager} from "../../core/UniswapV4Types.sol";
import {BalancerV3} from "../../core/BalancerV3.sol";
import {FreeMemory} from "../../utils/FreeMemory.sol";

import {ISettlerActions} from "../../ISettlerActions.sol";
Expand Down Expand Up @@ -46,7 +47,7 @@ import {BASE_POOL_MANAGER} from "../../core/UniswapV4Addresses.sol";
// Solidity inheritance is stupid
import {SettlerAbstract} from "../../SettlerAbstract.sol";

abstract contract BaseMixin is FreeMemory, SettlerBase, MaverickV2, DodoV2, UniswapV4 {
abstract contract BaseMixin is FreeMemory, SettlerBase, MaverickV2, DodoV2, UniswapV4, BalancerV3 {
constructor() {
assert(block.chainid == 8453 || block.chainid == 31337);
}
Expand All @@ -73,6 +74,19 @@ abstract contract BaseMixin is FreeMemory, SettlerBase, MaverickV2, DodoV2, Unis
) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256));

sellToUniswapV4(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin);
} else if (action == uint32(ISettlerActions.BALANCERV3.selector)) {
(
address recipient,
IERC20 sellToken,
uint256 bps,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
uint256 amountOutMin
) = abi.decode(data, (address, IERC20, uint256, bool, uint256, uint256, bytes, uint256));

sellToBalancerV3(recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills, amountOutMin);
} else if (action == uint32(ISettlerActions.MAVERICKV2.selector)) {
(
address recipient,
Expand Down
14 changes: 14 additions & 0 deletions src/chains/Base/MetaTxn.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ contract BaseSettlerMetaTxn is SettlerMetaTxn, BaseMixin {
);

sellToUniswapV4VIP(recipient, feeOnTransfer, hashMul, hashMod, fills, permit, sig, amountOutMin);
} else if (action == uint32(ISettlerActions.METATXN_BALANCERV3_VIP.selector)) {
(
address recipient,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
ISignatureTransfer.PermitTransferFrom memory permit,
uint256 amountOutMin
) = abi.decode(
data, (address, bool, uint256, uint256, bytes, ISignatureTransfer.PermitTransferFrom, uint256)
);

sellToBalancerV3VIP(recipient, feeOnTransfer, hashMul, hashMod, fills, permit, sig, amountOutMin);
} else if (action == uint32(ISettlerActions.METATXN_MAVERICKV2_VIP.selector)) {
(
address recipient,
Expand Down
15 changes: 15 additions & 0 deletions src/chains/Base/TakerSubmitted.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ contract BaseSettler is Settler, BaseMixin {
);

sellToUniswapV4VIP(recipient, feeOnTransfer, hashMul, hashMod, fills, permit, sig, amountOutMin);
} else if (action == uint32(ISettlerActions.BALANCERV3_VIP.selector)) {
(
address recipient,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
ISignatureTransfer.PermitTransferFrom memory permit,
bytes memory sig,
uint256 amountOutMin
) = abi.decode(
data, (address, bool, uint256, uint256, bytes, ISignatureTransfer.PermitTransferFrom, bytes, uint256)
);

sellToBalancerV3VIP(recipient, feeOnTransfer, hashMul, hashMod, fills, permit, sig, amountOutMin);
} else if (action == uint32(ISettlerActions.MAVERICKV2_VIP.selector)) {
(
address recipient,
Expand Down

0 comments on commit ed3a62a

Please sign in to comment.