github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/wasm/types/expected_keepers.go (about) 1 package types 2 3 import ( 4 "context" 5 6 sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types" 7 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/auth" 8 capabilitytypes "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/capability/types" 9 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/distribution/types" 10 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/params" 11 stakingtypes "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/staking/types" 12 connectiontypes "github.com/fibonacci-chain/fbc/libs/ibc-go/modules/core/03-connection/types" 13 channeltypes "github.com/fibonacci-chain/fbc/libs/ibc-go/modules/core/04-channel/types" 14 ibcexported "github.com/fibonacci-chain/fbc/libs/ibc-go/modules/core/exported" 15 ) 16 17 // BankViewKeeper defines a subset of methods implemented by the cosmos-sdk bank keeper 18 type BankViewKeeper interface { 19 GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins 20 GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin 21 } 22 23 // BankKeeper defines a subset of methods implemented by the cosmos-sdk bank keeper 24 type BankKeeper interface { 25 BankViewKeeper 26 // Burner 27 IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error 28 BlockedAddr(addr sdk.AccAddress) bool 29 SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error 30 GetSendEnabled(ctx sdk.Context) bool 31 } 32 33 // AccountKeeper defines a subset of methods implemented by the cosmos-sdk account keeper 34 type AccountKeeper interface { 35 // Return a new account with the next account number and the specified address. Does not save the new account to the store. 36 NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) auth.Account 37 // Retrieve an account from the store. 38 GetAccount(ctx sdk.Context, addr sdk.AccAddress) auth.Account 39 // Set an account in the store. 40 SetAccount(ctx sdk.Context, acc auth.Account) 41 // SetObserverKeeper sets an observer for listening changes of any accounts. 42 SetObserverKeeper(observer auth.ObserverI) 43 } 44 45 // DistributionKeeper defines a subset of methods implemented by the cosmos-sdk distribution keeper 46 type DistributionKeeper interface { 47 DelegationRewards(c context.Context, req *types.QueryDelegationRewardsParams) (*sdk.DecCoins, error) 48 } 49 50 // StakingKeeper defines a subset of methods implemented by the cosmos-sdk staking keeper 51 type StakingKeeper interface { 52 // BondDenom - Bondable coin denomination 53 BondDenom(ctx sdk.Context) (res string) 54 // GetValidator get a single validator 55 GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) 56 // GetBondedValidatorsByPower get the current group of bonded validators sorted by power-rank 57 GetBondedValidatorsByPower(ctx sdk.Context) []stakingtypes.Validator 58 // GetAllDelegatorDelegations return all delegations for a delegator 59 GetAllDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress) []stakingtypes.Delegation 60 // GetDelegation return a specific delegation 61 GetDelegation(ctx sdk.Context, 62 delAddr sdk.AccAddress, valAddr sdk.ValAddress) (delegation stakingtypes.Delegation, found bool) 63 // HasReceivingRedelegation check if validator is receiving a redelegation 64 HasReceivingRedelegation(ctx sdk.Context, 65 delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) bool 66 } 67 68 // ChannelKeeper defines the expected IBC channel keeper 69 type ChannelKeeper interface { 70 GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) 71 GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) 72 SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet ibcexported.PacketI) error 73 ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error 74 GetAllChannels(ctx sdk.Context) (channels []channeltypes.IdentifiedChannel) 75 IterateChannels(ctx sdk.Context, cb func(channeltypes.IdentifiedChannel) bool) 76 SetChannel(ctx sdk.Context, portID, channelID string, channel channeltypes.Channel) 77 } 78 79 // ClientKeeper defines the expected IBC client keeper 80 type ClientKeeper interface { 81 GetClientConsensusState(ctx sdk.Context, clientID string) (connection ibcexported.ConsensusState, found bool) 82 } 83 84 // ConnectionKeeper defines the expected IBC connection keeper 85 type ConnectionKeeper interface { 86 GetConnection(ctx sdk.Context, connectionID string) (connection connectiontypes.ConnectionEnd, found bool) 87 } 88 89 // PortKeeper defines the expected IBC port keeper 90 type PortKeeper interface { 91 BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability 92 } 93 94 type CapabilityKeeper interface { 95 GetCapability(ctx sdk.Context, name string) (*capabilitytypes.Capability, bool) 96 ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error 97 AuthenticateCapability(ctx sdk.Context, capability *capabilitytypes.Capability, name string) bool 98 } 99 100 // ICS20TransferPortSource is a subset of the ibc transfer keeper. 101 type ICS20TransferPortSource interface { 102 GetPort(ctx sdk.Context) string 103 } 104 105 type Subspace interface { 106 GetParamSet(ctx sdk.Context, ps params.ParamSet) 107 SetParamSet(ctx sdk.Context, ps params.ParamSet) 108 } 109 110 type DBAdapter interface { 111 NewStore(gasMeter sdk.GasMeter, parent sdk.KVStore, prefix []byte) sdk.KVStore 112 }