Skip to main content

AuthZ

ℹ️info

Terra's Authz module inherits from the Cosmos SDK's authz module. This document is a stub and mainly explains important Terra-specific notes on how it is used.

The authz (message authorization) module allows users to authorize another account to send messages on their behalf. Certain authorizations, such as the spending of another account's tokens, can be parameterized to constrain the permissions of the grantee, such as setting a spending limit.

Message types

MsgGrantAuthorization


_8
// MsgGrantAuthorization grants the provided authorization to the grantee on the granter's
_8
// account during the provided time period
_8
type MsgGrantAuthorization struct {
_8
Granter sdk.AccAddress `json:"granter"`
_8
Grantee sdk.AccAddress `json:"grantee"`
_8
Authorization Authorization `json:"authorization"`
_8
Period time.Duration `json:"period"`
_8
}

MsgRevokeAuthorization


_9
// MsgRevokeAuthorization revokes any authorization with the provided sdk.Msg type on the
_9
// granter's account that has been granted to the grantee
_9
type MsgRevokeAuthorization struct {
_9
Granter sdk.AccAddress `json:"granter"`
_9
Grantee sdk.AccAddress `json:"grantee"`
_9
// AuthorizationMsgType is the type of sdk.Msg that the revoked Authorization refers to.
_9
// i.e. this is what `Authorization.MsgType()` returns
_9
AuthorizationMsgType string `json:"authorization_msg_type"`
_9
}

MsgExecAuthorized


_7
// MsgExecAuthorized attempts to execute the provided messages using
_7
// authorizations granted to the grantee. Each message should only have
_7
// one signer corresponding to the granter of the authorization.
_7
type MsgExecAuthorized struct {
_7
Grantee sdk.AccAddress `json:"grantee"`
_7
Msgs []sdk.Msg `json:"msgs"`
_7
}