Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v1 source realm

Package community\_pool manages the GnoSwap community treasury.

Readme View source

Community Pool

GnoSwap community treasury for ecosystem development.

Overview

The community pool holds registered protocol-owned tokens. The emission system routes its configured community-pool share to this address, while other protocol flows may fund it separately. This package exposes a direct, access-controlled transfer operation; it does not store proposal or voting state.

Configuration

  • Emission Allocation: 5% of GNS emissions (default)
  • Transfer Authorization: TransferToken accepts an admin or governance caller while withdrawals are not halted
  • Token Scope: Transfers use registered token paths and the community-pool balance

External governance and transfers

  • Proposal and voting workflows, if used, are implemented by an external governance process.
  • An approved external execution may call TransferToken, but the package itself performs no proposal validation or automatic execution.
  • Successful transfers emit a TransferToken event.

Emergency admin policy

Governance is the recommended normal route for treasury transfers. While governance is not yet mature, admin authorization is retained for emergency-only use.

This restriction is an operational policy, not an on-chain emergency check. The admin can call TransferToken directly without an approved governance proposal. The contract does not verify an emergency or automatically remove admin access when governance matures. Withdrawal-halt and token-transfer checks still apply; emergency admin access does not bypass them.

Key Functions

TransferToken

Directly transfers a registered token to a specified address. The caller must be admin or governance, withdrawals must not be halted, and the normal token transfer validation applies.

Gnoweb

Render("") shows the admin and governance role addresses and the withdrawal halt checked by TransferToken. It does not enumerate token balances or claim a total treasury value. Query a specific registered token with GetBalanceOf(tokenPath). Unsupported paths return 404.

Usage

1// Governance execution, or emergency admin action under the operational policy
2TransferToken(
3    cross(cur),
4    "gno.land/r/gnoswap/gns.GNS",
5    recipientAddr,
6    1000000,
7)

Security

  • Admin-or-governance authorization is required for transfers
  • Withdrawal halt blocks transfers
  • Registered-token and balance validation is enforced by the transfer helper
  • Proposal/voting state is not implemented in this package
  • Event emission provides transfer traceability
  • Multi-token support

Overview

Package community_pool manages the GnoSwap community treasury.

This contract holds registered protocol-owned assets. The emission system routes its configured community-pool share here, and external governance may use proposal execution to authorize a spend. Proposal and voting state are outside this package: TransferToken is a direct admin-or-governance entry point subject to the withdrawal halt and token-transfer validation.

Governance is the recommended normal route. While governance is not yet mature, admin access is retained for emergency-only use as an operational policy. The contract does not verify an emergency or require proposal approval for admin calls, and admin access does not expire automatically.

Functions 3

func GetBalanceOf

Action
1func GetBalanceOf(tokenPath string) (int64, error)
source

GetBalanceOf returns the community pool's balance for a registered token.

Parameters:

  • tokenPath: registry key/path of the token contract whose balance is queried

Returns:

  • balance: token units held by the configured community-pool address, or 0 when validation fails
  • err: nil when tokenPath is valid and registered; non-nil for an invalid or unregistered tokenPath

func Render

1func Render(path string) string
source

Render shows the authorities and withdrawal gate used by treasury transfers.

func TransferToken

crossing Action
1func TransferToken(cur realm, tokenPath string, to address, amount int64)
source

TransferToken transfers token units from the community pool to an address.

Parameters:

  • cur: current realm context; callers use cross(cur) when crossing into this realm
  • tokenPath: registry key/path of the registered token to transfer
  • to: recipient address for the token units
  • amount: number of token units to transfer; transfer failure panics through the safe wrapper

Only callable by admin or governance while withdrawals are not halted. Governance is the recommended normal route. While governance is not yet mature, admin access is retained for emergency-only use as an operational policy, not a contract-enforced condition. Admin calls do not require an approved proposal; emergency status is not checked and admin access does not expire automatically.

Imports 9

Source Files 5