cosmos-sdk/x/authz/exported/keeper.go
MD Aleem 7df79b55f0
x/authz: Add DelegateAuthorization, UndelegateAuthorization (#8472)
* add proto msgs

* add delegate authorization

* add delegate authorization tests

* add delegate authorization to cli

* fix lint

* add cli tests

* made max_tokens optional

* add tests

* add table tests

* resolve conflicts

* add undelegate authorization

* proto-gen

* fix errors

* fix lint

* resolve conflicts

* fix imports

* add allow & deny lists to delegate authorization

* refactor authorizations

* proto-docs

* fix lint

* review changes

* golint

* proto lint

* review changes

* add staking authorization

* review changes

* fix protos

* review changes

* review changes

* clean docs

* proto-docs

* proto-gen

* proto-docs
2021-02-20 06:57:57 +00:00

25 lines
1.2 KiB
Go

package exported
import (
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
)
type Keeper interface {
// DispatchActions executes the provided messages via authorization grants from the message signer to the grantee
DispatchActions(ctx sdk.Context, grantee sdk.AccAddress, msgs []sdk.ServiceMsg) sdk.Result
// Grants the provided authorization to the grantee on the granter's account with the provided expiration time
// If there is an existing authorization grant for the same sdk.Msg type, this grant overwrites that.
Grant(ctx sdk.Context, grantee sdk.AccAddress, granter sdk.AccAddress, authorization Authorization, expiration time.Time) error
// Revokes any authorization for the provided message type granted to the grantee by the granter.
Revoke(ctx sdk.Context, grantee sdk.AccAddress, granter sdk.AccAddress, msgType string)
// Returns any Authorization (or nil), with the expiration time,
// granted to the grantee by the granter for the provided msg type.
// If the Authorization is expired already, it will revoke the authorization and return nil
GetOrRevokeAuthorization(ctx sdk.Context, grantee sdk.AccAddress, granter sdk.AccAddress, msgType string) (cap Authorization, expiration time.Time)
}