PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/r/gnoswap/gov/governance/v1

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
v1
Namespace
gnoswap / gov / governance
Files
23 (README)(gnomod.toml)
Exported functions
n/a — Gnoland RPC unavailable (functions): rpc abci_query: HTTP 500
Module
gno.land/r/gnoswap/gov/governance/v1
gno
0.9

Files (23)

  • README.mdmarkdown
  • gnomod.tomltoml
  • assert.gnogno
  • config.gnogno
  • consts.gnogno
  • doc.gnogno
  • errors.gnogno
  • getter_utils.gnogno
  • getter.gnogno
  • governance_execute.gnogno
  • governance_propose.gnogno
  • governance_vote.gnogno
  • init.gnogno
  • instance.gnogno
  • parameter_registry.gnogno
  • proposal_action_status.gnogno
  • proposal_data.gnogno
  • proposal_schedule_status.gnogno
  • proposal_status.gnogno
  • proposal_vote_status.gnogno
  • proposal.gnogno
  • render.gnogno
  • utils.gnogno
  • config.gnogno
    1package governance23import (4	"chain"5	"time"67	"gno.land/p/gnoswap/utils/v1"8

    Functions

    Gnoland RPC unavailable (functions): rpc abci_query: HTTP 500

    Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.

    Rendered

    RenderedRawgnoweb ↗
    This realm does not provide renderable output (vm/qrender → NoRenderDeclError). View on gnoweb ↗

    vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.

    9 "gno.land/r/gnoswap/access/v1"
    10 en "gno.land/r/gnoswap/emission"
    11 "gno.land/r/gnoswap/halt/v1"
    12
    13 "gno.land/r/gnoswap/gov/governance"
    14)
    15
    16// makeConfig creates a new governance configuration.
    17func makeConfig(
    18 votingStartDelay int64,
    19 votingPeriod int64,
    20 votingWeightSmoothingDuration int64,
    21 quorum int64,
    22 proposalCreationThreshold int64,
    23 executionDelay int64,
    24 executionWindow int64,
    25) governance.Config {
    26 // Create new configuration with provided parameters. Constructed via the
    27 // domain constructor so the Config value is allocated inside the governance
    28 // domain realm (satisfies the realm allocation check).
    29 return governance.NewConfig(
    30 votingStartDelay,
    31 votingPeriod,
    32 votingWeightSmoothingDuration,
    33 quorum,
    34 proposalCreationThreshold,
    35 executionDelay,
    36 executionWindow,
    37 )
    38}
    39
    40// Reconfigure updates governance configuration.
    41// Only admin or governance contract can call this function.
    42// Updates all governance parameters and emits a "Reconfigure" event.
    43//
    44// Parameters:
    45// - _: Noncrossing implementation-call discriminator; pass 0.
    46// - rlm: Current realm context forwarded unchanged by the governance proxy; validated before external calls.
    47// - votingStartDelay: delay in seconds from proposal creation until voting starts
    48// - votingPeriod: duration in seconds for which voting remains open
    49// - votingWeightSmoothingDuration: duration in seconds used to smooth voting weight snapshots
    50// - quorum: quorum percentage applied to the proposal's quorum-weight base
    51// - proposalCreationThreshold: minimum voting weight required to create a proposal
    52// - executionDelay: delay in seconds from voting end until execution becomes available
    53// - executionWindow: duration in seconds during which an executable proposal may run
    54//
    55// Returns:
    56// - int64: newly stored governance configuration version
    57func (gv *governanceV1) Reconfigure(
    58 _ int, rlm realm,
    59 votingStartDelay int64,
    60 votingPeriod int64,
    61 votingWeightSmoothingDuration int64,
    62 quorum int64,
    63 proposalCreationThreshold int64,
    64 executionDelay int64,
    65 executionWindow int64,
    66) int64 {
    67 access.AssertIsRlmCurrent(0, rlm)
    68
    69 // Check if system is halted before proceeding
    70 halt.AssertIsNotHaltedGovernance()
    71
    72 prev := rlm.Previous()
    73 caller := prev.Address()
    74 access.AssertIsAdminOrGovernance(caller)
    75
    76 assertIsValidSmoothingPeriod(votingWeightSmoothingDuration)
    77
    78 // Create and validate new configuration
    79 newCfg := makeConfig(
    80 votingStartDelay,
    81 votingPeriod,
    82 votingWeightSmoothingDuration,
    83 quorum,
    84 proposalCreationThreshold,
    85 executionDelay,
    86 executionWindow,
    87 )
    88
    89 currentTime := time.Now().Unix()
    90
    91 if err := newCfg.IsValid(currentTime); err != nil {
    92 panic(makeErrorWithDetails(errInvalidConfiguration, err.Error()))
    93 }
    94
    95 // Mint and distribute GNS tokens as part of the process
    96 en.MintAndDistributeGns(cross(rlm))
    97
    98 // Store previous version for event emission
    99 previousVersion := gv.getCurrentConfigVersion()
    100
    101 // Apply the new configuration
    102 nextVersion := gv.reconfigure(0, rlm, newCfg)
    103
    104 chain.Emit(
    105 "Reconfigure",
    106 "prevAddr", caller.String(),
    107 "prevRealm", prev.PkgPath(),
    108 "votingStartDelay", utils.FormatInt(newCfg.VotingStartDelay),
    109 "votingPeriod", utils.FormatInt(newCfg.VotingPeriod),
    110 "votingWeightSmoothingDuration", utils.FormatInt(newCfg.VotingWeightSmoothingDuration),
    111 "quorum", utils.FormatInt(newCfg.Quorum),
    112 "proposalCreationThreshold", utils.FormatInt(newCfg.ProposalCreationThreshold),
    113 "executionDelay", utils.FormatInt(newCfg.ExecutionDelay),
    114 "executionPeriod", utils.FormatInt(newCfg.ExecutionWindow),
    115 "newConfigVersion", utils.FormatInt(nextVersion),
    116 "prevConfigVersion", utils.FormatInt(previousVersion),
    117 )
    118
    119 return nextVersion
    120}
    121
    122// reconfigure stores the validated configuration with incremented version number.
    123func (gv *governanceV1) reconfigure(_ int, rlm realm, cfg governance.Config) int64 {
    124 // Generate next version number
    125 nextVersion := gv.nextConfigVersion(0, rlm)
    126
    127 // Store the new configuration with version
    128 err := gv.setConfig(0, rlm, nextVersion, cfg)
    129 if err != nil {
    130 panic("failed to set config: " + err.Error())
    131 }
    132
    133 return nextVersion
    134}
    135