> For the complete documentation index, see [llms.txt](https://smart-global.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://smart-global.gitbook.io/docs/smart-contracts/fee-contract/governance-functions.md).

# Governance Functions

## Technical Reference: DAO & Governance Functions

The `FeeContract` treasury utilizes a democratic governance cycle managed by members of the 300-point club for budget allocations (development, marketing, server support) and connected contract updates. The contract contains no direct administrative withdrawal functions for USDT or tokens; all financial disbursements require community ratification.

### 1. Governance Proposal Initiation Function (`startProposal`)

Function Signature: `function startProposal(uint8 pType, address target, uint256 amount) external onlyOwner`

#### 💡 Systemic Logic and Application

This function initiates the decision-making cycle within the governance fund. To allocate a budget or upgrade system infrastructure, the founder submits a proposal on the blockchain defining three core parameters:

* `pType`: Proposed action type (`0` = USDT Transfer, `1` = Native `SGT` Token Transfer, `2` = Linked Payment Contract Upgrade).
* `target`: Destination wallet address or the new contract address.
* `amount`: Required USDT or token volume to be transferred (applicable for types `0` and `1`).

#### 🧮 System State Change and Snapshot Registration

Upon creation, the system queries and records a snapshot of eligible members to establish the voting threshold: \[ Increments proposal round number: `round++` ] \[ Registers target address (`target`), proposal type (`pType`), and requested volume (`amount`) ] \[ Queries and records a snapshot of total 300-point club members: `snapshot300` ] \[ Resets vote counters and activates proposal: `votes = 0` and `isActive = True` ]

#### 🛡️ Execution Conditions and Restrictions

* Administrative Authentication: The caller must be the contract owner (`onlyOwner`).
* No Active Proposal Conflict: Only one proposal can be active at a time (`require(!_currentProposal.isActive)`).
* Address Validation: The target address must not evaluate to the zero address, and the payment gateway contract must be configured.
* Token Connection Condition: For a native token transfer (Type 1), the token contract must be actively linked to the treasury.
* Active Governance Community Condition: At least 1 eligible member must be present in the 300-point club (`require(count300 > 0)`).

### 2. Eligible Member Vote Registration Function (`vote`)

Function Signature: `function vote() external`

#### 💡 Systemic Logic and Application

This function registers affirmative votes to ratify the active proposal. Network users who have achieved a cumulative total of at least 300 sales points can invoke this function to participate in the financial decision.

#### 🧮 System State Change

\[ Registers the user's affirmative vote for the current round: `_hasVoted[round][user] = True` ] \[ Increments total affirmative vote counter: `votes++` ]

#### 🛡️ Execution Conditions and Restrictions

* Active Proposal Existence: The system must hold an actively running proposal (`require(_currentProposal.isActive)`).
* Point Qualification: The caller must hold at least 300 binary points (`require(points >= 300)`).
* No Duplicate Voting: Each wallet address holds exactly 1 voting right per voting cycle (`round`).

### 3. Resolution Final Execution Function (`executeProposal`)

Function Signature: `function executeProposal() external nonReentrant`

#### 💡 Systemic Logic and Application

When affirmative votes surpass the required threshold, any network user can invoke this function to execute the resolution on the blockchain.

#### 🧮 Ratification Threshold and Execution

\[ Legal Ratification Threshold ]: Affirmative Votes (`votes`) > (`snapshot300` / 2) Upon surpassing the threshold, the contract automatically executes one of the following actions based on `pType`:

* 🟢 Type 0 (TransferUSDT): The requested USDT volume (`amount`) is transferred to the destination wallet using the `safeTransfer` method.
* 🟣 Type 1 (TransferToken): The requested native `SGT` token volume (`amount`) is deposited to the destination wallet.
* 🔵 Type 2 (UpdateNetwork): The linked payment gateway contract address (`globalPayAddress`) is upgraded to the new address. \[ Deactivates proposal following execution: `isActive = False` ]

#### 🛡️ Execution Conditions and Restrictions

* Reentrancy Protection: Secured by the `nonReentrant` modifier to prevent reentrancy attacks during asset withdrawal.
* Active Proposal State: The proposal must be actively running.
* Absolute Majority: Total affirmative votes must strictly exceed 50% of all 300-point members recorded in the snapshot (`require(votes > snapshot300 / 2)`).

### 4. Active Proposal Reset Function (`resetProposal`)

Function Signature: `function resetProposal() external onlyOwner`

#### 💡 Systemic Logic and Application

If a proposal fails to reach quorum due to insufficient member participation, or if configuration errors occur in the destination address or volume, the founder can invoke this function to deactivate the active proposal. This reopens the pathway to submit new proposals.

#### 🧮 System State Change

\[ Active proposal status updates to deactivated: `isActive = False` ]

#### 🛡️ Execution Conditions and Restrictions

* Administrative Authentication: The caller must be the contract owner (`onlyOwner`).
