Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
4d827c39
Commit
4d827c39
authored
Sep 21, 2023
by
tre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create deployment scripts for drippie
parent
adf55b3a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
28 deletions
+60
-28
DeployPeriphery.s.sol
packages/contracts-bedrock/scripts/DeployPeriphery.s.sol
+60
-28
No files found.
packages/contracts-bedrock/scripts/DeployPeriphery.s.sol
View file @
4d827c39
...
@@ -63,23 +63,40 @@ contract DeployPeriphery is Deployer {
...
@@ -63,23 +63,40 @@ contract DeployPeriphery is Deployer {
/// @notice Deploy the ProxyAdmin
/// @notice Deploy the ProxyAdmin
function deployProxyAdmin() public broadcast returns (address addr_) {
function deployProxyAdmin() public broadcast returns (address addr_) {
ProxyAdmin admin = new ProxyAdmin{ salt: keccak256(bytes("ProxyAdmin")) }({
bytes32 salt = keccak256(bytes("ProxyAdmin"));
bytes32 initCodeHash = keccak256(abi.encodePacked(type(ProxyAdmin).creationCode, abi.encode(msg.sender)));
address preComputedAddress = computeCreate2Address(salt, initCodeHash);
if (preComputedAddress.code.length > 0) {
console.log("ProxyAdmin already deployed at %s", preComputedAddress);
save("ProxyAdmin", preComputedAddress);
addr_ = preComputedAddress;
} else {
ProxyAdmin admin = new ProxyAdmin{ salt: salt }({
_owner: msg.sender
_owner: msg.sender
});
});
require(admin.owner() == msg.sender);
require(admin.owner() == msg.sender);
save("ProxyAdmin", address(admin));
save("ProxyAdmin", address(admin));
console.log("ProxyAdmin deployed at %s", address(admin));
console.log("ProxyAdmin deployed at %s", address(admin));
addr_ = address(admin);
addr_ = address(admin);
}
}
}
/// @notice Deploy the FaucetProxy
/// @notice Deploy the FaucetProxy
function deployFaucetProxy() public broadcast returns (address addr_) {
function deployFaucetProxy() public broadcast returns (address addr_) {
bytes32 salt = keccak256(bytes("FaucetProxy"));
address proxyAdmin = mustGetAddress("ProxyAdmin");
address proxyAdmin = mustGetAddress("ProxyAdmin");
Proxy proxy = new Proxy{ salt: keccak256(bytes("FaucetProxy")) }({
bytes32 initCodeHash = keccak256(abi.encodePacked(type(Proxy).creationCode, abi.encode(proxyAdmin)));
address preComputedAddress = computeCreate2Address(salt, initCodeHash);
if (preComputedAddress.code.length > 0) {
console.log("FaucetProxy already deployed at %s", preComputedAddress);
save("FaucetProxy", preComputedAddress);
addr_ = preComputedAddress;
} else {
Proxy proxy = new Proxy{ salt: salt }({
_admin: proxyAdmin
_admin: proxyAdmin
});
});
address admin = address(uint160(uint256(vm.load(address(proxy), OWNER_KEY))));
address admin = address(uint160(uint256(vm.load(address(proxy), OWNER_KEY))));
require(admin == proxyAdmin);
require(admin == proxyAdmin);
...
@@ -88,16 +105,26 @@ contract DeployPeriphery is Deployer {
...
@@ -88,16 +105,26 @@ contract DeployPeriphery is Deployer {
addr_ = address(proxy);
addr_ = address(proxy);
}
}
}
/// @notice Deploy the faucet contract.
/// @notice Deploy the faucet contract.
function deployFaucet() public broadcast returns (address) {
function deployFaucet() public broadcast returns (address addr_) {
Faucet faucet = new Faucet{ salt: keccak256(bytes("Faucet")) }(cfg.faucetAdmin());
bytes32 salt = keccak256(bytes("Faucet"));
bytes32 initCodeHash = keccak256(abi.encodePacked(type(Faucet).creationCode, abi.encode(cfg.faucetAdmin())));
address preComputedAddress = computeCreate2Address(salt, initCodeHash);
if (preComputedAddress.code.length > 0) {
console.log("Faucet already deployed at %s", preComputedAddress);
save("Faucet", preComputedAddress);
addr_ = preComputedAddress;
} else {
Faucet faucet = new Faucet{ salt: salt }(cfg.faucetAdmin());
require(faucet.ADMIN() == cfg.faucetAdmin());
require(faucet.ADMIN() == cfg.faucetAdmin());
save("Faucet", address(faucet));
save("Faucet", address(faucet));
console.log("Faucet deployed at %s", address(faucet));
console.log("Faucet deployed at %s", address(faucet));
return address(faucet);
addr_ = address(faucet);
}
}
}
/// @notice Initialize the Faucet
/// @notice Initialize the Faucet
...
@@ -105,8 +132,13 @@ contract DeployPeriphery is Deployer {
...
@@ -105,8 +132,13 @@ contract DeployPeriphery is Deployer {
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
address faucetProxy = mustGetAddress("FaucetProxy");
address faucetProxy = mustGetAddress("FaucetProxy");
address faucet = mustGetAddress("Faucet");
address faucet = mustGetAddress("Faucet");
address implementationAddress = proxyAdmin.getProxyImplementation(faucetProxy);
if (implementationAddress == faucet) {
console.log("Faucet proxy implementation already set");
} else {
proxyAdmin.upgrade({ _proxy: payable(faucetProxy), _implementation: faucet });
proxyAdmin.upgrade({ _proxy: payable(faucetProxy), _implementation: faucet });
}
require(Faucet(payable(faucetProxy)).ADMIN() == Faucet(payable(faucet)).ADMIN());
require(Faucet(payable(faucetProxy)).ADMIN() == Faucet(payable(faucet)).ADMIN());
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment