Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 94 additions & 92 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ keywords = ["cosmos", "cosmwasm"]
cosmwasm-schema = "1.2"
cosmwasm-std = "1.2"
cw-address-like = { version = "1.0.4", path = "./packages/address-like" }
cw-ownable-derive = { version = "0.5.1", path = "./packages/ownable/derive" }
cw-ownable-derive = { version = "0.6.0", path = "./packages/ownable/derive" }
cw-storage-plus = "1.1"
cw-utils = "1.0"
proc-macro2 = "1"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A collection of [CosmWasm][1] utilities and helper libraries.
| [cw-address-like][2] | v1.0.4 | A trait that marks unchecked or checked address strings |
| [cw-item-set][3] | v0.7.1 | Set of non-duplicate items for storage |
| [cw-optional-indexes][4] | v0.1.1 | Index types for `IndexedMap` where an item may or may not have an index |
| [cw-ownable][5] | v0.5.1 | Utility for controlling contract ownership |
| [cw-ownable][5] | v0.6.0 | Utility for controlling contract ownership |
| [cw-paginate][6] | v0.2.1 | Helper function for interating maps |

## License
Expand Down
2 changes: 1 addition & 1 deletion packages/ownable/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cw-ownable"
version = "0.5.1"
version = "0.6.0"
description = "Utility for controlling ownership of CosmWasm smart contracts"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
10 changes: 10 additions & 0 deletions packages/ownable/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult<Binary> {
}
```

You can use ownership for other purposes:

```rust
use cw_ownable::OwnershipStore;

pub const CREATOR: OwnershipStore = OwnershipStore::new("creator");
```

`CREATOR` has all functions in place: `initialize_owner`, `is_owner`, `assert_owner`, and `get_ownership`.

## License

Contents of this crate at or prior to version `0.5.0` are published under [GNU Affero General Public License v3](https://github.com/steak-enjoyers/cw-plus-plus/blob/9c8fcf1c95b74dd415caf5602068c558e9d16ecc/LICENSE) or later; contents after the said version are published under [Apache-2.0](../../LICENSE) license.
2 changes: 1 addition & 1 deletion packages/ownable/derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cw-ownable-derive"
version = "0.5.1"
version = "0.6.0"
description = "Macros for generating code used by the `cw-ownable` crate"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
8 changes: 5 additions & 3 deletions packages/ownable/derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ fn merge_variants(metadata: TokenStream, left: TokenStream, right: TokenStream)
let Enum(DataEnum {
variants,
..
}) = &mut left.data else {
}) = &mut left.data
else {
return syn::Error::new(left.ident.span(), "only enums can accept variants")
.to_compile_error()
.into();
Expand All @@ -33,14 +34,15 @@ fn merge_variants(metadata: TokenStream, left: TokenStream, right: TokenStream)
let Enum(DataEnum {
variants: to_add,
..
}) = right.data else {
}) = right.data
else {
return syn::Error::new(left.ident.span(), "only enums can provide variants")
.to_compile_error()
.into();
};

// insert variants from the right to the left
variants.extend(to_add.into_iter());
variants.extend(to_add);

quote! { #left }.into()
}
Expand Down
Loading