mirror of
https://github.com/logos-messaging/logos-messaging-rlnv2-contract.git
synced 2026-01-10 09:53:11 +00:00
Add proxy contract for TST
This commit is contained in:
parent
900d4f95e0
commit
f58a2c349f
41
script/DeployTokenWithProxy.s.sol
Normal file
41
script/DeployTokenWithProxy.s.sol
Normal file
@ -0,0 +1,41 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity >=0.8.19 <0.9.0;
|
||||
|
||||
import { BaseScript } from "./Base.s.sol";
|
||||
import { TestStableToken } from "../test/TestStableToken.sol";
|
||||
import {
|
||||
TransparentUpgradeableProxy,
|
||||
ITransparentUpgradeableProxy
|
||||
} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
|
||||
import { ProxyAdmin } from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
|
||||
|
||||
contract DeployTokenWithProxy is BaseScript {
|
||||
function run() public broadcast returns (address proxy, address implementation, address admin) {
|
||||
// Deploy the initial implementation
|
||||
implementation = address(new TestStableToken());
|
||||
|
||||
// Deploy proxy admin
|
||||
admin = address(new ProxyAdmin());
|
||||
|
||||
// Deploy the proxy with empty initialization data
|
||||
proxy = address(new TransparentUpgradeableProxy(implementation, admin, ""));
|
||||
|
||||
return (proxy, implementation, admin);
|
||||
}
|
||||
}
|
||||
|
||||
contract UpdateTokenImplementation is BaseScript {
|
||||
function run(address proxyAddress, address proxyAdminAddress) public broadcast returns (address newImplementation) {
|
||||
// Deploy new implementation
|
||||
newImplementation = address(new TestStableToken());
|
||||
|
||||
// Upgrade via ProxyAdmin
|
||||
ProxyAdmin(proxyAdminAddress).upgradeAndCall(
|
||||
ITransparentUpgradeableProxy(proxyAddress),
|
||||
newImplementation,
|
||||
""
|
||||
);
|
||||
|
||||
return newImplementation;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user