-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
316 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 20 additions & 17 deletions
37
cosmwasm/ibc-union/core/light-client-interface/src/state.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
use cosmwasm_std::{Addr, StdError, StdResult}; | ||
use depolama::{Prefix, Store, ValueCodec}; | ||
use cw_storage_plus::Item; | ||
// use depolama::{Prefix, Store, ValueCodec}; | ||
use unionlabs::primitives::Bytes; | ||
|
||
pub enum IbcHost {} | ||
impl Store for IbcHost { | ||
const PREFIX: Prefix = Prefix::new(b"ibc_host"); | ||
pub const IBC_HOST: Item<Addr> = Item::new("ibc_host"); | ||
|
||
type Key = (); | ||
type Value = Addr; | ||
} | ||
// pub enum IbcHost {} | ||
// impl Store for IbcHost { | ||
// const PREFIX: Prefix = Prefix::new(b"ibc_host"); | ||
|
||
impl ValueCodec<Addr> for IbcHost { | ||
fn encode_value(value: &Addr) -> Bytes { | ||
value.as_bytes().into() | ||
} | ||
// type Key = (); | ||
// type Value = Addr; | ||
// } | ||
|
||
fn decode_value(raw: &Bytes) -> StdResult<Addr> { | ||
String::from_utf8(raw.to_vec()) | ||
.map(Addr::unchecked) | ||
.map_err(|e| StdError::generic_err(format!("invalid value: {e}"))) | ||
} | ||
} | ||
// impl ValueCodec<Addr> for IbcHost { | ||
// fn encode_value(value: &Addr) -> Bytes { | ||
// value.as_bytes().into() | ||
// } | ||
|
||
// fn decode_value(raw: &Bytes) -> StdResult<Addr> { | ||
// String::from_utf8(raw.to_vec()) | ||
// .map(Addr::unchecked) | ||
// .map_err(|e| StdError::generic_err(format!("invalid value: {e}"))) | ||
// } | ||
// } |
Oops, something went wrong.