Documentation
¶
Overview ¶
Package api implements the vault backend API.
Package api implements the vault backend API.
Index ¶
- Constants
- Variables
- func NewAuthorizeActionTx(nonce uint64, fee *transaction.Fee, action *AuthorizeAction) *transaction.Transaction
- func NewCancelActionTx(nonce uint64, fee *transaction.Fee, action *CancelAction) *transaction.Transaction
- func NewCreateTx(nonce uint64, fee *transaction.Fee, create *Create) *transaction.Transaction
- func NewVaultAddress(creator staking.Address, id uint64) staking.Address
- func RegisterService(server *grpc.Server, service Backend)
- type Action
- func (a *Action) Authorities(vault *Vault) []*Authority
- func (a *Action) Equal(other *Action) bool
- func (a *Action) IsAuthorized(vault *Vault, addr staking.Address) bool
- func (a Action) PrettyPrint(ctx context.Context, prefix string, w io.Writer)
- func (a Action) PrettyType() (any, error)
- func (a *Action) Validate(params *ConsensusParameters) error
- type ActionCanceledEvent
- type ActionExecuteMessage
- func (am *ActionExecuteMessage) Authorities(vault *Vault) []*Authority
- func (am ActionExecuteMessage) PrettyPrint(ctx context.Context, prefix string, w io.Writer)
- func (am ActionExecuteMessage) PrettyPrintBody(ctx context.Context, prefix string, w io.Writer)
- func (am ActionExecuteMessage) PrettyType() (any, error)
- func (am *ActionExecuteMessage) Validate() error
- type ActionExecutedEvent
- type ActionExecutionResult
- type ActionResume
- type ActionSubmittedEvent
- type ActionSuspend
- type ActionUpdateAuthority
- func (au *ActionUpdateAuthority) Apply(vault *Vault)
- func (au *ActionUpdateAuthority) Authorities(vault *Vault) []*Authority
- func (au ActionUpdateAuthority) PrettyPrint(ctx context.Context, prefix string, w io.Writer)
- func (au ActionUpdateAuthority) PrettyType() (any, error)
- func (au *ActionUpdateAuthority) Validate(params *ConsensusParameters) error
- type ActionUpdateWithdrawPolicy
- type AddressQuery
- type AddressState
- type Authority
- func (a *Authority) Contains(address staking.Address) bool
- func (a Authority) PrettyPrint(_ context.Context, prefix string, w io.Writer)
- func (a Authority) PrettyType() (any, error)
- func (a *Authority) Validate(params *ConsensusParameters) error
- func (a *Authority) Verify(addresses []staking.Address) bool
- type AuthorityUpdatedEvent
- type AuthorizeAction
- type Backend
- type CancelAction
- type Client
- func (c *Client) AddressState(ctx context.Context, request *AddressQuery) (*AddressState, error)
- func (c *Client) Cleanup()
- func (c *Client) ConsensusParameters(ctx context.Context, height int64) (*ConsensusParameters, error)
- func (c *Client) GetEvents(ctx context.Context, height int64) ([]*Event, error)
- func (c *Client) PendingActions(ctx context.Context, request *VaultQuery) ([]*PendingAction, error)
- func (c *Client) StateToGenesis(ctx context.Context, height int64) (*Genesis, error)
- func (c *Client) Vault(ctx context.Context, request *VaultQuery) (*Vault, error)
- func (c *Client) Vaults(ctx context.Context, height int64) ([]*Vault, error)
- func (c *Client) WatchEvents(ctx context.Context) (<-chan *Event, pubsub.ClosableSubscription, error)
- type ConsensusParameterChanges
- type ConsensusParameters
- type Create
- type Event
- type Genesis
- type PendingAction
- type PolicyUpdatedEvent
- type PrettyActionExecuteMessage
- type State
- type StateChangedEvent
- type Vault
- type VaultQuery
- type WithdrawPolicy
Constants ¶
const ( // GasOpCreate is the gas operation identifier for creating a vault. GasOpCreate transaction.Op = "create" // GasOpAuthorizeAction is the gas operation identifier for authorizing an action. GasOpAuthorizeAction transaction.Op = "authorize_action" // GasOpCancelAction is the gas operation identifier for canceling an action. GasOpCancelAction transaction.Op = "cancel_action" )
const ( StateSuspended = 0 StateActive = 1 )
const (
// ModuleName is a unique module name for the vault module.
ModuleName = "vault"
)
Variables ¶
var ( // ErrInvalidArgument is the error returned on malformed arguments. ErrInvalidArgument = errors.New(ModuleName, 1, "vault: invalid argument") // ErrNoSuchVault is the error returned when a vault does not exist. ErrNoSuchVault = errors.New(ModuleName, 2, "vault: no such vault") // ErrNoSuchState is the error returned when address state does not exist. ErrNoSuchState = errors.New(ModuleName, 3, "vault: no such state") // ErrInvalidNonce is the error returned when the vault nonce is invalid. ErrInvalidNonce = errors.New(ModuleName, 4, "vault: invalid nonce") // ErrForbidden is the error returned when an action is forbidden. ErrForbidden = errors.New(ModuleName, 5, "vault: forbidden") // ErrNoSuchAction is the error returned when an action does not exist. ErrNoSuchAction = errors.New(ModuleName, 6, "vault: no such action") // ErrUnsupportedAction is the error returned when an action is not supported. ErrUnsupportedAction = errors.New(ModuleName, 7, "vault: action not supported") )
var ( // MethodCreate is the method name for creating vaults. MethodCreate = transaction.NewMethodName(ModuleName, "Create", Create{}) // MethodAuthorizeAction is the method name for authorizing actions. MethodAuthorizeAction = transaction.NewMethodName(ModuleName, "AuthorizeAction", AuthorizeAction{}) // MethodCancelAction is the method name for canceling actions. MethodCancelAction = transaction.NewMethodName(ModuleName, "CancelAction", CancelAction{}) // Methods is the list of all methods supported by the vault backend. Methods = []transaction.MethodName{ MethodCreate, MethodAuthorizeAction, MethodCancelAction, } )
var DefaultConsensusParameters = ConsensusParameters{ Enabled: true, MaxAuthorityAddresses: 32, GasCosts: DefaultGasCosts, }
DefaultConsensusParameters are the default vault consensus parameters.
var DefaultGasCosts = transaction.Costs{ GasOpCreate: 10000, GasOpAuthorizeAction: 5000, GasOpCancelAction: 5000, }
DefaultGasCosts are the "default" gas costs for operations.
Functions ¶
func NewAuthorizeActionTx ¶
func NewAuthorizeActionTx(nonce uint64, fee *transaction.Fee, action *AuthorizeAction) *transaction.Transaction
NewAuthorizeActionTx creates a new authorize action transaction.
func NewCancelActionTx ¶
func NewCancelActionTx(nonce uint64, fee *transaction.Fee, action *CancelAction) *transaction.Transaction
NewCancelActionTx creates a new cancel action transaction.
func NewCreateTx ¶
func NewCreateTx(nonce uint64, fee *transaction.Fee, create *Create) *transaction.Transaction
NewCreateTx creates a new vault creation transaction.
func NewVaultAddress ¶
NewVaultAddress returns the address for the vault.
func RegisterService ¶
RegisterService registers a new vault service with the given gRPC server.
Types ¶
type Action ¶
type Action struct {
// Suspend is the suspend action.
Suspend *ActionSuspend `json:"suspend,omitempty"`
// Resume is the resume action.
Resume *ActionResume `json:"resume,omitempty"`
// ExecuteMessage is the execute message action.
ExecuteMessage *ActionExecuteMessage `json:"execute_msg,omitempty"`
// UpdateWithdrawPolicy is the withdraw policy update action.
UpdateWithdrawPolicy *ActionUpdateWithdrawPolicy `json:"update_withdraw_policy,omitempty"`
// UpdateAuthority is the authority update action.
UpdateAuthority *ActionUpdateAuthority `json:"update_authority,omitempty"`
}
Action is a vault action.
func (*Action) Authorities ¶
Authorities returns the authorities of the given vault that can authorize this action.
func (*Action) IsAuthorized ¶
IsAuthorized returns true iff the given address is authorized to execute this action.
func (Action) PrettyPrint ¶
PrettyPrint writes a pretty-printed representation of Action to the given writer.
func (Action) PrettyType ¶
PrettyType returns a representation of Action that can be used for pretty printing.
func (*Action) Validate ¶
func (a *Action) Validate(params *ConsensusParameters) error
Validate validates the given action.
type ActionCanceledEvent ¶
type ActionCanceledEvent struct {
// Vault is the vault address.
Vault staking.Address `json:"vault"`
// Nonce is the action nonce.
Nonce uint64 `json:"nonce"`
}
ActionCanceledEvent is the event emitted when a vault action is canceled.
func (*ActionCanceledEvent) EventKind ¶
func (e *ActionCanceledEvent) EventKind() string
EventKind returns a string representation of this event's kind.
type ActionExecuteMessage ¶
type ActionExecuteMessage struct {
// Method is the method that should be called.
Method transaction.MethodName `json:"method"`
// Body is the method call body.
Body cbor.RawMessage `json:"body,omitempty"`
}
ActionExecuteMessage is the action to execute a message on behalf of the vault. The message is dispatched as if the vault originated a transaction.
func (*ActionExecuteMessage) Authorities ¶
func (am *ActionExecuteMessage) Authorities(vault *Vault) []*Authority
Authorities returns the authorities of the given vault that can authorize this action.
func (ActionExecuteMessage) PrettyPrint ¶
PrettyPrint writes a pretty-printed representation of ActionExecuteMessage to the given writer.
func (ActionExecuteMessage) PrettyPrintBody ¶
PrettyPrintBody writes a pretty-printed representation of the message body to the given writer.
func (ActionExecuteMessage) PrettyType ¶
func (am ActionExecuteMessage) PrettyType() (any, error)
PrettyType returns a representation of ActionExecuteMessage that can be used for pretty printing.
func (*ActionExecuteMessage) Validate ¶
func (am *ActionExecuteMessage) Validate() error
Validate validates the given action.
type ActionExecutedEvent ¶
type ActionExecutedEvent struct {
// Vault is the vault address.
Vault staking.Address `json:"vault"`
// Nonce is the action nonce.
Nonce uint64 `json:"nonce"`
// Result is the action execution result.
Result ActionExecutionResult `json:"result,omitempty"`
}
ActionExecutedEvent is the event emitted when a new vault action is executed.
func (*ActionExecutedEvent) EventKind ¶
func (e *ActionExecutedEvent) EventKind() string
EventKind returns a string representation of this event's kind.
type ActionExecutionResult ¶
type ActionExecutionResult struct {
Module string `json:"module,omitempty"`
Code uint32 `json:"code,omitempty"`
}
ActionExecutionResult is the result of executing an action.
type ActionResume ¶
type ActionResume struct{}
ActionResume is the action to suspend the vault.
func (*ActionResume) Authorities ¶
func (ar *ActionResume) Authorities(vault *Vault) []*Authority
Authorities returns the authorities of the given vault that can authorize this action.
type ActionSubmittedEvent ¶
type ActionSubmittedEvent struct {
// Submitter is the account address of the submitter.
Submitter staking.Address `json:"submitter"`
// Vault is the vault address.
Vault staking.Address `json:"vault"`
// Nonce is the action nonce.
Nonce uint64 `json:"nonce"`
}
ActionSubmittedEvent is the event emitted when a new vault action is submitted.
func (*ActionSubmittedEvent) EventKind ¶
func (e *ActionSubmittedEvent) EventKind() string
EventKind returns a string representation of this event's kind.
type ActionSuspend ¶
type ActionSuspend struct{}
ActionSuspend is the action to suspend the vault.
func (*ActionSuspend) Authorities ¶
func (as *ActionSuspend) Authorities(vault *Vault) []*Authority
Authorities returns the authorities of the given vault that can authorize this action.
type ActionUpdateAuthority ¶
type ActionUpdateAuthority struct {
// AdminAuthority is the new admin authority. If the field is nil no update should be done.
AdminAuthority *Authority `json:"admin_authority,omitempty"`
// SuspendAuthority is the new suspend authority. If the field is nil no update should be done.
SuspendAuthority *Authority `json:"suspend_authority,omitempty"`
}
ActionUpdateAuthority is the action to update one of the vault authorities.
func (*ActionUpdateAuthority) Apply ¶
func (au *ActionUpdateAuthority) Apply(vault *Vault)
Apply applies the authority update to the given vault.
func (*ActionUpdateAuthority) Authorities ¶
func (au *ActionUpdateAuthority) Authorities(vault *Vault) []*Authority
Authorities returns the authorities of the given vault that can authorize this action.
func (ActionUpdateAuthority) PrettyPrint ¶
PrettyPrint writes a pretty-printed representation of ActionUpdateAuthority to the given writer.
func (ActionUpdateAuthority) PrettyType ¶
func (au ActionUpdateAuthority) PrettyType() (any, error)
PrettyType returns a representation of ActionUpdateAuthority that can be used for pretty printing.
func (*ActionUpdateAuthority) Validate ¶
func (au *ActionUpdateAuthority) Validate(params *ConsensusParameters) error
Validate validates the given action.
type ActionUpdateWithdrawPolicy ¶
type ActionUpdateWithdrawPolicy struct {
// Address is the address the policy update is for.
Address staking.Address `json:"address"`
// Policy is the new withdraw policy.
Policy WithdrawPolicy `json:"policy"`
}
ActionUpdateWithdrawPolicy is the action to update the withdraw policy for a given address.
func (*ActionUpdateWithdrawPolicy) Authorities ¶
func (au *ActionUpdateWithdrawPolicy) Authorities(vault *Vault) []*Authority
Authorities returns the authorities of the given vault that can authorize this action.
func (ActionUpdateWithdrawPolicy) PrettyPrint ¶
PrettyPrint writes a pretty-printed representation of ActionUpdateWithdrawPolicy to the given writer.
func (ActionUpdateWithdrawPolicy) PrettyType ¶
func (au ActionUpdateWithdrawPolicy) PrettyType() (any, error)
PrettyType returns a representation of ActionUpdateWithdrawPolicy that can be used for pretty printing.
func (*ActionUpdateWithdrawPolicy) Validate ¶
func (au *ActionUpdateWithdrawPolicy) Validate() error
Validate validates the given action.
type AddressQuery ¶
type AddressQuery struct {
// Height is the query height.
Height int64 `json:"height"`
// Vault is the vault address.
Vault staking.Address `json:"vault"`
// Address is the queried address.
Address staking.Address `json:"address"`
}
AddressQuery is a query for data about a given address for the given vault.
type AddressState ¶
type AddressState struct {
// WithdrawPolicy is the active withdraw policy.
WithdrawPolicy WithdrawPolicy `json:"withdraw_policy"`
// CurrentBucket specifies the interval we are currently doing accounting for.
CurrentBucket uint64 `json:"bucket"`
// CurrentAmount specifies the amount already withdrawn in the current interval.
CurrentAmount quantity.Quantity `json:"amount"`
}
AddressState is the state stored for the given address.
func (*AddressState) AuthorizeWithdrawal ¶
func (as *AddressState) AuthorizeWithdrawal(height int64, amount *quantity.Quantity) bool
AuthorizeWithdrawal performs withdrawal authorization. In case withdrawal is allowed, the state is also updated to reflect the additional withdrawal.
func (*AddressState) UpdateWithdrawPolicy ¶
func (as *AddressState) UpdateWithdrawPolicy(newPolicy *WithdrawPolicy)
UpdateWithdrawPolicy updates the withdraw policy to a new policy together with any internal accounting adjustments.
type Authority ¶
type Authority struct {
// Addresses are the addresses that can authorize an action.
Addresses []staking.Address `json:"addresses"`
// Threshold is the minimum number of addresses that must authorize an action.
Threshold uint8 `json:"threshold"`
}
Authority is the vault multisig authority.
func (Authority) PrettyPrint ¶
PrettyPrint writes a pretty-printed representation of Authority to the given writer.
func (Authority) PrettyType ¶
PrettyType returns a representation of Authority that can be used for pretty printing.
func (*Authority) Validate ¶
func (a *Authority) Validate(params *ConsensusParameters) error
Validate validates the authority configuration.
type AuthorityUpdatedEvent ¶
type AuthorityUpdatedEvent struct {
// Vault is the vault address.
Vault staking.Address `json:"vault"`
}
AuthorityUpdatedEvent is the event emitted when a vault authority is updated.
func (*AuthorityUpdatedEvent) EventKind ¶
func (e *AuthorityUpdatedEvent) EventKind() string
EventKind returns a string representation of this event's kind.
type AuthorizeAction ¶
type AuthorizeAction struct {
// Vault is the address of the target vault.
Vault staking.Address `json:"vault"`
// Nonce is the action nonce.
Nonce uint64 `json:"nonce"`
// Action is the action that should be authorized.
Action Action `json:"action"`
}
AuthorizeAction is an action authorization call body.
func (AuthorizeAction) PrettyPrint ¶
PrettyPrint writes a pretty-printed representation of AuthorizeAction to the given writer.
func (AuthorizeAction) PrettyType ¶
func (a AuthorizeAction) PrettyType() (any, error)
PrettyType returns a representation of AuthorizeAction that can be used for pretty printing.
func (*AuthorizeAction) Validate ¶
func (a *AuthorizeAction) Validate(params *ConsensusParameters) error
Validate validates the action authorization call.
type Backend ¶
type Backend interface {
// Vaults returns all of the registered vaults.
Vaults(ctx context.Context, height int64) ([]*Vault, error)
// Vault returns information about the given vault.
Vault(ctx context.Context, query *VaultQuery) (*Vault, error)
// AddressState returns the state information for the given source address.
AddressState(ctx context.Context, query *AddressQuery) (*AddressState, error)
// PendingActions returns the list of pending actions for the given vault.
PendingActions(ctx context.Context, query *VaultQuery) ([]*PendingAction, error)
// StateToGenesis returns the genesis state at specified block height.
StateToGenesis(ctx context.Context, height int64) (*Genesis, error)
// ConsensusParameters returns the vault consensus parameters.
ConsensusParameters(ctx context.Context, height int64) (*ConsensusParameters, error)
// GetEvents returns the events at specified block height.
GetEvents(ctx context.Context, height int64) ([]*Event, error)
// WatchEvents returns a channel that produces a stream of Events.
WatchEvents(ctx context.Context) (<-chan *Event, pubsub.ClosableSubscription, error)
}
Backend is a vault implementation.
type CancelAction ¶
type CancelAction struct {
// Vault is the address of the target vault.
Vault staking.Address `json:"vault"`
// Nonce is the action nonce.
Nonce uint64 `json:"nonce"`
}
CancelAction is an action cancellation call body.
func (CancelAction) PrettyPrint ¶
PrettyPrint writes a pretty-printed representation of CancelAction to the given writer.
func (CancelAction) PrettyType ¶
func (a CancelAction) PrettyType() (any, error)
PrettyType returns a representation of CancelAction that can be used for pretty printing.
func (*CancelAction) Validate ¶
func (a *CancelAction) Validate() error
Validate validates the action cancellation call.
type Client ¶ added in v0.2501.0
type Client struct {
// contains filtered or unexported fields
}
Client is a gRPC vault client.
func NewClient ¶ added in v0.2501.0
func NewClient(c *grpc.ClientConn) *Client
NewClient creates a new gRPC vault client.
func (*Client) AddressState ¶ added in v0.2501.0
func (c *Client) AddressState(ctx context.Context, request *AddressQuery) (*AddressState, error)
func (*Client) ConsensusParameters ¶ added in v0.2501.0
func (*Client) PendingActions ¶ added in v0.2501.0
func (c *Client) PendingActions(ctx context.Context, request *VaultQuery) ([]*PendingAction, error)
func (*Client) StateToGenesis ¶ added in v0.2501.0
func (*Client) WatchEvents ¶ added in v0.2501.0
type ConsensusParameterChanges ¶
type ConsensusParameterChanges struct {
// MaxAuthorityAddresses is the new maximum number of addresses that can be configured for each
// authority.
MaxAuthorityAddresses *uint8 `json:"max_authority_addresses,omitempty"`
// GasCosts are the new gas costs.
GasCosts transaction.Costs `json:"gas_costs,omitempty"`
}
ConsensusParameterChanges are allowed vault consensus parameter changes.
func (*ConsensusParameterChanges) Apply ¶
func (c *ConsensusParameterChanges) Apply(params *ConsensusParameters) error
Apply applies changes to the given consensus parameters.
func (*ConsensusParameterChanges) SanityCheck ¶
func (c *ConsensusParameterChanges) SanityCheck() error
SanityCheck performs a sanity check on the consensus parameter changes.
type ConsensusParameters ¶
type ConsensusParameters struct {
// Enabled specifies whether the vault service is enabled.
Enabled bool `json:"enabled,omitempty"`
// MaxAuthorityAddresses is the maximum number of addresses that can be configured for each
// authority.
MaxAuthorityAddresses uint8 `json:"max_authority_addresses,omitempty"`
// GasCosts are the vault transaction gas costs.
GasCosts transaction.Costs `json:"gas_costs,omitempty"`
}
ConsensusParameters are the vault consensus parameters.
func (*ConsensusParameters) SanityCheck ¶
func (p *ConsensusParameters) SanityCheck() error
SanityCheck performs a sanity check on the consensus parameters.
type Create ¶
type Create struct {
// AdminAuthority specifies the vault's admin authority.
AdminAuthority Authority `json:"admin_authority"`
// SuspendAuthority specifies the vault's suspend authority.
SuspendAuthority Authority `json:"suspend_authority"`
}
Create is a create call body.
func (Create) PrettyPrint ¶
PrettyPrint writes a pretty-printed representation of Create to the given writer.
func (Create) PrettyType ¶
PrettyType returns a representation of Create that can be used for pretty printing.
func (*Create) Validate ¶
func (c *Create) Validate(params *ConsensusParameters) error
Validate validates the create call.
type Event ¶
type Event struct {
Height int64 `json:"height,omitempty"`
TxHash hash.Hash `json:"tx_hash,omitempty"`
ActionSubmitted *ActionSubmittedEvent `json:"action_submitted,omitempty"`
ActionCanceled *ActionCanceledEvent `json:"action_canceled,omitempty"`
ActionExecuted *ActionExecutedEvent `json:"action_executed,omitempty"`
StateChanged *StateChangedEvent `json:"state_changed,omitempty"`
PolicyUpdated *PolicyUpdatedEvent `json:"policy_updated"`
AuthorityUpdated *AuthorityUpdatedEvent `json:"authority_updated"`
}
Event signifies a vault event.
type Genesis ¶
type Genesis struct {
// Parameters are the genesis consensus parameters.
Parameters ConsensusParameters `json:"params"`
// Vaults are the vaults.
Vaults []*Vault `json:"vaults,omitempty"`
// States are the per vault per-address states.
States map[staking.Address]map[staking.Address]*AddressState `json:"states,omitempty"`
// PendingActions are the per-vault pending actions.
PendingActions map[staking.Address][]*PendingAction `json:"pending_actions,omitempty"`
}
Genesis is the initial vault state for use in the genesis block.
func (*Genesis) SanityCheck ¶
SanityCheck does basic sanity checking on the genesis state.
type PendingAction ¶
type PendingAction struct {
// Nonce is the action nonce.
Nonce uint64 `json:"nonce"`
// AuthorizedBy contains the addresses that have authorized the action.
AuthorizedBy []staking.Address `json:"authorized_by"`
// Action is the pending action itself.
Action Action `json:"action"`
}
PendingAction is an action waiting for authorizations in order to be executed.
func (*PendingAction) ContainsAuthorizationFrom ¶
func (pa *PendingAction) ContainsAuthorizationFrom(addr staking.Address) bool
ContainsAuthorizationFrom returns true iff the given address is among the action authorizers.
type PolicyUpdatedEvent ¶
type PolicyUpdatedEvent struct {
// Vault is the vault address.
Vault staking.Address `json:"vault"`
// Address is the address for which the policy has been updated.
Address staking.Address `json:"address"`
}
PolicyUpdatedEvent is the event emitted when a vault policy for an address is updated.
func (*PolicyUpdatedEvent) EventKind ¶
func (e *PolicyUpdatedEvent) EventKind() string
EventKind returns a string representation of this event's kind.
type PrettyActionExecuteMessage ¶
type PrettyActionExecuteMessage struct {
Method transaction.MethodName `json:"method"`
Body any `json:"body,omitempty"`
}
PrettyActionExecuteMessage is used for pretty-printing execute message actions so that the actual content is displayed instead of the binary blob.
It should only be used for pretty printing.
type StateChangedEvent ¶
type StateChangedEvent struct {
// Vault is the vault address.
Vault staking.Address `json:"vault"`
// OldState is the old vault state.
OldState State `json:"old_state"`
// NewState is the new vault state.
NewState State `json:"new_state"`
}
StateChangedEvent is the event emitted when a vault state is changed.
func (*StateChangedEvent) EventKind ¶
func (e *StateChangedEvent) EventKind() string
EventKind returns a string representation of this event's kind.
type Vault ¶
type Vault struct {
// Creator is the address of the vault creator.
Creator staking.Address `json:"creator"`
// ID is the unique per-creator identifier of the vault.
ID uint64 `json:"id"`
// State is the vault state.
State State `json:"state"`
// Nonce is the nonce to use for the next action.
Nonce uint64 `json:"nonce,omitempty"`
// AdminAuthority specifies the vault's admin authority.
AdminAuthority Authority `json:"admin_authority"`
// SuspendAuthority specifies the vault's suspend authority.
SuspendAuthority Authority `json:"suspend_authority"`
}
Vault contains metadata about a vault.
func (*Vault) Authorities ¶
Authorities returns the list of all vault authorities.
func (*Vault) AuthoritiesContain ¶
AuthoritiesContain returns true iff any of the vault's authorities contain the address.
type VaultQuery ¶
type VaultQuery struct {
// Height is the query height.
Height int64 `json:"height"`
// Address is the vault address.
Address staking.Address `json:"address"`
}
VaultQuery is a query for data about a given vault.
type WithdrawPolicy ¶
type WithdrawPolicy struct {
// LimitAmount is the maximum amount of tokens that may be withdrawn in the given interval.
LimitAmount quantity.Quantity `json:"limit_amount"`
// LimitInterval is the interval (in blocks) when the limit amount resets.
LimitInterval uint64 `json:"limit_interval"`
}
WithdrawPolicy is the per-address withdraw policy.
func (*WithdrawPolicy) IsDisabled ¶
func (wp *WithdrawPolicy) IsDisabled() bool
IsDisabled returns true iff the policy is disabled and no withdrawal is allowed.
func (WithdrawPolicy) PrettyPrint ¶
PrettyPrint writes a pretty-printed representation of WithdrawPolicy to the given writer.
func (WithdrawPolicy) PrettyType ¶
func (wp WithdrawPolicy) PrettyType() (any, error)
PrettyType returns a representation of WithdrawPolicy that can be used for pretty printing.
func (*WithdrawPolicy) Validate ¶
func (wp *WithdrawPolicy) Validate() error
Validate validates the withdrawal policy.