> 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/smart-global-pay/governance-functions.md).

# Governance Functions

## Technical Reference: Governance Functions

The governance section of the `SmartGlobalPay` contract enables decentralized decision-making regarding the connection management of the central treasury. Voting rights within this protocol are not financial assets; they are allocated strictly based on network expansion metrics, specifically achieving milestone point ranks within the binary tree.

### 1. Governance Vote Registration Function (`vote`)

Function Signature: `function vote() external`

#### 💡 Logic and Application

This function enables eligible network members to register a formal vote to reset the central bank contract address connection. Users must have achieved the 100-point rank in their activity history to invoke this function. This mechanism is utilized for scenarios requiring a treasury upgrade or network address modification.

#### 🧮 System State Change

Invoking this function consumes the user's voting right for the current round and updates the vote counter: \[ Total votes for the current round (`voteTotal`) increments by one unit: `voteTotal++` ] \[ The `hasVoted` boolean state for the calling address updates to `True` for the current round ]

#### 🛡️ Execution Conditions and Restrictions

* Owner Authentication: The caller (`msg.sender`) must be actively registered as an owner within the ecosystem (`ownerExists`).
* Qualification: The historical accumulated points earned by the user (`ownerAllPoint`) must be at least 100 points (`require(ownerAllPoint >= 100)`).
* No Duplicate Voting: The user must not have already voted in the current voting cycle (`votingRound`). Each eligible address holds exactly one voting right per round (`require(hasVoted == false)`).

### 2. Resolution Execution Function (`executeVote`)

Function Signature: `function executeVote() external`

#### 💡 Logic and Application

If the affirmative votes registered via the `vote` function reach the specified threshold, an eligible member can invoke this function to execute the resolution on the blockchain. Successful execution terminates the current bank address connection, enabling the configuration of a new bank via the `setGlobalBank` function.

#### 🧮 Majority Threshold Formula and State Change

Execution requires passing a threshold of over 50% (majority): \[ Required Threshold ] : Affirmative Votes (`voteTotal`) > ( Total 100-Point Rank Users ÷ 2 )

If the threshold is achieved, the following state changes are applied: \[ The bank connection variable (`isBankSet`) updates to `False` ] \[ The vote counter (`voteTotal`) resets to zero ] \[ The voting round number (`votingRound`) increments by one unit: `votingRound++` ]

#### 🛡️ Execution Conditions and Restrictions

* Owner Authentication: The caller must be registered as an owner within the protocol.
* Caller Qualification: The caller executing the function must hold at least 100 historical points.
* Eligible Community Existence: The total number of 100-point users across the network (`count_100_Point_Users`) must be greater than zero.
* Majority Threshold: The registered affirmative votes (`voteTotal`) must strictly exceed half of all eligible users (`require(voteTotal > totalEligible / 2)`).
