Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: hb-187-user-story-for-defining-storage-for-connection #81

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions contracts/cosmwasm-vm/cw-ibc-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ use cosmwasm_schema::cw_serde;
use cw_storage_plus::{Item, Map};
use ibc::core::{
ics02_client::client_type::ClientType,
ics04_channel::packet::Sequence,
ics24_host::identifier::{ChannelId, ClientId, PortId},
ics03_connection::connection::ConnectionEnd,
ics04_channel::channel::ChannelEnd,
ics04_channel::packet::Sequence,
ics24_host::identifier::{ChannelId, ClientId, ConnectionId, PortId},
};
5 changes: 5 additions & 0 deletions contracts/cosmwasm-vm/cw-ibc-core/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct CwIbcStore<'a> {
next_client_sequence: Item<'a, u128>,
next_connection_sequence: Item<'a, u128>,
next_channel_sequence: Item<'a, u128>,
connections: Map<'a, ConnectionId, ConnectionEnd>,
channels: Map<'a, (PortId, ChannelId), ChannelEnd>,
}

Expand Down Expand Up @@ -43,6 +44,9 @@ impl<'a> CwIbcStore<'a> {
pub fn next_channel_sequence(&self) -> &Item<'a, u128> {
&self.next_channel_sequence
}
pub fn connections(&self) -> &Map<'a, ConnectionId, ConnectionEnd> {
&self.connections
}
pub fn channels(&self) -> &Map<'a, (PortId, ChannelId), ChannelEnd> {
&self.channels
}
Expand All @@ -58,6 +62,7 @@ impl<'a> CwIbcStore<'a> {
next_client_sequence: Item::new(StorageKey::NextClientSequence.as_str()),
next_connection_sequence: Item::new(StorageKey::NextConnectionSequence.as_str()),
next_channel_sequence: Item::new(StorageKey::NextChannelSequence.as_str()),
connections: Map::new(StorageKey::Connections.as_str()),
channels: Map::new(StorageKey::Channels.as_str()),
}
}
Expand Down
2 changes: 2 additions & 0 deletions contracts/cosmwasm-vm/cw-ibc-core/src/storage_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub enum StorageKey {
NextClientSequence,
NextConnectionSequence,
NextChannelSequence,
Connections,
Channels,
}

Expand All @@ -27,6 +28,7 @@ impl StorageKey {
StorageKey::NextClientSequence => "next_client_sequence",
StorageKey::NextConnectionSequence => "next_connection_sequence",
StorageKey::NextChannelSequence => "next_channel_sequence",
StorageKey::Connections => "connections",
StorageKey::Channels => "channels",
}
}
Expand Down