Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauro Lacy committed Aug 6, 2024
1 parent 276a44c commit 1afdf40
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
9 changes: 7 additions & 2 deletions contracts/babylon/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ pub fn execute(
// TODO: Add events
Ok(Response::new())
}
ExecuteMsg::Slashing { fp_btc_pk, block_height, secret_key } => {
ExecuteMsg::Slashing {
fp_btc_pk,
block_height,
secret_key,
} => {
// This is an internal routing message from the `btc-staking` contract
// Check sender
let btc_staking = CONFIG
Expand All @@ -173,7 +177,8 @@ pub fn execute(
}
// Send over IBC to the Provider (Babylon)
let channel = IBC_CHANNEL.load(deps.storage)?;
let msg = ibc_packet::slashing_msg(&env, &channel, &fp_btc_pk, block_height, &secret_key)?;
let msg =
ibc_packet::slashing_msg(&env, &channel, &fp_btc_pk, block_height, &secret_key)?;
// TODO: Add events
Ok(Response::new().add_message(msg))
}
Expand Down
25 changes: 15 additions & 10 deletions contracts/babylon/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,14 @@ pub(crate) mod ibc_packet {
use super::*;
use crate::state::config::CONFIG;
use babylon_apis::ibc_consumer::{consumer_packet_data, ConsumerPacketData};
use babylon_apis::{btc_staking_api::{
ActiveBtcDelegation, BtcUndelegationInfo, CovenantAdaptorSignatures,
FinalityProviderDescription, NewFinalityProvider, ProofOfPossessionBtc, SignatureInfo,
UnbondedBtcDelegation,
}, ibc_consumer};
use babylon_apis::{
btc_staking_api::{
ActiveBtcDelegation, BtcUndelegationInfo, CovenantAdaptorSignatures,
FinalityProviderDescription, NewFinalityProvider, ProofOfPossessionBtc, SignatureInfo,
UnbondedBtcDelegation,
},
ibc_consumer,
};
use babylon_proto::babylon::btcstaking::v1::BtcStakingIbcPacket;
use cosmwasm_std::{to_json_binary, Decimal, IbcChannel, IbcMsg, WasmMsg};
use std::str::FromStr;
Expand Down Expand Up @@ -311,11 +314,13 @@ pub(crate) mod ibc_packet {
block_height: u64,
secret_key: &[u8],
) -> Result<IbcMsg, ContractError> {
let packet = ConsumerPacketData { packet: consumer_packet_data::Packet::Slashing(ibc_consumer::Slashing {
fp_btc_pk: fp_btc_pk.to_vec(),
block_height,
secret_key: secret_key.to_vec(),
}), };
let packet = ConsumerPacketData {
packet: consumer_packet_data::Packet::Slashing(ibc_consumer::Slashing {
fp_btc_pk: fp_btc_pk.to_vec(),
block_height,
secret_key: secret_key.to_vec(),
}),
};
let msg = IbcMsg::SendPacket {
channel_id: channel.endpoint.channel_id.clone(),
data: to_json_binary(&packet)?,
Expand Down
6 changes: 3 additions & 3 deletions contracts/babylon/src/msg/contract.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::{Binary, StdError, StdResult};
use babylon_apis::Bytes;
use crate::msg::btc_header::{BtcHeader, BtcHeaderResponse, BtcHeadersResponse};
use crate::msg::cz_header::CzHeaderResponse;
use crate::msg::epoch::EpochResponse;
use crate::state::config::Config;
use babylon_apis::Bytes;
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::{Binary, StdError, StdResult};

const BABYLON_TAG_BYTES: usize = 4;

Expand Down

0 comments on commit 1afdf40

Please sign in to comment.