CW3 EXAMPLE
Last updated
Was this helpful?
Last updated
Was this helpful?
In this example, we will be looking at transforming the cw3 from the cw-plus repo to a fixed multisig ADO. The final result can be found .
The easiest and most recommended way of starting development on any ADO is to use the . From the template, we can start a new project by running the following in the terminal:
You will notice that the ADO name will be the taken from the specified name of the project by default:
For naming an ADO, try to conform with our naming standard which uses a - to separate the name in case the name is made of several words.
In the Cargo.toml file, you can check the version of your imported crates. The latest version of andromeda-std is "0.1.2" so make sure you update it in case another version is being used:
Now that you are set up with the template, you can start filling in the messages for the ADO. Since we already have most of the logic from the cw3 fixed multisig, we can just move them to our ADO template.
To create a new error type, you can use the error.rs file as in any Cosmwasm contract. Since our ADO template implements a lot of functionality imported by the andromeda-std crate, we will need to wrap the andromeda error types to be included in our error.rs file.
This is already present in the template.
In the error.rs file include the following:
Then we wrap it into our ContractError enum like so:
All our ADOs contain the following migrate function to be able to migrate an ADO to a new code_id:
This can be imported and added into your ADO like so:
Other than what we have covered, most of the logic of the CW3 remained the same. Unit test and integration tests were not changed as they are already written and all passed in the ADO version as well. As mentioned , we do provide custom mock structs for testing. You can check any of our published ADOs testing from our to see how these structs can be used to conduct testing.