19 releases (6 breaking)

new 0.10.0-soon Sep 22, 2021
0.8.1 Aug 26, 2021
0.8.0-rc1 Jul 29, 2021
0.6.0-alpha1 Mar 12, 2021
0.4.0 Dec 22, 2020

#796 in Magic Beans

Download history 1/week @ 2021-06-01 12/week @ 2021-06-08 2/week @ 2021-06-15 19/week @ 2021-06-22 1/week @ 2021-06-29 3/week @ 2021-07-06 31/week @ 2021-07-13 35/week @ 2021-07-20 53/week @ 2021-07-27 49/week @ 2021-08-03 91/week @ 2021-08-10 8/week @ 2021-08-17 22/week @ 2021-08-24 42/week @ 2021-08-31 4/week @ 2021-09-07 29/week @ 2021-09-14

127 downloads per month
Used in cw3-flex-multisig

Apache-2.0

290KB
6K SLoC

CW4 Group

This is a basic implementation of the cw4 spec. It fulfills all elements of the spec, including the raw query lookups, and it designed to be used as a backing storage for cw3 compliant contracts.

It stores a set of members along with an admin, and allows the admin to update the state. Raw queries (intended for cross-contract queries) can check a given member address and the total weight. Smart queries (designed for client API) can do the same, and also query the admin address as well as paginate over all members.

Init

To create it, you must pass in a list of members, as well as an optional admin, if you wish it to be mutable.

pub struct InitMsg {
    pub admin: Option<HumanAddr>,
    pub members: Vec<Member>,
}

pub struct Member {
    pub addr: HumanAddr,
    pub weight: u64,
}

Members are defined by an address and a weight. This is transformed and stored under their CanonicalAddr, in a format defined in cw4 raw queries.

Note that 0 is an allowed weight. This doesn't give any voting rights, but it does define this address is part of the group. This could be used in e.g. a KYC whitelist to say they are allowed, but cannot participate in decision-making.

Messages

Basic update messages, queries, and hooks are defined by the cw4 spec. Please refer to it for more info.

cw4-group adds one message to control the group membership:

UpdateMembers{add, remove} - takes a membership diff and adds/updates the members, as well as removing any provided addresses. If an address is on both lists, it will be removed. If it appears multiple times in add, only the last occurrence will be used.

Dependencies

~2–4MB
~72K SLoC