Skip to content

Commit

Permalink
Merge pull request #575 from chainbound/fix/cli/operators-status
Browse files Browse the repository at this point in the history
fix(cli): operators status stake
  • Loading branch information
thedevbirb authored Dec 16, 2024
2 parents 82f59e5 + 47fd022 commit a93583f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
26 changes: 14 additions & 12 deletions bolt-cli/src/commands/operators/eigenlayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,19 +244,21 @@ impl EigenLayerSubcommand {

// Check if operator has collateral
let mut total_collateral = Uint::from(0);
for (name, address) in deployments.collateral {
let stake = match bolt_manager.getOperatorStake(address, address).call().await {
Ok(stake) => stake._0,
Err(e) => {
match try_parse_contract_error::<BoltEigenLayerMiddlewareErrors>(e)? {
BoltEigenLayerMiddlewareErrors::KeyNotFound(_) => Uint::from(0),
other => unreachable!(
"Unexpected error with selector {:?}",
other.selector()
),
for (name, collateral) in deployments.collateral {
let stake =
match bolt_manager.getOperatorStake(address, collateral).call().await {
Ok(stake) => stake._0,
Err(e) => {
match try_parse_contract_error::<BoltEigenLayerMiddlewareErrors>(e)?
{
BoltEigenLayerMiddlewareErrors::KeyNotFound(_) => Uint::from(0),
other => unreachable!(
"Unexpected error with selector {:?}",
other.selector()
),
}
}
}
};
};
if stake > Uint::from(0) {
total_collateral += stake;
info!(?address, token = %name, amount = ?stake, "Operator has collateral");
Expand Down
26 changes: 14 additions & 12 deletions bolt-cli/src/commands/operators/symbiotic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,21 @@ impl SymbioticSubcommand {

// Check if operator has collateral
let mut total_collateral = Uint::from(0);
for (name, address) in deployments.collateral {
let stake = match bolt_manager.getOperatorStake(address, address).call().await {
Ok(stake) => stake._0,
Err(e) => {
match try_parse_contract_error::<BoltSymbioticMiddlewareErrors>(e)? {
BoltSymbioticMiddlewareErrors::KeyNotFound(_) => Uint::from(0),
other => unreachable!(
"Unexpected error with selector {:?}",
other.selector()
),
for (name, collateral) in deployments.collateral {
let stake =
match bolt_manager.getOperatorStake(address, collateral).call().await {
Ok(stake) => stake._0,
Err(e) => {
match try_parse_contract_error::<BoltSymbioticMiddlewareErrors>(e)?
{
BoltSymbioticMiddlewareErrors::KeyNotFound(_) => Uint::from(0),
other => unreachable!(
"Unexpected error with selector {:?}",
other.selector()
),
}
}
}
};
};
if stake > Uint::from(0) {
total_collateral += stake;
info!(?address, token = %name, amount = ?stake, "Operator has collateral");
Expand Down

0 comments on commit a93583f

Please sign in to comment.