Skip to content

Commit

Permalink
feat(zk-toolbox): Deploy custom token
Browse files Browse the repository at this point in the history
Signed-off-by: Danil <[email protected]>
  • Loading branch information
Deniallugo committed Jun 26, 2024
1 parent 298a97e commit 903d9cd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ impl Default for Erc20DeploymentConfig {
symbol: String::from("DAI"),
decimals: 18,
implementation: String::from("TestnetERC20Token.sol"),
mint: 10000000000,
mint: 10000000000000000000,
},
Erc20DeploymentTokensConfig {
name: String::from("WBTC"),
symbol: String::from("WBTC"),
decimals: 8,
implementation: String::from("TestnetERC20Token.sol"),
mint: 10000000000,
mint: 10000000000000000000,
},
Erc20DeploymentTokensConfig {
name: String::from("Wrapped Ether"),
Expand Down Expand Up @@ -209,6 +209,7 @@ pub struct DeployErc20Config {
pub create2_factory_salt: H256,
pub create2_factory_addr: Address,
pub tokens: HashMap<String, TokenDeployErc20Config>,
pub additional_addresses_for_minting: Vec<Address>,
}

impl FileConfig for DeployErc20Config {}
Expand All @@ -217,6 +218,7 @@ impl DeployErc20Config {
pub fn new(
erc20_deployment_config: &Erc20DeploymentConfig,
contracts_config: &ContractsConfig,
additional_addresses_for_minting: Vec<Address>,
) -> Self {
let mut tokens = HashMap::new();
for token in &erc20_deployment_config.tokens {
Expand All @@ -235,6 +237,7 @@ impl DeployErc20Config {
create2_factory_addr: contracts_config.create2_factory_addr,
create2_factory_salt: contracts_config.create2_factory_salt,
tokens,
additional_addresses_for_minting,
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions zk_toolbox/crates/zk_inception/src/commands/chain/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ pub async fn init(
// Copy ecosystem contracts
contracts_config.save_with_base_path(shell, &chain_config.configs)?;

crate::commands::ecosystem::init::distribute_eth(
&ecosystem_config,
&chain_config,
init_args.l1_rpc_url.clone(),
)
.await?;
let spinner = Spinner::new(MSG_REGISTERING_CHAIN_SPINNER);
contracts_config = register_chain(
shell,
Expand Down
20 changes: 11 additions & 9 deletions zk_toolbox/crates/zk_inception/src/commands/ecosystem/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,6 @@ pub async fn run(args: EcosystemInitArgs, shell: &Shell) -> anyhow::Result<()> {
l1_rpc_url: final_ecosystem_args.ecosystem.l1_rpc_url.clone(),
};

distribute_eth(
&ecosystem_config,
&chain_config,
final_ecosystem_args.ecosystem.l1_rpc_url.clone(),
)
.await?;

chain::init::init(
&mut chain_init_args,
shell,
Expand Down Expand Up @@ -195,8 +188,17 @@ async fn deploy_erc20(
l1_rpc_url: String,
) -> anyhow::Result<DeployErc20Output> {
let deploy_config_path = DEPLOY_ERC20_SCRIPT_PARAMS.input(&ecosystem_config.link_to_code);
DeployErc20Config::new(erc20_deployment_config, contracts_config)
.save(shell, deploy_config_path)?;
let wallets = ecosystem_config.get_wallets()?;
DeployErc20Config::new(
erc20_deployment_config,
contracts_config,
vec![
wallets.governor.address,
wallets.operator.address,
wallets.blob_operator.address,
],
)
.save(shell, deploy_config_path)?;

let mut forge = Forge::new(&ecosystem_config.path_to_foundry())
.script(&DEPLOY_ERC20_SCRIPT_PARAMS.script(), forge_args.clone())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod args;
mod change_default;
mod create;
pub mod create_configs;
mod init;
pub(crate) mod init;

#[derive(Subcommand, Debug)]
#[allow(clippy::large_enum_variant)]
Expand Down

0 comments on commit 903d9cd

Please sign in to comment.