-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
408 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-5.1.0/ | ||
@openzeppelin-contracts-upgradeable/=dependencies/@openzeppelin-contracts-upgradeable-5.1.0/ | ||
@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-5.1.0/ | ||
forge-std/=dependencies/forge-std-1.9.4/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.28; | ||
|
||
import "forge-std/src/Script.sol"; | ||
import "forge-std/src/Vm.sol"; | ||
import "src/GroupMessages.sol"; | ||
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
|
||
contract DeployGroupMessages is Script { | ||
function run() external { | ||
uint256 privateKey = vm.envUint("PRIVATE_KEY"); | ||
address deployer = vm.addr(privateKey); | ||
vm.startBroadcast(privateKey); | ||
|
||
// Step 1: Deploy the implementation contract. | ||
GroupMessages groupMessagesImpl = new GroupMessages(); | ||
|
||
// Step 2: Deploy the proxy contract. | ||
ERC1967Proxy proxy = | ||
new ERC1967Proxy( | ||
address(groupMessagesImpl), | ||
abi.encodeWithSelector(GroupMessages.initialize.selector, deployer) | ||
); | ||
|
||
console.log( | ||
'{"deployer":"%s","proxy":"%s","implementation":"%s"}', | ||
deployer, | ||
address(proxy), | ||
address(groupMessagesImpl) | ||
); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.28; | ||
|
||
import "forge-std/src/Script.sol"; | ||
import "forge-std/src/Vm.sol"; | ||
import "src/IdentityUpdates.sol"; | ||
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
|
||
contract DeployIdentityUpdates is Script { | ||
function run() external { | ||
uint256 privateKey = vm.envUint("PRIVATE_KEY"); | ||
address deployer = vm.addr(privateKey); | ||
vm.startBroadcast(privateKey); | ||
|
||
// Step 1: Deploy the implementation contract | ||
IdentityUpdates idUpdatesImpl = new IdentityUpdates(); | ||
|
||
// Step 2: Deploy the proxy contract | ||
ERC1967Proxy proxy = | ||
new ERC1967Proxy( | ||
address(idUpdatesImpl), | ||
abi.encodeWithSelector(IdentityUpdates.initialize.selector, deployer) | ||
); | ||
|
||
console.log( | ||
'{"deployer":"%s","proxy":"%s","implementation":"%s"}', | ||
deployer, | ||
address(proxy), | ||
address(idUpdatesImpl) | ||
); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.28; | ||
|
||
import "forge-std/src/Script.sol"; | ||
import "forge-std/src/Vm.sol"; | ||
import "src/GroupMessages.sol"; | ||
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
|
||
contract UpgradeGroupMessages is Script { | ||
function run() external { | ||
address proxyAddress = vm.envAddress("XMTP_GROUP_MESSAGES_PROXY_ADDRESS"); | ||
require(proxyAddress != address(0), "XMTP_GROUP_MESSAGES_PROXY_ADDRESS not set"); | ||
|
||
uint256 privateKey = vm.envUint("PRIVATE_KEY"); | ||
address upgrader = vm.addr(privateKey); | ||
vm.startBroadcast(privateKey); | ||
|
||
// Step 1: Deploy the new implementation contract. | ||
GroupMessages newImplementation = new GroupMessages(); | ||
|
||
// Step 2: Initialize the proxy. | ||
GroupMessages proxy = GroupMessages(proxyAddress); | ||
|
||
// Step 3: Upgrade the proxy pointer to the new implementation. | ||
proxy.upgradeToAndCall(address(newImplementation), ""); | ||
|
||
console.log( | ||
'{"upgrader":"%s","proxy":"%s","newImplementation":"%s"}', | ||
upgrader, | ||
address(proxy), | ||
address(newImplementation) | ||
); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.28; | ||
|
||
import "forge-std/src/Script.sol"; | ||
import "forge-std/src/Vm.sol"; | ||
import "src/IdentityUpdates.sol"; | ||
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
|
||
contract UpgradeGroupMessages is Script { | ||
function run() external { | ||
address proxyAddress = vm.envAddress("XMTP_IDENTITY_UPDATES_PROXY_ADDRESS"); | ||
require(proxyAddress != address(0), "XMTP_IDENTITY_UPDATES_PROXY_ADDRESS not set"); | ||
|
||
uint256 privateKey = vm.envUint("PRIVATE_KEY"); | ||
address upgrader = vm.addr(privateKey); | ||
vm.startBroadcast(privateKey); | ||
|
||
// Step 1: Deploy the new implementation contract. | ||
IdentityUpdates newImplementation = new IdentityUpdates(); | ||
|
||
// Step 2: Initialize the proxy. | ||
IdentityUpdates proxy = IdentityUpdates(proxyAddress); | ||
|
||
// Step 3: Upgrade the proxy pointer to the new implementation. | ||
proxy.upgradeToAndCall(address(newImplementation), ""); | ||
|
||
console.log( | ||
'{"upgrader":"%s","proxy":"%s","newImplementation":"%s"}', | ||
upgrader, | ||
address(proxy), | ||
address(newImplementation) | ||
); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.