Skip to content

Commit

Permalink
Merge branch 'main' into zeke/proposal-deposits
Browse files Browse the repository at this point in the history
  • Loading branch information
ueco-jb authored Sep 23, 2022
2 parents 67941a7 + ad0fe7b commit c3f02f4
Show file tree
Hide file tree
Showing 8 changed files with 417 additions and 375 deletions.
388 changes: 23 additions & 365 deletions contracts/cw4-group/src/contract.rs

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion contracts/cw4-group/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cosmwasm_std::StdError;
use cosmwasm_std::{OverflowError, StdError};
use thiserror::Error;

use cw_controllers::{AdminError, HookError};
Expand All @@ -14,6 +14,9 @@ pub enum ContractError {
#[error("{0}")]
Admin(#[from] AdminError),

#[error("{0}")]
Overflow(#[from] OverflowError),

#[error("Unauthorized")]
Unauthorized {},
}
3 changes: 3 additions & 0 deletions contracts/cw4-group/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ pub mod msg;
pub mod state;

pub use crate::error::ContractError;

#[cfg(test)]
mod tests;
2 changes: 1 addition & 1 deletion contracts/cw4-group/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub enum QueryMsg {
#[returns(cw_controllers::AdminResponse)]
Admin {},
#[returns(cw4::TotalWeightResponse)]
TotalWeight {},
TotalWeight { at_height: Option<u64> },
#[returns(cw4::MemberListResponse)]
ListMembers {
start_after: Option<String>,
Expand Down
20 changes: 14 additions & 6 deletions contracts/cw4-group/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
use cosmwasm_std::Addr;
use cw4::TOTAL_KEY;
use cw4::{
MEMBERS_CHANGELOG, MEMBERS_CHECKPOINTS, MEMBERS_KEY, TOTAL_KEY, TOTAL_KEY_CHANGELOG,
TOTAL_KEY_CHECKPOINTS,
};
use cw_controllers::{Admin, Hooks};
use cw_storage_plus::{Item, SnapshotMap, Strategy};
use cw_storage_plus::{SnapshotItem, SnapshotMap, Strategy};

pub const ADMIN: Admin = Admin::new("admin");
pub const HOOKS: Hooks = Hooks::new("cw4-hooks");

pub const TOTAL: Item<u64> = Item::new(TOTAL_KEY);
pub const TOTAL: SnapshotItem<u64> = SnapshotItem::new(
TOTAL_KEY,
TOTAL_KEY_CHECKPOINTS,
TOTAL_KEY_CHANGELOG,
Strategy::EveryBlock,
);

pub const MEMBERS: SnapshotMap<&Addr, u64> = SnapshotMap::new(
cw4::MEMBERS_KEY,
cw4::MEMBERS_CHECKPOINTS,
cw4::MEMBERS_CHANGELOG,
MEMBERS_KEY,
MEMBERS_CHECKPOINTS,
MEMBERS_CHANGELOG,
Strategy::EveryBlock,
);
Loading

0 comments on commit c3f02f4

Please sign in to comment.