Skip to content

Commit

Permalink
fix(ucs01): forward correct denoms
Browse files Browse the repository at this point in the history
Signed-off-by: aeryz <abdullaheryz@protonmail.com>
  • Loading branch information
aeryz committed Jun 7, 2024
1 parent beededc commit dfbd17e
Show file tree
Hide file tree
Showing 2 changed files with 154 additions and 123 deletions.
18 changes: 7 additions & 11 deletions cosmwasm/ucs01-relay-api/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ pub trait TransferProtocol {
.add_event(
packet_event
.add_attributes([
("this_module_version", Self::VERSION),
(ATTR_MODULE, TRANSFER_MODULE),
(ATTR_SENDER, packet.sender().to_string().as_str()),
(ATTR_RECEIVER, packet.receiver().to_string().as_str()),
Expand Down Expand Up @@ -295,7 +296,7 @@ pub trait TransferProtocol {
&mut self,
receiver: &<Self::Packet as TransferPacket>::Addr,
tokens: Vec<TransferToken>,
) -> Result<Vec<CosmosMsg<Self::CustomMsg>>, Self::Error>;
) -> Result<(Vec<TransferToken>, Vec<CosmosMsg<Self::CustomMsg>>), Self::Error>;

fn receive(&mut self, original_packet: IbcPacket) -> IbcReceiveResponse<Self::CustomMsg> {
let handle = || -> Result<IbcReceiveResponse<Self::CustomMsg>, Self::Error> {
Expand All @@ -308,6 +309,7 @@ pub trait TransferProtocol {
// to be overwritten.
let transfer_msgs = self
.receive_transfer(packet.receiver(), packet.tokens())?
.1
.into_iter()
.map(|msg| SubMsg::reply_on_error(msg, Self::RECEIVE_REPLY_ID));

Expand All @@ -316,13 +318,7 @@ pub trait TransferProtocol {
if let Ok(memo) = serde_json_wasm::from_str::<Memo>(&memo) {
match memo {
Memo::Forward { forward } => {
return Ok(Self::packet_forward(
self,
packet,
original_packet,
forward,
false,
))
return Ok(self.packet_forward(packet, original_packet, forward, false))
}
Memo::None { .. } => {}
};
Expand Down Expand Up @@ -402,11 +398,11 @@ pub trait TransferProtocol {
sequence: u64,
) -> Result<Option<(Vec<CosmosMsg<Self::CustomMsg>>, Vec<(&str, String)>)>, Self::Error>;

fn convert_foreign_protocol_ack(
fn convert_ack_to_foreign_protocol(
&self,
foreign_protocol: &str,
ack: Binary,
) -> Result<Binary, Self::Error>;
ack: GenericAck,
) -> Result<GenericAck, Self::Error>;
}

#[cfg(test)]
Expand Down
Loading

0 comments on commit dfbd17e

Please sign in to comment.