Skip to content

Commit

Permalink
add multi-owner cw-ownable with cosmwasm v2 (#1)
Browse files Browse the repository at this point in the history
* move all logic to `OwnershipStore`. This way `cw-ownable` is still a singleton. But can be re-use e.g. by defining `CREATOR: OwnershipStore = OwnershipStore::new("creator")`

* cargo fmt

* cargo clippy --tests

* use api and storage (instead of DepsMut) for being less restrictive

* fix ownable

* remove unneccessary lifetime (clippy warning)

---------

Co-authored-by: mr-t <[email protected]>
  • Loading branch information
mintthemoon and taitruong authored Aug 12, 2024
1 parent 4658ec9 commit eb4445e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/optional-indexes/src/unique.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct OptionalUniqueIndex<IK, T, PK = ()> {
phantom: PhantomData<PK>,
}

impl<'a, IK, T, PK> OptionalUniqueIndex<IK, T, PK> {
impl<IK, T, PK> OptionalUniqueIndex<IK, T, PK> {
pub const fn new(idx_fn: fn(&T) -> Option<IK>, idx_namespace: &'static str) -> Self {
Self {
index: idx_fn,
Expand Down
8 changes: 4 additions & 4 deletions packages/ownable/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ pub struct Ownership<T: AddressLike> {
pub pending_expiry: Option<Expiration>,
}

pub struct OwnershipStore<'a> {
pub item: Item<'a, Ownership<Addr>>,
pub struct OwnershipStore {
pub item: Item<Ownership<Addr>>,
}

impl<'a> OwnershipStore<'a> {
pub const fn new(key: &'a str) -> Self {
impl OwnershipStore {
pub const fn new(key: &'static str) -> Self {
Self {
item: Item::new(key),
}
Expand Down

0 comments on commit eb4445e

Please sign in to comment.