diff --git a/CHANGELOG.md b/CHANGELOG.md index 68d5f921e..334ff2dea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ Master list of UniV3 forks: * Add `DODOV1` action to Mantle * Add `DODOV1` action to Polygon * Add `DODOV1` action to Scroll +* Add `rebateClaimer()(address)` function on Mainnet Settlers for gas rebate program ## 2024-12-14 diff --git a/src/SettlerBase.sol b/src/SettlerBase.sol index 2bab07aee..8b8cac9ea 100644 --- a/src/SettlerBase.sol +++ b/src/SettlerBase.sol @@ -5,6 +5,8 @@ import {IERC20} from "@forge-std/interfaces/IERC20.sol"; import {IERC721Owner} from "./IERC721Owner.sol"; import {ISignatureTransfer} from "@permit2/interfaces/ISignatureTransfer.sol"; +import {DEPLOYER} from "./deployer/DeployerAddress.sol"; + import {Basic} from "./core/Basic.sol"; import {RfqOrderSettlement} from "./core/RfqOrderSettlement.sol"; import {UniswapV3Fork} from "./core/UniswapV3Fork.sol"; @@ -60,7 +62,7 @@ abstract contract SettlerBase is Basic, RfqOrderSettlement, UniswapV3Fork, Unisw constructor(bytes20 gitCommit, uint256 tokenId) { if (block.chainid != 31337) { emit GitCommit(gitCommit); - assert(IERC721Owner(0x00000000000004533Fe15556B1E086BB1A72cEae).ownerOf(tokenId) == address(this)); + assert(IERC721Owner(DEPLOYER).ownerOf(tokenId) == address(this)); } else { assert(gitCommit == bytes20(0)); } diff --git a/src/chains/Blast/Common.sol b/src/chains/Blast/Common.sol index 26a9449b2..eb92235a1 100644 --- a/src/chains/Blast/Common.sol +++ b/src/chains/Blast/Common.sol @@ -36,6 +36,7 @@ import { rogueXV1Factory, rogueXV1InitHash, rogueXV1ForkId, IRoxSpotSwapCallback } from "../../core/univ3forks/RogueXV1.sol"; +import {DEPLOYER} from "../../deployer/DeployerAddress.sol"; import {IOwnable} from "../../deployer/TwoStepOwnable.sol"; import {BLAST, BLAST_USDB, BLAST_WETH, BlastYieldMode, BlastGasMode} from "./IBlast.sol"; @@ -46,11 +47,7 @@ abstract contract BlastMixin is FreeMemory, SettlerBase { constructor() { if (block.chainid != 31337) { assert(block.chainid == 81457); - BLAST.configure( - BlastYieldMode.AUTOMATIC, - BlastGasMode.CLAIMABLE, - IOwnable(0x00000000000004533Fe15556B1E086BB1A72cEae).owner() - ); + BLAST.configure(BlastYieldMode.AUTOMATIC, BlastGasMode.CLAIMABLE, IOwnable(DEPLOYER).owner()); BLAST_USDB.configure(BlastYieldMode.VOID); BLAST_WETH.configure(BlastYieldMode.VOID); } diff --git a/src/chains/Mainnet/Common.sol b/src/chains/Mainnet/Common.sol index 147cae55c..9ec8f1769 100644 --- a/src/chains/Mainnet/Common.sol +++ b/src/chains/Mainnet/Common.sol @@ -36,6 +36,9 @@ import { ISolidlyV3Callback } from "../../core/univ3forks/SolidlyV3.sol"; +import {DEPLOYER} from "../../deployer/DeployerAddress.sol"; +import {IOwnable} from "../../deployer/TwoStepOwnable.sol"; + // Solidity inheritance is stupid import {SettlerAbstract} from "../../SettlerAbstract.sol"; @@ -137,4 +140,8 @@ abstract contract MainnetMixin is function _curveFactory() internal pure override returns (address) { return 0x0c0e5f2fF0ff18a3be9b835635039256dC4B4963; } + + function rebateClaimer() external view returns (address) { + return IOwnable(DEPLOYER).owner(); + } } diff --git a/src/chains/Mode/Common.sol b/src/chains/Mode/Common.sol index 2ee850fbc..b13c1efa8 100644 --- a/src/chains/Mode/Common.sol +++ b/src/chains/Mode/Common.sol @@ -19,6 +19,7 @@ import {IAlgebraCallback} from "../../core/univ3forks/Algebra.sol"; import {swapModeV3Factory, swapModeV3InitHash, swapModeV3ForkId} from "../../core/univ3forks/SwapModeV3.sol"; import {IUniswapV3Callback} from "../../core/univ3forks/UniswapV3.sol"; +import {DEPLOYER} from "../../deployer/DeployerAddress.sol"; import {MODE_SFS} from "./IModeSFS.sol"; // Solidity inheritance is stupid @@ -27,7 +28,7 @@ import {Permit2PaymentAbstract} from "../../core/Permit2PaymentAbstract.sol"; abstract contract ModeMixin is FreeMemory, SettlerBase { constructor() { assert(block.chainid == 34443 || block.chainid == 31337); - MODE_SFS.assign(MODE_SFS.getTokenId(0x00000000000004533Fe15556B1E086BB1A72cEae)); + MODE_SFS.assign(MODE_SFS.getTokenId(DEPLOYER)); } function _isRestrictedTarget(address target) diff --git a/src/deployer/BlastDeployer.sol b/src/deployer/BlastDeployer.sol index 4e31a071f..feb80e99a 100644 --- a/src/deployer/BlastDeployer.sol +++ b/src/deployer/BlastDeployer.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity =0.8.25; +import {DEPLOYER} from "./DeployerAddress.sol"; import {Deployer} from "./Deployer.sol"; import {BLAST, BlastYieldMode, BlastGasMode} from "../chains/Blast/IBlast.sol"; @@ -8,11 +9,7 @@ import {BLAST, BlastYieldMode, BlastGasMode} from "../chains/Blast/IBlast.sol"; contract BlastDeployer is Deployer { constructor(uint256 version) Deployer(version) { assert(block.chainid == 81457); - BLAST.configure( - BlastYieldMode.AUTOMATIC, - BlastGasMode.CLAIMABLE, - BlastDeployer(0x00000000000004533Fe15556B1E086BB1A72cEae).owner() - ); + BLAST.configure(BlastYieldMode.AUTOMATIC, BlastGasMode.CLAIMABLE, BlastDeployer(DEPLOYER).owner()); } function initialize(address initialOwner) public override { diff --git a/src/deployer/Deployer.sol b/src/deployer/Deployer.sol index 2965636cc..73037f062 100644 --- a/src/deployer/Deployer.sol +++ b/src/deployer/Deployer.sol @@ -15,6 +15,7 @@ import {ProxyMultiCall} from "../utils/ProxyMultiCall.sol"; import {Feature, wrap, isNull} from "./Feature.sol"; import {Nonce, zero, isNull} from "./Nonce.sol"; import {IDeployer, IERC721ViewMetadata} from "./IDeployer.sol"; +import {DEPLOYER} from "./DeployerAddress.sol"; library NonceList { struct ListElem { @@ -149,7 +150,7 @@ contract Deployer is IDeployer, ERC1967UUPSUpgradeable, Context, ERC1967TwoStepO } function initialize(address initialOwner) public virtual { - require(address(this) == 0x00000000000004533Fe15556B1E086BB1A72cEae || block.chainid == 31337); + require(address(this) == DEPLOYER || block.chainid == 31337); if (_implVersion == 1) { _setPendingOwner(initialOwner); } else { diff --git a/src/deployer/DeployerAddress.sol b/src/deployer/DeployerAddress.sol new file mode 100644 index 000000000..1cb28fa2f --- /dev/null +++ b/src/deployer/DeployerAddress.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.25; + +address constant DEPLOYER = 0x00000000000004533Fe15556B1E086BB1A72cEae; diff --git a/src/deployer/ModeDeployer.sol b/src/deployer/ModeDeployer.sol index d2760022d..1b1893e30 100644 --- a/src/deployer/ModeDeployer.sol +++ b/src/deployer/ModeDeployer.sol @@ -2,6 +2,7 @@ pragma solidity =0.8.25; import {Deployer} from "./Deployer.sol"; +import {DEPLOYER} from "./DeployerAddress.sol"; import {MODE_SFS} from "../chains/Mode/IModeSFS.sol"; /// @custom:security-contact security@0x.org @@ -10,11 +11,11 @@ contract ModeDeployer is Deployer { constructor(uint256 version) Deployer(version) { assert(block.chainid == 34443); - if (0x00000000000004533Fe15556B1E086BB1A72cEae.code.length == 0) { + if (DEPLOYER.code.length == 0) { assert(_implVersion == 1); sfsTokenId = MODE_SFS.register(0xf36b9f50E59870A24F42F9Ba43b2aD0A4b8f2F51); } else { - MODE_SFS.assign(sfsTokenId = MODE_SFS.getTokenId(0x00000000000004533Fe15556B1E086BB1A72cEae)); + MODE_SFS.assign(sfsTokenId = MODE_SFS.getTokenId(DEPLOYER)); } } diff --git a/src/deployer/SafeModule.sol b/src/deployer/SafeModule.sol index eed32ffaf..a5172faec 100644 --- a/src/deployer/SafeModule.sol +++ b/src/deployer/SafeModule.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.25; +import {DEPLOYER} from "./DeployerAddress.sol"; import {IDeployer, IDeployerRemove} from "./IDeployer.sol"; import {Feature} from "./Feature.sol"; import {Nonce} from "./Nonce.sol"; @@ -23,7 +24,7 @@ contract ZeroExSettlerDeployerSafeModule is IDeployerRemove { using Revert for bool; ISafeMinimal public immutable safe; - IDeployer public constant deployer = IDeployer(0x00000000000004533Fe15556B1E086BB1A72cEae); + IDeployer public constant deployer = IDeployer(DEPLOYER); constructor(address _safe) { assert(address(this) == 0x1CeC01DC0fFEE5eB5aF47DbEc1809F2A7c601C30 || block.chainid == 31337); diff --git a/test/deployer/Deployer.t.sol b/test/deployer/Deployer.t.sol index c36772bfa..fbb22fe6f 100644 --- a/test/deployer/Deployer.t.sol +++ b/test/deployer/Deployer.t.sol @@ -7,6 +7,7 @@ import {ERC1967UUPSProxy} from "src/proxy/ERC1967UUPSProxy.sol"; import {AddressDerivation} from "src/utils/AddressDerivation.sol"; import {Create3} from "src/utils/Create3.sol"; import {IERC1967Proxy} from "src/proxy/ERC1967UUPSUpgradeable.sol"; +import {DEPLOYER} from "src/deployer/DeployerAddress.sol"; import "@forge-std/Test.sol"; @@ -19,7 +20,7 @@ contract DeployerTest is Test { function setUp() public { vm.createSelectFork(vm.envString("MAINNET_RPC_URL"), 19921675); - deployer = Deployer(0x00000000000004533Fe15556B1E086BB1A72cEae); + deployer = Deployer(DEPLOYER); vm.label(address(deployer), "Deployer (proxy)"); vm.prank(deployer.owner());