CW83: Smart Account Registry
An interface for CosmWasm based smart contracts defining interaction with smart account registries used for creating smart contract based account defined in CW82
Queries
All CW83-compliant registries must define a message with the following variants in for their query endpoint
Where AccountQuery is defined in the following manner
Different implementations are free to customise the query in any desirable manner to link an account to a username, a non-fungible token, credential info and so on.
The response type enforces the contracts implementing the standard to return a smart account address corresponsing to the query and leave a room to customize for returning addition info related to the account
Messages
The only required message variant for the execute endpoint is `CreateAccount``:
where CreateAccountMsg is defined in the following manner:
allowing contracts to define payload needed for validation in the registry and also for generating an instantiation message for smart account contracts
Usage
A contract that wishes to follow the standard must add the variants described above to their query and execute messages. This package exposes a helper macro attribute registry_query that injects it automatically:
// <- Must be before #[cw_serde]
Modules using the message must ether import AccountQuery from cw83 package or to define it manually. Here is an example of customising it from token bound account registry:
use AccountQuery as AccountQueryBase;
pub type AccountQuery = ;
Defining execute message can also happen through a helper
Note: AccountQuery must also be imported
Same scenario must be repeated for CreateAccountMsg. An example of customizing a message from the tba-registry:
use CreateAccountMsg as CreateAccountMsgBase
pub type CreateAccountMsg = ;
If a contract doesn't define additional variants it can directly use Cw83QueryMsg and Cw83ExecuteMsg from the package directly
Examples
Example contracts can be found in this repository and are prefixed with cw83-
| Contract | Description |
|---|---|
cw83-tba-registry |
A Registry of token bound accounts |