CW3 EXAMPLE
In this example, we will be looking at transforming the cw3 fixed multisig contract from the cw-plus repo to a fixed multisig ADO. The final result can be found here.
Initial Setup
The easiest and most recommended way of starting development on any ADO is to use the Andromeda ADO Template. 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:
Building the ADO
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.
Local Error Types
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:
Migrate Function
All our ADOs contain the following migrate function to be able to migrate an ADO to a new code_id:
This will be added to our template, but if not found at the time you go through this, make sure to add it.
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 before, we do provide custom mock structs for testing. You can check any of our published ADOs testing from our core repo to see how these structs can be used to conduct testing.
Last updated
Was this helpful?