Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final audit revision #90

Merged
merged 11 commits into from
Feb 19, 2024
129 changes: 64 additions & 65 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/cw721-tester/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn instantiate(
msg::InstantiateMsg {
name: msg.name,
symbol: msg.symbol,
minter: msg.minter,
minter: Some(msg.minter),
withdraw_address: None,
},
)?;
Expand Down
5 changes: 3 additions & 2 deletions contracts/sg-ics721/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use ics721_types::token_types::Class;

use sg721_base::msg::{CollectionInfoResponse, QueryMsg};

use crate::state::{SgCollectionData, SgIcs721Contract};
use crate::state::{SgCollectionData, SgIcs721Contract, STARGAZE_ICON_PLACEHOLDER};

impl Ics721Execute for SgIcs721Contract {
type ClassData = SgCollectionData;
Expand Down Expand Up @@ -48,7 +48,8 @@ impl Ics721Execute for SgIcs721Contract {
// therefore, we use ics721 creator as owner
creator: ics721_contract_info.creator,
description: "".to_string(),
image: "https://arkprotocol.io".to_string(),
// use Stargaze icon as placeholder
image: STARGAZE_ICON_PLACEHOLDER.to_string(),
external_link: None,
explicit_content: None,
start_trading_time: None,
Expand Down
3 changes: 3 additions & 0 deletions contracts/sg-ics721/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ use cosmwasm_schema::cw_serde;
use cosmwasm_std::ContractInfoResponse;
use sg721_base::msg::CollectionInfoResponse;

pub const STARGAZE_ICON_PLACEHOLDER: &str =
"ipfs://bafkreie5vwrm5zts4wiq6ebtopmztgl5qzyl4uszyllgwpaizyc5w2uycm";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for @jhernandezb providing another link


/// Collection data provided by the (source) cw721 contract. This is pass as optional class data during interchain transfer to target chain.
/// ICS721 on target chain is free to use this data or not. Lik in case of `sg721-base` it uses owner for defining creator in collection info.
#[cw_serde]
Expand Down
27 changes: 15 additions & 12 deletions contracts/sg-ics721/src/testing/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ use sg721::InstantiateMsg as Sg721InstantiateMsg;
use sg721_base::msg::{CollectionInfoResponse, QueryMsg as Sg721QueryMsg};
use sha2::{digest::Update, Digest, Sha256};

use crate::{state::SgCollectionData, ContractError, SgIcs721Contract};
use crate::{
state::{SgCollectionData, STARGAZE_ICON_PLACEHOLDER},
ContractError, SgIcs721Contract,
};

const ICS721_CREATOR: &str = "ics721-creator";
const CONTRACT_NAME: &str = "crates.io:sg-ics721";
Expand Down Expand Up @@ -371,7 +374,7 @@ impl Test {
collection_info: sg721::CollectionInfo {
creator: source_cw721_owner.to_string(),
description: "".to_string(),
image: "https://arkprotocol.io".to_string(),
image: STARGAZE_ICON_PLACEHOLDER.to_string(),
external_link: None,
explicit_content: None,
start_trading_time: None,
Expand Down Expand Up @@ -728,7 +731,7 @@ fn test_do_instantiate_and_mint() {
// creator of ics721 contract is also creator of collection, since no owner in ClassData provided
creator: test.app.api().addr_make(ICS721_CREATOR).to_string(),
description: "".to_string(),
image: "https://arkprotocol.io".to_string(),
image: STARGAZE_ICON_PLACEHOLDER.to_string(),
external_link: None,
explicit_content: None,
start_trading_time: None,
Expand Down Expand Up @@ -904,7 +907,7 @@ fn test_do_instantiate_and_mint() {
// creator based on owner from collection in soure chain
creator: test.app.api().addr_make(ICS721_CREATOR).to_string(),
description: "".to_string(),
image: "https://arkprotocol.io".to_string(),
image: STARGAZE_ICON_PLACEHOLDER.to_string(),
external_link: None,
explicit_content: None,
start_trading_time: None,
Expand Down Expand Up @@ -1078,7 +1081,7 @@ fn test_do_instantiate_and_mint() {
// creator of ics721 contract is creator of nft contract, since no owner in ClassData provided
creator: test.app.api().addr_make(ICS721_CREATOR).to_string(),
description: "".to_string(),
image: "https://arkprotocol.io".to_string(),
image: STARGAZE_ICON_PLACEHOLDER.to_string(),
external_link: None,
explicit_content: None,
start_trading_time: None,
Expand Down Expand Up @@ -1256,7 +1259,7 @@ fn test_do_instantiate_and_mint() {
// creator of ics721 contract is creator of nft contract, since no owner in ClassData provided
creator: test.app.api().addr_make(ICS721_CREATOR).to_string(),
description: "".to_string(),
image: "https://arkprotocol.io".to_string(),
image: STARGAZE_ICON_PLACEHOLDER.to_string(),
external_link: None,
explicit_content: None,
start_trading_time: None,
Expand Down Expand Up @@ -1434,7 +1437,7 @@ fn test_do_instantiate_and_mint() {
// creator of ics721 contract is creator of nft contract, since no owner in ClassData provided
creator: test.app.api().addr_make(ICS721_CREATOR).to_string(),
description: "".to_string(),
image: "https://arkprotocol.io".to_string(),
image: STARGAZE_ICON_PLACEHOLDER.to_string(),
external_link: None,
explicit_content: None,
start_trading_time: None,
Expand Down Expand Up @@ -1666,7 +1669,7 @@ fn test_do_instantiate_and_mint_2_different_collections() {
// creator of ics721 contract is also creator of collection, since no owner in ClassData provided
creator: test.app.api().addr_make(ICS721_CREATOR).to_string(),
description: "".to_string(),
image: "https://arkprotocol.io".to_string(),
image: STARGAZE_ICON_PLACEHOLDER.to_string(),
external_link: None,
explicit_content: None,
start_trading_time: None,
Expand All @@ -1679,7 +1682,7 @@ fn test_do_instantiate_and_mint_2_different_collections() {
// creator of ics721 contract is also creator of collection, since no owner in ClassData provided
creator: test.app.api().addr_make(ICS721_CREATOR).to_string(),
description: "".to_string(),
image: "https://arkprotocol.io".to_string(),
image: STARGAZE_ICON_PLACEHOLDER.to_string(),
external_link: None,
explicit_content: None,
start_trading_time: None,
Expand Down Expand Up @@ -1926,7 +1929,7 @@ fn test_do_instantiate_and_mint_no_instantiate() {
CollectionInfoResponse {
creator: test.app.api().addr_make(ICS721_CREATOR).to_string(),
description: "".to_string(),
image: "https://arkprotocol.io".to_string(),
image: STARGAZE_ICON_PLACEHOLDER.to_string(),
external_link: None,
explicit_content: None,
start_trading_time: None,
Expand Down Expand Up @@ -2108,7 +2111,7 @@ fn test_proxy_authorized() {
.addr_make(COLLECTION_OWNER_SOURCE_CHAIN)
.to_string(),
description: "".to_string(),
image: "https://arkprotocol.io".to_string(),
image: STARGAZE_ICON_PLACEHOLDER.to_string(),
external_link: None,
explicit_content: None,
start_trading_time: None,
Expand Down Expand Up @@ -2234,7 +2237,7 @@ fn test_receive_nft() {
collection_info: Some(CollectionInfoResponse {
creator: test.ics721.to_string(),
description: "".to_string(),
image: "https://arkprotocol.io".to_string(),
image: STARGAZE_ICON_PLACEHOLDER.to_string(),
external_link: None,
explicit_content: None,
start_trading_time: None,
Expand Down
7 changes: 5 additions & 2 deletions packages/ics721/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,17 @@ pub enum ContractError {
#[error("Transfer Doesn't contain any action, no redemption or creation")]
InvalidTransferNoAction,

#[error("Couldn't find nft contract for this class id: {0}")]
#[error("Couldn't find nft contract for class id: {0}")]
NoNftContractForClassId(String),

#[error("Unknown nft contract: {child_collection}, Class Id: {class_id}, Token ID: {token_id} => NFT contract: {cw721_addr}")]
NoClassIdForNftContract {
NoNftContractMatch {
child_collection: String,
class_id: String,
token_id: String,
cw721_addr: String,
},

#[error("Couldn't find class id for nft contract: {0}")]
NoClassIdForNftContract(String),
}
Loading
Loading