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

access/v1 package

Functions

AssertHasAnyRole

func AssertHasAnyRole(caller address, roleNames ...string)

AssertHasAnyRole checks roleNames in order and panics unless caller matches one. It panics immediately if a checked role is absent, even if a later role might match.

Parameters:

  • caller: address compared against each configured role address
  • roleNames: ordered role identifiers to check; each missing role causes a panic

Params

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertHasAnyRole(,)"

Result

AssertIsAdmin

func AssertIsAdmin(caller address)

AssertIsAdmin panics unless caller is the configured admin address.

Parameters:

  • caller: address whose authorization is checked against the admin role

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertIsAdmin()"

Result

AssertIsAdminOrGovernance

func AssertIsAdminOrGovernance(caller address)

AssertIsAdminOrGovernance panics unless caller is the configured admin or governance address.

Parameters:

  • caller: address whose authorization is checked against the admin and governance roles

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertIsAdminOrGovernance()"

Result

AssertIsAuthorized

func AssertIsAuthorized(roleName string, caller address)

AssertIsAuthorized panics if caller does not have the specified role or if the role is absent.

Parameters:

  • roleName: role identifier whose configured address is required
  • caller: address that must match the configured address for roleName

Params

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertIsAuthorized(,)"

Result

AssertIsEmission

func AssertIsEmission(caller address)

AssertIsEmission panics unless caller is the configured emission address.

Parameters:

  • caller: address whose authorization is checked against the emission role

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertIsEmission()"

Result

AssertIsGovStaker

func AssertIsGovStaker(caller address)

AssertIsGovStaker panics unless caller is the configured governance-staker address.

Parameters:

  • caller: address whose authorization is checked against the governance-staker role

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertIsGovStaker()"

Result

AssertIsGovXGNS

func AssertIsGovXGNS(caller address)

AssertIsGovXGNS panics unless caller is the configured xGNS governance address.

Parameters:

  • caller: address whose authorization is checked against the xGNS governance role

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertIsGovXGNS()"

Result

AssertIsGovernance

func AssertIsGovernance(caller address)

AssertIsGovernance panics unless caller is the configured governance address.

Parameters:

  • caller: address whose authorization is checked against the governance role

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertIsGovernance()"

Result

AssertIsLaunchpad

func AssertIsLaunchpad(caller address)

AssertIsLaunchpad panics unless caller is the configured launchpad address.

Parameters:

  • caller: address whose authorization is checked against the launchpad role

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertIsLaunchpad()"

Result

AssertIsPool

func AssertIsPool(caller address)

AssertIsPool panics unless caller is the configured pool address.

Parameters:

  • caller: address whose authorization is checked against the pool role

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertIsPool()"

Result

AssertIsPosition

func AssertIsPosition(caller address)

AssertIsPosition panics unless caller is the configured position address.

Parameters:

  • caller: address whose authorization is checked against the position role

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertIsPosition()"

Result

AssertIsProtocolFee

func AssertIsProtocolFee(caller address)

AssertIsProtocolFee panics unless caller is the configured protocol-fee address.

Parameters:

  • caller: address whose authorization is checked against the protocol-fee role

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertIsProtocolFee()"

Result

AssertIsRlmCurrent

func AssertIsRlmCurrent(_ int, rlm realm)

AssertIsRlmCurrent panics if the realm token is not the current crossing frame.

Parameters:

  • _: leading realm-call discriminator; callers pass 0
  • rlm: realm context token that must represent the current crossing frame

Params

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertIsRlmCurrent(,)"

Result

AssertIsRouter

func AssertIsRouter(caller address)

AssertIsRouter panics unless caller is the configured router address.

Parameters:

  • caller: address whose authorization is checked against the router role

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertIsRouter()"

Result

AssertIsStaker

func AssertIsStaker(caller address)

AssertIsStaker panics unless caller is the configured staker address.

Parameters:

  • caller: address whose authorization is checked against the staker role

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertIsStaker()"

Result

AssertIsValidAddress

func AssertIsValidAddress(addr address)

AssertIsValidAddress panics if addr is not a valid address.

Parameters:

  • addr: address value to validate

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.AssertIsValidAddress()"

Result

GetRoleAddresses

func GetRoleAddresses() map[string]address

GetRoleAddresses returns an independent map copy of all stored role addresses.

Returns:

  • roleAddresses: map from normalized role names to their configured addresses

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.GetRoleAddresses()"

Result

IsAuthorized

func IsAuthorized(role string, caller address) bool

IsAuthorized reports whether caller is the address currently mapped to role.

Parameters:

  • role: role name to trim and look up
  • caller: address to compare with the mapped role address

Returns:

  • authorized: true when role exists and caller matches its address; false when the role is absent or does not match

Params

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/access/v1.IsAuthorized(,)"

Result

RemoveRole

func RemoveRole(cur realm, roleName string)

RemoveRole removes a role from the system after trimming its name.

Parameters:

  • cur: current realm context; callers use cross(cur) when crossing into this realm
  • roleName: role identifier to trim and remove; an empty or unknown name panics

Only callable by the RBAC contract.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/access/v1" -func "RemoveRole" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "http://127.0.0.1:26657" ADDRESSgnokey query -remote "http://127.0.0.1:26657" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/access/v1" -func "RemoveRole" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "http://127.0.0.1:26657" call.tx
  

SetRoleAddress

func SetRoleAddress(cur realm, roleName string, roleAddress address)

SetRoleAddress sets or updates a role's address. It trims surrounding whitespace from roleName, creates missing roles, and replaces the address for an existing role.

Parameters:

  • cur: current realm context; callers use cross(cur) when crossing into this realm
  • roleName: role identifier; surrounding whitespace is ignored and an empty name panics
  • roleAddress: non-empty, valid address to associate with roleName

Only callable by the RBAC contract.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/access/v1" -func "SetRoleAddress" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "http://127.0.0.1:26657" ADDRESSgnokey query -remote "http://127.0.0.1:26657" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/access/v1" -func "SetRoleAddress" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "http://127.0.0.1:26657" call.tx