-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(minor-interchain-token-service): freeze/unfreeze (#670)
- Loading branch information
Showing
6 changed files
with
424 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
use axelar_wasm_std::IntoContractError; | ||
use cosmwasm_std::{to_json_binary, Binary, Deps}; | ||
use error_stack::{Result, ResultExt}; | ||
use router_api::ChainNameRaw; | ||
|
||
use crate::state; | ||
use crate::state::{load_all_its_contracts, may_load_its_contract}; | ||
|
||
pub fn its_contracts(deps: Deps, chain: ChainNameRaw) -> Result<Binary, state::Error> { | ||
let contract_address = state::may_load_its_contract(deps.storage, &chain)?; | ||
Ok(to_json_binary(&contract_address)?) | ||
#[derive(thiserror::Error, Debug, IntoContractError)] | ||
pub enum Error { | ||
#[error("failed to serialize data to JSON")] | ||
JsonSerialization, | ||
#[error("state error")] | ||
State, | ||
} | ||
|
||
pub fn all_its_contracts(deps: Deps) -> Result<Binary, state::Error> { | ||
let contract_addresses = state::load_all_its_contracts(deps.storage)?; | ||
Ok(to_json_binary(&contract_addresses)?) | ||
pub fn its_contract(deps: Deps, chain: ChainNameRaw) -> Result<Binary, Error> { | ||
let contract_address = | ||
may_load_its_contract(deps.storage, &chain).change_context(Error::State)?; | ||
to_json_binary(&contract_address).change_context(Error::JsonSerialization) | ||
} | ||
|
||
pub fn all_its_contracts(deps: Deps) -> Result<Binary, Error> { | ||
let contract_addresses = load_all_its_contracts(deps.storage).change_context(Error::State)?; | ||
to_json_binary(&contract_addresses).change_context(Error::JsonSerialization) | ||
} |
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
Oops, something went wrong.