Skip to content

Commit

Permalink
chore(ucs01-relay): clean up existing pfm events
Browse files Browse the repository at this point in the history
  • Loading branch information
PoisonPhang committed Jun 7, 2024
1 parent ce251fd commit 76c523a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions cosmwasm/ucs01-relay/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ use protos::{
use sha2::{Digest, Sha256};
use token_factory_api::TokenFactoryMsg;
use ucs01_relay_api::{
middleware::{InFlightPfmPacket, Memo, MiddlewareError, PacketForward, PacketForwardError},
middleware::{
InFlightPfmPacket, Memo, MiddlewareError, PacketForward, PacketForwardError,
PFM_ERROR_EVENT,
},
protocol::{TransferProtocol, ATTR_ERROR, ATTR_SUCCESS, IBC_SEND_ID},
types::{
make_foreign_denom, DenomOrigin, EncodingError, GenericAck, Ics20Ack, Ics20Packet,
Expand Down Expand Up @@ -554,7 +557,7 @@ impl<'a> TransferProtocol for Ics20Protocol<'a> {
return IbcReceiveResponse::new(
Binary::try_from(Self::ack_failure(e.to_string())).expect("impossible"),
)
.add_event(Event::new("forward_err").add_attribute("error", e.to_string()))
.add_event(Event::new(PFM_ERROR_EVENT).add_attribute("error", e.to_string()))
}
};

Expand All @@ -581,7 +584,8 @@ impl<'a> TransferProtocol for Ics20Protocol<'a> {

// TODO: persist full memo
let memo = match forward.next {
Some(next) => serde_json_wasm::to_string(&Memo::Forward { forward: *next }).unwrap(),
Some(next) => serde_json_wasm::to_string(&Memo::Forward { forward: *next })
.expect("can convert pfm memo to json string"),
None => "".to_owned(),
};

Expand Down Expand Up @@ -920,7 +924,7 @@ impl<'a> TransferProtocol for Ucs01Protocol<'a> {
return IbcReceiveResponse::new(
Binary::try_from(Self::ack_failure(e.to_string())).expect("impossible"),
)
.add_event(Event::new("forward_err").add_attribute("error", e.to_string()))
.add_event(Event::new(PFM_ERROR_EVENT).add_attribute("error", e.to_string()))
}
};

Expand All @@ -947,7 +951,8 @@ impl<'a> TransferProtocol for Ucs01Protocol<'a> {

// TODO: persist full memo
let memo = match forward.next {
Some(next) => serde_json_wasm::to_string(&Memo::Forward { forward: *next }).unwrap(),
Some(next) => serde_json_wasm::to_string(&Memo::Forward { forward: *next })
.expect("can convert pfm memo to json string"),
None => "".to_owned(),
};

Expand Down

0 comments on commit 76c523a

Please sign in to comment.