-
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
* Add support for freezing and unfreezing specific chains
- Loading branch information
Showing
6 changed files
with
384 additions
and
17 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,28 @@ | ||
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 load ITS contract")] | ||
ItsContract, | ||
#[error("failed to load all ITS contracts")] | ||
AllItsContracts, | ||
#[error("failed to serialize data to JSON")] | ||
JsonSerializationError, | ||
} | ||
|
||
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_contracts(deps: Deps, chain: ChainNameRaw) -> Result<Binary, Error> { | ||
let contract_address = | ||
may_load_its_contract(deps.storage, &chain).change_context(Error::ItsContract)?; | ||
to_json_binary(&contract_address).change_context(Error::JsonSerializationError) | ||
} | ||
|
||
pub fn all_its_contracts(deps: Deps) -> Result<Binary, Error> { | ||
let contract_addresses = | ||
load_all_its_contracts(deps.storage).change_context(Error::AllItsContracts)?; | ||
to_json_binary(&contract_addresses).change_context(Error::JsonSerializationError) | ||
} |
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.