types

package
v0.0.0-...-69704c5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeRegisterFeeSplit      = "register_fee_split"
	EventTypeCancelFeeSplit        = "cancel_fee_split"
	EventTypeUpdateFeeSplit        = "update_fee_split"
	EventTypeDistributeDevFeeSplit = "distribute_dev_fee_split"

	AttributeKeyContract          = "contract"
	AttributeKeyWithdrawerAddress = "withdrawer_address"

	InnerTxFeesplit = "fee-split"
)

feesplit events

View Source
const (
	// module name
	ModuleName = "feesplit"
	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName
	// RouterKey to be used for message routing
	RouterKey = ModuleName

	QueryParameters              = "params"
	QueryFeeSplits               = "fee-splits"
	QueryFeeSplit                = "fee-split"
	QueryDeployerFeeSplits       = "deployer-fee-splits"
	QueryDeployerFeeSplitsDetail = "deployer-fee-splits-detail"
	QueryWithdrawerFeeSplits     = "withdrawer-fee-splits"
)

constants

View Source
const (
	TypeMsgRegisterFeeSplit = "register_fee_split"
	TypeMsgCancelFeeSplit   = "cancel_fee_split"
	TypeMsgUpdateFeeSplit   = "update_fee_split"
)
View Source
const DefaultCodespace string = ModuleName

Variables

View Source
var (
	ErrNotFeesplitHeight             = sdkerrors.Register(DefaultCodespace, 1, "not feesplit height")
	ErrInternalFeeSplit              = sdkerrors.Register(DefaultCodespace, 2, "internal feesplit error")
	ErrFeeSplitDisabled              = sdkerrors.Register(DefaultCodespace, 3, "feesplit module is disabled by governance")
	ErrFeeSplitAlreadyRegistered     = sdkerrors.Register(DefaultCodespace, 4, "feesplit already exists for given contract")
	ErrFeeSplitNoContractDeployed    = sdkerrors.Register(DefaultCodespace, 5, "no contract deployed")
	ErrFeeSplitContractNotRegistered = sdkerrors.Register(DefaultCodespace, 6, "no feesplit registered for contract")
	ErrFeeSplitDeployerIsNotEOA      = sdkerrors.Register(DefaultCodespace, 7, "deployer is not EOA")
	ErrFeeAccountNotFound            = sdkerrors.Register(DefaultCodespace, 8, "account not found")
	ErrDerivedNotMatched             = sdkerrors.Register(DefaultCodespace, 9, "derived address not matched")
)

errors

View Source
var (
	KeyPrefixFeeSplit      = []byte{prefixFeeSplit}
	KeyPrefixDeployer      = []byte{prefixDeployer}
	KeyPrefixWithdrawer    = []byte{prefixWithdrawer}
	KeyPrefixContractShare = []byte{prefixContractShare}
)

KVStore key prefixes

View Source
var (
	DefaultEnableFeeSplit  = false
	DefaultDeveloperShares = sdk.NewDecWithPrec(50, 2) // 50%
	// Cost for executing `crypto.CreateAddress` must be at least 36 gas for the
	// contained keccak256(word) operation
	DefaultAddrDerivationCostCreate = uint64(50)

	ParamStoreKeyEnableFeeSplit           = []byte("EnableFeeSplit")
	ParamStoreKeyDeveloperShares          = []byte("DeveloperShares")
	ParamStoreKeyAddrDerivationCostCreate = []byte("AddrDerivationCostCreate")
)

Parameter store key

View Source
var ModuleCdc = codec.New()

ModuleCdc defines the feesplit module's codec

Functions

func GetKeyPrefixDeployer

func GetKeyPrefixDeployer(deployerAddress sdk.AccAddress) []byte

GetKeyPrefixDeployer returns the KVStore key prefix for storing registered fee split contract for a deployer

func GetKeyPrefixWithdrawer

func GetKeyPrefixWithdrawer(withdrawerAddress sdk.AccAddress) []byte

GetKeyPrefixWithdrawer returns the KVStore key prefix for storing registered fee split contract for a withdrawer

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable returns the parameter key table.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers all the necessary types and interfaces for the feesplit module

func SetParamsNeedUpdate

func SetParamsNeedUpdate()

func ValidateNonZeroAddress

func ValidateNonZeroAddress(address string) error

ValidateNonZeroAddress returns an error if the provided string is not a hex formatted string address or is equal to zero

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account
}

AccountKeeper defines the expected interface needed to retrieve account info.

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func GetParamsCache

func GetParamsCache() *Cache

func NewCache

func NewCache() *Cache

func (*Cache) DeleteFeeSplit

func (c *Cache) DeleteFeeSplit(contract common.Address, isCheckTx bool)

DeleteFeeSplit The change in feeSplit is only related to the user tx(register,update,cancel)

func (*Cache) GetFeeSplit

func (c *Cache) GetFeeSplit(contract common.Address) (FeeSplit, bool)

func (*Cache) GetParams

func (c *Cache) GetParams() Params

func (*Cache) GetShare

func (c *Cache) GetShare(contract common.Address) (sdk.Dec, bool)

func (*Cache) IsNeedParamsUpdate

func (c *Cache) IsNeedParamsUpdate() bool

func (*Cache) SetNeedParamsUpdate

func (c *Cache) SetNeedParamsUpdate()

func (*Cache) UpdateFeeSplit

func (c *Cache) UpdateFeeSplit(contract common.Address, feeSplit FeeSplit, isCheckTx bool)

UpdateFeeSplit The change in feeSplit is only related to the user tx(register,update,cancel)

func (*Cache) UpdateParams

func (c *Cache) UpdateParams(params Params, isCheckTx bool)

UpdateParams the update in params is relates to the proposal and initGenesis

func (*Cache) UpdateShare

func (c *Cache) UpdateShare(contract common.Address, share sdk.Dec, isCheckTx bool)

UpdateShare The change in share is only related to the proposal

type EvmKeeper

type EvmKeeper interface {
	AddInnerTx(...interface{})
	DeleteInnerTx(...interface{})
}

type FeeSplit

type FeeSplit struct {
	// hex address of registered contract
	ContractAddress common.Address `json:"contract_address,omitempty"`
	// bech32 address of contract deployer
	DeployerAddress sdk.AccAddress `json:"deployer_address,omitempty"`
	// bech32 address of account receiving the transaction fees it defaults to
	// deployer_address
	WithdrawerAddress sdk.AccAddress `json:"withdrawer_address,omitempty"`
}

FeeSplit defines an instance that organizes fee distribution conditions for the owner of a given smart contract

func NewFeeSplit

func NewFeeSplit(contract common.Address, deployer, withdrawer sdk.AccAddress) FeeSplit

NewFeeSplit returns an instance of FeeSplit. If the provided withdrawer address is empty, it sets the value to an empty string.

func (FeeSplit) Validate

func (fs FeeSplit) Validate() error

Validate performs a stateless validation of a FeeSplit

type FeeSplitSharesProposal

type FeeSplitSharesProposal struct {
	Title       string   `json:"title" yaml:"title"`
	Description string   `json:"description" yaml:"description"`
	Shares      []Shares `json:"shares" yaml:"shares"`
}

func NewFeeSplitSharesProposal

func NewFeeSplitSharesProposal(title, description string, shares []Shares) FeeSplitSharesProposal

func (FeeSplitSharesProposal) GetDescription

func (fp FeeSplitSharesProposal) GetDescription() string

func (FeeSplitSharesProposal) GetTitle

func (fp FeeSplitSharesProposal) GetTitle() string

func (FeeSplitSharesProposal) ProposalRoute

func (fp FeeSplitSharesProposal) ProposalRoute() string

func (FeeSplitSharesProposal) ProposalType

func (fp FeeSplitSharesProposal) ProposalType() string

func (FeeSplitSharesProposal) String

func (fp FeeSplitSharesProposal) String() string

func (FeeSplitSharesProposal) ValidateBasic

func (fp FeeSplitSharesProposal) ValidateBasic() sdk.Error

type FeeSplitWithShare

type FeeSplitWithShare struct {
	ContractAddress   string  `json:"contract_address,omitempty"`
	DeployerAddress   string  `json:"deployer_address,omitempty"`
	WithdrawerAddress string  `json:"withdrawer_address,omitempty"`
	Share             sdk.Dec `json:"share,omitempty"`
}

type GenesisState

type GenesisState struct {
	// module parameters
	Params Params `json:"params"`
	// active registered contracts for fee distribution
	FeeSplits []FeeSplit `json:"fee_splits"`
}

GenesisState defines the module's genesis state.

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState sets default evm genesis state with empty accounts and default params and chain config values.

func NewGenesisState

func NewGenesisState(params Params, feeSplits []FeeSplit) GenesisState

NewGenesisState creates a new genesis state.

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

type GovKeeper

type GovKeeper interface {
	GetDepositParams(ctx sdk.Context) govtypes.DepositParams
	GetVotingParams(ctx sdk.Context) govtypes.VotingParams
}

GovKeeper defines the expected gov Keeper

type MsgCancelFeeSplit

type MsgCancelFeeSplit struct {
	// contract hex address
	ContractAddress string `json:"contract_address,omitempty"`
	// deployer bech32 address
	DeployerAddress string `json:"deployer_address,omitempty"`
}

MsgCancelFeeSplit defines a message that cancels a registered FeeSplit

func NewMsgCancelFeeSplit

func NewMsgCancelFeeSplit(
	contract common.Address,
	deployer sdk.AccAddress,
) MsgCancelFeeSplit

NewMsgCancelFeeSplit creates new instance of MsgCancelFeeSplit.

func (MsgCancelFeeSplit) GetSignBytes

func (msg MsgCancelFeeSplit) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgCancelFeeSplit) GetSigners

func (msg MsgCancelFeeSplit) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgCancelFeeSplit) Route

func (msg MsgCancelFeeSplit) Route() string

Route returns the message route for a MsgCancelFeeSplit.

func (MsgCancelFeeSplit) Type

func (msg MsgCancelFeeSplit) Type() string

Type returns the message type for a MsgCancelFeeSplit.

func (MsgCancelFeeSplit) ValidateBasic

func (msg MsgCancelFeeSplit) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type MsgRegisterFeeSplit

type MsgRegisterFeeSplit struct {
	// contract hex address
	ContractAddress string `json:"contract_address,omitempty"`
	// bech32 address of message sender, must be the same as the origin EOA
	// sending the transaction which deploys the contract
	DeployerAddress string `json:"deployer_address,omitempty"`
	// bech32 address of account receiving the transaction fees
	WithdrawerAddress string `json:"withdrawer_address,omitempty"`
	// array of nonces from the address path, where the last nonce is the nonce
	// that determines the contract's address - it can be an EOA nonce or a
	// factory contract nonce
	Nonces []uint64 `json:"nonces,omitempty"`
}

MsgRegisterFeeSplit defines a message that registers a FeeSplit

func NewMsgRegisterFeeSplit

func NewMsgRegisterFeeSplit(
	contract common.Address,
	deployer,
	withdrawer sdk.AccAddress,
	nonces []uint64,
) MsgRegisterFeeSplit

NewMsgRegisterFeeSplit creates new instance of MsgRegisterFeeSplit

func (MsgRegisterFeeSplit) GetSignBytes

func (msg MsgRegisterFeeSplit) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgRegisterFeeSplit) GetSigners

func (msg MsgRegisterFeeSplit) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgRegisterFeeSplit) Route

func (msg MsgRegisterFeeSplit) Route() string

Route returns the name of the module

func (MsgRegisterFeeSplit) Type

func (msg MsgRegisterFeeSplit) Type() string

Type returns the the action

func (MsgRegisterFeeSplit) ValidateBasic

func (msg MsgRegisterFeeSplit) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type MsgUpdateFeeSplit

type MsgUpdateFeeSplit struct {
	// contract hex address
	ContractAddress string `json:"contract_address,omitempty"`
	// deployer bech32 address
	DeployerAddress string `json:"deployer_address,omitempty"`
	// new withdrawer bech32 address for receiving the transaction fees
	WithdrawerAddress string `json:"withdrawer_address,omitempty"`
}

MsgUpdateFeeSplit defines a message that updates the withdrawer address for a registered FeeSplit

func NewMsgUpdateFeeSplit

func NewMsgUpdateFeeSplit(
	contract common.Address,
	deployer,
	withdraw sdk.AccAddress,
) MsgUpdateFeeSplit

NewMsgUpdateFeeSplit creates new instance of MsgUpdateFeeSplit

func (MsgUpdateFeeSplit) GetSignBytes

func (msg MsgUpdateFeeSplit) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgUpdateFeeSplit) GetSigners

func (msg MsgUpdateFeeSplit) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgUpdateFeeSplit) Route

func (msg MsgUpdateFeeSplit) Route() string

Route returns the name of the module

func (MsgUpdateFeeSplit) Type

func (msg MsgUpdateFeeSplit) Type() string

Type returns the the action

func (MsgUpdateFeeSplit) ValidateBasic

func (msg MsgUpdateFeeSplit) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type Params

type Params struct {
	// enable_fee_split defines a parameter to enable the feesplit module
	EnableFeeSplit bool `json:"enable_fee_split",yaml:"enable_fee_split"`
	// developer_shares defines the proportion of the transaction fees to be
	// distributed to the registered contract owner
	DeveloperShares sdk.Dec `json:"developer_shares",yaml:"developer_shares"`
	// addr_derivation_cost_create defines the cost of address derivation for
	// verifying the contract deployer at fee registration
	AddrDerivationCostCreate uint64 `json:"addr_derivation_cost_create",yaml:"addr_derivation_cost_create"`
}

Params defines the feesplit module params

func DefaultParams

func DefaultParams() Params

func NewParams

func NewParams(
	enableFeeSplit bool,
	developerShares sdk.Dec,
	addrDerivationCostCreate uint64,
) Params

NewParams creates a new Params object

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

ParamSetPairs returns the parameter set pairs.

func (Params) String

func (p Params) String() string

String implements the fmt.Stringer interface

func (Params) Validate

func (p Params) Validate() error

type QueryDeployerFeeSplitsRequest

type QueryDeployerFeeSplitsRequest struct {
	// deployer bech32 address
	DeployerAddress string `json:"deployer_address,omitempty"`
	// pagination defines an optional pagination for the request.
	Pagination *query.PageRequest `json:"pagination,omitempty"`
}

QueryDeployerFeeSplitsRequest is the request type for the Query/DeployerFeeSplits.

type QueryDeployerFeeSplitsResponse

type QueryDeployerFeeSplitsResponse struct {
	ContractAddresses []string `json:"contract_addresses,omitempty"`
	// pagination defines the pagination in the response.
	Pagination *query.PageResponse `json:"pagination,omitempty"`
}

QueryDeployerFeeSplitsResponse is the response type for the Query/DeployerFeeSplits.

type QueryDeployerFeeSplitsResponseV2

type QueryDeployerFeeSplitsResponseV2 struct {
	FeeSplits []FeeSplitWithShare `json:"fee_splits,omitempty"`
	// pagination defines the pagination in the response.
	Pagination *query.PageResponse `json:"pagination,omitempty"`
}

QueryDeployerFeeSplitsResponseV2 is the response type for the Query/DeployerFeeSplitsDetail.

type QueryFeeSplitRequest

type QueryFeeSplitRequest struct {
	// contract identifier is the hex contract address of a contract
	ContractAddress string `json:"contract_address,omitempty"`
}

QueryFeeSplitRequest is the request type for the Query/FeeSplit.

type QueryFeeSplitResponse

type QueryFeeSplitResponse struct {
	FeeSplit FeeSplitWithShare `json:"fee_split"`
}

QueryFeeSplitResponse is the response type for the Query/FeeSplit.

type QueryFeeSplitsRequest

type QueryFeeSplitsRequest struct {
	// pagination defines an optional pagination for the request.
	Pagination *query.PageRequest `json:"pagination,omitempty"`
}

QueryFeeSplitsRequest is the request type for the Query/FeeSplits.

type QueryFeeSplitsResponse

type QueryFeeSplitsResponse struct {
	FeeSplits []FeeSplitWithShare `json:"fee_splits"`
	// pagination defines the pagination in the response.
	Pagination *query.PageResponse `json:"pagination,omitempty"`
}

QueryFeeSplitsResponse is the response type for the Query/FeeSplits.

type QueryParamsRequest

type QueryParamsRequest struct {
}

QueryParamsRequest is the request type for the Query/Params.

type QueryParamsResponse

type QueryParamsResponse struct {
	Params Params `json:"params"`
}

QueryParamsResponse is the response type for the Query/Params.

type QueryWithdrawerFeeSplitsRequest

type QueryWithdrawerFeeSplitsRequest struct {
	// withdrawer bech32 address
	WithdrawerAddress string `json:"withdrawer_address,omitempty"`
	// pagination defines an optional pagination for the request.
	Pagination *query.PageRequest `json:"pagination,omitempty"`
}

QueryWithdrawerFeeSplitsRequest is the request type for the Query/WithdrawerFeeSplits.

type QueryWithdrawerFeeSplitsResponse

type QueryWithdrawerFeeSplitsResponse struct {
	ContractAddresses []string `json:"contract_addresses,omitempty"`
	// pagination defines the pagination in the response.
	Pagination *query.PageResponse `json:"pagination,omitempty"`
}

QueryWithdrawerFeeSplitsResponse is the response type for the Query/WithdrawerFeeSplits.

type Shares

type Shares struct {
	ContractAddr string  `json:"contract_addr" yaml:"contract_addr"`
	Share        sdk.Dec `json:"share" yaml:"share"`
}

type Subspace

type Subspace interface {
	GetParamSet(ctx sdk.Context, ps params.ParamSet)
	SetParamSet(ctx sdk.Context, ps params.ParamSet)
}

type SupplyKeeper

type SupplyKeeper interface {
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
}

SupplyKeeper defines the expected interface needed to retrieve account balances.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL