Skip to content

Commit 0245e2b

Browse files
authored
Merge 6349553 into 49b8821
2 parents 49b8821 + 6349553 commit 0245e2b

28 files changed

+429
-1693
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ docs/
2121
# NPM modules
2222
node_modules
2323
gasreport.ansi
24+
25+
#soljson
26+
soljson-latest.js

foundry.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ solc_version = "0.8.26"
66
optimizer = true
77
optimizer_runs = 999999
88
verbosity = 3
9-
fork_block_number = 21_345_650
9+
fork_block_number = 23_170_985
1010
rpc_storage_caching = { chains = ["mainnet"], endpoints = "all" }
1111
evm_version = "cancun"
1212

script/Deploy.s.sol

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,13 @@ contract DeployProduction is Script, DeployBase {
3434
uint64 currentNonce_ = vm.getNonce(deployer_);
3535

3636
uint64 startNonce_ = currentNonce_;
37-
address earnerManagerImplementation_;
38-
address earnerManagerProxy_;
3937
address wrappedMTokenImplementation_;
4038
address wrappedMTokenProxy_;
4139

4240
while (true) {
4341
if (startNonce_ > deployerWrappedMProxyNonce_) revert DeployerNonceTooHigh();
4442

45-
(
46-
earnerManagerImplementation_,
47-
earnerManagerProxy_,
48-
wrappedMTokenImplementation_,
49-
wrappedMTokenProxy_
50-
) = mockDeploy(deployer_, startNonce_);
43+
(wrappedMTokenImplementation_, wrappedMTokenProxy_) = mockDeploy(deployer_, startNonce_);
5144

5245
if (wrappedMTokenProxy_ == expectedWrappedMProxy_) break;
5346

@@ -66,21 +59,18 @@ contract DeployProduction is Script, DeployBase {
6659

6760
if (currentNonce_ != startNonce_) revert UnexpectedDeployerNonce();
6861

69-
(earnerManagerImplementation_, earnerManagerProxy_, wrappedMTokenImplementation_, wrappedMTokenProxy_) = deploy(
62+
(wrappedMTokenImplementation_, wrappedMTokenProxy_) = deploy(
7063
vm.envAddress("M_TOKEN"),
7164
vm.envAddress("REGISTRAR"),
7265
vm.envAddress("EXCESS_DESTINATION"),
7366
vm.envAddress("SWAP_FACILITY"),
74-
vm.envAddress("WRAPPED_M_MIGRATION_ADMIN"),
75-
vm.envAddress("EARNER_MANAGER_MIGRATION_ADMIN")
67+
vm.envAddress("WRAPPED_M_MIGRATION_ADMIN")
7668
);
7769

7870
vm.stopBroadcast();
7971

8072
console2.log("Wrapped M Implementation address:", wrappedMTokenImplementation_);
8173
console2.log("Wrapped M Proxy address:", wrappedMTokenProxy_);
82-
console2.log("Earner Manager Implementation address:", earnerManagerImplementation_);
83-
console2.log("Earner Manager Proxy address:", earnerManagerProxy_);
8474

8575
if (wrappedMTokenProxy_ != expectedWrappedMProxy_)
8676
revert ResultingProxyMismatch(expectedWrappedMProxy_, wrappedMTokenProxy_);

script/DeployBase.sol

Lines changed: 11 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ pragma solidity 0.8.26;
55
import { ContractHelper } from "../lib/common/src/libs/ContractHelper.sol";
66
import { Proxy } from "../lib/common/src/Proxy.sol";
77

8-
import { EarnerManager } from "../src/EarnerManager.sol";
98
import { WrappedMTokenMigratorV1 } from "../src/WrappedMTokenMigratorV1.sol";
109
import { WrappedMToken } from "../src/WrappedMToken.sol";
1110

@@ -17,9 +16,6 @@ contract DeployBase {
1716
* @param swapFacility_ The address of the SwapFacility contract.
1817
* @param excessDestination_ The address of the excess destination.
1918
* @param wrappedMMigrationAdmin_ The address of the Wrapped M Migration Admin.
20-
* @param earnerManagerMigrationAdmin_ The address of the Earner Manager Migration Admin.
21-
* @return earnerManagerImplementation_ The address of the deployed Earner Manager implementation.
22-
* @return earnerManagerProxy_ The address of the deployed Earner Manager proxy.
2319
* @return wrappedMTokenImplementation_ The address of the deployed Wrapped M Token implementation.
2420
* @return wrappedMTokenProxy_ The address of the deployed Wrapped M Token proxy.
2521
*/
@@ -28,29 +24,10 @@ contract DeployBase {
2824
address registrar_,
2925
address excessDestination_,
3026
address swapFacility_,
31-
address wrappedMMigrationAdmin_,
32-
address earnerManagerMigrationAdmin_
33-
)
34-
public
35-
virtual
36-
returns (
37-
address earnerManagerImplementation_,
38-
address earnerManagerProxy_,
39-
address wrappedMTokenImplementation_,
40-
address wrappedMTokenProxy_
41-
)
42-
{
43-
// Earner Manager Implementation constructor needs only known values.
44-
// Earner Manager Proxy constructor needs `earnerManagerImplementation_`.
45-
// Wrapped M Token Implementation constructor needs `earnerManagerProxy_`.
46-
// Wrapped M Token Proxy constructor needs `wrappedMTokenImplementation_`.
47-
48-
earnerManagerImplementation_ = address(new EarnerManager(registrar_, earnerManagerMigrationAdmin_));
49-
50-
earnerManagerProxy_ = address(new Proxy(earnerManagerImplementation_));
51-
27+
address wrappedMMigrationAdmin_
28+
) public virtual returns (address wrappedMTokenImplementation_, address wrappedMTokenProxy_) {
5229
wrappedMTokenImplementation_ = address(
53-
new WrappedMToken(mToken_, registrar_, earnerManagerProxy_, excessDestination_, swapFacility_, wrappedMMigrationAdmin_)
30+
new WrappedMToken(mToken_, registrar_, excessDestination_, swapFacility_, wrappedMMigrationAdmin_)
5431
);
5532

5633
wrappedMTokenProxy_ = address(new Proxy(wrappedMTokenImplementation_));
@@ -63,9 +40,6 @@ contract DeployBase {
6340
* @param excessDestination_ The address of the excess destination.
6441
* @param swapFacility_ The address of the SwapFacility contract.
6542
* @param wrappedMMigrationAdmin_ The address of the Wrapped M Migration Admin.
66-
* @param earnerManagerMigrationAdmin_ The address of the Earner Manager Migration Admin.
67-
* @return earnerManagerImplementation_ The address of the deployed Earner Manager implementation.
68-
* @return earnerManagerProxy_ The address of the deployed Earner Manager proxy.
6943
* @return wrappedMTokenImplementation_ The address of the deployed Wrapped M Token implementation.
7044
* @return wrappedMTokenMigrator_ The address of the deployed Wrapped M Token Migrator.
7145
*/
@@ -75,29 +49,10 @@ contract DeployBase {
7549
address excessDestination_,
7650
address swapFacility_,
7751
address wrappedMMigrationAdmin_,
78-
address earnerManagerMigrationAdmin_,
7952
address[] memory earners_
80-
)
81-
public
82-
virtual
83-
returns (
84-
address earnerManagerImplementation_,
85-
address earnerManagerProxy_,
86-
address wrappedMTokenImplementation_,
87-
address wrappedMTokenMigrator_
88-
)
89-
{
90-
// Earner Manager Implementation constructor needs only known values.
91-
// Earner Manager Proxy constructor needs `earnerManagerImplementation_`.
92-
// Wrapped M Token Implementation constructor needs `earnerManagerProxy_`.
93-
// Migrator needs `wrappedMTokenImplementation_` addresses.
94-
95-
earnerManagerImplementation_ = address(new EarnerManager(registrar_, earnerManagerMigrationAdmin_));
96-
97-
earnerManagerProxy_ = address(new Proxy(earnerManagerImplementation_));
98-
53+
) public virtual returns (address wrappedMTokenImplementation_, address wrappedMTokenMigrator_) {
9954
wrappedMTokenImplementation_ = address(
100-
new WrappedMToken(mToken_, registrar_, earnerManagerProxy_, excessDestination_, swapFacility_, wrappedMMigrationAdmin_)
55+
new WrappedMToken(mToken_, registrar_, excessDestination_, swapFacility_, wrappedMMigrationAdmin_)
10156
);
10257

10358
wrappedMTokenMigrator_ = address(new WrappedMTokenMigratorV1(wrappedMTokenImplementation_, earners_));
@@ -107,67 +62,29 @@ contract DeployBase {
10762
* @dev Mock deploys Wrapped M Token, returning the would-be addresses.
10863
* @param deployer_ The address of the deployer.
10964
* @param deployerNonce_ The nonce of the deployer.
110-
* @return earnerManagerImplementation_ The address of the would-be Earner Manager implementation.
111-
* @return earnerManagerProxy_ The address of the would-be Earner Manager proxy.
11265
* @return wrappedMTokenImplementation_ The address of the would-be Wrapped M Token implementation.
11366
* @return wrappedMTokenProxy_ The address of the would-be Wrapped M Token proxy.
11467
*/
11568
function mockDeploy(
11669
address deployer_,
11770
uint256 deployerNonce_
118-
)
119-
public
120-
view
121-
virtual
122-
returns (
123-
address earnerManagerImplementation_,
124-
address earnerManagerProxy_,
125-
address wrappedMTokenImplementation_,
126-
address wrappedMTokenProxy_
127-
)
128-
{
129-
// Earner Manager Implementation constructor needs only known values.
130-
// Earner Manager Proxy constructor needs `earnerManagerImplementation_`.
131-
// Wrapped M Token Implementation constructor needs `earnerManagerProxy_`.
132-
// Wrapped M Token Proxy constructor needs `wrappedMTokenImplementation_`.
133-
134-
earnerManagerImplementation_ = ContractHelper.getContractFrom(deployer_, deployerNonce_);
135-
earnerManagerProxy_ = ContractHelper.getContractFrom(deployer_, deployerNonce_ + 1);
136-
wrappedMTokenImplementation_ = ContractHelper.getContractFrom(deployer_, deployerNonce_ + 2);
137-
wrappedMTokenProxy_ = ContractHelper.getContractFrom(deployer_, deployerNonce_ + 3);
71+
) public view virtual returns (address wrappedMTokenImplementation_, address wrappedMTokenProxy_) {
72+
wrappedMTokenImplementation_ = ContractHelper.getContractFrom(deployer_, deployerNonce_);
73+
wrappedMTokenProxy_ = ContractHelper.getContractFrom(deployer_, deployerNonce_ + 1);
13874
}
13975

14076
/**
14177
* @dev Mock deploys Wrapped M Token, returning the would-be addresses.
14278
* @param deployer_ The address of the deployer.
14379
* @param deployerNonce_ The nonce of the deployer.
144-
* @return earnerManagerImplementation_ The address of the would-be Earner Manager implementation.
145-
* @return earnerManagerProxy_ The address of the would-be Earner Manager proxy.
14680
* @return wrappedMTokenImplementation_ The address of the would-be Wrapped M Token implementation.
14781
* @return wrappedMTokenMigrator_ The address of the deployed Wrapped M Token Migrator.
14882
*/
14983
function mockDeployUpgrade(
15084
address deployer_,
15185
uint256 deployerNonce_
152-
)
153-
public
154-
view
155-
virtual
156-
returns (
157-
address earnerManagerImplementation_,
158-
address earnerManagerProxy_,
159-
address wrappedMTokenImplementation_,
160-
address wrappedMTokenMigrator_
161-
)
162-
{
163-
// Earner Manager Implementation constructor needs only known values.
164-
// Earner Manager Proxy constructor needs `earnerManagerImplementation_`.
165-
// Wrapped M Token Implementation constructor needs `earnerManagerProxy_`.
166-
// Migrator needs `wrappedMTokenImplementation_` addresses.
167-
168-
earnerManagerImplementation_ = ContractHelper.getContractFrom(deployer_, deployerNonce_);
169-
earnerManagerProxy_ = ContractHelper.getContractFrom(deployer_, deployerNonce_ + 1);
170-
wrappedMTokenImplementation_ = ContractHelper.getContractFrom(deployer_, deployerNonce_ + 2);
171-
wrappedMTokenMigrator_ = ContractHelper.getContractFrom(deployer_, deployerNonce_ + 3);
86+
) public view virtual returns (address wrappedMTokenImplementation_, address wrappedMTokenMigrator_) {
87+
wrappedMTokenImplementation_ = ContractHelper.getContractFrom(deployer_, deployerNonce_);
88+
wrappedMTokenMigrator_ = ContractHelper.getContractFrom(deployer_, deployerNonce_ + 1);
17289
}
17390
}

script/DeployUpgradeMainnet.s.sol

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ contract DeployUpgradeMainnet is Script, DeployBase {
2222
// NOTE: Ensure this is the correct Excess Destination mainnet address.
2323
address internal constant _EXCESS_DESTINATION = 0xd7298f620B0F752Cf41BD818a16C756d9dCAA34f; // Vault
2424

25-
// TODO: Replace with the correct Swap Facility mainnet address after deployment.
26-
address internal constant _SWAP_FACILITY = address(0);
25+
address internal constant _SWAP_FACILITY = 0xB6807116b3B1B321a390594e31ECD6e0076f6278;
2726

2827
address internal constant _M_TOKEN = 0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1b;
2928

@@ -93,20 +92,13 @@ contract DeployUpgradeMainnet is Script, DeployBase {
9392
uint64 currentNonce_ = vm.getNonce(deployer_);
9493

9594
uint64 startNonce_ = currentNonce_;
96-
address earnerManagerImplementation_;
97-
address earnerManagerProxy_;
9895
address wrappedMTokenImplementation_;
9996
address wrappedMTokenMigrator_;
10097

10198
while (true) {
10299
if (startNonce_ > _DEPLOYER_MIGRATOR_NONCE) revert DeployerNonceTooHigh();
103100

104-
(
105-
earnerManagerImplementation_,
106-
earnerManagerProxy_,
107-
wrappedMTokenImplementation_,
108-
wrappedMTokenMigrator_
109-
) = mockDeployUpgrade(deployer_, startNonce_);
101+
(wrappedMTokenImplementation_, wrappedMTokenMigrator_) = mockDeployUpgrade(deployer_, startNonce_);
110102

111103
if (wrappedMTokenMigrator_ == _EXPECTED_WRAPPED_M_MIGRATOR) break;
112104

@@ -131,25 +123,17 @@ contract DeployUpgradeMainnet is Script, DeployBase {
131123
earners_[index_] = _earners[index_];
132124
}
133125

134-
(
135-
earnerManagerImplementation_,
136-
earnerManagerProxy_,
137-
wrappedMTokenImplementation_,
138-
wrappedMTokenMigrator_
139-
) = deployUpgrade(
126+
(wrappedMTokenImplementation_, wrappedMTokenMigrator_) = deployUpgrade(
140127
_M_TOKEN,
141128
_REGISTRAR,
142129
_EXCESS_DESTINATION,
143130
_SWAP_FACILITY,
144131
_WRAPPED_M_MIGRATION_ADMIN,
145-
_EARNER_MANAGER_MIGRATION_ADMIN,
146132
earners_
147133
);
148134

149135
vm.stopBroadcast();
150136

151-
console2.log("Earner Manager Implementation address:", earnerManagerImplementation_);
152-
console2.log("Earner Manager Proxy address:", earnerManagerProxy_);
153137
console2.log("Wrapped M Implementation address:", wrappedMTokenImplementation_);
154138
console2.log("Migrator address:", wrappedMTokenMigrator_);
155139

0 commit comments

Comments
 (0)