Since Sylvia supports CustomMsg and CustomQuery we should add support for sudo.
Generate SudoMsg
To allow sudo communication with a contract, first we have to generate the SudoMsg.
It should be represented as and enum and concatenate messages as variants.
Sudo should be supported by both interface and contract and generated as
First step to provide support for the sudo would be to add support for it in interfaces.
We should support below example and generate SudoMsg with two variants.
This should look the same as ExecMsg and QueyMsg so not much to be covered here.
Sudo in Contract
Same as in case of the Interface SudoMsg should be generated as ExecMsg and QueryMsg.
There is however one additional thing to be generated which is ContractSudoMsg.
It is needed as we have to be able to implement Interfaces on the Contracts and we want to be able to dispatch to proper handler.
Next to the generated messages we have to generate utils for handling the sudo in the MultiTest helpers.
interface::Querier implementation on contract::BoundQuerier
newly generated trait implementation on interface::Proxy
We don't have to update Querier generation, however sudo messages should be implemented on the interface::Proxy.
At this point we should be able to have a Contract handling sudo messages from both itself and Interface and be able to test the behavior using MultiTest.
Coexistence with other features
We should make sure that sudo works with custom and generics. Adding variants to respective examples should confirm proper support for these features.
Override entry points example should also be updated with sudo variant. This way we can remove manually implemented message.
This example should generate the SudoMsg and use the user defined entry point in the MultiTest helpers,
specifically in cw_multi_test::Contract implementation on Contract.
Roadmap
[x] Support #[msg(sudo)] used in interface
[x] Support #[msg(sudo)] used in contract
[x] Support #[msg(sudo)] used in Interface implementation
[x] Support #[msg(sudo)] used in entry_points
[x] #304
[x] #305
[x] #306
[x] #307
Update docs
README and sylvia-book has to be updated with changes from this feature.
Motivation
Since
Sylvia
supportsCustomMsg
andCustomQuery
we should add support forsudo
.Generate
SudoMsg
To allow
sudo
communication with a contract, first we have to generate theSudoMsg
. It should be represented as andenum
and concatenate messages as variants.Sudo
should be supported by bothinterface
andcontract
and generated asSudo
in InterfaceFirst step to provide support for the sudo would be to add support for it in interfaces. We should support below example and generate
SudoMsg
with two variants.This should look the same as
ExecMsg
andQueyMsg
so not much to be covered here.Sudo
in ContractSame as in case of the Interface
SudoMsg
should be generated asExecMsg
andQueryMsg
. There is however one additional thing to be generated which isContractSudoMsg
. It is needed as we have to be able to implement Interfaces on the Contracts and we want to be able to dispatch to proper handler.Next to the generated messages we have to generate utils for handling the
sudo
in theMultiTest
helpers.Sudo
in Interface ImplemenationInterface implementation handles two things:
interface::Querier
implementation oncontract::BoundQuerier
interface::Proxy
We don't have to update
Querier
generation, howeversudo
messages should be implemented on theinterface::Proxy
. At this point we should be able to have a Contract handlingsudo
messages from both itself and Interface and be able to test the behavior usingMultiTest
.Coexistence with other features
We should make sure that
sudo
works withcustom
and generics. Adding variants to respective examples should confirm proper support for these features.Override entry points example should also be updated with
sudo
variant. This way we can remove manually implemented message. This example should generate theSudoMsg
and use the user defined entry point in theMultiTest
helpers, specifically incw_multi_test::Contract
implementation on Contract.Roadmap
#[msg(sudo)]
used ininterface
#[msg(sudo)]
used incontract
#[msg(sudo)]
used in Interface implementation#[msg(sudo)]
used inentry_points
Update docs
README
andsylvia-book
has to be updated with changes from this feature.