terra: Fix clippy warnings
This commit is contained in:
parent
68ae3ff6cd
commit
f7cc16aa91
|
@ -208,7 +208,7 @@ mod tests {
|
||||||
use cw20::TokenInfoResponse;
|
use cw20::TokenInfoResponse;
|
||||||
|
|
||||||
fn get_balance(deps: Deps, address: HumanAddr) -> Uint128 {
|
fn get_balance(deps: Deps, address: HumanAddr) -> Uint128 {
|
||||||
query_balance(deps, address.into()).unwrap().balance
|
query_balance(deps, address).unwrap().balance
|
||||||
}
|
}
|
||||||
|
|
||||||
fn do_init(mut deps: DepsMut, creator: &HumanAddr) {
|
fn do_init(mut deps: DepsMut, creator: &HumanAddr) {
|
||||||
|
@ -261,7 +261,7 @@ mod tests {
|
||||||
|
|
||||||
let env = mock_env();
|
let env = mock_env();
|
||||||
let info = mock_info(creator, &[]);
|
let info = mock_info(creator, &[]);
|
||||||
let res = execute(deps.branch(), env, info, msg.clone()).unwrap();
|
let res = execute(deps.branch(), env, info, msg).unwrap();
|
||||||
assert_eq!(0, res.messages.len());
|
assert_eq!(0, res.messages.len());
|
||||||
assert_eq!(get_balance(deps.as_ref(), mint_to.clone(),), amount);
|
assert_eq!(get_balance(deps.as_ref(), mint_to.clone(),), amount);
|
||||||
|
|
||||||
|
@ -293,10 +293,7 @@ mod tests {
|
||||||
do_init(deps.as_mut(), &minter);
|
do_init(deps.as_mut(), &minter);
|
||||||
|
|
||||||
let amount = Uint128::new(222_222_222);
|
let amount = Uint128::new(222_222_222);
|
||||||
let msg = ExecuteMsg::Mint {
|
let msg = ExecuteMsg::Mint { recipient, amount };
|
||||||
recipient: recipient.clone(),
|
|
||||||
amount,
|
|
||||||
};
|
|
||||||
|
|
||||||
let other_address = HumanAddr::from("other");
|
let other_address = HumanAddr::from("other");
|
||||||
let env = mock_env();
|
let env = mock_env();
|
||||||
|
@ -326,7 +323,7 @@ mod tests {
|
||||||
|
|
||||||
let env = mock_env();
|
let env = mock_env();
|
||||||
let info = mock_info(&owner, &[]);
|
let info = mock_info(&owner, &[]);
|
||||||
let res = execute(deps.as_mut(), env, info, msg.clone()).unwrap();
|
let res = execute(deps.as_mut(), env, info, msg).unwrap();
|
||||||
assert_eq!(0, res.messages.len());
|
assert_eq!(0, res.messages.len());
|
||||||
assert_eq!(get_balance(deps.as_ref(), owner), Uint128::new(222_000_000));
|
assert_eq!(get_balance(deps.as_ref(), owner), Uint128::new(222_000_000));
|
||||||
assert_eq!(get_balance(deps.as_ref(), recipient), amount_transfer);
|
assert_eq!(get_balance(deps.as_ref(), recipient), amount_transfer);
|
||||||
|
@ -344,12 +341,12 @@ mod tests {
|
||||||
let recipient = HumanAddr::from("recipient");
|
let recipient = HumanAddr::from("recipient");
|
||||||
let amount_transfer = Uint128::new(222_222);
|
let amount_transfer = Uint128::new(222_222);
|
||||||
let msg = ExecuteMsg::Transfer {
|
let msg = ExecuteMsg::Transfer {
|
||||||
recipient: recipient.clone(),
|
recipient,
|
||||||
amount: amount_transfer,
|
amount: amount_transfer,
|
||||||
};
|
};
|
||||||
|
|
||||||
let env = mock_env();
|
let env = mock_env();
|
||||||
let info = mock_info(&owner, &[]);
|
let info = mock_info(&owner, &[]);
|
||||||
let _ = execute(deps.as_mut(), env, info, msg.clone()).unwrap_err(); // Will panic if no error
|
let _ = execute(deps.as_mut(), env, info, msg).unwrap_err(); // Will panic if no error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ use cw20::Expiration;
|
||||||
|
|
||||||
type HumanAddr = String;
|
type HumanAddr = String;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct InstantiateMsg {
|
pub struct InstantiateMsg {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub symbol: String,
|
pub symbol: String,
|
||||||
|
@ -18,19 +18,19 @@ pub struct InstantiateMsg {
|
||||||
pub init_hook: Option<InitHook>,
|
pub init_hook: Option<InitHook>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct InitHook {
|
pub struct InitHook {
|
||||||
pub msg: Binary,
|
pub msg: Binary,
|
||||||
pub contract_addr: HumanAddr,
|
pub contract_addr: HumanAddr,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct InitMint {
|
pub struct InitMint {
|
||||||
pub recipient: HumanAddr,
|
pub recipient: HumanAddr,
|
||||||
pub amount: Uint128,
|
pub amount: Uint128,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub struct MigrateMsg {}
|
pub struct MigrateMsg {}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ pub enum ExecuteMsg {
|
||||||
UpdateMetadata { name: String, symbol: String },
|
UpdateMetadata { name: String, symbol: String },
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum QueryMsg {
|
pub enum QueryMsg {
|
||||||
// Generic information about the wrapped asset
|
// Generic information about the wrapped asset
|
||||||
|
@ -113,7 +113,7 @@ pub enum QueryMsg {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct WrappedAssetInfoResponse {
|
pub struct WrappedAssetInfoResponse {
|
||||||
pub asset_chain: u16, // Asset chain id
|
pub asset_chain: u16, // Asset chain id
|
||||||
pub asset_address: Binary, // Asset smart contract address in the original chain
|
pub asset_address: Binary, // Asset smart contract address in the original chain
|
||||||
|
|
|
@ -7,7 +7,7 @@ use cosmwasm_storage::{singleton, singleton_read, ReadonlySingleton, Singleton};
|
||||||
pub const KEY_WRAPPED_ASSET: &[u8] = b"wrappedAsset";
|
pub const KEY_WRAPPED_ASSET: &[u8] = b"wrappedAsset";
|
||||||
|
|
||||||
// Created at initialization and reference original asset and bridge address
|
// Created at initialization and reference original asset and bridge address
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct WrappedAssetInfo {
|
pub struct WrappedAssetInfo {
|
||||||
pub asset_chain: u16, // Asset chain id
|
pub asset_chain: u16, // Asset chain id
|
||||||
pub asset_address: Binary, // Asset smart contract address on the original chain
|
pub asset_address: Binary, // Asset smart contract address on the original chain
|
||||||
|
|
|
@ -59,7 +59,7 @@ fn do_mint(
|
||||||
) {
|
) {
|
||||||
let mint_msg = ExecuteMsg::Mint {
|
let mint_msg = ExecuteMsg::Mint {
|
||||||
recipient: recipient.to_string(),
|
recipient: recipient.to_string(),
|
||||||
amount: amount.clone(),
|
amount: *amount,
|
||||||
};
|
};
|
||||||
let info = mock_info(INITIALIZER, &[]);
|
let info = mock_info(INITIALIZER, &[]);
|
||||||
let handle_response: Response = execute(deps.as_mut(), mock_env(), info, mint_msg).unwrap();
|
let handle_response: Response = execute(deps.as_mut(), mock_env(), info, mint_msg).unwrap();
|
||||||
|
@ -74,7 +74,7 @@ fn do_transfer(
|
||||||
) {
|
) {
|
||||||
let transfer_msg = ExecuteMsg::Transfer {
|
let transfer_msg = ExecuteMsg::Transfer {
|
||||||
recipient: recipient.to_string(),
|
recipient: recipient.to_string(),
|
||||||
amount: amount.clone(),
|
amount: *amount,
|
||||||
};
|
};
|
||||||
let env = mock_env();
|
let env = mock_env();
|
||||||
let info = mock_info(sender.as_str(), &[]);
|
let info = mock_info(sender.as_str(), &[]);
|
||||||
|
@ -116,8 +116,8 @@ fn check_token_details(deps: &OwnedDeps<MockStorage, MockApi, MockQuerier>, supp
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn init_works() {
|
fn init_works() {
|
||||||
let mut deps = do_init();
|
let deps = do_init();
|
||||||
check_token_details(&mut deps, Uint128::new(0));
|
check_token_details(&deps, Uint128::new(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -126,7 +126,7 @@ fn query_works() {
|
||||||
|
|
||||||
let query_response = query(deps.as_ref(), mock_env(), QueryMsg::WrappedAssetInfo {}).unwrap();
|
let query_response = query(deps.as_ref(), mock_env(), QueryMsg::WrappedAssetInfo {}).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
from_slice::<WrappedAssetInfoResponse>(&query_response.as_slice()).unwrap(),
|
from_slice::<WrappedAssetInfoResponse>(query_response.as_slice()).unwrap(),
|
||||||
WrappedAssetInfoResponse {
|
WrappedAssetInfoResponse {
|
||||||
asset_chain: 1,
|
asset_chain: 1,
|
||||||
asset_address: vec![1; 32].into(),
|
asset_address: vec![1; 32].into(),
|
||||||
|
@ -172,6 +172,6 @@ fn transfer_works() {
|
||||||
do_mint(&mut deps, &sender, &Uint128::new(123_123_123));
|
do_mint(&mut deps, &sender, &Uint128::new(123_123_123));
|
||||||
do_transfer(&mut deps, &sender, &recipient, &Uint128::new(123_123_000));
|
do_transfer(&mut deps, &sender, &recipient, &Uint128::new(123_123_000));
|
||||||
|
|
||||||
check_balance(&mut deps, &sender, &Uint128::new(123));
|
check_balance(&deps, &sender, &Uint128::new(123));
|
||||||
check_balance(&mut deps, &recipient, &Uint128::new(123_123_000));
|
check_balance(&deps, &recipient, &Uint128::new(123_123_000));
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,11 +304,7 @@ where
|
||||||
|
|
||||||
// update the approval list (remove any for the same spender before adding)
|
// update the approval list (remove any for the same spender before adding)
|
||||||
let spender_addr = deps.api.addr_validate(spender)?;
|
let spender_addr = deps.api.addr_validate(spender)?;
|
||||||
token.approvals = token
|
token.approvals.retain(|apr| apr.spender != spender_addr);
|
||||||
.approvals
|
|
||||||
.into_iter()
|
|
||||||
.filter(|apr| apr.spender != spender_addr)
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
// only difference between approve and revoke
|
// only difference between approve and revoke
|
||||||
if add {
|
if add {
|
||||||
|
|
|
@ -7,7 +7,7 @@ use cw721::{
|
||||||
use serde::de::DeserializeOwned;
|
use serde::de::DeserializeOwned;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Cw721Contract(pub Addr);
|
pub struct Cw721Contract(pub Addr);
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|
|
@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
|
||||||
use cosmwasm_std::Binary;
|
use cosmwasm_std::Binary;
|
||||||
use cw721::Expiration;
|
use cw721::Expiration;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct InstantiateMsg {
|
pub struct InstantiateMsg {
|
||||||
/// Name of the NFT contract
|
/// Name of the NFT contract
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
@ -57,7 +57,7 @@ pub enum ExecuteMsg<T> {
|
||||||
Burn { token_id: String },
|
Burn { token_id: String },
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct MintMsg<T> {
|
pub struct MintMsg<T> {
|
||||||
/// Unique ID of the NFT
|
/// Unique ID of the NFT
|
||||||
pub token_id: String,
|
pub token_id: String,
|
||||||
|
@ -71,7 +71,7 @@ pub struct MintMsg<T> {
|
||||||
pub extension: T,
|
pub extension: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum QueryMsg {
|
pub enum QueryMsg {
|
||||||
/// Return the owner of the given token, error if token does not exist
|
/// Return the owner of the given token, error if token does not exist
|
||||||
|
@ -148,7 +148,7 @@ pub enum QueryMsg {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Shows who can mint these tokens
|
/// Shows who can mint these tokens
|
||||||
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
|
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
|
||||||
pub struct MinterResponse {
|
pub struct MinterResponse {
|
||||||
pub minter: String,
|
pub minter: String,
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
|
||||||
pub use cosmwasm_std::to_binary;
|
pub use cosmwasm_std::to_binary;
|
||||||
use cosmwasm_std::Empty;
|
use cosmwasm_std::Empty;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug, Default)]
|
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug, Default)]
|
||||||
pub struct Trait {
|
pub struct Trait {
|
||||||
pub display_type: Option<String>,
|
pub display_type: Option<String>,
|
||||||
pub trait_type: String,
|
pub trait_type: String,
|
||||||
|
|
|
@ -36,13 +36,13 @@ pub struct InstantiateMsg {
|
||||||
pub init_hook: Option<InitHook>,
|
pub init_hook: Option<InitHook>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct InitHook {
|
pub struct InitHook {
|
||||||
pub msg: Binary,
|
pub msg: Binary,
|
||||||
pub contract_addr: HumanAddr,
|
pub contract_addr: HumanAddr,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum QueryMsg {
|
pub enum QueryMsg {
|
||||||
/// Generic information about the wrapped asset
|
/// Generic information about the wrapped asset
|
||||||
|
@ -120,7 +120,7 @@ pub enum QueryMsg {
|
||||||
Minter {},
|
Minter {},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct WrappedAssetInfoResponse {
|
pub struct WrappedAssetInfoResponse {
|
||||||
pub asset_chain: u16, // Asset chain id
|
pub asset_chain: u16, // Asset chain id
|
||||||
pub asset_address: Binary, // Asset smart contract address in the original chain
|
pub asset_address: Binary, // Asset smart contract address in the original chain
|
||||||
|
|
|
@ -7,7 +7,7 @@ use cosmwasm_storage::{singleton, singleton_read, ReadonlySingleton, Singleton};
|
||||||
pub const KEY_WRAPPED_ASSET: &[u8] = b"wrappedAsset";
|
pub const KEY_WRAPPED_ASSET: &[u8] = b"wrappedAsset";
|
||||||
|
|
||||||
// Created at initialization and reference original asset and bridge address
|
// Created at initialization and reference original asset and bridge address
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct WrappedAssetInfo {
|
pub struct WrappedAssetInfo {
|
||||||
pub asset_chain: u16, // Asset chain id
|
pub asset_chain: u16, // Asset chain id
|
||||||
pub asset_address: Binary, // Asset smart contract address on the original chain
|
pub asset_address: Binary, // Asset smart contract address on the original chain
|
||||||
|
|
|
@ -53,7 +53,7 @@ pub fn query(_deps: Deps, _env: Env, _msg: QueryMsg) -> StdResult<Binary> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn complete_transfer_with_payload(
|
fn complete_transfer_with_payload(
|
||||||
mut deps: DepsMut,
|
deps: DepsMut,
|
||||||
_env: Env,
|
_env: Env,
|
||||||
info: MessageInfo,
|
info: MessageInfo,
|
||||||
data: &Binary,
|
data: &Binary,
|
||||||
|
|
|
@ -4,22 +4,22 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
type HumanAddr = String;
|
type HumanAddr = String;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct InstantiateMsg {
|
pub struct InstantiateMsg {
|
||||||
pub token_bridge_contract: HumanAddr,
|
pub token_bridge_contract: HumanAddr,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum ExecuteMsg {
|
pub enum ExecuteMsg {
|
||||||
CompleteTransferWithPayload { data: Binary },
|
CompleteTransferWithPayload { data: Binary },
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub struct MigrateMsg {}
|
pub struct MigrateMsg {}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum QueryMsg {
|
pub enum QueryMsg {
|
||||||
WrappedRegistry { chain: u16, address: Binary },
|
WrappedRegistry { chain: u16, address: Binary },
|
||||||
|
|
|
@ -9,7 +9,7 @@ type HumanAddr = String;
|
||||||
pub static CONFIG_KEY: &[u8] = b"config";
|
pub static CONFIG_KEY: &[u8] = b"config";
|
||||||
|
|
||||||
// Guardian set information
|
// Guardian set information
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub token_bridge_contract: HumanAddr,
|
pub token_bridge_contract: HumanAddr,
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
type HumanAddr = String;
|
type HumanAddr = String;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct InstantiateMsg {
|
pub struct InstantiateMsg {
|
||||||
// governance contract details
|
// governance contract details
|
||||||
pub gov_chain: u16,
|
pub gov_chain: u16,
|
||||||
|
@ -14,7 +14,7 @@ pub struct InstantiateMsg {
|
||||||
pub wrapped_asset_code_id: u64,
|
pub wrapped_asset_code_id: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum ExecuteMsg {
|
pub enum ExecuteMsg {
|
||||||
RegisterAssetHook {
|
RegisterAssetHook {
|
||||||
|
@ -34,24 +34,24 @@ pub enum ExecuteMsg {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub struct MigrateMsg {}
|
pub struct MigrateMsg {}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum QueryMsg {
|
pub enum QueryMsg {
|
||||||
WrappedRegistry { chain: u16, address: Binary },
|
WrappedRegistry { chain: u16, address: Binary },
|
||||||
AllWrappedAssets {},
|
AllWrappedAssets {},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub struct WrappedRegistryResponse {
|
pub struct WrappedRegistryResponse {
|
||||||
pub address: HumanAddr,
|
pub address: HumanAddr,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum WormholeQueryMsg {
|
pub enum WormholeQueryMsg {
|
||||||
VerifyVAA { vaa: Binary, block_time: u64 },
|
VerifyVAA { vaa: Binary, block_time: u64 },
|
||||||
|
|
|
@ -21,7 +21,7 @@ pub static TOKEN_ID_HASHES_KEY: &[u8] = b"token_id_hashes";
|
||||||
pub static SPL_CACHE_KEY: &[u8] = b"spl_cache";
|
pub static SPL_CACHE_KEY: &[u8] = b"spl_cache";
|
||||||
|
|
||||||
// Guardian set information
|
// Guardian set information
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct ConfigInfo {
|
pub struct ConfigInfo {
|
||||||
// governance contract details
|
// governance contract details
|
||||||
pub gov_chain: u16,
|
pub gov_chain: u16,
|
||||||
|
@ -31,7 +31,7 @@ pub struct ConfigInfo {
|
||||||
pub wrapped_asset_code_id: u64,
|
pub wrapped_asset_code_id: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct SplCacheItem {
|
pub struct SplCacheItem {
|
||||||
pub name: [u8; 32],
|
pub name: [u8; 32],
|
||||||
pub symbol: [u8; 32],
|
pub symbol: [u8; 32],
|
||||||
|
@ -124,7 +124,7 @@ impl TokenBridgeMessage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct BoundedVec<T, const N: usize> {
|
pub struct BoundedVec<T, const N: usize> {
|
||||||
vec: Vec<T>,
|
vec: Vec<T>,
|
||||||
|
@ -159,7 +159,7 @@ impl<T, const N: usize> BoundedVec<T, N> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct TransferInfo {
|
pub struct TransferInfo {
|
||||||
pub nft_address: [u8; 32],
|
pub nft_address: [u8; 32],
|
||||||
pub nft_chain: u16,
|
pub nft_chain: u16,
|
||||||
|
|
|
@ -1,35 +1,15 @@
|
||||||
static WASM: &[u8] = include_bytes!("../../../target/wasm32-unknown-unknown/release/wormhole.wasm");
|
static WASM: &[u8] = include_bytes!("../../../target/wasm32-unknown-unknown/release/wormhole.wasm");
|
||||||
|
|
||||||
use cosmwasm_std::{
|
use cosmwasm_std::{from_slice, Coin, Env, HumanAddr, InitResponse};
|
||||||
from_slice,
|
|
||||||
Coin,
|
|
||||||
Env,
|
|
||||||
HumanAddr,
|
|
||||||
InitResponse,
|
|
||||||
};
|
|
||||||
use cosmwasm_storage::to_length_prefixed;
|
use cosmwasm_storage::to_length_prefixed;
|
||||||
use cosmwasm_vm::{
|
use cosmwasm_vm::{
|
||||||
testing::{
|
testing::{init, mock_env, mock_instance, MockApi, MockQuerier, MockStorage},
|
||||||
init,
|
Api, Instance, Storage,
|
||||||
mock_env,
|
|
||||||
mock_instance,
|
|
||||||
MockApi,
|
|
||||||
MockQuerier,
|
|
||||||
MockStorage,
|
|
||||||
},
|
|
||||||
Api,
|
|
||||||
Instance,
|
|
||||||
Storage,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use wormhole::{
|
use wormhole::{
|
||||||
msg::InitMsg,
|
msg::InitMsg,
|
||||||
state::{
|
state::{ConfigInfo, GuardianAddress, GuardianSetInfo, CONFIG_KEY},
|
||||||
ConfigInfo,
|
|
||||||
GuardianAddress,
|
|
||||||
GuardianSetInfo,
|
|
||||||
CONFIG_KEY,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use hex;
|
use hex;
|
||||||
|
|
|
@ -22,10 +22,13 @@ use wormhole::{
|
||||||
state::{vaa_archive_add, vaa_archive_check, GovernancePacket, ParsedVAA},
|
state::{vaa_archive_add, vaa_archive_check, GovernancePacket, ParsedVAA},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(not(feature = "library"))]
|
||||||
|
use cosmwasm_std::entry_point;
|
||||||
|
|
||||||
use cosmwasm_std::{
|
use cosmwasm_std::{
|
||||||
coin, entry_point, to_binary, BankMsg, Binary, CanonicalAddr, Coin, CosmosMsg, Decimal, Deps,
|
coin, to_binary, BankMsg, Binary, CanonicalAddr, Coin, CosmosMsg, Decimal, Deps, DepsMut,
|
||||||
DepsMut, Empty, Env, MessageInfo, Order, QuerierWrapper, QueryRequest, Reply, Response,
|
Empty, Env, MessageInfo, Order, QuerierWrapper, QueryRequest, Reply, Response, StdError,
|
||||||
StdError, StdResult, SubMsg, Uint128, WasmMsg, WasmQuery,
|
StdResult, SubMsg, Uint128, WasmMsg, WasmQuery,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -259,7 +262,7 @@ pub fn coins_after_tax(deps: DepsMut, coins: Vec<Coin>) -> StdResult<Vec<Coin>>
|
||||||
let mut res = vec![];
|
let mut res = vec![];
|
||||||
for coin in coins {
|
for coin in coins {
|
||||||
let asset = Asset {
|
let asset = Asset {
|
||||||
amount: coin.amount.clone(),
|
amount: coin.amount,
|
||||||
info: AssetInfo::NativeToken {
|
info: AssetInfo::NativeToken {
|
||||||
denom: coin.denom.clone(),
|
denom: coin.denom.clone(),
|
||||||
},
|
},
|
||||||
|
@ -285,7 +288,7 @@ fn parse_vaa(deps: Deps, block_time: u64, data: &Binary) -> StdResult<ParsedVAA>
|
||||||
pub fn execute(deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) -> StdResult<Response> {
|
pub fn execute(deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) -> StdResult<Response> {
|
||||||
match msg {
|
match msg {
|
||||||
ExecuteMsg::RegisterAssetHook { asset_id } => {
|
ExecuteMsg::RegisterAssetHook { asset_id } => {
|
||||||
handle_register_asset(deps, env, info, &asset_id.as_slice())
|
handle_register_asset(deps, env, info, asset_id.as_slice())
|
||||||
}
|
}
|
||||||
ExecuteMsg::InitiateTransfer {
|
ExecuteMsg::InitiateTransfer {
|
||||||
asset,
|
asset,
|
||||||
|
@ -391,13 +394,13 @@ fn handle_register_asset(
|
||||||
let mut bucket = wrapped_asset(deps.storage);
|
let mut bucket = wrapped_asset(deps.storage);
|
||||||
let result = bucket.load(asset_id);
|
let result = bucket.load(asset_id);
|
||||||
let result = result.map_err(|_| ContractError::RegistrationForbidden.std())?;
|
let result = result.map_err(|_| ContractError::RegistrationForbidden.std())?;
|
||||||
if result != HumanAddr::from(WRAPPED_ASSET_UPDATING) {
|
if result != WRAPPED_ASSET_UPDATING {
|
||||||
return ContractError::AssetAlreadyRegistered.std_err();
|
return ContractError::AssetAlreadyRegistered.std_err();
|
||||||
}
|
}
|
||||||
|
|
||||||
bucket.save(asset_id, &info.sender.to_string())?;
|
bucket.save(asset_id, &info.sender.to_string())?;
|
||||||
|
|
||||||
let contract_address: CanonicalAddr = deps.api.addr_canonicalize(&info.sender.as_str())?;
|
let contract_address: CanonicalAddr = deps.api.addr_canonicalize(info.sender.as_str())?;
|
||||||
wrapped_asset_address(deps.storage).save(contract_address.as_slice(), &asset_id.to_vec())?;
|
wrapped_asset_address(deps.storage).save(contract_address.as_slice(), &asset_id.to_vec())?;
|
||||||
|
|
||||||
Ok(Response::new()
|
Ok(Response::new()
|
||||||
|
@ -431,7 +434,7 @@ fn handle_attest_meta(
|
||||||
}
|
}
|
||||||
|
|
||||||
let cfg = config_read(deps.storage).load()?;
|
let cfg = config_read(deps.storage).load()?;
|
||||||
let asset_id = build_asset_id(meta.token_chain, &meta.token_address.as_slice());
|
let asset_id = build_asset_id(meta.token_chain, meta.token_address.as_slice());
|
||||||
|
|
||||||
// If a CW20 wrapped already exists and this message has a newer sequence ID
|
// If a CW20 wrapped already exists and this message has a newer sequence ID
|
||||||
// we allow updating the metadata. If not, we create a brand new token.
|
// we allow updating the metadata. If not, we create a brand new token.
|
||||||
|
@ -532,7 +535,7 @@ fn handle_create_asset_meta_token(
|
||||||
nonce,
|
nonce,
|
||||||
})?,
|
})?,
|
||||||
// forward coins sent to this message
|
// forward coins sent to this message
|
||||||
funds: coins_after_tax(deps, info.funds.clone())?,
|
funds: coins_after_tax(deps, info.funds)?,
|
||||||
}))
|
}))
|
||||||
.add_attribute("meta.token_chain", CHAIN_ID.to_string())
|
.add_attribute("meta.token_chain", CHAIN_ID.to_string())
|
||||||
.add_attribute("meta.token", asset_address)
|
.add_attribute("meta.token", asset_address)
|
||||||
|
@ -570,7 +573,7 @@ fn handle_create_asset_meta_native_token(
|
||||||
nonce,
|
nonce,
|
||||||
})?,
|
})?,
|
||||||
// forward coins sent to this message
|
// forward coins sent to this message
|
||||||
funds: coins_after_tax(deps, info.funds.clone())?,
|
funds: coins_after_tax(deps, info.funds)?,
|
||||||
}))
|
}))
|
||||||
.add_attribute("meta.token_chain", CHAIN_ID.to_string())
|
.add_attribute("meta.token_chain", CHAIN_ID.to_string())
|
||||||
.add_attribute("meta.symbol", symbol)
|
.add_attribute("meta.symbol", symbol)
|
||||||
|
@ -662,8 +665,8 @@ fn submit_vaa(deps: DepsMut, env: Env, info: MessageInfo, data: &Binary) -> StdR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_governance_payload(deps: DepsMut, env: Env, data: &Vec<u8>) -> StdResult<Response> {
|
fn handle_governance_payload(deps: DepsMut, env: Env, data: &[u8]) -> StdResult<Response> {
|
||||||
let gov_packet = GovernancePacket::deserialize(&data)?;
|
let gov_packet = GovernancePacket::deserialize(data)?;
|
||||||
let module = get_string_from_32(&gov_packet.module);
|
let module = get_string_from_32(&gov_packet.module);
|
||||||
|
|
||||||
if module != "TokenBridge" {
|
if module != "TokenBridge" {
|
||||||
|
@ -684,7 +687,7 @@ fn handle_governance_payload(deps: DepsMut, env: Env, data: &Vec<u8>) -> StdResu
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_upgrade_contract(_deps: DepsMut, env: Env, data: &Vec<u8>) -> StdResult<Response> {
|
fn handle_upgrade_contract(_deps: DepsMut, env: Env, data: &Vec<u8>) -> StdResult<Response> {
|
||||||
let UpgradeContract { new_contract } = UpgradeContract::deserialize(&data)?;
|
let UpgradeContract { new_contract } = UpgradeContract::deserialize(data)?;
|
||||||
|
|
||||||
Ok(Response::new()
|
Ok(Response::new()
|
||||||
.add_message(CosmosMsg::Wasm(WasmMsg::Migrate {
|
.add_message(CosmosMsg::Wasm(WasmMsg::Migrate {
|
||||||
|
@ -699,7 +702,7 @@ fn handle_register_chain(deps: DepsMut, _env: Env, data: &Vec<u8>) -> StdResult<
|
||||||
let RegisterChain {
|
let RegisterChain {
|
||||||
chain_id,
|
chain_id,
|
||||||
chain_address,
|
chain_address,
|
||||||
} = RegisterChain::deserialize(&data)?;
|
} = RegisterChain::deserialize(data)?;
|
||||||
|
|
||||||
let existing = bridge_contracts_read(deps.storage).load(&chain_id.to_be_bytes());
|
let existing = bridge_contracts_read(deps.storage).load(&chain_id.to_be_bytes());
|
||||||
if existing.is_ok() {
|
if existing.is_ok() {
|
||||||
|
@ -716,6 +719,7 @@ fn handle_register_chain(deps: DepsMut, _env: Env, data: &Vec<u8>) -> StdResult<
|
||||||
.add_attribute("chain_address", hex::encode(chain_address)))
|
.add_attribute("chain_address", hex::encode(chain_address)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn handle_complete_transfer(
|
fn handle_complete_transfer(
|
||||||
deps: DepsMut,
|
deps: DepsMut,
|
||||||
env: Env,
|
env: Env,
|
||||||
|
@ -726,7 +730,7 @@ fn handle_complete_transfer(
|
||||||
data: &Vec<u8>,
|
data: &Vec<u8>,
|
||||||
relayer_address: &HumanAddr,
|
relayer_address: &HumanAddr,
|
||||||
) -> StdResult<Response> {
|
) -> StdResult<Response> {
|
||||||
let transfer_info = TransferInfo::deserialize(&data)?;
|
let transfer_info = TransferInfo::deserialize(data)?;
|
||||||
let marker_byte = transfer_info.token_address.as_slice()[0];
|
let marker_byte = transfer_info.token_address.as_slice()[0];
|
||||||
if transfer_info.token_chain == CHAIN_ID {
|
if transfer_info.token_chain == CHAIN_ID {
|
||||||
match marker_byte {
|
match marker_byte {
|
||||||
|
@ -766,6 +770,7 @@ fn handle_complete_transfer(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn handle_complete_transfer_token(
|
fn handle_complete_transfer_token(
|
||||||
deps: DepsMut,
|
deps: DepsMut,
|
||||||
_env: Env,
|
_env: Env,
|
||||||
|
@ -777,9 +782,9 @@ fn handle_complete_transfer_token(
|
||||||
relayer_address: &HumanAddr,
|
relayer_address: &HumanAddr,
|
||||||
) -> StdResult<Response> {
|
) -> StdResult<Response> {
|
||||||
let transfer_info = match transfer_type {
|
let transfer_info = match transfer_type {
|
||||||
TransferType::WithoutPayload => TransferInfo::deserialize(&data)?,
|
TransferType::WithoutPayload => TransferInfo::deserialize(data)?,
|
||||||
TransferType::WithPayload { payload: _ } => {
|
TransferType::WithPayload { payload: _ } => {
|
||||||
TransferWithPayloadInfo::deserialize(&data)?.as_transfer_info()
|
TransferWithPayloadInfo::deserialize(data)?.as_transfer_info()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -826,7 +831,7 @@ fn handle_complete_transfer_token(
|
||||||
// Check if this asset is already deployed
|
// Check if this asset is already deployed
|
||||||
let contract_addr = wrapped_asset_read(deps.storage).load(&asset_id).ok();
|
let contract_addr = wrapped_asset_read(deps.storage).load(&asset_id).ok();
|
||||||
|
|
||||||
return if let Some(contract_addr) = contract_addr {
|
if let Some(contract_addr) = contract_addr {
|
||||||
// Asset already deployed, just mint
|
// Asset already deployed, just mint
|
||||||
|
|
||||||
let mut messages = vec![CosmosMsg::Wasm(WasmMsg::Execute {
|
let mut messages = vec![CosmosMsg::Wasm(WasmMsg::Execute {
|
||||||
|
@ -858,7 +863,7 @@ fn handle_complete_transfer_token(
|
||||||
.add_attribute("fee", fee.to_string()))
|
.add_attribute("fee", fee.to_string()))
|
||||||
} else {
|
} else {
|
||||||
Err(StdError::generic_err("Wrapped asset not deployed. To deploy, invoke CreateWrapped with the associated AssetMeta"))
|
Err(StdError::generic_err("Wrapped asset not deployed. To deploy, invoke CreateWrapped with the associated AssetMeta"))
|
||||||
};
|
}
|
||||||
} else {
|
} else {
|
||||||
let token_address = transfer_info.token_address.as_slice().get_address(0);
|
let token_address = transfer_info.token_address.as_slice().get_address(0);
|
||||||
|
|
||||||
|
@ -911,6 +916,7 @@ fn handle_complete_transfer_token(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn handle_complete_transfer_token_native(
|
fn handle_complete_transfer_token_native(
|
||||||
mut deps: DepsMut,
|
mut deps: DepsMut,
|
||||||
_env: Env,
|
_env: Env,
|
||||||
|
@ -922,9 +928,9 @@ fn handle_complete_transfer_token_native(
|
||||||
relayer_address: &HumanAddr,
|
relayer_address: &HumanAddr,
|
||||||
) -> StdResult<Response> {
|
) -> StdResult<Response> {
|
||||||
let transfer_info = match transfer_type {
|
let transfer_info = match transfer_type {
|
||||||
TransferType::WithoutPayload => TransferInfo::deserialize(&data)?,
|
TransferType::WithoutPayload => TransferInfo::deserialize(data)?,
|
||||||
TransferType::WithPayload { payload: () } => {
|
TransferType::WithPayload { payload: () } => {
|
||||||
TransferWithPayloadInfo::deserialize(&data)?.as_transfer_info()
|
TransferWithPayloadInfo::deserialize(data)?.as_transfer_info()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -964,7 +970,7 @@ fn handle_complete_transfer_token_native(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wipe the native byte marker and extract the serialized denom.
|
// Wipe the native byte marker and extract the serialized denom.
|
||||||
let mut token_address = transfer_info.token_address.clone();
|
let mut token_address = transfer_info.token_address;
|
||||||
let token_address = token_address.as_mut_slice();
|
let token_address = token_address.as_mut_slice();
|
||||||
token_address[0] = 0;
|
token_address[0] = 0;
|
||||||
|
|
||||||
|
@ -999,6 +1005,7 @@ fn handle_complete_transfer_token_native(
|
||||||
.add_attribute("fee", fee.to_string()))
|
.add_attribute("fee", fee.to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn handle_initiate_transfer(
|
fn handle_initiate_transfer(
|
||||||
deps: DepsMut,
|
deps: DepsMut,
|
||||||
env: Env,
|
env: Env,
|
||||||
|
@ -1038,6 +1045,7 @@ fn handle_initiate_transfer(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn handle_initiate_transfer_token(
|
fn handle_initiate_transfer_token(
|
||||||
mut deps: DepsMut,
|
mut deps: DepsMut,
|
||||||
env: Env,
|
env: Env,
|
||||||
|
@ -1067,7 +1075,7 @@ fn handle_initiate_transfer_token(
|
||||||
let mut submessages: Vec<SubMsg> = vec![];
|
let mut submessages: Vec<SubMsg> = vec![];
|
||||||
|
|
||||||
// we'll only need this for payload 3 transfers
|
// we'll only need this for payload 3 transfers
|
||||||
let sender_address = deps.api.addr_canonicalize(&info.sender.to_string())?;
|
let sender_address = deps.api.addr_canonicalize(info.sender.as_ref())?;
|
||||||
let sender_address = extend_address_to_32_array(&sender_address);
|
let sender_address = extend_address_to_32_array(&sender_address);
|
||||||
|
|
||||||
match wrapped_asset_address_read(deps.storage).load(asset_canonical.as_slice()) {
|
match wrapped_asset_address_read(deps.storage).load(asset_canonical.as_slice()) {
|
||||||
|
@ -1134,7 +1142,7 @@ fn handle_initiate_transfer_token(
|
||||||
nonce,
|
nonce,
|
||||||
})?,
|
})?,
|
||||||
// forward coins sent to this message
|
// forward coins sent to this message
|
||||||
funds: coins_after_tax(deps.branch(), info.funds.clone())?,
|
funds: coins_after_tax(deps.branch(), info.funds)?,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
|
@ -1206,7 +1214,7 @@ fn handle_initiate_transfer_token(
|
||||||
TransferType::WithoutPayload => {
|
TransferType::WithoutPayload => {
|
||||||
let transfer_info = TransferInfo {
|
let transfer_info = TransferInfo {
|
||||||
amount: (0, amount.u128()),
|
amount: (0, amount.u128()),
|
||||||
token_address: asset_address.clone(),
|
token_address: asset_address,
|
||||||
token_chain: asset_chain,
|
token_chain: asset_chain,
|
||||||
recipient,
|
recipient,
|
||||||
recipient_chain,
|
recipient_chain,
|
||||||
|
@ -1220,7 +1228,7 @@ fn handle_initiate_transfer_token(
|
||||||
TransferType::WithPayload { payload } => {
|
TransferType::WithPayload { payload } => {
|
||||||
let transfer_info = TransferWithPayloadInfo {
|
let transfer_info = TransferWithPayloadInfo {
|
||||||
amount: (0, amount.u128()),
|
amount: (0, amount.u128()),
|
||||||
token_address: asset_address.clone(),
|
token_address: asset_address,
|
||||||
token_chain: asset_chain,
|
token_chain: asset_chain,
|
||||||
recipient,
|
recipient,
|
||||||
recipient_chain,
|
recipient_chain,
|
||||||
|
@ -1255,7 +1263,7 @@ fn handle_initiate_transfer_token(
|
||||||
.add_attribute(
|
.add_attribute(
|
||||||
"transfer.sender",
|
"transfer.sender",
|
||||||
hex::encode(extend_address_to_32(
|
hex::encode(extend_address_to_32(
|
||||||
&deps.api.addr_canonicalize(&info.sender.as_str())?,
|
&deps.api.addr_canonicalize(info.sender.as_str())?,
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
.add_attribute("transfer.recipient_chain", recipient_chain.to_string())
|
.add_attribute("transfer.recipient_chain", recipient_chain.to_string())
|
||||||
|
@ -1275,6 +1283,7 @@ fn format_native_denom_symbol(denom: &str) -> String {
|
||||||
denom.to_uppercase()[1..3].to_string() + "T"
|
denom.to_uppercase()[1..3].to_string() + "T"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn handle_initiate_transfer_native_token(
|
fn handle_initiate_transfer_native_token(
|
||||||
deps: DepsMut,
|
deps: DepsMut,
|
||||||
env: Env,
|
env: Env,
|
||||||
|
@ -1333,7 +1342,7 @@ fn handle_initiate_transfer_native_token(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TransferType::WithPayload { payload } => {
|
TransferType::WithPayload { payload } => {
|
||||||
let sender_address = deps.api.addr_canonicalize(&info.sender.to_string())?;
|
let sender_address = deps.api.addr_canonicalize(info.sender.as_ref())?;
|
||||||
let sender_address = extend_address_to_32_array(&sender_address);
|
let sender_address = extend_address_to_32_array(&sender_address);
|
||||||
let transfer_info = TransferWithPayloadInfo {
|
let transfer_info = TransferWithPayloadInfo {
|
||||||
amount: (0, amount.u128()),
|
amount: (0, amount.u128()),
|
||||||
|
@ -1351,14 +1360,14 @@ fn handle_initiate_transfer_native_token(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let sender = deps.api.addr_canonicalize(&info.sender.as_str())?;
|
let sender = deps.api.addr_canonicalize(info.sender.as_str())?;
|
||||||
messages.push(CosmosMsg::Wasm(WasmMsg::Execute {
|
messages.push(CosmosMsg::Wasm(WasmMsg::Execute {
|
||||||
contract_addr: cfg.wormhole_contract,
|
contract_addr: cfg.wormhole_contract,
|
||||||
msg: to_binary(&WormholeExecuteMsg::PostMessage {
|
msg: to_binary(&WormholeExecuteMsg::PostMessage {
|
||||||
message: Binary::from(token_bridge_message.serialize()),
|
message: Binary::from(token_bridge_message.serialize()),
|
||||||
nonce,
|
nonce,
|
||||||
})?,
|
})?,
|
||||||
funds: coins_after_tax(deps, info.funds.clone())?,
|
funds: coins_after_tax(deps, info.funds)?,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Ok(Response::new()
|
Ok(Response::new()
|
||||||
|
@ -1465,8 +1474,8 @@ pub fn build_native_id(denom: &str) -> Vec<u8> {
|
||||||
asset_address
|
asset_address
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_governance_emitter(cfg: &ConfigInfo, emitter_chain: u16, emitter_address: &Vec<u8>) -> bool {
|
fn is_governance_emitter(cfg: &ConfigInfo, emitter_chain: u16, emitter_address: &[u8]) -> bool {
|
||||||
cfg.gov_chain == emitter_chain && cfg.gov_address == emitter_address.clone()
|
cfg.gov_chain == emitter_chain && cfg.gov_address == emitter_address
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -5,7 +5,7 @@ use terraswap::asset::{Asset, AssetInfo};
|
||||||
|
|
||||||
type HumanAddr = String;
|
type HumanAddr = String;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct InstantiateMsg {
|
pub struct InstantiateMsg {
|
||||||
// governance contract details
|
// governance contract details
|
||||||
pub gov_chain: u16,
|
pub gov_chain: u16,
|
||||||
|
@ -59,24 +59,24 @@ pub enum ExecuteMsg {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub struct MigrateMsg {}
|
pub struct MigrateMsg {}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum QueryMsg {
|
pub enum QueryMsg {
|
||||||
WrappedRegistry { chain: u16, address: Binary },
|
WrappedRegistry { chain: u16, address: Binary },
|
||||||
TransferInfo { vaa: Binary },
|
TransferInfo { vaa: Binary },
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub struct WrappedRegistryResponse {
|
pub struct WrappedRegistryResponse {
|
||||||
pub address: HumanAddr,
|
pub address: HumanAddr,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub struct TransferInfoResponse {
|
pub struct TransferInfoResponse {
|
||||||
pub amount: Uint128,
|
pub amount: Uint128,
|
||||||
|
|
|
@ -21,7 +21,7 @@ pub static BRIDGE_DEPOSITS: &[u8] = b"bridge_deposits";
|
||||||
pub static NATIVE_COUNTER: &[u8] = b"native_counter";
|
pub static NATIVE_COUNTER: &[u8] = b"native_counter";
|
||||||
|
|
||||||
// Guardian set information
|
// Guardian set information
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct ConfigInfo {
|
pub struct ConfigInfo {
|
||||||
// governance contract details
|
// governance contract details
|
||||||
pub gov_chain: u16,
|
pub gov_chain: u16,
|
||||||
|
@ -83,7 +83,7 @@ type Serialized128 = String;
|
||||||
|
|
||||||
/// Structure to keep track of an active CW20 transfer, required to pass state through to the reply
|
/// Structure to keep track of an active CW20 transfer, required to pass state through to the reply
|
||||||
/// handler for submessages during a transfer.
|
/// handler for submessages during a transfer.
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct TransferState {
|
pub struct TransferState {
|
||||||
pub account: String,
|
pub account: String,
|
||||||
pub message: Vec<u8>,
|
pub message: Vec<u8>,
|
||||||
|
@ -167,7 +167,7 @@ impl TokenBridgeMessage {
|
||||||
// 98 u16 recipient_chain
|
// 98 u16 recipient_chain
|
||||||
// 100 u256 fee
|
// 100 u256 fee
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct TransferInfo {
|
pub struct TransferInfo {
|
||||||
pub amount: (u128, u128),
|
pub amount: (u128, u128),
|
||||||
pub token_address: [u8; 32],
|
pub token_address: [u8; 32],
|
||||||
|
@ -219,7 +219,7 @@ impl TransferInfo {
|
||||||
// 100 [u8; 32] sender_address
|
// 100 [u8; 32] sender_address
|
||||||
// 132 [u8] payload
|
// 132 [u8] payload
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct TransferWithPayloadInfo {
|
pub struct TransferWithPayloadInfo {
|
||||||
pub amount: (u128, u128),
|
pub amount: (u128, u128),
|
||||||
pub token_address: [u8; 32],
|
pub token_address: [u8; 32],
|
||||||
|
@ -275,7 +275,7 @@ impl TransferWithPayloadInfo {
|
||||||
pub fn as_transfer_info(&self) -> TransferInfo {
|
pub fn as_transfer_info(&self) -> TransferInfo {
|
||||||
TransferInfo {
|
TransferInfo {
|
||||||
amount: self.amount,
|
amount: self.amount,
|
||||||
token_address: self.token_address.clone(),
|
token_address: self.token_address,
|
||||||
token_chain: self.token_chain,
|
token_chain: self.token_chain,
|
||||||
recipient: self.recipient,
|
recipient: self.recipient,
|
||||||
recipient_chain: self.recipient_chain,
|
recipient_chain: self.recipient_chain,
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::state::{GuardianAddress, GuardianSetInfo};
|
||||||
|
|
||||||
type HumanAddr = String;
|
type HumanAddr = String;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct InstantiateMsg {
|
pub struct InstantiateMsg {
|
||||||
pub gov_chain: u16,
|
pub gov_chain: u16,
|
||||||
pub gov_address: Binary,
|
pub gov_address: Binary,
|
||||||
|
@ -15,18 +15,18 @@ pub struct InstantiateMsg {
|
||||||
pub guardian_set_expirity: u64,
|
pub guardian_set_expirity: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum ExecuteMsg {
|
pub enum ExecuteMsg {
|
||||||
SubmitVAA { vaa: Binary },
|
SubmitVAA { vaa: Binary },
|
||||||
PostMessage { message: Binary, nonce: u32 },
|
PostMessage { message: Binary, nonce: u32 },
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub struct MigrateMsg {}
|
pub struct MigrateMsg {}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum QueryMsg {
|
pub enum QueryMsg {
|
||||||
GuardianSetInfo {},
|
GuardianSetInfo {},
|
||||||
|
@ -35,14 +35,14 @@ pub enum QueryMsg {
|
||||||
QueryAddressHex { address: HumanAddr },
|
QueryAddressHex { address: HumanAddr },
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub struct GuardianSetInfoResponse {
|
pub struct GuardianSetInfoResponse {
|
||||||
pub guardian_set_index: u32, // Current guardian set index
|
pub guardian_set_index: u32, // Current guardian set index
|
||||||
pub addresses: Vec<GuardianAddress>, // List of querdian addresses
|
pub addresses: Vec<GuardianAddress>, // List of querdian addresses
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub struct WrappedRegistryResponse {
|
pub struct WrappedRegistryResponse {
|
||||||
pub address: HumanAddr,
|
pub address: HumanAddr,
|
||||||
|
@ -54,7 +54,7 @@ pub struct GetStateResponse {
|
||||||
pub fee: Coin,
|
pub fee: Coin,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub struct GetAddressHexResponse {
|
pub struct GetAddressHexResponse {
|
||||||
pub hex: String,
|
pub hex: String,
|
||||||
|
|
|
@ -37,7 +37,7 @@ pub struct ConfigInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validator Action Approval(VAA) data
|
// Validator Action Approval(VAA) data
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct ParsedVAA {
|
pub struct ParsedVAA {
|
||||||
pub version: u8,
|
pub version: u8,
|
||||||
pub guardian_set_index: u32,
|
pub guardian_set_index: u32,
|
||||||
|
@ -150,7 +150,7 @@ impl ParsedVAA {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Guardian address
|
// Guardian address
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct GuardianAddress {
|
pub struct GuardianAddress {
|
||||||
pub bytes: Binary, // 20-byte addresses
|
pub bytes: Binary, // 20-byte addresses
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ impl GuardianAddress {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Guardian set information
|
// Guardian set information
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct GuardianSetInfo {
|
pub struct GuardianSetInfo {
|
||||||
pub addresses: Vec<GuardianAddress>,
|
pub addresses: Vec<GuardianAddress>,
|
||||||
// List of guardian addresses
|
// List of guardian addresses
|
||||||
|
@ -187,7 +187,7 @@ impl GuardianSetInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wormhole contract generic information
|
// Wormhole contract generic information
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||||
pub struct WormholeInfo {
|
pub struct WormholeInfo {
|
||||||
// Period for which a guardian set stays active after it has been replaced
|
// Period for which a guardian set stays active after it has been replaced
|
||||||
pub guardian_set_expirity: u64,
|
pub guardian_set_expirity: u64,
|
||||||
|
@ -220,8 +220,7 @@ pub fn sequence_set(storage: &mut dyn Storage, emitter: &[u8], sequence: u64) ->
|
||||||
pub fn sequence_read(storage: &dyn Storage, emitter: &[u8]) -> u64 {
|
pub fn sequence_read(storage: &dyn Storage, emitter: &[u8]) -> u64 {
|
||||||
bucket_read(storage, SEQUENCE_KEY)
|
bucket_read(storage, SEQUENCE_KEY)
|
||||||
.load(emitter)
|
.load(emitter)
|
||||||
.or::<u64>(Ok(0))
|
.unwrap_or(0)
|
||||||
.unwrap()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn vaa_archive_add(storage: &mut dyn Storage, hash: &[u8]) -> StdResult<()> {
|
pub fn vaa_archive_add(storage: &mut dyn Storage, hash: &[u8]) -> StdResult<()> {
|
||||||
|
@ -231,8 +230,7 @@ pub fn vaa_archive_add(storage: &mut dyn Storage, hash: &[u8]) -> StdResult<()>
|
||||||
pub fn vaa_archive_check(storage: &dyn Storage, hash: &[u8]) -> bool {
|
pub fn vaa_archive_check(storage: &dyn Storage, hash: &[u8]) -> bool {
|
||||||
bucket_read(storage, GUARDIAN_SET_KEY)
|
bucket_read(storage, GUARDIAN_SET_KEY)
|
||||||
.load(hash)
|
.load(hash)
|
||||||
.or::<bool>(Ok(false))
|
.unwrap_or(false)
|
||||||
.unwrap()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn wrapped_asset(storage: &mut dyn Storage) -> Bucket<HumanAddr> {
|
pub fn wrapped_asset(storage: &mut dyn Storage) -> Bucket<HumanAddr> {
|
||||||
|
|
|
@ -185,7 +185,7 @@ fn get_address_test() -> StdResult<()> {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn get_address_test_panic() -> () {
|
fn get_address_test_panic() {
|
||||||
// panics because of junk in first 12 bytes
|
// panics because of junk in first 12 bytes
|
||||||
let ones_32: &[u8] = &[1; 32];
|
let ones_32: &[u8] = &[1; 32];
|
||||||
ones_32.get_address(0);
|
ones_32.get_address(0);
|
||||||
|
@ -193,7 +193,7 @@ fn get_address_test_panic() -> () {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn get_address_test_panic_2() -> () {
|
fn get_address_test_panic_2() {
|
||||||
// panics because not enough bytes (need at least 32)
|
// panics because not enough bytes (need at least 32)
|
||||||
let short_address: &[u8] = &[0; 31];
|
let short_address: &[u8] = &[0; 31];
|
||||||
short_address.get_address(0);
|
short_address.get_address(0);
|
||||||
|
|
|
@ -11,8 +11,6 @@ use wormhole::{
|
||||||
state::{ConfigInfo, GuardianAddress, GuardianSetInfo, CONFIG_KEY},
|
state::{ConfigInfo, GuardianAddress, GuardianSetInfo, CONFIG_KEY},
|
||||||
};
|
};
|
||||||
|
|
||||||
use hex;
|
|
||||||
|
|
||||||
static INITIALIZER: &str = "initializer";
|
static INITIALIZER: &str = "initializer";
|
||||||
static GOV_ADDR: &[u8] = b"GOVERNANCE_ADDRESS";
|
static GOV_ADDR: &[u8] = b"GOVERNANCE_ADDRESS";
|
||||||
|
|
||||||
|
@ -54,10 +52,10 @@ fn do_init(guardians: &[GuardianAddress]) -> OwnedDeps<MockStorage, MockApi, Moc
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn init_works() {
|
fn init_works() {
|
||||||
let guardians = [GuardianAddress::from(GuardianAddress {
|
let guardians = [GuardianAddress {
|
||||||
bytes: hex::decode("beFA429d57cD18b7F8A4d91A2da9AB4AF05d0FBe")
|
bytes: hex::decode("beFA429d57cD18b7F8A4d91A2da9AB4AF05d0FBe")
|
||||||
.expect("Decoding failed")
|
.expect("Decoding failed")
|
||||||
.into(),
|
.into(),
|
||||||
})];
|
}];
|
||||||
let _deps = do_init(&guardians);
|
let _deps = do_init(&guardians);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use cw0::Expiration;
|
use cw0::Expiration;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
|
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum Cw721QueryMsg {
|
pub enum Cw721QueryMsg {
|
||||||
/// Return the owner of the given token, error if token does not exist
|
/// Return the owner of the given token, error if token does not exist
|
||||||
|
@ -94,18 +94,18 @@ pub struct OperatorsResponse {
|
||||||
pub operators: Vec<Approval>,
|
pub operators: Vec<Approval>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
|
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
|
||||||
pub struct NumTokensResponse {
|
pub struct NumTokensResponse {
|
||||||
pub count: u64,
|
pub count: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
|
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
|
||||||
pub struct ContractInfoResponse {
|
pub struct ContractInfoResponse {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub symbol: String,
|
pub symbol: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
|
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
|
||||||
pub struct NftInfoResponse<T> {
|
pub struct NftInfoResponse<T> {
|
||||||
/// Universal resource identifier for this NFT
|
/// Universal resource identifier for this NFT
|
||||||
/// Should point to a JSON file that conforms to the ERC721
|
/// Should point to a JSON file that conforms to the ERC721
|
||||||
|
@ -123,7 +123,7 @@ pub struct AllNftInfoResponse<T> {
|
||||||
pub info: NftInfoResponse<T>,
|
pub info: NftInfoResponse<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
|
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
|
||||||
pub struct TokensResponse {
|
pub struct TokensResponse {
|
||||||
/// Contains all token_ids in lexicographical ordering
|
/// Contains all token_ids in lexicographical ordering
|
||||||
/// If there are more than `limit`, use `start_from` in future queries
|
/// If there are more than `limit`, use `start_from` in future queries
|
||||||
|
|
|
@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
|
||||||
use cosmwasm_std::{to_binary, Binary, CosmosMsg, StdResult, WasmMsg};
|
use cosmwasm_std::{to_binary, Binary, CosmosMsg, StdResult, WasmMsg};
|
||||||
|
|
||||||
/// Cw721ReceiveMsg should be de/serialized under `Receive()` variant in a ExecuteMsg
|
/// Cw721ReceiveMsg should be de/serialized under `Receive()` variant in a ExecuteMsg
|
||||||
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
|
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub struct Cw721ReceiveMsg {
|
pub struct Cw721ReceiveMsg {
|
||||||
pub sender: String,
|
pub sender: String,
|
||||||
|
|
Loading…
Reference in New Issue