var img = document.createElement('img'); img.src = "https://terradocs.matomo.cloud//piwik.php?idsite=4&rec=1&url=https://docs.enterprise.money" + location.pathname; img.style = "border:0"; img.alt = "tracker"; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(img,s);
Skip to main content

Messages

This page outlines important messages for Enterprise smart contracts. For more information on DAO creation, visit Creating a DAO.

📝Message templates

To learn how to write messages for governance proposals, visit the Message templates section.

InstantiateMsg​

The InstantiateMsg contains all the necessary info for creating a DAO, including the DAO metadata, governance config, creation contract address, membership info, and whitelists.

Rust
Copy

_8
struct InstantiateMsg {
_8
pub dao_metadata: DaoMetadata,
_8
pub dao_gov_config: DaoGovConfig,
_8
pub dao_membership_info: DaoMembershipInfo,
_8
pub enterprise_factory_contract: String,
_8
pub asset_whitelist: Option<Vec<AssetInfo>>,
_8
pub nft_whitelist: Option<Vec<Addr>>,
_8
}

The enterprise_factory_contract field refers to the address of the enterprise-factory contract that is creating the DAO.

Rust
Copy

_8
struct InstantiateMsg {
_8
pub dao_metadata: DaoMetadata,
_8
pub dao_gov_config: DaoGovConfig,
_8
pub dao_membership_info: DaoMembershipInfo,
_8
pub enterprise_factory_contract: String,
_8
pub asset_whitelist: Option<Vec<AssetInfo>>,
_8
pub nft_whitelist: Option<Vec<Addr>>,
_8
}

asset_whitelist​

Token assets that are allowed to show in DAO’s treasury. A whitelist helps prevent spam by users creating and sending random tokens to the DAO.

Rust
Copy

_8
struct InstantiateMsg {
_8
pub dao_metadata: DaoMetadata,
_8
pub dao_gov_config: DaoGovConfig,
_8
pub dao_membership_info: DaoMembershipInfo,
_8
pub enterprise_factory_contract: String,
_8
pub asset_whitelist: Option<Vec<AssetInfo>>,
_8
pub nft_whitelist: Option<Vec<Addr>>,
_8
}

nft_whitelist​

The NFT assets that are allowed to be shown in DAO’s treasury.

Rust
Copy

_8
struct InstantiateMsg {
_8
pub dao_metadata: DaoMetadata,
_8
pub dao_gov_config: DaoGovConfig,
_8
pub dao_membership_info: DaoMembershipInfo,
_8
pub enterprise_factory_contract: String,
_8
pub asset_whitelist: Option<Vec<AssetInfo>>,
_8
pub nft_whitelist: Option<Vec<Addr>>,
_8
}

The InstantiateMsg contains all the necessary info for creating a DAO, including the DAO metadata, governance config, creation contract address, membership info, and whitelists.

The enterprise_factory_contract field refers to the address of the enterprise-factory contract that is creating the DAO.

asset_whitelist​

Token assets that are allowed to show in DAO’s treasury. A whitelist helps prevent spam by users creating and sending random tokens to the DAO.

nft_whitelist​

The NFT assets that are allowed to be shown in DAO’s treasury.

Rust
CopyExpandClose

_8
struct InstantiateMsg {
_8
pub dao_metadata: DaoMetadata,
_8
pub dao_gov_config: DaoGovConfig,
_8
pub dao_membership_info: DaoMembershipInfo,
_8
pub enterprise_factory_contract: String,
_8
pub asset_whitelist: Option<Vec<AssetInfo>>,
_8
pub nft_whitelist: Option<Vec<Addr>>,
_8
}

Execute messages​

The following section outlines the Enterprise's various execute messages.

Rust
Copy

_9
enum ExecuteMsg {
_9
CreateProposal(CreateProposalMsg),
_9
CastVote(CastVoteMsg),
_9
ExecuteProposal(ExecuteProposalMsg),
_9
Unstake(UnstakeMsg),
_9
Claim {},
_9
ReceiveCw20(Cw20ReceiveMsg),
_9
ReceiveCw721(Cw721ReceiveMsg),
_9
}

CreateProposalMsg​

This message creates a proposal using a title, description, and the proposal_actions. If a proposal passes, actions are executed in the order received.

Rust
Copy

_5
struct CreateProposalMsg {
_5
pub title: String,
_5
pub description: Option<String>,
_5
pub proposal_actions: Vec<ProposalAction>,
_5
}

CastVoteMsg​

Used to cast a vote for a proposal in the voting period using a proposal id and an outcome. The possible choices are:

  • Yes: in favor
  • No: not in favor
  • Abstain: a vote that counts toward meeting quorum, but is neither for nor against.
  • Veto: vetoes the proposal.
Rust
Copy

_11
struct CastVoteMsg {
_11
pub proposal_id: ProposalId,
_11
pub outcome: DefaultVoteOption,
_11
}
_11
_11
enum DefaultVoteOption {
_11
Yes = 0,
_11
No = 1,
_11
Abstain = 2,
_11
Veto = 3,
_11
}

ExecuteProposalMsg​

Used to execute a passed proposal.

Rust
Copy

_3
struct ExecuteProposalMsg {
_3
pub proposal_id: ProposalId,
_3
}

UnstakeMsg​

Used to unstake tokens or an NFT from governance staking. Users will have to claim their unstaked assets after the unstaking period ends.

Rust
Copy

_14
enum UnstakeMsg {
_14
Cw20(UnstakeCw20Msg),
_14
Cw721(UnstakeCw721Msg),
_14
}
_14
_14
struct UnstakeCw20Msg {
_14
pub amount: Uint128,
_14
}
_14
_14
struct UnstakeCw721Msg {
_14
pub tokens: Vec<NftTokenId>,
_14
}
_14
_14
type NftTokenId = String;

Claim​

Claims all assets available to the sender after they have unstaked and the unlocking period has passed.

Rust
Copy

_9
pub enum ExecuteMsg {
_9
CreateProposal(CreateProposalMsg),
_9
CastVote(CastVoteMsg),
_9
ExecuteProposal(ExecuteProposalMsg),
_9
Unstake(UnstakeMsg),
_9
Claim {},
_9
Receive(Cw20ReceiveMsg),
_9
ReceiveNft(Cw721ReceiveMsg),
_9
}

Hooks​

These hook messages are used for receiving CW20 tokens and CW721 NFTs that are going to be staked.

Rust
Copy

_7
enum Cw20HookMsg {
_7
Stake {},
_7
}
_7
_7
enum Cw721HookMsg {
_7
Stake {},
_7
}

The following section outlines the Enterprise's various execute messages.

CreateProposalMsg​

This message creates a proposal using a title, description, and the proposal_actions. If a proposal passes, actions are executed in the order received.

CastVoteMsg​

Used to cast a vote for a proposal in the voting period using a proposal id and an outcome. The possible choices are:

  • Yes: in favor
  • No: not in favor
  • Abstain: a vote that counts toward meeting quorum, but is neither for nor against.
  • Veto: vetoes the proposal.

ExecuteProposalMsg​

Used to execute a passed proposal.

UnstakeMsg​

Used to unstake tokens or an NFT from governance staking. Users will have to claim their unstaked assets after the unstaking period ends.

Claim​

Claims all assets available to the sender after they have unstaked and the unlocking period has passed.

Hooks​

These hook messages are used for receiving CW20 tokens and CW721 NFTs that are going to be staked.

Rust
CopyExpandClose

_9
enum ExecuteMsg {
_9
CreateProposal(CreateProposalMsg),
_9
CastVote(CastVoteMsg),
_9
ExecuteProposal(ExecuteProposalMsg),
_9
Unstake(UnstakeMsg),
_9
Claim {},
_9
ReceiveCw20(Cw20ReceiveMsg),
_9
ReceiveCw721(Cw721ReceiveMsg),
_9
}