Search Apps Documentation Source Content File Folder Download Copy Actions Download

access package

Functions

AssertHasAnyRole

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

AssertHasAnyRole panics if the caller does not have any of the specified roles. Also panics if any of the roles do not exist.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertHasAnyRole(,)"

Result

AssertIsAdmin

func AssertIsAdmin(caller address)

AssertIsAdmin panics if the caller is not admin. Used for admin-only functions.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertIsAdmin()"

Result

AssertIsAdminOrGovernance

func AssertIsAdminOrGovernance(caller address)

AssertIsAdminOrGovernance panics if the caller is not admin or governance. Used for functions that require elevated privileges.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertIsAdminOrGovernance()"

Result

AssertIsAuthorized

func AssertIsAuthorized(roleName string, caller address)

AssertIsAuthorized panics if the caller does not have the specified role. Also panics if the role does not exist.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertIsAuthorized(,)"

Result

AssertIsEmission

func AssertIsEmission(caller address)

AssertIsEmission panics if the caller is not emission. Used for emission-only functions.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertIsEmission()"

Result

AssertIsGovStaker

func AssertIsGovStaker(caller address)

AssertIsGovStaker panics if the caller is not governance staker. Used for governance staking functions.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertIsGovStaker()"

Result

AssertIsGovXGNS

func AssertIsGovXGNS(caller address)

AssertIsGovXGNS panics if the caller is not xGNS governance. Used for xGNS governance functions.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertIsGovXGNS()"

Result

AssertIsGovernance

func AssertIsGovernance(caller address)

AssertIsGovernance panics if the caller is not governance. Used for governance-only functions.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertIsGovernance()"

Result

AssertIsLaunchpad

func AssertIsLaunchpad(caller address)

AssertIsLaunchpad panics if the caller is not launchpad. Used for launchpad-only functions.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertIsLaunchpad()"

Result

AssertIsPool

func AssertIsPool(caller address)

AssertIsPool panics if the caller is not pool. Used for pool-only functions.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertIsPool()"

Result

AssertIsPosition

func AssertIsPosition(caller address)

AssertIsPosition panics if the caller is not position. Used for position-only functions.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertIsPosition()"

Result

AssertIsProtocolFee

func AssertIsProtocolFee(caller address)

AssertIsProtocolFee panics if the caller is not protocol fee. Used for protocol fee management functions.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertIsProtocolFee()"

Result

AssertIsRouter

func AssertIsRouter(caller address)

AssertIsRouter panics if the caller is not router. Used for router-only functions.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertIsRouter()"

Result

AssertIsStaker

func AssertIsStaker(caller address)

AssertIsStaker panics if the caller is not staker. Used for staker-only functions.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertIsStaker()"

Result

AssertIsUser

func AssertIsUser(r runtime.Realm)

AssertIsUser panics if the caller is not a user realm. Used to ensure calls come from user accounts, not other contracts.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertIsUser()"

Result

AssertIsValidAddress

func AssertIsValidAddress(addr address)

AssertIsValidAddress panics if the provided address is invalid.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.AssertIsValidAddress()"

Result

GetRoleAddresses

func GetRoleAddresses() map[string]address

GetRoleAddresses returns a copy of all role addresses.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.GetRoleAddresses()"

Result

IsAuthorized

func IsAuthorized(role string, caller address) bool

IsAuthorized checks if caller has the specified role. Parameters: - role: role name to check - caller: address to verify Returns true if authorized, false otherwise.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/access.IsAuthorized(,)"

Result

RemoveRole

func RemoveRole(cur realm, roleName string)

RemoveRole removes a role from the system. Parameters: - roleName: name of the role to remove Only callable by 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" -func "RemoveRole" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/access" -func "RemoveRole" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

SetRoleAddress

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

SetRoleAddress sets or updates a role's address. Creates the role if it doesn't exist, updates it if it does. Parameters: - cur: current realm (required by interrealm spec; not used directly) - roleName: name of the role - roleAddress: address for the role Only callable by 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" -func "SetRoleAddress" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/access" -func "SetRoleAddress" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx