types

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeCreatePool             = "create_pool"
	EventTypeUpdatePool             = "update_pool"
	EventTypePausePool              = "pause_pool"
	EventTypeResumePool             = "resume_pool"
	EventTypeDepositCollateral      = "deposit_collateral"
	EventTypeWithdrawCollateral     = "withdraw_collateral"
	EventTypePurchaseShield         = "purchase_shield"
	EventTypeStakeForShield         = "stake_for_shield"
	EventTypeUnstakeFromShield      = "unstake_from_shield"
	EventTypeWithdrawRewards        = "withdraw_rewards"
	EventTypeWithdrawForeignRewards = "withdraw_foreign_rewards"
	EventTypeClearPayouts           = "clear_payouts"
	EventTypeCreateReimbursement    = "create_reimbursement"
	EventTypeWithdrawReimbursement  = "withdraw_reimbursement"
	EventTypeUpdateSponsor          = "update_sponsor"

	AttributeKeyShield              = "shield"
	AttributeKeyDeposit             = "deposit"
	AttributeKeySponsor             = "sponsor"
	AttributeKeySponsorAddress      = "sponsor_address"
	AttributeKeyPoolID              = "pool_id"
	AttributeKeyAdditionalTime      = "additional_time"
	AttributeKeyTimeOfCoverage      = "time_of_coverage"
	AttributeKeyBlocksOfCoverage    = "blocks_of_coverage"
	AttributeKeyCollateral          = "collateral"
	AttributeKeyDenom               = "denom"
	AttributeKeyToAddr              = "to_address"
	AttributeKeyAccountAddress      = "account_address"
	AttributeKeyAmount              = "amount"
	AttributeKeyPurchaseID          = "purchase_id"
	AttributeKeyCompensationAmount  = "compensation_amount"
	AttributeKeyBeneficiary         = "beneficiary"
	AttributeKeyPurchaseDescription = "purchase_description"
	AttributeKeyServiceFees         = "service_fees"
	AttributeKeyProtectionEndTime   = "protection_end_time"
	AttributeValueCategory          = ModuleName
)
View Source
const (
	// ModuleName is the name of this module.
	ModuleName = "shield"

	// RouterKey is used to route messages.
	RouterKey = ModuleName

	// StoreKey is the prefix under which we store this module's data.
	StoreKey = ModuleName

	// QuerierRoute is used to handle abci_query requests.
	QuerierRoute = ModuleName

	// DefaultParamspace is the default name for parameter store.
	DefaultParamspace = ModuleName
)
View Source
const (
	QueryPoolByID            = "pool_id"
	QueryPoolBySponsor       = "pool_sponsor"
	QueryPools               = "pools"
	QueryPurchase            = "purchase"
	QueryPurchaseList        = "purchase_list"
	QueryPurchaserPurchases  = "purchaser_purchases"
	QueryPoolPurchases       = "pool_purchases"
	QueryPurchases           = "purchases"
	QueryProviderCollaterals = "provider_collaterals"
	QueryPoolCollaterals     = "pool_collaterals"
	QueryProvider            = "provider"
	QueryProviders           = "providers"
	QueryPoolParams          = "pool_params"
	QueryClaimParams         = "claim_params"
	QueryStatus              = "status"
	QueryStakedForShield     = "staked_for_shield"
	QueryShieldStakingRate   = "shield_staking_rate"
	QueryReimbursement       = "reimbursement"
	QueryReimbursements      = "reimbursements"
)
View Source
const (
	// ProposalTypeShieldClaim defines the type for a ShieldClaimProposal.
	ProposalTypeShieldClaim = "ShieldClaim"
)

Variables

View Source
var (
	ErrNotShieldAdmin             = sdkerrors.Register(ModuleName, 101, "not the shield admin account")
	ErrNoDeposit                  = sdkerrors.Register(ModuleName, 102, "no coins given for initial deposit")
	ErrNoShield                   = sdkerrors.Register(ModuleName, 103, "no coins given for shield")
	ErrEmptySponsor               = sdkerrors.Register(ModuleName, 104, "no sponsor specified for a pool")
	ErrNoPoolFound                = sdkerrors.Register(ModuleName, 105, "no pool found")
	ErrNoUpdate                   = sdkerrors.Register(ModuleName, 106, "nothing was updated for the pool")
	ErrInvalidGenesis             = sdkerrors.Register(ModuleName, 107, "invalid genesis state")
	ErrInvalidPoolID              = sdkerrors.Register(ModuleName, 108, "invalid pool ID")
	ErrInvalidDuration            = sdkerrors.Register(ModuleName, 109, "invalid specification of coverage duration")
	ErrAdminWithdraw              = sdkerrors.Register(ModuleName, 110, "admin cannot manually withdraw collateral")
	ErrNoDelegationAmount         = sdkerrors.Register(ModuleName, 111, "cannot obtain delegation amount info")
	ErrInsufficientStaking        = sdkerrors.Register(ModuleName, 112, "insufficient total delegation amount to deposit the collateral")
	ErrPoolAlreadyPaused          = sdkerrors.Register(ModuleName, 113, "pool is already paused")
	ErrPoolAlreadyActive          = sdkerrors.Register(ModuleName, 114, "pool is already active")
	ErrPoolInactive               = sdkerrors.Register(ModuleName, 115, "pool is inactive")
	ErrPurchaseMissingDescription = sdkerrors.Register(ModuleName, 116, "missing description for the purchase")
	ErrNotEnoughShield            = sdkerrors.Register(ModuleName, 117, "not enough available shield")
	ErrNoPurchaseFound            = sdkerrors.Register(ModuleName, 118, "no purchase found for the given txhash")
	ErrNoRewards                  = sdkerrors.Register(ModuleName, 119, "no foreign coins rewards to transfer for the denomination")
	ErrInvalidDenom               = sdkerrors.Register(ModuleName, 120, "invalid coin denomination")
	ErrInvalidToAddr              = sdkerrors.Register(ModuleName, 121, "invalid recipient address")
	ErrNoCollateralFound          = sdkerrors.Register(ModuleName, 122, "no collateral for the pool found with the given provider address")
	ErrInvalidCollateralAmount    = sdkerrors.Register(ModuleName, 123, "invalid amount of collateral")
	ErrEmptySender                = sdkerrors.Register(ModuleName, 124, "no sender provided")
	ErrPoolLifeTooShort           = sdkerrors.Register(ModuleName, 125, "new pool life is too short")
	ErrPurchaseNotFound           = sdkerrors.Register(ModuleName, 126, "purchase is not found")
	ErrProviderNotFound           = sdkerrors.Register(ModuleName, 127, "provider is not found")
	ErrNotEnoughCollateral        = sdkerrors.Register(ModuleName, 128, "not enough collateral")
	ErrReimbursementNotFound      = sdkerrors.Register(ModuleName, 129, "reimbursement is not found")
	ErrInvalidBeneficiary         = sdkerrors.Register(ModuleName, 130, "invalid beneficiary")
	ErrNotPayoutTime              = sdkerrors.Register(ModuleName, 131, "has not reached payout time yet")
	ErrOverWithdraw               = sdkerrors.Register(ModuleName, 132, "too much withdraw initiated")
	ErrNoPoolFoundForSponsor      = sdkerrors.Register(ModuleName, 133, "no pool found for the given sponsor")
	ErrSponsorAlreadyExists       = sdkerrors.Register(ModuleName, 134, "a pool already exists under the given sponsor")
	ErrCollateralBadDenom         = sdkerrors.Register(ModuleName, 135, "invalid coin denomination for collateral")
	ErrSponsorPurchase            = sdkerrors.Register(ModuleName, 136, "pool sponsor cannot purchase shield")
	ErrOperationNotSupported      = sdkerrors.Register(ModuleName, 137, "operation is currently not supported")
	ErrPoolShieldExceedsLimit     = sdkerrors.Register(ModuleName, 138, "pool shield exceeds limit")
	ErrShieldAdminNotActive       = sdkerrors.Register(ModuleName, 139, "shield admin is not activated")
	ErrPurchaseTooSmall           = sdkerrors.Register(ModuleName, 140, "purchase amount is too small")
	ErrNotEnoughStaked            = sdkerrors.Register(ModuleName, 142, "not enough unlocked staking to be withdrawn")
)
View Source
var (
	ShieldAdminKey              = []byte{0x00}
	TotalCollateralKey          = []byte{0x01}
	TotalWithdrawingKey         = []byte{0x02}
	TotalShieldKey              = []byte{0x03}
	TotalClaimedKey             = []byte{0x04}
	ServiceFeesKey              = []byte{0x05}
	RemainingServiceFeesKey     = []byte{0x06}
	PoolKey                     = []byte{0x07}
	NextPoolIDKey               = []byte{0x08}
	NextPurchaseIDKey           = []byte{0x09}
	PurchaseListKey             = []byte{0x0A}
	PurchaseQueueKey            = []byte{0x0B}
	ProviderKey                 = []byte{0x0C}
	WithdrawQueueKey            = []byte{0x0D}
	LastUpdateTimeKey           = []byte{0x0E}
	GlobalStakeForShieldPoolKey = []byte{0x0F}
	StakeForShieldKey           = []byte{0x11}
	BlockServiceFeesKey         = []byte{0x12}
	OriginalStakingKey          = []byte{0x13}
	ReimbursementKey            = []byte{0x14}
)
View Source
var (
	// default values for Shield pool's parameters
	DefaultProtectionPeriod  = time.Hour * 24 * 21                                                   // 21 days
	DefaultShieldFeesRate    = sdk.NewDecWithPrec(769, 5)                                            // 0.769%
	DefaultWithdrawPeriod    = time.Hour * 24 * 21                                                   // 21 days
	DefaultPoolShieldLimit   = sdk.NewDecWithPrec(50, 2)                                             // 50%
	DefaultMinShieldPurchase = sdk.NewCoins(sdk.NewCoin(common.MicroCTKDenom, sdk.NewInt(50000000))) // 50 CTK

	// default values for Shield claim proposal's parameters
	DefaultClaimPeriod              = time.Hour * 24 * 21                                                    // 21 days
	DefaultPayoutPeriod             = time.Hour * 24 * 56                                                    // 56 days
	DefaultMinClaimProposalDeposit  = sdk.NewCoins(sdk.NewCoin(common.MicroCTKDenom, sdk.NewInt(100000000))) // 100 CTK
	DefaultClaimProposalDepositRate = sdk.NewDecWithPrec(10, 2)                                              // 10%
	DefaultClaimProposalFeesRate    = sdk.NewDecWithPrec(1, 2)                                               // 1%

	// default value for staking-shield rate parameter
	DefaultStakingShieldRate = sdk.NewDec(2)
)

default parameter values

View Source
var (
	ParamStoreKeyPoolParams          = []byte("shieldpoolparams")
	ParamStoreKeyClaimProposalParams = []byte("claimproposalparams")
	ParamStoreKeyStakingShieldRate   = []byte("stakingshieldrateparams")
)

parameter keys

View Source
var ModuleCdc *codec.Codec

ModuleCdc is the generic sealed codec to be used throughout module.

Functions

func DefaultStakingShieldRateParams added in v1.1.0

func DefaultStakingShieldRateParams() sdk.Dec

DefaultStakingShieldRateParams returns a default DefaultStakingShieldRateParams.

func GetBlockServiceFeesKey added in v1.1.0

func GetBlockServiceFeesKey() []byte

func GetGlobalStakeForShieldPoolKey added in v1.1.0

func GetGlobalStakeForShieldPoolKey() []byte

func GetLastUpdateTimeKey

func GetLastUpdateTimeKey() []byte

GetLastUpdateTimeKey gets the key for the last update time.

func GetNextPoolIDKey

func GetNextPoolIDKey() []byte

GetNextPoolIDKey gets the key for the next pool ID.

func GetNextPurchaseIDKey

func GetNextPurchaseIDKey() []byte

GetNextPurchaseIDKey gets the key for the next pool ID.

func GetOriginalStakingKey added in v1.1.0

func GetOriginalStakingKey(purchaseID uint64) []byte

func GetPoolKey

func GetPoolKey(id uint64) []byte

GetPoolKey gets the key for the pool identified by pool ID.

func GetProviderKey

func GetProviderKey(addr sdk.AccAddress) []byte

GetProviderKey gets the key for the delegator's tracker.

func GetPurchaseExpirationTimeKey

func GetPurchaseExpirationTimeKey(timestamp time.Time) []byte

GetPurchaseExpirationTimeKey gets a withdraw queue key, which is obtained from the expiration time.

func GetPurchaseListKey

func GetPurchaseListKey(id uint64, purchaser sdk.AccAddress) []byte

GetPurchaseTxHashKey gets the key for a purchase.

func GetReimbursementKey added in v1.1.0

func GetReimbursementKey(proposalID uint64) []byte

GetReimbursementKey gets the key for a reimbursement.

func GetRemainingServiceFeesKey

func GetRemainingServiceFeesKey() []byte

func GetServiceFeesKey

func GetServiceFeesKey() []byte

func GetShieldAdminKey

func GetShieldAdminKey() []byte

GetShieldAdminKey gets the key for the shield admin.

func GetStakeForShieldKey added in v1.1.0

func GetStakeForShieldKey(poolID uint64, purchaser sdk.AccAddress) []byte

func GetTotalClaimedKey added in v1.1.0

func GetTotalClaimedKey() []byte

func GetTotalCollateralKey

func GetTotalCollateralKey() []byte

func GetTotalShieldKey

func GetTotalShieldKey() []byte

func GetTotalWithdrawingKey

func GetTotalWithdrawingKey() []byte

func GetWithdrawCompletionTimeKey

func GetWithdrawCompletionTimeKey(timestamp time.Time) []byte

GetWithdrawCompletionTimeKey gets a withdraw queue key, which is obtained from the completion time.

func NewUnbondingDelegation

func NewUnbondingDelegation(delAddr sdk.AccAddress, valAddr sdk.ValAddress, entry stakingTypes.UnbondingDelegationEntry) staking.UnbondingDelegation

NewUnbondingDelegation returns a new UnbondingDelegation instance.

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable is the key declaration for parameters.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers the account types and interface.

func ValidateGenesis

func ValidateGenesis(bz json.RawMessage) error

ValidateGenesis validates shield genesis data.

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account
	SetAccount(ctx sdk.Context, acc authexported.Account)
	IterateAccounts(ctx sdk.Context, process func(authexported.Account) (stop bool))
}

AccountKeeper defines the expected account keeper.

type BankKeeper

type BankKeeper interface {
	SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
	DelegateCoins(ctx sdk.Context, fromAdd, toAddr sdk.AccAddress, amt sdk.Coins) error
	UndelegateCoins(ctx sdk.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error

	SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, error)
	AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, error)
}

BankKeeper defines the expected bank keeper.

type ClaimProposalParams

type ClaimProposalParams struct {
	ClaimPeriod  time.Duration `json:"claim_period" yaml:"claim_period"`
	PayoutPeriod time.Duration `json:"payout_period" yaml:"payout_period"`
	MinDeposit   sdk.Coins     `json:"min_deposit" json:"min_deposit"`
	DepositRate  sdk.Dec       `json:"deposit_rate" yaml:"deposit_rate"`
	FeesRate     sdk.Dec       `json:"fees_rate" yaml:"fees_rate"`
}

ClaimProposalParams defines the parameters for the shield claim proposals.

func DefaultClaimProposalParams

func DefaultClaimProposalParams() ClaimProposalParams

DefaultClaimProposalParams returns a default ClaimProposalParams instance.

func NewClaimProposalParams

func NewClaimProposalParams(claimPeriod, payoutPeriod time.Duration, minDeposit sdk.Coins, depositRate, feesRate sdk.Dec) ClaimProposalParams

NewClaimProposalParams creates a new ClaimProposalParams instance.

type GenesisState

type GenesisState struct {
	ShieldAdmin                  sdk.AccAddress                `json:"shield_admin" yaml:"shield_admin"`
	NextPoolID                   uint64                        `json:"next_pool_id" yaml:"next_pool_id"`
	NextPurchaseID               uint64                        `json:"next_purchase_id" yaml:"next_purchase_id"`
	PoolParams                   PoolParams                    `json:"pool_params" yaml:"pool_params"`
	ClaimProposalParams          ClaimProposalParams           `json:"claim_proposal_params" yaml:"claim_proposal_params"`
	TotalCollateral              sdk.Int                       `json:"total_collateral" yaml:"total_collateral"`
	TotalWithdrawing             sdk.Int                       `json:"total_withdrawing" yaml:"total_withdrawing"`
	TotalShield                  sdk.Int                       `json:"total_shield" yaml:"total_shield"`
	TotalClaimed                 sdk.Int                       `json:"total_claimed" yaml:"total_claimed"`
	ServiceFees                  MixedDecCoins                 `json:"service_fees" yaml:"service_fees"`
	RemainingServiceFees         MixedDecCoins                 `json:"remaining_service_fees" yaml:"remaining_service_fees"`
	Pools                        []Pool                        `json:"pools" yaml:"pools"`
	Providers                    []Provider                    `json:"providers" yaml:"providers"`
	PurchaseLists                []PurchaseList                `json:"purchases" yaml:"purchases"`
	Withdraws                    Withdraws                     `json:"withdraws" yaml:"withdraws"`
	LastUpdateTime               time.Time                     `json:"last_update_time" yaml:"last_update_time"`
	ShieldStakingRate            sdk.Dec                       `json:"shield_staking_rate" yaml:"shield_staking_rate"`
	GlobalStakingPool            sdk.Int                       `json:"global_staking_pool" yaml:"global_staking_pool"`
	StakeForShields              []ShieldStaking               `json:"staking_purchases" yaml:"staking_purchases"`
	OriginalStakings             []OriginalStaking             `json:"original_stakings" yaml:"original_stakings"`
	ProposalIDReimbursementPairs []ProposalIDReimbursementPair `json:"proposalID_reimbursement_pairs" yaml:"proposalID_reimbursement_pairs"`
}

GenesisState defines the shield genesis state.

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState returns a default genesis state.

func GetGenesisStateFromAppState

func GetGenesisStateFromAppState(cdc *codec.Codec, appState map[string]json.RawMessage) GenesisState

GetGenesisStateFromAppState returns GenesisState given raw application genesis state.

func NewGenesisState

func NewGenesisState(shieldAdmin sdk.AccAddress, nextPoolID, nextPurchaseID uint64, poolParams PoolParams,
	claimProposalParams ClaimProposalParams, totalCollateral, totalWithdrawing, totalShield, totalClaimed sdk.Int, serviceFees, remainingServiceFees MixedDecCoins,
	pools []Pool, providers []Provider, purchase []PurchaseList, withdraws Withdraws, lastUpdateTime time.Time, sSRate sdk.Dec, globalStakingPool sdk.Int,
	stakingPurchases []ShieldStaking, originalStaking []OriginalStaking, proposalIDReimbursementPairs []ProposalIDReimbursementPair) GenesisState

NewGenesisState creates a new genesis state.

type GovKeeper

type GovKeeper interface {
	GetVotingParams(ctx sdk.Context) govTypes.VotingParams
}

GovKeeper defines the expected gov keeper.

type LockedCollateral

type LockedCollateral struct {
	ProposalID uint64  `json:"proposal_id" yaml:"proposal_id"`
	Amount     sdk.Int `json:"locked_coins" yaml:"locked_coins"`
}

LockedCollateral defines the data type of locked collateral for a claim proposal.

func NewLockedCollateral

func NewLockedCollateral(proposalID uint64, lockedAmt sdk.Int) LockedCollateral

NewLockedCollateral returns a new LockedCollateral instance.

type MixedCoins

type MixedCoins struct {
	Native  sdk.Coins
	Foreign sdk.Coins
}

MixedCoins defines the struct for mixed coins with native and foreign coins.

func (MixedCoins) Add

func (mc MixedCoins) Add(a MixedCoins) MixedCoins

Add implements the add method of MixedCoins.

func (MixedCoins) String

func (mc MixedCoins) String() string

String implements the Stringer for MixedCoins.

type MixedDecCoins

type MixedDecCoins struct {
	Native  sdk.DecCoins `json:"native" yaml:"native"`
	Foreign sdk.DecCoins `json:"foreign" yaml:"foreign"`
}

MixedDecCoins defines the struct for mixed coins in decimal with native and foreign decimal coins.

func InitMixedDecCoins

func InitMixedDecCoins() MixedDecCoins

InitMixedDecCoins initialize an empty mixed decimal coins instance.

func MixedDecCoinsFromMixedCoins

func MixedDecCoinsFromMixedCoins(mc MixedCoins) MixedDecCoins

MixedDecCoinsFromMixedCoins converts MixedCoins to MixedDecCoins.

func NewMixedDecCoins

func NewMixedDecCoins(native, foreign sdk.DecCoins) MixedDecCoins

NewMixedDecCoins returns a new mixed decimal coins instance.

func (MixedDecCoins) Add

Add adds two MixedDecCoins type coins together.

func (MixedDecCoins) MulDec

func (mdc MixedDecCoins) MulDec(d sdk.Dec) MixedDecCoins

MulDec multiplies native and foreign coins by a decimal.

func (MixedDecCoins) QuoDec

func (mdc MixedDecCoins) QuoDec(d sdk.Dec) MixedDecCoins

QuoDec divides native and foreign coins by a decimal.

func (MixedDecCoins) String

func (mdc MixedDecCoins) String() string

String implements the Stringer for MixedDecCoins.

func (MixedDecCoins) Sub

Sub calculates the difference between two mixed dec coins.

type MsgClearPayouts

type MsgClearPayouts struct {
	From  sdk.AccAddress `json:"sender" yaml:"sender"`
	Denom string         `json:"denom" yaml:"denom"`
}

MsgClearPayouts defines attributes of clear payouts transaction.

func NewMsgClearPayouts

func NewMsgClearPayouts(sender sdk.AccAddress, denom string) MsgClearPayouts

NewMsgClearPayouts creates a new MsgClearPayouts instance.

func (MsgClearPayouts) GetSignBytes

func (msg MsgClearPayouts) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface.

func (MsgClearPayouts) GetSigners

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

GetSigners implements the sdk.Msg interface.

func (MsgClearPayouts) Route

func (msg MsgClearPayouts) Route() string

Route implements the sdk.Msg interface.

func (MsgClearPayouts) Type

func (msg MsgClearPayouts) Type() string

Type implements the sdk.Msg interface.

func (MsgClearPayouts) ValidateBasic

func (msg MsgClearPayouts) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

type MsgCreatePool

type MsgCreatePool struct {
	From        sdk.AccAddress `json:"from" yaml:"from"`
	Shield      sdk.Coins      `json:"shield" yaml:"shield"`
	Deposit     MixedCoins     `json:"deposit" yaml:"deposit"`
	Sponsor     string         `json:"sponsor" yaml:"sponsor"`
	SponsorAddr sdk.AccAddress `json:"sponsor_addr" yaml:"sponsor_addr"`
	Description string         `json:"description" yaml:"description"`
	ShieldLimit sdk.Int        `json:"shield_limit" yaml:"shield_limit"`
}

MsgCreatePool defines the attributes of a create-pool transaction.

func NewMsgCreatePool

func NewMsgCreatePool(accAddr sdk.AccAddress, shield sdk.Coins, deposit MixedCoins, sponsor string, sponsorAddr sdk.AccAddress, description string, shieldLimit sdk.Int) MsgCreatePool

NewMsgCreatePool creates a new NewMsgCreatePool instance.

func (MsgCreatePool) GetSignBytes

func (msg MsgCreatePool) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface.

func (MsgCreatePool) GetSigners

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

GetSigners implements the sdk.Msg interface.

func (MsgCreatePool) Route

func (msg MsgCreatePool) Route() string

Route implements the sdk.Msg interface.

func (MsgCreatePool) Type

func (msg MsgCreatePool) Type() string

Type implements the sdk.Msg interface.

func (MsgCreatePool) ValidateBasic

func (msg MsgCreatePool) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

type MsgDepositCollateral

type MsgDepositCollateral struct {
	From       sdk.AccAddress `json:"sender" yaml:"sender"`
	Collateral sdk.Coins      `json:"collateral" yaml:"collateral"`
}

MsgDepositCollateral defines the attributes of a depositing collaterals.

func NewMsgDepositCollateral

func NewMsgDepositCollateral(sender sdk.AccAddress, collateral sdk.Coins) MsgDepositCollateral

NewMsgDepositCollateral creates a new MsgDepositCollateral instance.

func (MsgDepositCollateral) GetSignBytes

func (msg MsgDepositCollateral) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface.

func (MsgDepositCollateral) GetSigners

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

GetSigners implements the sdk.Msg interface.

func (MsgDepositCollateral) Route

func (msg MsgDepositCollateral) Route() string

Route implements the sdk.Msg interface.

func (MsgDepositCollateral) Type

func (msg MsgDepositCollateral) Type() string

Type implements the sdk.Msg interface.

func (MsgDepositCollateral) ValidateBasic

func (msg MsgDepositCollateral) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

type MsgPausePool

type MsgPausePool struct {
	From   sdk.AccAddress `json:"from" yaml:"from"`
	PoolID uint64         `json:"pool_id" yaml:"pool_id"`
}

MsgPausePool defines the attributes of a pausing a shield pool.

func NewMsgPausePool

func NewMsgPausePool(accAddr sdk.AccAddress, id uint64) MsgPausePool

NewMsgPausePool creates a new NewMsgPausePool instance.

func (MsgPausePool) GetSignBytes

func (msg MsgPausePool) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface.

func (MsgPausePool) GetSigners

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

GetSigners implements the sdk.Msg interface.

func (MsgPausePool) Route

func (msg MsgPausePool) Route() string

Route implements the sdk.Msg interface.

func (MsgPausePool) Type

func (msg MsgPausePool) Type() string

Type implements the sdk.Msg interface.

func (MsgPausePool) ValidateBasic

func (msg MsgPausePool) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

type MsgPurchaseShield

type MsgPurchaseShield struct {
	PoolID      uint64         `json:"pool_id" yaml:"pool_id"`
	Shield      sdk.Coins      `json:"shield" yaml:"shield"`
	Description string         `json:"description" yaml:"description"`
	From        sdk.AccAddress `json:"from" yaml:"from"`
}

MsgPurchaseShield defines the attributes of purchase shield transaction.

func NewMsgPurchaseShield

func NewMsgPurchaseShield(poolID uint64, shield sdk.Coins, description string, from sdk.AccAddress) MsgPurchaseShield

NewMsgPurchaseShield creates a new MsgPurchaseShield instance.

func (MsgPurchaseShield) GetSignBytes

func (msg MsgPurchaseShield) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface.

func (MsgPurchaseShield) GetSigners

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

GetSigners implements the sdk.Msg interface.

func (MsgPurchaseShield) Route

func (msg MsgPurchaseShield) Route() string

Route implements the sdk.Msg interface.

func (MsgPurchaseShield) Type

func (msg MsgPurchaseShield) Type() string

Type implements the sdk.Msg interface.

func (MsgPurchaseShield) ValidateBasic

func (msg MsgPurchaseShield) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

type MsgResumePool

type MsgResumePool struct {
	From   sdk.AccAddress `json:"from" yaml:"from"`
	PoolID uint64         `json:"pool_id" yaml:"pool_id"`
}

MsgResumePool defines the attributes of a resuming a shield pool.

func NewMsgResumePool

func NewMsgResumePool(accAddr sdk.AccAddress, id uint64) MsgResumePool

NewMsgResumePool creates a new NewMsgResumePool instance.

func (MsgResumePool) GetSignBytes

func (msg MsgResumePool) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface.

func (MsgResumePool) GetSigners

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

GetSigners implements the sdk.Msg interface.

func (MsgResumePool) Route

func (msg MsgResumePool) Route() string

Route implements the sdk.Msg interface.

func (MsgResumePool) Type

func (msg MsgResumePool) Type() string

Type implements the sdk.Msg interface.

func (MsgResumePool) ValidateBasic

func (msg MsgResumePool) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

type MsgStakeForShield added in v1.1.0

type MsgStakeForShield struct {
	PoolID      uint64         `json:"pool_id" yaml:"pool_id"`
	Shield      sdk.Coins      `json:"shield" yaml:"shield"`
	Description string         `json:"description" yaml:"description"`
	From        sdk.AccAddress `json:"from" yaml:"from"`
}

TODO: eliminate this msg type MsgStakeForShield defines the attributes of staking for purchase transaction.

func NewMsgStakeForShield added in v1.1.0

func NewMsgStakeForShield(poolID uint64, shield sdk.Coins, description string, from sdk.AccAddress) MsgStakeForShield

NewMsgStakeForShield creates a new MsgPurchaseShield instance.

func (MsgStakeForShield) GetSignBytes added in v1.1.0

func (msg MsgStakeForShield) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface.

func (MsgStakeForShield) GetSigners added in v1.1.0

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

GetSigners implements the sdk.Msg interface.

func (MsgStakeForShield) Route added in v1.1.0

func (msg MsgStakeForShield) Route() string

Route implements the sdk.Msg interface.

func (MsgStakeForShield) Type added in v1.1.0

func (msg MsgStakeForShield) Type() string

Type implements the sdk.Msg interface.

func (MsgStakeForShield) ValidateBasic added in v1.1.0

func (msg MsgStakeForShield) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

type MsgUnstakeFromShield added in v1.1.0

type MsgUnstakeFromShield struct {
	PoolID uint64         `json:"pool_id" yaml:"pool_id"`
	Shield sdk.Coins      `json:"shield" yaml:"shield"`
	From   sdk.AccAddress `json:"from" yaml:"from"`
}

MsgUnstakeFromShield defines the attributes of staking for purchase transaction.

func NewMsgUnstakeFromShield added in v1.1.0

func NewMsgUnstakeFromShield(poolID uint64, shield sdk.Coins, from sdk.AccAddress) MsgUnstakeFromShield

NewMsgUnstakeFromShield creates a new MsgPurchaseShield instance.

func (MsgUnstakeFromShield) GetSignBytes added in v1.1.0

func (msg MsgUnstakeFromShield) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface.

func (MsgUnstakeFromShield) GetSigners added in v1.1.0

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

GetSigners implements the sdk.Msg interface.

func (MsgUnstakeFromShield) Route added in v1.1.0

func (msg MsgUnstakeFromShield) Route() string

Route implements the sdk.Msg interface.

func (MsgUnstakeFromShield) Type added in v1.1.0

func (msg MsgUnstakeFromShield) Type() string

Type implements the sdk.Msg interface.

func (MsgUnstakeFromShield) ValidateBasic added in v1.1.0

func (msg MsgUnstakeFromShield) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

type MsgUpdatePool

type MsgUpdatePool struct {
	From        sdk.AccAddress `json:"from" yaml:"from"`
	Shield      sdk.Coins      `json:"Shield" yaml:"Shield"`
	ServiceFees MixedCoins     `json:"service_fees" yaml:"service_fees"`
	PoolID      uint64         `json:"pool_id" yaml:"pool_id"`
	Description string         `json:"description" yaml:"description"`
	ShieldLimit sdk.Int        `json:"shield_limit" yaml:"shield_limit"`
}

MsgUpdatePool defines the attributes of a shield pool update transaction.

func NewMsgUpdatePool

func NewMsgUpdatePool(accAddr sdk.AccAddress, shield sdk.Coins, serviceFees MixedCoins, id uint64, description string, shieldLimit sdk.Int) MsgUpdatePool

NewMsgUpdatePool creates a new MsgUpdatePool instance.

func (MsgUpdatePool) GetSignBytes

func (msg MsgUpdatePool) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface.

func (MsgUpdatePool) GetSigners

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

GetSigners implements the sdk.Msg interface.

func (MsgUpdatePool) Route

func (msg MsgUpdatePool) Route() string

Route implements the sdk.Msg interface.

func (MsgUpdatePool) Type

func (msg MsgUpdatePool) Type() string

Type implements the sdk.Msg interface.

func (MsgUpdatePool) ValidateBasic

func (msg MsgUpdatePool) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

type MsgUpdateSponsor added in v1.1.0

type MsgUpdateSponsor struct {
	PoolID      uint64         `json:"pool_id" yaml:"pool_id"`
	Sponsor     string         `json:"sponsor" yaml:"sponsor"`
	SponsorAddr sdk.AccAddress `json:"sponsor_addr" yaml:"sponsor_addr"`
	FromAddr    sdk.AccAddress `json:"from" yaml:"from"`
}

MsgUpdateSponsor defines the attributes of a update-sponsor transaction.

func NewMsgUpdateSponsor added in v1.1.0

func NewMsgUpdateSponsor(poolID uint64, sponsor string, sponsorAddr, fromAddr sdk.AccAddress) MsgUpdateSponsor

NewMsgUpdateSponsor creates a new NewMsgUpdateSponsor instance.

func (MsgUpdateSponsor) GetSignBytes added in v1.1.0

func (msg MsgUpdateSponsor) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface.

func (MsgUpdateSponsor) GetSigners added in v1.1.0

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

GetSigners implements the sdk.Msg interface.

func (MsgUpdateSponsor) Route added in v1.1.0

func (msg MsgUpdateSponsor) Route() string

Route implements the sdk.Msg interface.

func (MsgUpdateSponsor) Type added in v1.1.0

func (msg MsgUpdateSponsor) Type() string

Type implements the sdk.Msg interface.

func (MsgUpdateSponsor) ValidateBasic added in v1.1.0

func (msg MsgUpdateSponsor) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

type MsgWithdrawCollateral

type MsgWithdrawCollateral struct {
	From       sdk.AccAddress `json:"sender" yaml:"sender"`
	Collateral sdk.Coins      `json:"collateral" yaml:"collateral"`
}

NewMsgWithdrawCollateral defines the attributes of a withdrawing collaterals.

func NewMsgWithdrawCollateral

func NewMsgWithdrawCollateral(sender sdk.AccAddress, collateral sdk.Coins) MsgWithdrawCollateral

NewMsgDepositCollateral creates a new MsgDepositCollateral instance.

func (MsgWithdrawCollateral) GetSignBytes

func (msg MsgWithdrawCollateral) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface.

func (MsgWithdrawCollateral) GetSigners

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

GetSigners implements the sdk.Msg interface.

func (MsgWithdrawCollateral) Route

func (msg MsgWithdrawCollateral) Route() string

Route implements the sdk.Msg interface.

func (MsgWithdrawCollateral) Type

func (msg MsgWithdrawCollateral) Type() string

Type implements the sdk.Msg interface.

func (MsgWithdrawCollateral) ValidateBasic

func (msg MsgWithdrawCollateral) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

type MsgWithdrawForeignRewards

type MsgWithdrawForeignRewards struct {
	From   sdk.AccAddress `json:"sender" yaml:"sender"`
	Denom  string         `json:"denom" yaml:"denom"`
	ToAddr string         `json:"to_addr" yaml:"to_addr"`
}

MsgWithdrawForeignRewards defines attributes of withdraw foreign rewards transaction.

func NewMsgWithdrawForeignRewards

func NewMsgWithdrawForeignRewards(sender sdk.AccAddress, denom, toAddr string) MsgWithdrawForeignRewards

NewMsgWithdrawForeignRewards creates a new MsgWithdrawForeignRewards instance.

func (MsgWithdrawForeignRewards) GetSignBytes

func (msg MsgWithdrawForeignRewards) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface.

func (MsgWithdrawForeignRewards) GetSigners

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

GetSigners implements the sdk.Msg interface

func (MsgWithdrawForeignRewards) Route

func (msg MsgWithdrawForeignRewards) Route() string

Route implements the sdk.Msg interface.

func (MsgWithdrawForeignRewards) Type

func (msg MsgWithdrawForeignRewards) Type() string

Type implements the sdk.Msg interface

func (MsgWithdrawForeignRewards) ValidateBasic

func (msg MsgWithdrawForeignRewards) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

type MsgWithdrawReimbursement

type MsgWithdrawReimbursement struct {
	ProposalID uint64         `json:"proposal_id" yaml:"proposal_id"`
	From       sdk.AccAddress `json:"from" yaml:"from"`
}

MsgWithdrawReimburse defines the attributes of withdraw reimbursement transaction.

func NewMsgWithdrawReimbursement

func NewMsgWithdrawReimbursement(proposalID uint64, from sdk.AccAddress) MsgWithdrawReimbursement

NewMsgWithdrawReimbursement creates a new MsgWithdrawReimbursement instance.

func (MsgWithdrawReimbursement) GetSignBytes

func (msg MsgWithdrawReimbursement) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface.

func (MsgWithdrawReimbursement) GetSigners

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

GetSigners implements the sdk.Msg interface.

func (MsgWithdrawReimbursement) Route

func (msg MsgWithdrawReimbursement) Route() string

Route implements the sdk.Msg interface.

func (MsgWithdrawReimbursement) Type

func (msg MsgWithdrawReimbursement) Type() string

Type implements the sdk.Msg interface.

func (MsgWithdrawReimbursement) ValidateBasic

func (msg MsgWithdrawReimbursement) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

type MsgWithdrawRewards

type MsgWithdrawRewards struct {
	From sdk.AccAddress `json:"sender" yaml:"sender"`
}

MsgWithdrawForeignRewards defines attribute of withdraw rewards transaction.

func NewMsgWithdrawRewards

func NewMsgWithdrawRewards(sender sdk.AccAddress) MsgWithdrawRewards

NewMsgWithdrawRewards creates a new MsgWithdrawRewards instance.

func (MsgWithdrawRewards) GetSignBytes

func (msg MsgWithdrawRewards) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface.

func (MsgWithdrawRewards) GetSigners

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

GetSigners implements the sdk.Msg interface.

func (MsgWithdrawRewards) Route

func (msg MsgWithdrawRewards) Route() string

Route implements the sdk.Msg interface.

func (MsgWithdrawRewards) Type

func (msg MsgWithdrawRewards) Type() string

Type implements the sdk.Msg interface.

func (MsgWithdrawRewards) ValidateBasic

func (msg MsgWithdrawRewards) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

type OriginalStaking added in v1.1.0

type OriginalStaking struct {
	PurchaseID uint64
	Amount     sdk.Int
}

func NewOriginalStaking added in v1.1.0

func NewOriginalStaking(purchaser uint64, amount sdk.Int) OriginalStaking

type Pool

type Pool struct {
	// ID is the id of the pool.
	ID uint64 `json:"id" yaml:"id"`

	// Description is the term of the pool.
	Description string `json:"description" yaml:"description"`

	// Sponsor is the project owner of the pool.
	Sponsor string `json:"sponsor" yaml:"sponsor"`

	// SponsorAddress is the CertiK Chain address of the sponsor.
	SponsorAddress sdk.AccAddress `json:"sponsor_address" yaml:"sponsor_address"`

	// ShieldLimit is the maximum shield can be purchased for the pool.
	ShieldLimit sdk.Int `json:"shield_limit" yaml:"shield_limit"`

	// Active means new purchases are allowed.
	Active bool `json:"active" yaml:"active"`

	// Shield is the amount of all active purchased shields.
	Shield sdk.Int `json:"shield" yaml:"shield"`
}

Pool contains a shield project pool's data.

func NewPool

func NewPool(id uint64, description, sponsor string, sponsorAddress sdk.AccAddress, shieldLimit sdk.Int, shield sdk.Int) Pool

NewPool creates a new project pool.

type PoolParams

type PoolParams struct {
	ProtectionPeriod  time.Duration `json:"protection_period" yaml:"protection_period"`
	ShieldFeesRate    sdk.Dec       `json:"shield_fees_rate" yaml:"shield_fees_rate"`
	WithdrawPeriod    time.Duration `json:"withdraw_period" yaml:"withdraw_period"`
	PoolShieldLimit   sdk.Dec       `json:"pool_shield_limit" yaml:"pool_shield_limit"`
	MinShieldPurchase sdk.Coins     `json:"min_shield_purchase" yaml:"min_shield_purchase"`
}

PoolParams defines the parameters for the shield pool.

func DefaultPoolParams

func DefaultPoolParams() PoolParams

DefaultPoolParams returns a default PoolParams instance.

func NewPoolParams

func NewPoolParams(protectionPeriod, withdrawPeriod time.Duration, shieldFeesRate sdk.Dec, poolShieldLimit sdk.Dec, minShieldPurchase sdk.Coins) PoolParams

NewPoolParams creates a new PoolParams object.

type PoolPurchaser

type PoolPurchaser struct {
	// PoolID is the id of the shield pool.
	PoolID uint64

	// Purchaser is the chain address of the purchaser.
	Purchaser sdk.AccAddress
}

PoolPurchase is a pair of pool id and purchaser.

type ProposalIDReimbursementPair added in v1.1.0

type ProposalIDReimbursementPair struct {
	ProposalID    uint64
	Reimbursement Reimbursement
}

ProposalIDReimbursementPair stores information of a reimbursement and corresponding proposal ID.

func NewProposalIDReimbursementPair added in v1.1.0

func NewProposalIDReimbursementPair(proposalID uint64, reimbursement Reimbursement) ProposalIDReimbursementPair

NewProposalIDReimbursementPair returns a new ProposalIDReimbursementPair instance.

type Provider

type Provider struct {
	// Address is the address of the provider.
	Address sdk.AccAddress `json:"address" yaml:"address"`

	// DelegationBonded is the amount of bonded delegation.
	DelegationBonded sdk.Int `json:"delegation_bonded" yaml:"delegation_bonded"`

	// Collateral is amount of all collaterals for the provider, including
	// those in withdraw queue but excluding those currently locked, in all
	// pools.
	Collateral sdk.Int `json:"collateral" yaml:"collateral"`

	// TotalLocked is the amount locked for pending claims.
	TotalLocked sdk.Int `json:"total_locked" yaml:"total_locked"`

	// Withdrawing is the amount of collateral in withdraw queues.
	Withdrawing sdk.Int `json:"withdrawing" yaml:"withdrawing"`

	// Rewards is the pooling rewards to be collected.
	Rewards MixedDecCoins `json:"rewards" yaml:"rewards"`
}

Provider tracks total delegation, total collateral, and rewards of a provider.

func NewProvider

func NewProvider(addr sdk.AccAddress) Provider

NewProvider creates a new provider object.

type Purchase

type Purchase struct {
	// PurchaseID is the purchase_id.
	PurchaseID uint64 `json:"purchase_id" yaml:"purchase_id"`

	// ProtectionEndTime is the time when the protection of the shield ends.
	ProtectionEndTime time.Time `json:"protection_end_time" yaml:"protection_end_time"`

	// DeletionTime is the time when the purchase should be deleted.
	DeletionTime time.Time `json:"deletion_time" yaml:"deletion_time"`

	// Description is the information about the protected asset.
	Description string `json:"description" yaml:"description"`

	// Shield is the unused amount of shield purchased.
	Shield sdk.Int `json:"shield" yaml:"shield"`

	// ServiceFees is the service fees paid by this purchase.
	ServiceFees MixedDecCoins `json:"service_fees" yaml:"service_fees"`
}

Purchase record an individual purchase.

func NewPurchase

func NewPurchase(purchaseID uint64, protectionEndTime, deletionTime time.Time, description string, shield sdk.Int, serviceFees MixedDecCoins) Purchase

NewPurchase creates a new purchase object.

type PurchaseList

type PurchaseList struct {
	// PoolID is the id of the shield of the purchase.
	PoolID uint64 `json:"pool_id" yaml:"pool_id"`

	// Purchaser is the address making the purchase.
	Purchaser sdk.AccAddress `json:"purchaser" yaml:"purchaser"`

	// Entries stores all purchases by the purchaser in the pool.
	Entries []Purchase `json:"entries" yaml:"entries"`
}

PurchaseList is a collection of purchase.

func NewPurchaseList

func NewPurchaseList(poolID uint64, purchaser sdk.AccAddress, purchases []Purchase) PurchaseList

NewPurchaseList creates a new purchase list.

type QueryPaginationParams

type QueryPaginationParams struct {
	Page  int
	Limit int
}

QueryPaginationParams provides basic pagination parameters for queries in shield module.

func NewQueryPaginationParams

func NewQueryPaginationParams(page, limit int) QueryPaginationParams

NewQueryPaginationParams creates new instance of the QueryPaginationParams.

type QueryResStatus

type QueryResStatus struct {
	TotalCollateral         sdk.Int       `json:"total_collateral" yaml:"total_collateral"`
	TotalShield             sdk.Int       `json:"total_shield" yaml:"total_shield"`
	TotalWithdrawing        sdk.Int       `json:"total_withdrawing" yaml:"total_withdrawing"`
	CurrentServiceFees      MixedDecCoins `json:"current_service_fees" yaml:"current_service_fees"`
	RemainingServiceFees    MixedDecCoins `json:"remaining_service_fees" yaml:"remaining_service_fees"`
	GlobalShieldStakingPool sdk.Int       `json:"global_shield_staking_pool" yaml:"global_shield_staking_pool"`
}

func NewQueryResStatus

func NewQueryResStatus(totalCollateral, totalShield, totalWithdrawing sdk.Int, currentServiceFees, remainingServiceFees MixedDecCoins,
	globalStakingPool sdk.Int) QueryResStatus

type Reimbursement

type Reimbursement struct {
	Amount      sdk.Coins      `json:"amount" yaml:"amount"`
	Beneficiary sdk.AccAddress `json:"beneficiary" yaml:"beneficiary"`
	PayoutTime  time.Time      `json:"payout_time" yaml:"payout_time"`
}

Reimbursement stores information of a reimbursement.

func NewReimbursement

func NewReimbursement(amount sdk.Coins, beneficiary sdk.AccAddress, payoutTime time.Time) Reimbursement

NewReimbursement returns a new Reimbursement instance.

type ShieldClaimProposal

type ShieldClaimProposal struct {
	ProposalID  uint64         `json:"proposal_id" yaml:"proposal_id"`
	PoolID      uint64         `json:"pool_id" yaml:"pool_id"`
	PurchaseID  uint64         `json:"purchase_id" yaml:"purchase_id"`
	Loss        sdk.Coins      `json:"loss" yaml:"loss"`
	Evidence    string         `json:"evidence" yaml:"evidence"`
	Description string         `json:"description" yaml:"description"`
	Proposer    sdk.AccAddress `json:"proposer" yaml:"proposer"`
}

ShieldClaimProposal defines the data structure of a shield claim proposal.

func NewShieldClaimProposal

func NewShieldClaimProposal(poolID uint64, loss sdk.Coins, purchaseID uint64, evidence, description string, proposer sdk.AccAddress) ShieldClaimProposal

NewShieldClaimProposal creates a new shield claim proposal.

func (ShieldClaimProposal) GetDescription

func (scp ShieldClaimProposal) GetDescription() string

GetDescription returns the description of a shield claim proposal.

func (ShieldClaimProposal) GetTitle

func (scp ShieldClaimProposal) GetTitle() string

GetTitle returns the title of a shield claim proposal.

func (ShieldClaimProposal) ProposalRoute

func (scp ShieldClaimProposal) ProposalRoute() string

GetDescription returns the routing key of a shield claim proposal.

func (ShieldClaimProposal) ProposalType

func (scp ShieldClaimProposal) ProposalType() string

ProposalType returns the type of a shield claim proposal.

func (ShieldClaimProposal) String

func (scp ShieldClaimProposal) String() string

String implements the Stringer interface.

func (ShieldClaimProposal) ValidateBasic

func (scp ShieldClaimProposal) ValidateBasic() error

ValidateBasic runs basic stateless validity checks.

type ShieldStaking added in v1.1.0

type ShieldStaking struct {
	PoolID            uint64         `json:"pool_id" yaml:"pool_id"`
	Purchaser         sdk.AccAddress `json:"purchaser" yaml:"purchaser"`
	Amount            sdk.Int        `json:"amount" yaml:"amount"`
	WithdrawRequested sdk.Int        `json:"withdraw_requested" yaml:"withdraw_requested"`
}

func NewShieldStaking added in v1.1.0

func NewShieldStaking(poolID uint64, purchaser sdk.AccAddress, amount sdk.Int) ShieldStaking

type StakingKeeper

type StakingKeeper interface {
	// IterateValidators iterates through validators by admin address, execute func for each validator.
	IterateValidators(sdk.Context, func(index int64, validator stakingexported.ValidatorI) (stop bool))

	// GetValidator gets a particular validator by admin address with a found flag.
	GetValidator(sdk.Context, sdk.ValAddress) (staking.Validator, bool)
	// GetAllValidators gets the set of all validators with no limits, used during genesis dump.
	GetAllValidators(ctx sdk.Context) []staking.Validator
	// GetValidatorDelegations returns all delegations to a specific validator. Useful for querier.
	GetValidatorDelegations(ctx sdk.Context, valAddr sdk.ValAddress) []staking.Delegation

	// Delegation allows for getting a particular delegation for a given validator
	// and delegator outside the scope of the staking module.
	Delegation(sdk.Context, sdk.AccAddress, sdk.ValAddress) stakingexported.DelegationI
	GetAllDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress) []staking.Delegation
	GetAllUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAddress) []staking.UnbondingDelegation
	GetUnbondingDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (staking.UnbondingDelegation, bool)
	SetUnbondingDelegation(ctx sdk.Context, ubd staking.UnbondingDelegation)
	RemoveUnbondingDelegation(ctx sdk.Context, ubd staking.UnbondingDelegation)
	GetUBDQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (dvPairs []staking.DVPair)
	SetUBDQueueTimeSlice(ctx sdk.Context, timestamp time.Time, timeslice []staking.DVPair)
	InsertUBDQueue(ctx sdk.Context, ubd staking.UnbondingDelegation, completionTime time.Time)
	SetDelegation(ctx sdk.Context, delegation staking.Delegation)
	GetDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (staking.Delegation, bool)
	BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
	AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
	UBDQueueIterator(ctx sdk.Context, timestamp time.Time) sdk.Iterator
	RemoveValidatorTokensAndShares(ctx sdk.Context, validator staking.Validator, sharesToRemove sdk.Dec) (valOut staking.Validator, removedTokens sdk.Int)
	RemoveUBDQueue(ctx sdk.Context, timestamp time.Time)
	GetRedelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (redelegations []staking.Redelegation)
	SetValidator(ctx sdk.Context, validator staking.Validator)
	DeleteValidatorByPowerIndex(ctx sdk.Context, validator staking.Validator)
	RemoveDelegation(ctx sdk.Context, delegation staking.Delegation)
	RemoveValidator(ctx sdk.Context, address sdk.ValAddress)

	BondDenom(sdk.Context) string
	UnbondingTime(sdk.Context) time.Duration
}

StakingKeeper defines the expected staking keeper.

type SupplyKeeper

type SupplyKeeper interface {
	GetModuleAddress(moduleName string) sdk.AccAddress
	GetModuleAccount(ctx sdk.Context, moduleName string) exported.ModuleAccountI
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
	SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error
}

SupplyKeeper defines the expected supply keeper.

type Withdraw

type Withdraw struct {
	// Address is the chain address of the provider withdrawing.
	Address sdk.AccAddress `json:"address" yaml:"address"`

	// Amount is the amount of withdraw.
	Amount sdk.Int `json:"amount" yaml:"amount"`

	// CompletionTime is the scheduled withdraw completion time.
	CompletionTime time.Time `json:"completion_time" yaml:"completion_time"`
}

Withdraw stores an ongoing withdraw of pool collateral.

func NewWithdraw

func NewWithdraw(addr sdk.AccAddress, amount sdk.Int, completionTime time.Time) Withdraw

NewWithdraw creates a new withdraw object.

type Withdraws

type Withdraws []Withdraw

Withdraws contains multiple withdraws.

Jump to

Keyboard shortcuts

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