Skip to content

Commit

Permalink
feat: op deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
rhlsthrm committed Jun 25, 2024
1 parent a72628a commit a2005c9
Show file tree
Hide file tree
Showing 7 changed files with 317 additions and 7 deletions.
146 changes: 146 additions & 0 deletions broadcast/Deploy.s.sol/10/run-1719308569.json

Large diffs are not rendered by default.

146 changes: 146 additions & 0 deletions broadcast/Deploy.s.sol/10/run-latest.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions deploy-optimism.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source .env
forge script ./script/Deploy.s.sol --tc DeployOptimism --broadcast --ffi --json --rpc-url optimism --chain optimism --private-key $MODE_PRIVATE_KEY --verify -vvv
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ solc_version = "0.8.23"
[rpc_endpoints]
mode = "https://mainnet.mode.network"
base = "https://mainnet.base.org"
optimism = "https://mainnet.optimism.io"
15 changes: 13 additions & 2 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ contract DeployMode is Script, DeployHelper {
function run() public {
address multisig = 0x6EAC39BBe26f0d6Ab8DF0f974734D2228d4Da226;
vm.startBroadcast();
_deployImplementationAndProxy(multisig);
_deployImplementationAndProxy(multisig, true);
vm.stopBroadcast();
}
}
Expand All @@ -21,7 +21,18 @@ contract DeployBase is Script, DeployHelper {
function run() public {
address multisig = 0x03A376468888cee39Fa23C234201Ba704992e030;
vm.startBroadcast();
_deployImplementationAndProxy(multisig);
_deployImplementationAndProxy(multisig, false);
vm.stopBroadcast();
}
}

contract DeployOptimism is Script, DeployHelper {
function setUp() public {}

function run() public {
address multisig = 0x03A376468888cee39Fa23C234201Ba704992e030;
vm.startBroadcast();
_deployImplementationAndProxy(multisig, false);
vm.stopBroadcast();
}
}
4 changes: 2 additions & 2 deletions script/DeployHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {ERC1967Utils} from "openzeppelin-contracts/contracts/proxy/ERC1967/ERC19

contract DeployHelper {
IonicToken public token;
function _deployImplementationAndProxy(address owner) internal {
function _deployImplementationAndProxy(address owner, bool isCanonical) internal {
// Deploy the proxy and initialize the contract through the proxy
address proxy = Upgrades.deployUUPSProxy(
"IonicToken.sol",
abi.encodeCall(IonicToken.initialize, (owner))
abi.encodeCall(IonicToken.initialize, (owner, isCanonical))
);
token = IonicToken(proxy);
}
Expand Down
10 changes: 7 additions & 3 deletions src/IonicToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ contract IonicToken is
_disableInitializers();
}

function initialize(address initialOwner) public initializer {
function initialize(
address initialOwner,
bool isCanonical
) public initializer {
__ERC20_init("Ionic", "ION");
__Ownable_init(initialOwner);
__ERC20Permit_init("Ionic");
__UUPSUpgradeable_init();

_mint(msg.sender, 1_000_000_000 * 10 ** decimals());
if (isCanonical) {
_mint(msg.sender, 1_000_000_000 * 10 ** decimals());
}
}

/// XERC20 SPECIFIC FUNCTIONALITY
Expand Down

0 comments on commit a2005c9

Please sign in to comment.