Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rebateClaimer()(address) function on Mainnet Settlers for gas rebate program #270

Merged
merged 5 commits into from
Dec 16, 2024
Merged
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 @@ -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

Expand Down
4 changes: 3 additions & 1 deletion src/SettlerBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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));
}
Expand Down
7 changes: 2 additions & 5 deletions src/chains/Blast/Common.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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);
}
Expand Down
7 changes: 7 additions & 0 deletions src/chains/Mainnet/Common.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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();
}
}
3 changes: 2 additions & 1 deletion src/chains/Mode/Common.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
7 changes: 2 additions & 5 deletions src/deployer/BlastDeployer.sol
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
// 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";

/// @custom:security-contact [email protected]
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 {
Expand Down
3 changes: 2 additions & 1 deletion src/deployer/Deployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions src/deployer/DeployerAddress.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: MIT
pragma solidity =0.8.25;

address constant DEPLOYER = 0x00000000000004533Fe15556B1E086BB1A72cEae;
5 changes: 3 additions & 2 deletions src/deployer/ModeDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]
Expand All @@ -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));
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/deployer/SafeModule.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion test/deployer/Deployer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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());
Expand Down
Loading