Skip to content

Commit

Permalink
chore: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
drewstone committed Nov 18, 2024
1 parent af201b5 commit f550f9b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 23 deletions.
26 changes: 15 additions & 11 deletions blueprints/arbitrum-orbit/src/jobs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,26 +66,30 @@ pub struct FeeRecipientParams {
macro_rules! impl_node_script_job {
($job_name:ident, $params_type:ty, $id:expr) => {
#[sdk::job(
id = $id,
params(params),
event_listener(
listener = TangleEventListener::<ServiceContext, JobCalled>,
pre_processor = services_pre_processor,
),
)]
id = $id,
params(params),
event_listener(
listener = TangleEventListener::<ServiceContext, JobCalled>,
pre_processor = services_pre_processor,
),
)]
pub fn $job_name(
params: $params_type,
_context: ServiceContext,
) -> Result<String, std::io::Error> {
let output = Command::new("node")
.arg(concat!("scripts/", stringify!($job_name).replace("_", "-"), ".ts"))
.arg(concat!(
"scripts/",
stringify!($job_name).replace("_", "-"),
".ts"
))
.arg(serde_json::to_string(&params).unwrap())
.output()?;

if !output.status.success() {
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
String::from_utf8_lossy(&output.stderr).to_string()
String::from_utf8_lossy(&output.stderr).to_string(),
));
}

Expand All @@ -97,7 +101,7 @@ macro_rules! impl_node_script_job {
// Job to set validators
impl_node_script_job!(set_validators, ValidatorParams, 1);

// Job to add privileged executors
// Job to add privileged executors
impl_node_script_job!(add_executors, ExecutorParams, 2);

// Job to configure fast withdrawals
Expand All @@ -107,4 +111,4 @@ impl_node_script_job!(configure_fast_withdrawals, FastWithdrawalParams, 3);
impl_node_script_job!(manage_batch_posters, BatchPosterParams, 4);

// Job to configure fee recipients
impl_node_script_job!(configure_fee_recipients, FeeRecipientParams, 5);
impl_node_script_job!(configure_fee_recipients, FeeRecipientParams, 5);
20 changes: 13 additions & 7 deletions blueprints/arbitrum-orbit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use alloy_primitives::Address;
use alloy_sol_types::sol;
use color_eyre::eyre::Result;
use gadget_sdk::load_abi;
use jobs::{manage_batch_posters, set_validators, BatchPosterParams, ServiceContext, TokenBridgeParams, ValidatorParams};
use jobs::{
manage_batch_posters, set_validators, BatchPosterParams, ServiceContext, TokenBridgeParams,
ValidatorParams,
};
use serde::{Deserialize, Serialize};

pub mod jobs;
Expand Down Expand Up @@ -72,11 +75,14 @@ async fn setup_initial_configuration(
if config.setup_token_bridge {
let output = Command::new("node")
.arg("scripts/configure-token-bridge.ts")
.arg(serde_json::to_string(&TokenBridgeParams {
rollup_address: deployment.rollup_address,
native_token: config.native_token.unwrap_or(Address::ZERO),
owner: config.owner,
}).unwrap())
.arg(
serde_json::to_string(&TokenBridgeParams {
rollup_address: deployment.rollup_address,
native_token: config.native_token.unwrap_or(Address::ZERO),
owner: config.owner,
})
.unwrap(),
)
.output()?;

if !output.status.success() {
Expand Down Expand Up @@ -104,4 +110,4 @@ async fn setup_initial_configuration(
set_validators(validator_params, context.clone())?;

Ok(())
}
}
19 changes: 14 additions & 5 deletions blueprints/arbitrum-orbit/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
use alloy_primitives::Address;
use arbitrum_orbit_blueprint::{jobs::{AddExecutorsEventHandler, ConfigureFastWithdrawalsEventHandler, ConfigureFeeRecipientsEventHandler, ManageBatchPostersEventHandler, SetValidatorsEventHandler}, OrbitRaaSBlueprint};
use arbitrum_orbit_blueprint::{
jobs::{
AddExecutorsEventHandler, ConfigureFastWithdrawalsEventHandler,
ConfigureFeeRecipientsEventHandler, ManageBatchPostersEventHandler,
SetValidatorsEventHandler,
},
OrbitRaaSBlueprint,
};
use color_eyre::Result;
use gadget_sdk::{self as sdk, utils::evm::get_provider_http};
use sdk::runners::tangle::TangleConfig;
Expand All @@ -14,7 +21,7 @@ async fn main() -> Result<()> {
let blueprint_address = Address::from([0; 20]);
let contract = OrbitRaaSBlueprint::new(blueprint_address, provider);
let rollup_config_return = contract.getRollupConfig(service_id).call().await?;

let rollup_config = RollupConfig {
chain_id: rollup_config_return.chainId,
owner: rollup_config_return.owner,
Expand Down Expand Up @@ -52,7 +59,8 @@ async fn main() -> Result<()> {
// Initialize all jobs
let set_validators = SetValidatorsEventHandler::new(&env, context).await?;
let add_executors = AddExecutorsEventHandler::new(&env, context).await?;
let configure_fast_withdrawals = ConfigureFastWithdrawalsEventHandler::new(&env, context).await?;
let configure_fast_withdrawals =
ConfigureFastWithdrawalsEventHandler::new(&env, context).await?;
let manage_batch_postesr = ManageBatchPostersEventHandler::new(&env, context).await?;
let configure_fee_recipients = ConfigureFeeRecipientsEventHandler::new(&env, context).await?;

Expand All @@ -64,8 +72,9 @@ async fn main() -> Result<()> {
.job(configure_fast_withdraw)
.job(manage_batch_posters)
.job(configure_fee_recipients)
.run().await?;
.run()
.await?;

gadget_sdk::info!("Exiting...");
Ok(())
}
}

0 comments on commit f550f9b

Please sign in to comment.