Transaction

B4799AEADAE6FE…5BD8A04952F1

Block 77,259 · index 0 · indexed

Summary

Hash
B4799AEADAE6FEF9FA7B40993103659F719D5ED539602ADE04115BD8A04952F1
Block
77,259
Size
7382 bytes
Gas used
11,344,564 / 13,613,441
Fee
13614ugnot
Status
success

Messages

#1AddPackagegno.land/r/gnoswap/community_pool/v113 arguments

Arguments · 13

  1. #1community_pool
  2. #2README.md
  3. #3# 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 ```go // Governance execution, or emergency admin action under the operational policy TransferToken( cross(cur), "gno.land/r/gnoswap/gns.GNS", recipientAddr, 1000000, ) ``` ## 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
  4. #4community_pool.gno
  5. #5package community_pool import ( "chain" "strconv" prbac "gno.land/p/gnoswap/rbac/v1" "gno.land/r/gnoswap/access/v1" "gno.land/r/gnoswap/common" "gno.land/r/gnoswap/halt/v1" ) // 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 GetBalanceOf(tokenPath string) (int64, error) { communityPoolAddr := access.MustGetAddress(prbac.ROLE_COMMUNITY_POOL.String()) if err := common.IsRegistered(tokenPath); err != nil { return 0, err } return common.BalanceOf(tokenPath, communityPoolAddr), nil } // 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. func TransferToken(cur realm, tokenPath string, to address, amount int64) { halt.AssertIsNotHaltedWithdraw() prevRealm := cur.Previous() caller := prevRealm.Address() access.AssertIsAdminOrGovernance(caller) common.SafeGRC20Transfer(0, cur, tokenPath, to, amount) chain.Emit( "TransferToken", "prevAddr", caller.String(), "prevRealm", prevRealm.PkgPath(), "tokenPath", tokenPath, "to", to.String(), "amount", strconv.FormatInt(amount, 10), ) }
  6. #6doc.gno
  7. #7// 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. package community_pool
  8. #8gnomod.toml
  9. #9module = "gno.land/r/gnoswap/community_pool/v1" gno = "0.9"
  10. #10render.gno
  11. #11package community_pool import ( prbac "gno.land/p/gnoswap/rbac/v1" "gno.land/p/moul/md/v0" "gno.land/p/moul/mdtable/v0" ufmt "gno.land/p/nt/ufmt/v0" "gno.land/r/gnoswap/access/v1" "gno.land/r/gnoswap/halt/v1" ) // Render shows the authorities and withdrawal gate used by treasury transfers. func Render(path string) string { if path != "" { return "404\n" } out := md.H1("Gnoswap Community Pool") + "\n" + md.Paragraph( "The community treasury holds tokens for ecosystem funding.\n"+ "Balances are queried per token; this page does not report a total treasury value.", ) + md.H2("Transfers") + "\n" + md.Paragraph("Transfers require the admin or governance role and are blocked when withdrawals are halted.") statusTable := mdtable.Table{ Headers: []string{"Restriction", "Enabled"}, Rows: [][]string{ {"Withdrawals halted", ufmt.Sprintf("%t", halt.IsHaltedWithdraw())}, }, } out += statusTable.String() + "\n" out += md.H2("Transfer authorities") + "\n" authorityTable := mdtable.Table{ Headers: []string{"Role", "Address"}, } for _, role := range []prbac.SystemRole{prbac.ROLE_ADMIN, prbac.ROLE_GOVERNANCE} { value := "Unassigned" if addr, ok := access.GetAddress(role.String()); ok { value = md.InlineCode(addr.String()) } authorityTable.Append([]string{role.String(), value}) } return out + authorityTable.String() }
  12. #12/gno.MemPackageType
  13. #13 MPUserAll

Result log

msg:0,success:true,log:,events:[]

← Back to block 77,259