Sputnik DAO smart contracts analysis: Core design and implementation of the proposal mechanism

robot
Abstract generation in progress

Rust smart contracts Development Diary (11) - Detailed Explanation of Sputnik DAO Proposal Mechanism

Sputnik-DAO, as an important infrastructure of the NEAR Protocol, is driving the NEAR ecosystem towards decentralization. Currently, the platform has facilitated the establishment of decentralized autonomous communities for multiple NEAR projects and provided a complete and flexible community decision-making governance solution.

Sputnikdaov2 is a smart contract used for governance voting in the Sputnik-DAO community. This article will introduce the core concepts of the contract: proposal (Proposal), and subsequent articles will discuss related DAO community governance models (Policy).

1. Proposal Initiation

Members of the Sputnik-DAO community can express opinions or submit proposals regarding project governance or management. Each stakeholder member can review and vote on proposals, thereby influencing the future direction of the project.

At the contract level, members can call the sputnikdaov2 contract's add_proposal() method to initiate a new proposal:

rust pub fn add_proposal(\u0026mut self, proposal: ProposalInput) -\u003e u64

Proposers need to provide the following details:

  • Proposal text description ( Description )
  • Proposal type ( kind )

This information will be passed as parameters to the add_proposal() method, processed to generate a complete proposal(Proposal), and bound to the unique proposal_id, adding it to the proposal pool maintained globally by the contract.

The complete proposal attributes include: proposer, status, initiation time, voting status, etc.

It is important to note that Sputnik-DAO requires proposers to stake a certain amount of NEAR tokens as collateral. This deposit will be refunded to the proposer at the normal conclusion of the proposal.

2. Proposal Status

Proposals in Sputnik-DAO may undergo various states, with the initial state being InProgress. The state changes are driven by the act_proposal() method.

Members can call act_proposal() to perform the following actions on the proposal:

  • VoteApprove: indicates approval
  • VoteReject: indicates opposition
  • VoteRemove: believes the proposal is meaningless and needs to be removed

After voting, the contract will call policy.proposal_status() to count the votes, and the proposal status that meets the conditions will change accordingly.

  • Proposals in Approved status will be executed.
  • Proposals with Rejected or Removed status will execute wrap-up operations.

Proposals with a Removed status will be directly removed from the proposal pool, and the deposit will not be refunded. Proposals with a Rejected status will remain in the pool and the deposit will be refunded.

3. Proposal Execution

The proposal in Approved status will call the internal_execute_proposal() function to execute the decision content.

Sputnik-DAO supports multiple types of proposals. This article focuses on two typical types:

3.1 Contract Function Execution Proposal

FunctionCall type proposals can execute specified contract methods. The proposer passes the function operation to be executed (actions) through ProposalInput during creation.

Each action can specify the contract method name and parameters. Sputnik-DAO uses Promise Batch Actions to complete function execution.

3.2 Contract Fund Transfer Proposal

Transfer type proposals can transfer the tokens accumulated in the contract account, (NEAR or NEP-141 standard tokens, ), to a specified account.

internal_execute_proposal() will call the internal_payout() function to perform transfer operations for different types of tokens and receiving accounts.

4. Summary

This article introduces the core concept proposal of the Sputnik DAO smart contracts (Proposal), including the creation, voting, status changes, and execution process of the proposal. Subsequent articles will detail the governance model of the Sputnik-DAO based on the proposal (Policy) implementation and configuration.

ACT4.67%
BATCH-0.44%
View Original
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
  • Reward
  • 4
  • Repost
  • Share
Comment
0/400
WhaleWatchervip
· 7h ago
I understand voting governance; it's all about vote manipulation.
View OriginalReply0
airdrop_whisperervip
· 08-09 16:00
The near community is becoming more attractive.
View OriginalReply0
OnchainUndercovervip
· 08-09 06:55
near is a new sucker, BTC please do not disturb
View OriginalReply0
OnChainArchaeologistvip
· 08-09 06:32
near is still rolling.
View OriginalReply0
Trade Crypto Anywhere Anytime
qrCode
Scan to download Gate app
Community
English
  • 简体中文
  • English
  • Tiếng Việt
  • 繁體中文
  • Español
  • Русский
  • Français (Afrique)
  • Português (Portugal)
  • Bahasa Indonesia
  • 日本語
  • بالعربية
  • Українська
  • Português (Brasil)