Closed taitruong closed 6 months ago
You can also see from adjusted tests - it looks more convenient and natural.
Reason, why I came to this conclusion is this here: https://github.com/public-awesome/launchpad/blob/main/contracts/collections/sg721-base/src/contract.rs#L53-L58
// cw721 instantiation
let info = CW721ContractInfoResponse {
name: msg.name,
symbol: msg.symbol,
};
self.parent.contract_info.save(deps.storage, &info)?;
cw_ownable::initialize_owner(deps.storage, deps.api, Some(&msg.minter))?;
All this logic can completely be removed, by calling parent.instantiate
. Also these 3 props can be replaced by cw721_base::msg::InstantiateMsg
: https://github.com/public-awesome/launchpad/blob/main/packages/sg721/src/lib.rs#L118-L120
pub struct InstantiateMsg {
pub name: String,
pub symbol: String,
pub minter: String,
pub collection_info: CollectionInfo<RoyaltyInfoResponse>,
}
@jhernandezb
@shanev need one more approval, then we can merge and release 0.19.0 (#150)
PR for #151
Rather prefer having
minter: Option<String>
: https://github.com/CosmWasm/cw-nfts/blob/177a993dfb5a1a3164be1baf274f43b1ca53da53/contracts/cw721-base/src/msg.rs#L8-L18In case of none,
info.sender
should be minter. Makes it easier for other contracts (e.g. minter) re-using this msg.In most cases creator of contract is also minter. Rn creator (=sender) instantiates contract AND need to provides its own address in
minter
prop. You can see this in unit tests:Before: duplicate, since creator is in
info.sender
andminter.prop
After: no need to provider
minter
prop, since creator is sender:Instantiation is like this then:
like before, in case caller should NOT be minter/owner (edge case):
for creator (standard, 99.99% case):
@shanev @JakeHartnell