> 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/administrative-functions.md).

# Administrative Functions

## Technical Reference: Founder Administrative Functions

Founder Account: An account assigned to manage technical infrastructure upgrades, contract linking, and system configuration. This account holds no access rights to member assets. The administrative functions serve as operational tools for initial system bootstrapping, configuring informational endpoints, and connecting ecosystem components (such as tokens and NFTs).

Operational Parameter: These functions do not modify user assets, purchased packages, or the binary network structure of promoters. Critical financial variables, such as the central vault address, are locked following their initial configuration. Subsequent modifications are executed through community voting mechanisms. The objective of these functions is to maintain and configure the technical infrastructure of the educational platform.

### 1. Central Bank Configuration (`setGlobalBank`)

Function Signature: `function setGlobalBank(address X) external onlyFounder`

#### 💡 Logic and Application

This function connects the primary payment contract to the central treasury contract (`SmartGlobalBank`). Executing this function initializes the protocol's financial flow to route the 9% sales revenue allocation. The central bank connection can only be executed once; the variable is subsequently locked.

#### 🧮 System State Change

\[ The `smartBank` variable address updates to address `X` ] \[ The `isBankSet` boolean updates from `False` to `True` ]

#### 🛡️ Execution Conditions and Restrictions

* Administrative Authentication: The caller must be the founder address (`require(_msgSender() == founder)`).
* One-Time Lock: This function must not have been previously executed; the `isBankSet` variable must evaluate to `False` (`require(isBankSet == false, "Just 1 Time")`).

### 2. Native Ecosystem Token Configuration (`setGlobalToken`)

Function Signature: `function setGlobalToken(address _token) external onlyFounder`

#### 💡 Logic and Application

This function registers the official address of the native ecosystem token (`SmartGlobalToken - SGT`) to the network contract. This address is utilized for system queries across decentralized platforms.

#### 🧮 System State Change

\[ The `globalTokenAddress` variable updates to the specified address (`_token`) ]

#### 🛡️ Execution Conditions and Restrictions

* Administrative Authentication: The caller must be the founder address (`onlyFounder`).

### 3. Ecosystem NFT Contract Configuration (`setGlobalNft`)

Function Signature: `function setGlobalNft(address X) external onlyFounder`

#### 💡 Logic and Application

This function registers the official address of the ecosystem's Non-Fungible Token (NFT) contract within the network structure for future utilities and reward mechanisms.

#### 🧮 System State Change

\[ The `globalNftAddress` variable updates to the specified address (`X`) ]

#### 🛡️ Execution Conditions and Restrictions

* Administrative Authentication: The caller must be the founder address (`onlyFounder`).

### 4. Intermediary Contract Access Management (`setContractAccess`)

Function Signature: `function setContractAccess(address _contract, bool _status) external onlyFounder`

#### 💡 Logic and Application

To manage network computational privacy, reading owner data and binary network structures (functions protected by the `onlyAllowedViewer` modifier) is restricted from external smart contracts. The founder uses this function to grant or revoke whitelist access for ecosystem contracts (such as the bank or fee treasury) to query network data.

#### 🧮 System State Change

\[ The access status of the specified contract address within the `authorizedContracts` mapping updates to `True` or `False` ]

#### 🛡️ Execution Conditions and Restrictions

* Administrative Authentication: The caller must be the founder address (`onlyFounder`).

### 5. Legal Agreement Text Configuration (`setAgreementText`)

Function Signature: `function setAgreementText(string memory _text) external onlyFounder`

#### 💡 Logic and Application

This function records the legal agreement and operating terms of the ecosystem onto the blockchain. Users accept this text via the `agreeToStart` function prior to registration. This text can only be set once by the founder, after which it becomes immutable.

#### 🧮 System State Change

\[ The `agreementTextString` variable updates to the submitted text ] \[ The `isAgreementTextSet` boolean updates to `True` ]

#### 🛡️ Execution Conditions and Restrictions

* Administrative Authentication: The caller must be the founder address (`onlyFounder`).
* One-Time Lock: The `isAgreementTextSet` variable must evaluate to `False` (`require(isAgreementTextSet == false, "Text Already Set")`).

### 6. Information Setters

Function Signatures: `function setFounderMessage(string memory _message) external onlyFounder` `function setGlobalRoadmap(string memory _roadmap) external onlyFounder` `function setGlobalWebsite(string memory _website) external onlyFounder`

#### 💡 Logic and Application

These functions record and update informational data, including the Founder Message, Project Roadmap, and Official Website URL, within the contract database. Decentralized applications (DApps) query these variables to display the data.

#### 🧮 System State Change

\[ The `founderMessageString`, `projectRoadmapString`, and `globalWebsiteString` variables are replaced with the submitted data ]

#### 🛡️ Execution Conditions and Restrictions

* Administrative Authentication: The caller must be the founder address (`onlyFounder`).

### 7. Migration Source Contract Configuration (`setSourceContract`)

Function Signature: `function setSourceContract(address _sourceContract) external onlyFounder`

#### 💡 Logic and Application

This function establishes the infrastructure for migrating nodes from the V1 network to the upgraded V2 network. It registers the legacy contract address (`sourceContract`), enabling import functions to read member data from the old contract's storage.

#### 🧮 System State Change

\[ The `sourceContract` address variable updates to the V1 contract address ]

#### 🛡️ Execution Conditions and Restrictions

* Administrative Authentication: The caller must be the founder address (`onlyFounder`).

### 8. Single Node Migration (`importOne`)

Function Signature: `function importOne(address ownerAddress) external onlyFounder`

#### 💡 Logic and Application

This function migrates the structural data of a specific node from the V1 contract into the V2 binary structure. It reads node records (user ID, left and right point volume, referrer linkage, and downline connections) from the source contract and registers them in the new network. *Structural Note:* The first address imported via this function is registered as the system's starting wallet (`startWallet`).

#### 🧮 System State Change

\[ Retrieve the `NodeData` structure from the `sourceContract` ] \[ Generate a new ID and allocate a node within the `owners` mapping in the V2 network ] \[ Calculate and register the 7, 20, 100, and 300 milestone ranks for the migrated address ]

#### 🛡️ Execution Conditions and Restrictions

* Administrative Authentication: The caller must be the founder address (`onlyFounder`).
* Source Contract Existence: The `sourceContract` address must be configured (`sourceContract != address(0)`).
* No Duplicate Migration: The target address must not already be migrated (`!ownerExists(ownerAddress)`).
* V1 Node Authenticity: The user ID of the target address within the source contract must not be zero.
* Linkage Integrity Validation: If `startWallet` exists, the user's referrer address must already be imported. The target address must be recorded in the legacy network as the direct left or right downline of that referrer.

### 9. Batch Node Migration (`importFast`)

Function Signature: `function importFast(address[] calldata users) external onlyFounder`

#### 💡 Logic and Application

This function acts as a batch processing tool for network migration. It accepts an array of owner addresses, bypasses addresses that are already migrated or whose referrers have not been imported, and migrates the remaining valid nodes from V1 to V2.

#### 🧮 System State Change

\[ Iterate through the submitted array and read data for each address from the V1 source ] \[ Register valid owners within the V2 database and assign sequential IDs ]

#### 🛡️ Execution Conditions and Restrictions

* Administrative Authentication: The caller must be the founder address (`onlyFounder`).
* Source Contract Existence: The `sourceContract` address must be configured.
* Loop Validation Filtering: If an address is already registered in the new system, the transaction skips to processing the next address in the array without reverting.
