2022-06-16 09:48:01 -07:00
|
|
|
use schemars::JsonSchema;
|
2022-09-30 00:01:09 -07:00
|
|
|
use serde::{Deserialize, Serialize};
|
2022-06-16 09:48:01 -07:00
|
|
|
|
2022-09-30 00:01:09 -07:00
|
|
|
use cosmwasm_std::{Binary, CanonicalAddr, Storage};
|
|
|
|
use cosmwasm_storage::{singleton, singleton_read, ReadonlySingleton, Singleton};
|
2022-06-16 09:48:01 -07:00
|
|
|
|
|
|
|
pub const KEY_WRAPPED_ASSET: &[u8] = b"wrappedAsset";
|
|
|
|
|
|
|
|
// Created at initialization and reference original asset and bridge address
|
2022-09-30 02:18:54 -07:00
|
|
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
2022-06-16 09:48:01 -07:00
|
|
|
pub struct WrappedAssetInfo {
|
|
|
|
pub asset_chain: u16, // Asset chain id
|
|
|
|
pub asset_address: Binary, // Asset smart contract address on the original chain
|
|
|
|
pub bridge: CanonicalAddr, // Bridge address, authorized to mint and burn wrapped tokens
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn wrapped_asset_info(storage: &mut dyn Storage) -> Singleton<WrappedAssetInfo> {
|
|
|
|
singleton(storage, KEY_WRAPPED_ASSET)
|
|
|
|
}
|
|
|
|
|
2022-09-30 00:01:09 -07:00
|
|
|
pub fn wrapped_asset_info_read(storage: &dyn Storage) -> ReadonlySingleton<WrappedAssetInfo> {
|
2022-06-16 09:48:01 -07:00
|
|
|
singleton_read(storage, KEY_WRAPPED_ASSET)
|
|
|
|
}
|