-
Notifications
You must be signed in to change notification settings - Fork 181
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
Fix trait to be compatible for custom modules #77
Fix trait to be compatible for custom modules #77
Conversation
contracts/cw721-base/src/execute.rs
Outdated
E1: DeserializeOwned, | ||
E2: DeserializeOwned, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E1
is the execution message and E2
is the execution query message to the contract. They are the messages to the contract but not to the chain custom modules, so they are set as DeserializeOwned
.
contracts/cw721-base/src/execute.rs
Outdated
{ | ||
pub fn instantiate( | ||
&self, | ||
deps: DepsMut, | ||
deps: DepsMut<Q>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assigning CustomQuery
to all the Deps
in order to make communication to the custom modules available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea to include this! Just a comment about giving the new generics proper names and setting them to the same defaults cosmwasm_std
does.
contracts/cw721-base/src/execute.rs
Outdated
T: Serialize + DeserializeOwned + Clone, | ||
E1: DeserializeOwned, | ||
E2: DeserializeOwned, | ||
C: CustomMsg, | ||
E: CustomMsg, | ||
Q: CustomMsg, | ||
Q: CustomQuery, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to need to get rebased on this change which also changes these generic names: #75
How would you feel about giving Q
here a more descriptive name? DepsQueryExt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would name Q
into ModuleQuery
and C
into ModuleMsg
. What do you think?
contracts/cw721-base/src/execute.rs
Outdated
@@ -77,16 +80,16 @@ where | |||
} | |||
|
|||
// TODO pull this into some sort of trait extension?? | |||
impl<'a, T, C, E, Q> Cw721Contract<'a, T, C, E, Q> | |||
impl<'a, T, E1, E2, C, Q> Cw721Contract<'a, T, E1, E2, C, Q> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impl<'a, T, E1, E2, C, Q> Cw721Contract<'a, T, E1, E2, C, Q> | |
impl<'a, T, E1, E2, C, Q> Cw721Contract<'a, T, E1, E2, C, Q = Empty> |
How about giving this the same default value as CosmWasm does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it would be great adding default on its struct.
contracts/cw721-base/src/helpers.rs
Outdated
C: CustomMsg, | ||
Q: CustomQuery, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C: CustomMsg, | |
Q: CustomQuery, | |
ModuleLevelCustomMsg: CustomMsg = Empty, | |
ModuleLevelCustomQuery: CustomQuery = Empty, |
Rebased. |
Updated to |
Updated to main branch, any updates for it? @0xekez |
Currently,
CustomMsg
isn't thecosmwasm-std
version andCustomQuery
is not imported, it makes the current version is not compatible for custom modules, likex/profiles
in Desmos chain. In addition, any messages to the contract should not beCustomMsg
since they are not for the custom modules, they should beDeserializeOwned
, instead.This PR intends to fix the issues mentioned above.