Skip to content

Commit

Permalink
Remove attestation-related proposal actions
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDeeKay committed Jun 13, 2024
1 parent 35c1d7e commit 3be5b87
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 69 deletions.
4 changes: 1 addition & 3 deletions contracts/enterprise-facade-v1/src/facade_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,7 @@ impl EnterpriseFacadeV1 {
ProposalAction::UpdateMinimumWeightForRewards(msg) => {
Ok(UpdateMinimumWeightForRewards(msg.into()))
}
ProposalAction::AddAttestation(_)
| ProposalAction::RemoveAttestation { .. }
| ProposalAction::DeployCrossChainTreasury(_) => {
ProposalAction::DeployCrossChainTreasury(_) => {
Err(StdError::generic_err("unsupported proposal action"))
}
}
Expand Down
60 changes: 13 additions & 47 deletions contracts/enterprise-governance-controller/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,21 @@ use denom_staking_api::msg::QueryMsg::DenomConfig;
use enterprise_governance_api::msg::ExecuteMsg::UpdateVotes;
use enterprise_governance_api::msg::QueryMsg::SimulateEndPollStatus;
use enterprise_governance_controller_api::api::ProposalAction::{
AddAttestation, DistributeFunds, ExecuteEnterpriseMsgs, ExecuteMsgs, ModifyMultisigMembership,
RemoveAttestation, RequestFundingFromDao, UpdateAssetWhitelist, UpdateCouncil, UpdateGovConfig,
UpdateMetadata, UpdateMinimumWeightForRewards, UpdateNftWhitelist, UpgradeDao,
DistributeFunds, ExecuteEnterpriseMsgs, ExecuteMsgs, ModifyMultisigMembership,
RequestFundingFromDao, UpdateAssetWhitelist, UpdateCouncil, UpdateGovConfig, UpdateMetadata,
UpdateMinimumWeightForRewards, UpdateNftWhitelist, UpgradeDao,
};
use enterprise_governance_controller_api::api::ProposalType::{Council, General};
use enterprise_governance_controller_api::api::{
AddAttestationMsg, CastVoteMsg, ConfigResponse, CreateProposalMsg,
CreateProposalWithNftDepositMsg, DistributeFundsMsg, ExecuteEnterpriseMsgsMsg, ExecuteMsgsMsg,
ExecuteProposalMsg, ExecuteTreasuryMsgsMsg, GovConfig, GovConfigResponse, MemberVoteParams,
MemberVoteResponse, ModifyMultisigMembershipMsg, Proposal, ProposalAction, ProposalActionType,
ProposalDeposit, ProposalDepositAsset, ProposalId, ProposalInfo, ProposalParams,
ProposalResponse, ProposalStatus, ProposalStatusFilter, ProposalStatusParams,
ProposalStatusResponse, ProposalType, ProposalVotesParams, ProposalVotesResponse,
ProposalsParams, ProposalsResponse, RequestFundingFromDaoMsg,
UpdateAssetWhitelistProposalActionMsg, UpdateCouncilMsg, UpdateGovConfigMsg,
UpdateMinimumWeightForRewardsMsg, UpdateNftWhitelistProposalActionMsg,
CastVoteMsg, ConfigResponse, CreateProposalMsg, CreateProposalWithNftDepositMsg,
DistributeFundsMsg, ExecuteEnterpriseMsgsMsg, ExecuteMsgsMsg, ExecuteProposalMsg,
ExecuteTreasuryMsgsMsg, GovConfig, GovConfigResponse, MemberVoteParams, MemberVoteResponse,
ModifyMultisigMembershipMsg, Proposal, ProposalAction, ProposalActionType, ProposalDeposit,
ProposalDepositAsset, ProposalId, ProposalInfo, ProposalParams, ProposalResponse,
ProposalStatus, ProposalStatusFilter, ProposalStatusParams, ProposalStatusResponse,
ProposalType, ProposalVotesParams, ProposalVotesResponse, ProposalsParams, ProposalsResponse,
RequestFundingFromDaoMsg, UpdateAssetWhitelistProposalActionMsg, UpdateCouncilMsg,
UpdateGovConfigMsg, UpdateMinimumWeightForRewardsMsg, UpdateNftWhitelistProposalActionMsg,
};
use enterprise_governance_controller_api::error::GovernanceControllerError::{
CustomError, DuplicateNftDeposit, InsufficientProposalDeposit, InvalidCosmosMessage,
Expand All @@ -66,7 +65,7 @@ use enterprise_outposts_api::api::{
};
use enterprise_protocol::api::{
ComponentContractsResponse, DaoInfoResponse, DaoType, IsRestrictedUserParams,
IsRestrictedUserResponse, SetAttestationMsg, UpdateMetadataMsg, UpgradeDaoMsg,
IsRestrictedUserResponse, UpdateMetadataMsg, UpgradeDaoMsg,
};
use enterprise_protocol::msg::QueryMsg::{ComponentContracts, DaoInfo, IsRestrictedUser};
use enterprise_treasury_api::api::{
Expand Down Expand Up @@ -474,8 +473,6 @@ fn to_proposal_action_type(proposal_action: &ProposalAction) -> ProposalActionTy
ModifyMultisigMembership(_) => ProposalActionType::ModifyMultisigMembership,
DistributeFunds(_) => ProposalActionType::DistributeFunds,
UpdateMinimumWeightForRewards(_) => ProposalActionType::UpdateMinimumWeightForRewards,
AddAttestation(_) => ProposalActionType::AddAttestation,
RemoveAttestation {} => ProposalActionType::RemoveAttestation,
DeployCrossChainTreasury(_) => ProposalActionType::DeployCrossChainTreasury,
}
}
Expand Down Expand Up @@ -889,8 +886,6 @@ fn execute_proposal_actions_submsgs(
}
DistributeFunds(msg) => distribute_funds(ctx, msg)?,
UpdateMinimumWeightForRewards(msg) => update_minimum_weight_for_rewards(ctx, msg)?,
AddAttestation(msg) => add_attestation(ctx, msg)?,
RemoveAttestation {} => remove_attestation(ctx)?,
DeployCrossChainTreasury(msg) => deploy_cross_chain_treasury(ctx, msg)?,
};
submsgs.append(&mut actions)
Expand Down Expand Up @@ -1198,35 +1193,6 @@ fn update_minimum_weight_for_rewards(
Ok(vec![submsg])
}

fn add_attestation(
ctx: &mut Context,
msg: AddAttestationMsg,
) -> GovernanceControllerResult<Vec<SubMsg>> {
let enterprise_contract = ENTERPRISE_CONTRACT.load(ctx.deps.storage)?;

let submsg = SubMsg::new(wasm_execute(
enterprise_contract.to_string(),
&enterprise_protocol::msg::ExecuteMsg::SetAttestation(SetAttestationMsg {
attestation_text: msg.attestation_text,
}),
vec![],
)?);

Ok(vec![submsg])
}

fn remove_attestation(ctx: &mut Context) -> GovernanceControllerResult<Vec<SubMsg>> {
let enterprise_contract = ENTERPRISE_CONTRACT.load(ctx.deps.storage)?;

let submsg = SubMsg::new(wasm_execute(
enterprise_contract.to_string(),
&enterprise_protocol::msg::ExecuteMsg::RemoveAttestation {},
vec![],
)?);

Ok(vec![submsg])
}

fn deploy_cross_chain_treasury(
ctx: &mut Context,
msg: DeployCrossChainTreasuryMsg,
Expand Down
15 changes: 5 additions & 10 deletions contracts/enterprise-governance-controller/src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use cosmwasm_std::{Addr, CosmosMsg, Decimal, Deps, StdError, Uint128};
use cw_asset::{AssetInfo, AssetInfoBase, AssetInfoUnchecked};
use cw_utils::Duration;
use enterprise_governance_controller_api::api::ProposalAction::{
DistributeFunds, ExecuteMsgs, ModifyMultisigMembership, RemoveAttestation,
RequestFundingFromDao, UpdateAssetWhitelist, UpdateCouncil, UpdateGovConfig, UpdateMetadata,
DistributeFunds, ExecuteMsgs, ModifyMultisigMembership, RequestFundingFromDao,
UpdateAssetWhitelist, UpdateCouncil, UpdateGovConfig, UpdateMetadata,
UpdateMinimumWeightForRewards, UpdateNftWhitelist, UpgradeDao,
};
use enterprise_governance_controller_api::api::{
Expand All @@ -30,7 +30,7 @@ use enterprise_protocol::error::DaoError::{
use enterprise_protocol::msg::QueryMsg::DaoInfo;
use std::collections::{HashMap, HashSet};
use GovernanceControllerError::{MinimumDepositNotAllowed, UnsupportedOperationForDaoType};
use ProposalAction::{AddAttestation, ExecuteTreasuryMsgs};
use ProposalAction::ExecuteTreasuryMsgs;

const MAXIMUM_PROPOSAL_ACTIONS: u8 = 10;

Expand Down Expand Up @@ -132,10 +132,7 @@ pub fn validate_proposal_actions(

validate_dao_gov_config(&dao_type, &updated_gov_config)?;
}
UpdateMetadata(_)
| UpdateMinimumWeightForRewards(_)
| AddAttestation(_)
| RemoveAttestation {} => {
UpdateMetadata(_) | UpdateMinimumWeightForRewards(_) => {
// no-op
}
ProposalAction::DeployCrossChainTreasury(_) => {
Expand Down Expand Up @@ -503,8 +500,7 @@ pub fn validate_allowed_council_proposal_types(
| ProposalActionType::ExecuteEnterpriseMsgs
| ProposalActionType::ModifyMultisigMembership
| ProposalActionType::DistributeFunds
| ProposalActionType::UpdateMinimumWeightForRewards
| ProposalActionType::AddAttestation => {
| ProposalActionType::UpdateMinimumWeightForRewards => {
return Err(UnsupportedCouncilProposalAction {
action: action_type,
});
Expand All @@ -513,7 +509,6 @@ pub fn validate_allowed_council_proposal_types(
| ProposalActionType::UpdateAssetWhitelist
| ProposalActionType::UpdateNftWhitelist
| ProposalActionType::UpgradeDao
| ProposalActionType::RemoveAttestation
| ProposalActionType::DeployCrossChainTreasury => {
// allowed proposal action types
}
Expand Down
9 changes: 0 additions & 9 deletions packages/enterprise-governance-controller-api/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ pub enum ProposalActionType {
ModifyMultisigMembership,
DistributeFunds,
UpdateMinimumWeightForRewards,
AddAttestation,
RemoveAttestation,
DeployCrossChainTreasury,
}

Expand All @@ -182,8 +180,6 @@ pub enum ProposalAction {
ModifyMultisigMembership(ModifyMultisigMembershipMsg),
DistributeFunds(DistributeFundsMsg),
UpdateMinimumWeightForRewards(UpdateMinimumWeightForRewardsMsg),
AddAttestation(AddAttestationMsg),
RemoveAttestation {},
DeployCrossChainTreasury(DeployCrossChainTreasuryMsg),
}

Expand Down Expand Up @@ -265,11 +261,6 @@ pub struct UpdateMinimumWeightForRewardsMsg {
pub minimum_weight_for_rewards: Uint128,
}

#[cw_serde]
pub struct AddAttestationMsg {
pub attestation_text: String,
}

#[cw_serde]
pub struct CastVoteMsg {
pub proposal_id: ProposalId,
Expand Down

0 comments on commit 3be5b87

Please sign in to comment.