keeper

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PriceUpLimitRatio  = sdk.NewDecWithPrec(12, 1) //gas price uplimit 1.2x
	PriceLowLimitRatio = sdk.NewDecWithPrec(8, 1)  //gas price lowlimit 0.8x
)

Functions

func NewQuerier

func NewQuerier(k BaseKeeper) sdk.Querier

NewQuerier returns a new sdk.Keeper instance.

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, ak types.CUKeeper)

RegisterInvariants registers the bank module invariants

Types

type BaseKeeper

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

BaseKeeper manages transfers between accounts. It implements the ReceiptKeeper interface.

func NewBaseKeeper

func NewBaseKeeper(cdc *codec.Codec, key sdk.StoreKey, ck types.CUKeeper, ik types.IBCAssetKeeper, tk types.TokenKeeper, ok types.OrderKeeper,
	rk types.ReceiptKeeper, sk types.StakingKeeper, cn types.Chainnode,
	paramSpace params.Subspace, codespace sdk.CodespaceType, blacklistedAddrs map[string]bool) *BaseKeeper

func (BaseKeeper) AddCoin added in v0.9.3

func (keeper BaseKeeper) AddCoin(ctx sdk.Context, addr sdk.CUAddress, coin sdk.Coin) (sdk.Coin, sdk.Flow, sdk.Error)

func (BaseKeeper) AddCoinHold added in v0.9.3

func (keeper BaseKeeper) AddCoinHold(ctx sdk.Context, addr sdk.CUAddress, coin sdk.Coin) (sdk.Coin, sdk.Flow, sdk.Error)

func (BaseKeeper) AddCoins added in v0.9.3

func (keeper BaseKeeper) AddCoins(ctx sdk.Context, addr sdk.CUAddress, coins sdk.Coins) (sdk.Coins, []sdk.Flow, sdk.Error)

func (BaseKeeper) AddCoinsHold added in v0.9.3

func (keeper BaseKeeper) AddCoinsHold(ctx sdk.Context, addr sdk.CUAddress, coins sdk.Coins) (sdk.Coins, []sdk.Flow, sdk.Error)

func (BaseKeeper) BlacklistedAddr added in v0.9.3

func (keeper BaseKeeper) BlacklistedAddr(addr sdk.CUAddress) bool

func (BaseKeeper) CancelWithdrawal

func (keeper BaseKeeper) CancelWithdrawal(ctx sdk.Context, fromCUAddr sdk.CUAddress, orderID string) sdk.Result

func (BaseKeeper) CheckCollectOrders

func (keeper BaseKeeper) CheckCollectOrders(ctx sdk.Context, orderIDs []string, orderStatus sdk.OrderStatus, depositStatus sdk.DepositItemStatus) (sdk.Coins, *sdk.IBCToken, []*sdk.UtxoIn, []*sdk.OrderCollect, []*sdk.DepositItem, sdk.Error)

func (BaseKeeper) CheckDecodedUtxoTransaction

func (keeper BaseKeeper) CheckDecodedUtxoTransaction(ctx sdk.Context, chain, symbol string, opCUAddr sdk.CUAddress, orderIDs []*sdk.OrderWithdrawal, tx *chainnode.ExtUtxoTransaction, fromAddr string) (sdk.Int, sdk.Error)

func (BaseKeeper) CheckSysTransferOrders

func (keeper BaseKeeper) CheckSysTransferOrders(ctx sdk.Context, order *sdk.OrderSysTransfer, orderStatus sdk.OrderStatus) (*sdk.IBCToken, sdk.Error)

func (BaseKeeper) CheckWithdrawalOpCU

func (keeper BaseKeeper) CheckWithdrawalOpCU(ctx sdk.Context, opCU exported.CUIBCAsset, chain, symbol string, sendable bool, fromAddr string) sdk.Error

func (BaseKeeper) CheckWithdrawalOrders

func (keeper BaseKeeper) CheckWithdrawalOrders(ctx sdk.Context, orderIDs []string, orderStatus sdk.OrderStatus) (*sdk.IBCToken, []*sdk.OrderWithdrawal, sdk.Error)

func (BaseKeeper) Codespace added in v0.9.3

func (keeper BaseKeeper) Codespace() sdk.CodespaceType

Codespace returns the keeper's codespace.

func (BaseKeeper) CollectFinish

func (keeper BaseKeeper) CollectFinish(ctx sdk.Context, fromCUAddr sdk.CUAddress, orderIDs []string, costFee sdk.Int) sdk.Result

func (BaseKeeper) CollectSignFinish

func (keeper BaseKeeper) CollectSignFinish(ctx sdk.Context, orderIDs []string, signedTx []byte) sdk.Result

func (BaseKeeper) CollectWaitSign

func (keeper BaseKeeper) CollectWaitSign(ctx sdk.Context, toCUAddr sdk.CUAddress, orderIDs []string, rawData []byte) sdk.Result

func (BaseKeeper) ConfirmedDeposit

func (keeper BaseKeeper) ConfirmedDeposit(ctx sdk.Context, fromCUAddr sdk.CUAddress, validOrderIDs, invalidOrderIDs []string) sdk.Result

func (*BaseKeeper) DelegateCoins

func (keeper *BaseKeeper) DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.CUAddress, amt sdk.Coins) (sdk.Result, sdk.Error)

DelegateCoins performs delegation by deducting amt coins from an CustodianUnit with address addr. For vesting accounts, delegations amounts are tracked for both vesting and vested coins. The coins are then transferred from the delegator address to a ModuleAccount address. If any of the delegation amounts are negative, an error is returned.

func (BaseKeeper) Deposit

func (keeper BaseKeeper) Deposit(ctx sdk.Context, fromCUAddr, toCUAddr sdk.CUAddress, symbol sdk.Symbol, toAddr, hash string, index uint64, amt sdk.Int, orderID, memo string) sdk.Result

Deposit

func (BaseKeeper) GetAllBalance added in v0.9.3

func (keeper BaseKeeper) GetAllBalance(ctx sdk.Context, addr sdk.CUAddress) sdk.Coins

func (BaseKeeper) GetAllHoldBalance added in v0.9.3

func (keeper BaseKeeper) GetAllHoldBalance(ctx sdk.Context, addr sdk.CUAddress) sdk.Coins

func (BaseKeeper) GetBalance added in v0.9.3

func (keeper BaseKeeper) GetBalance(ctx sdk.Context, addr sdk.CUAddress, symbol string) sdk.Int

func (BaseKeeper) GetHoldBalance added in v0.9.3

func (keeper BaseKeeper) GetHoldBalance(ctx sdk.Context, addr sdk.CUAddress, symbol string) sdk.Int

func (BaseKeeper) InputOutputCoins added in v0.9.3

func (keeper BaseKeeper) InputOutputCoins(ctx sdk.Context, inputs []types.Input, outputs []types.Output) (sdk.Result, sdk.Error)

InputOutputCoins handles a list of inputs and outputs

func (BaseKeeper) IsSendEnabled added in v0.9.3

func (keeper BaseKeeper) IsSendEnabled(ctx sdk.Context) bool

IsSendEnabled returns the current SendEnabled nolint: errcheck

func (BaseKeeper) LockCoin added in v0.9.3

func (keeper BaseKeeper) LockCoin(ctx sdk.Context, addr sdk.CUAddress, coin sdk.Coin) ([]sdk.Flow, sdk.Error)

func (BaseKeeper) LockCoins added in v0.9.3

func (keeper BaseKeeper) LockCoins(ctx sdk.Context, addr sdk.CUAddress, coins sdk.Coins) ([]sdk.Flow, sdk.Error)

func (BaseKeeper) OpcuAssetTransfer

func (keeper BaseKeeper) OpcuAssetTransfer(ctx sdk.Context, opCUAddr sdk.CUAddress, toAddr, orderID, symbol string, items []sdk.TransferItem) sdk.Result

func (BaseKeeper) OpcuAssetTransferFinish

func (keeper BaseKeeper) OpcuAssetTransferFinish(ctx sdk.Context, fromCUAddr sdk.CUAddress, orderID string, costFee sdk.Int) sdk.Result

func (BaseKeeper) OpcuAssetTransferSignFinish

func (keeper BaseKeeper) OpcuAssetTransferSignFinish(ctx sdk.Context, orderID string, signedTx []byte) sdk.Result

func (BaseKeeper) OpcuAssetTransferWaitSign

func (keeper BaseKeeper) OpcuAssetTransferWaitSign(ctx sdk.Context, orderID string, signHashes [][]byte, rawData []byte) sdk.Result

func (*BaseKeeper) OrderRetry

func (keeper *BaseKeeper) OrderRetry(ctx sdk.Context, fromCUAddr sdk.CUAddress, orderIDs []string, retryTimes uint32, evidences []types.EvidenceValidator) sdk.Result

func (BaseKeeper) SendCoin added in v0.9.3

func (keeper BaseKeeper) SendCoin(ctx sdk.Context, from, to sdk.CUAddress, coin sdk.Coin) (sdk.Result, []sdk.Flow, sdk.Error)

func (BaseKeeper) SendCoins added in v0.9.3

func (keeper BaseKeeper) SendCoins(ctx sdk.Context, from, to sdk.CUAddress, coins sdk.Coins) (sdk.Result, []sdk.Flow, sdk.Error)

func (*BaseKeeper) SetEvidenceKeeper

func (keeper *BaseKeeper) SetEvidenceKeeper(evidenceKeeper types.EvidenceKeeper)

func (BaseKeeper) SetSendEnabled added in v0.9.3

func (keeper BaseKeeper) SetSendEnabled(ctx sdk.Context, enabled bool)

SetSendEnabled sets the send enabled

func (*BaseKeeper) SetStakingKeeper

func (keeper *BaseKeeper) SetStakingKeeper(sk types.StakingKeeper)

func (BaseKeeper) SubCoin added in v0.9.3

func (keeper BaseKeeper) SubCoin(ctx sdk.Context, addr sdk.CUAddress, coin sdk.Coin) (sdk.Coin, sdk.Flow, sdk.Error)

func (BaseKeeper) SubCoinHold added in v0.9.3

func (keeper BaseKeeper) SubCoinHold(ctx sdk.Context, addr sdk.CUAddress, coin sdk.Coin) (sdk.Coin, sdk.Flow, sdk.Error)

func (BaseKeeper) SubCoins added in v0.9.3

func (keeper BaseKeeper) SubCoins(ctx sdk.Context, addr sdk.CUAddress, coins sdk.Coins) (sdk.Coins, []sdk.Flow, sdk.Error)

func (BaseKeeper) SubCoinsHold added in v0.9.3

func (keeper BaseKeeper) SubCoinsHold(ctx sdk.Context, addr sdk.CUAddress, coins sdk.Coins) (sdk.Coins, []sdk.Flow, sdk.Error)

func (BaseKeeper) SysTransfer

func (keeper BaseKeeper) SysTransfer(ctx sdk.Context, fromCUAddr, toCUAddr sdk.CUAddress, toAddr, orderID, symbol string) sdk.Result

func (BaseKeeper) SysTransferFinish

func (keeper BaseKeeper) SysTransferFinish(ctx sdk.Context, fromCUAddr sdk.CUAddress, orderID string, costFee sdk.Int) sdk.Result

func (BaseKeeper) SysTransferSignFinish

func (keeper BaseKeeper) SysTransferSignFinish(ctx sdk.Context, orderID string, signedTx []byte) sdk.Result

func (BaseKeeper) SysTransferWaitSign

func (keeper BaseKeeper) SysTransferWaitSign(ctx sdk.Context, orderID string, signHash []byte, rawData []byte) sdk.Result

func (*BaseKeeper) UndelegateCoins

func (keeper *BaseKeeper) UndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.CUAddress, amt sdk.Coins) (sdk.Result, sdk.Error)

UndelegateCoins performs undelegation by crediting amt coins to an CustodianUnit with address addr. For vesting accounts, undelegation amounts are tracked for both vesting and vested coins. The coins are then transferred from a ModuleAccount address to the delegator address. If any of the undelegation amounts are negative, an error is returned.

func (BaseKeeper) UnlockCoin added in v0.9.3

func (keeper BaseKeeper) UnlockCoin(ctx sdk.Context, addr sdk.CUAddress, coin sdk.Coin) ([]sdk.Flow, sdk.Error)

func (BaseKeeper) UnlockCoins added in v0.9.3

func (keeper BaseKeeper) UnlockCoins(ctx sdk.Context, addr sdk.CUAddress, coins sdk.Coins) ([]sdk.Flow, sdk.Error)

func (BaseKeeper) Withdrawal

func (keeper BaseKeeper) Withdrawal(ctx sdk.Context, fromCUAddr sdk.CUAddress, toAddr, orderID, symbol string, amt, gasFee sdk.Int) sdk.Result

func (BaseKeeper) WithdrawalConfirm

func (keeper BaseKeeper) WithdrawalConfirm(ctx sdk.Context, fromCUAddr sdk.CUAddress, orderID string, valid bool) sdk.Result

WithdrawalConfirm confirm account type withdrawal order

func (BaseKeeper) WithdrawalFinish

func (keeper BaseKeeper) WithdrawalFinish(ctx sdk.Context, fromCUAddr sdk.CUAddress, orderIDs []string, costFee sdk.Int, valid bool) sdk.Result

func (BaseKeeper) WithdrawalSignFinish

func (keeper BaseKeeper) WithdrawalSignFinish(ctx sdk.Context, orderIDs []string, signedTx []byte) sdk.Result

func (BaseKeeper) WithdrawalWaitSign

func (keeper BaseKeeper) WithdrawalWaitSign(ctx sdk.Context, opCUAddr sdk.CUAddress, orderIDs []string, signHashes [][]byte, rawData []byte) sdk.Result

type Keeper

type Keeper interface {
	SendKeeper

	SetEvidenceKeeper(evidenceKeeper types.EvidenceKeeper)
	DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.CUAddress, amt sdk.Coins) (sdk.Result, sdk.Error)
	UndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.CUAddress, amt sdk.Coins) (sdk.Result, sdk.Error)
	Deposit(ctx sdk.Context, fromCU, toCUAddr sdk.CUAddress, symbol sdk.Symbol, toAddr, hash string, index uint64, amt sdk.Int, orderID, memo string) sdk.Result
	ConfirmedDeposit(ctx sdk.Context, fromCUAddr sdk.CUAddress, validOrderIDs, invalidOrderIds []string) sdk.Result
	CollectWaitSign(ctx sdk.Context, toCUAddr sdk.CUAddress, orderIDs []string, rawData []byte) sdk.Result
	CollectSignFinish(ctx sdk.Context, orderIDs []string, signedTx []byte) sdk.Result
	CollectFinish(ctx sdk.Context, fromCUAddr sdk.CUAddress, orderIDs []string, costFee sdk.Int) sdk.Result

	Withdrawal(ctx sdk.Context, fromCU sdk.CUAddress, toAddr, orderID, symbol string, amt, gasFee sdk.Int) sdk.Result
	WithdrawalConfirm(ctx sdk.Context, fromCUAddr sdk.CUAddress, orderID string, valid bool) sdk.Result

	WithdrawalWaitSign(ctx sdk.Context, opCUAddr sdk.CUAddress, orderIDs []string, signHashes [][]byte, rawData []byte) sdk.Result
	WithdrawalSignFinish(ctx sdk.Context, orderIDs []string, signedTx []byte) sdk.Result
	WithdrawalFinish(ctx sdk.Context, fromCUAddr sdk.CUAddress, orderIDs []string, costFee sdk.Int, valid bool) sdk.Result
	CancelWithdrawal(ctx sdk.Context, fromCUAddr sdk.CUAddress, orderID string) sdk.Result

	SysTransfer(ctx sdk.Context, fromCUAddr, toCUAddr sdk.CUAddress, toAddr, orderID, symbol string) sdk.Result
	SysTransferWaitSign(ctx sdk.Context, orderID string, signHash []byte, rawData []byte) sdk.Result
	SysTransferSignFinish(ctx sdk.Context, orderID string, signedTx []byte) sdk.Result
	SysTransferFinish(ctx sdk.Context, fromCUAddr sdk.CUAddress, orderID string, costFee sdk.Int) sdk.Result

	OpcuAssetTransfer(ctx sdk.Context, opCUAddr sdk.CUAddress, toAddr, orderID, symbol string, items []sdk.TransferItem) sdk.Result
	OpcuAssetTransferWaitSign(ctx sdk.Context, orderID string, signHashes [][]byte, rawData []byte) sdk.Result
	OpcuAssetTransferSignFinish(ctx sdk.Context, orderID string, signedTx []byte) sdk.Result
	OpcuAssetTransferFinish(ctx sdk.Context, fromCUAddr sdk.CUAddress, orderID string, costFee sdk.Int) sdk.Result

	OrderRetry(ctx sdk.Context, fromCUAddr sdk.CUAddress, orderIDs []string, retryTimes uint32, evidences []types.EvidenceValidator) sdk.Result
}

Keeper defines a module interface that facilitates the transfer of coins between accounts.

type SendKeeper

type SendKeeper interface {
	InputOutputCoins(ctx sdk.Context, inputs []types.Input, outputs []types.Output) (sdk.Result, sdk.Error)
	SendCoin(ctx sdk.Context, fromAddr sdk.CUAddress, toAddr sdk.CUAddress, amt sdk.Coin) (sdk.Result, []sdk.Flow, sdk.Error)
	SendCoins(ctx sdk.Context, fromAddr sdk.CUAddress, toAddr sdk.CUAddress, amt sdk.Coins) (sdk.Result, []sdk.Flow, sdk.Error)

	SubCoins(ctx sdk.Context, addr sdk.CUAddress, amt sdk.Coins) (sdk.Coins, []sdk.Flow, sdk.Error)
	SubCoinsHold(ctx sdk.Context, addr sdk.CUAddress, amt sdk.Coins) (sdk.Coins, []sdk.Flow, sdk.Error)
	AddCoins(ctx sdk.Context, addr sdk.CUAddress, amt sdk.Coins) (sdk.Coins, []sdk.Flow, sdk.Error)
	AddCoinsHold(ctx sdk.Context, addr sdk.CUAddress, amt sdk.Coins) (sdk.Coins, []sdk.Flow, sdk.Error)
	LockCoin(ctx sdk.Context, addr sdk.CUAddress, amt sdk.Coin) ([]sdk.Flow, sdk.Error)
	UnlockCoin(ctx sdk.Context, addr sdk.CUAddress, amt sdk.Coin) ([]sdk.Flow, sdk.Error)

	IsSendEnabled(ctx sdk.Context) bool
	SetSendEnabled(ctx sdk.Context, enabled bool)

	GetBalance(ctx sdk.Context, addr sdk.CUAddress, symbol string) sdk.Int
	GetAllBalance(ctx sdk.Context, addr sdk.CUAddress) sdk.Coins

	GetHoldBalance(ctx sdk.Context, addr sdk.CUAddress, symbol string) sdk.Int
	GetAllHoldBalance(ctx sdk.Context, addr sdk.CUAddress) sdk.Coins

	Codespace() sdk.CodespaceType

	BlacklistedAddr(addr sdk.CUAddress) bool
}

SendKeeper defines a module interface that facilitates the transfer of coins between accounts without the possibility of creating coins.

Jump to

Keyboard shortcuts

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