sidechain

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SafeToleratePeriod = 2 * 7 * 24 * 60 * 60 * time.Second // 2 weeks

	EnableOrDisableChannelKey = "enableOrDisableChannel"
	AddOrUpdateChannelKey     = "addOrUpdateChannel"
)
View Source
const (
	DefaultCodespace sdk.CodespaceType = 31

	CodeInvalidSideChainId sdk.CodeType = 101
)
View Source
const DefaultParamspace = "sidechain"

Default parameter namespace

View Source
const (
	QuerychannelSettings = "channelSettings"
)

Variables

View Source
var (
	SideChainStorePrefixByIdKey = []byte{0x01} // prefix for each key to a side chain store prefix, by side chain id

	PrefixForSendSequenceKey    = []byte{0xf0}
	PrefixForReceiveSequenceKey = []byte{0xf1}

	PrefixForChannelPermissionKey = []byte{0xc0}
)
View Source
var (
	CrossChainContractAddr, _ = hex.DecodeString("0000000000000000000000000000000000002000")
)
View Source
var (
	KeyAxcSideChainId = []byte("AxcSideChainId")
)

Functions

func EndBlock

func EndBlock(ctx sdk.Context, k Keeper)

func ErrInvalidSideChainId

func ErrInvalidSideChainId(codespace sdk.CodespaceType, msg string) sdk.Error

func GetSideChainStorePrefixKey

func GetSideChainStorePrefixKey(sideChainId string) []byte

func NewQuerier

func NewQuerier(k Keeper) sdk.Querier

creates a querier for staking REST endpoints

func ParamTypeTable

func ParamTypeTable() params.TypeTable

ParamTypeTable for sidechain module

Types

type ChanPermissionSettingHooks

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

--------------------- ChanPermissionSettingHooks -----------------

func NewChanPermissionSettingHook

func NewChanPermissionSettingHook(cdc *amino.Codec, keeper *Keeper) ChanPermissionSettingHooks

func (ChanPermissionSettingHooks) OnProposalSubmitted

func (hooks ChanPermissionSettingHooks) OnProposalSubmitted(ctx sdk.Context, proposal gov.Proposal) error

type IbcKeeper

type IbcKeeper interface {
	CreateRawIBCPackageById(ctx sdk.Context, destChainID sdk.ChainID, channelID sdk.ChannelID,
		packageType sdk.CrossChainPackageType, packageLoad []byte) (uint64, sdk.Error)
}

type Keeper

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

func NewKeeper

func NewKeeper(storeKey sdk.StoreKey, paramspace params.Subspace, cdc *codec.Codec) Keeper

func (Keeper) AxcSideChainId

func (k Keeper) AxcSideChainId(ctx sdk.Context) (sideChainId string)

func (*Keeper) CreateNewChannelToIbc

func (k *Keeper) CreateNewChannelToIbc(ctx sdk.Context, sideChainId sdk.ChainID, channelId sdk.ChannelID, rewardConfig sdk.RewardConfig, handleContract []byte) (seq uint64, sdkErr sdk.Error)

func (*Keeper) GetAllSideChainPrefixes

func (k *Keeper) GetAllSideChainPrefixes(ctx sdk.Context) ([]string, [][]byte)

func (*Keeper) GetChannelID

func (k *Keeper) GetChannelID(channelName string) (sdk.ChannelID, error)

func (*Keeper) GetChannelSendPermission

func (k *Keeper) GetChannelSendPermission(ctx sdk.Context, destChainID sdk.ChainID, channelID sdk.ChannelID) sdk.ChannelPermission

func (*Keeper) GetChannelSendPermissions

func (k *Keeper) GetChannelSendPermissions(ctx sdk.Context, destChainID sdk.ChainID) map[sdk.ChannelID]sdk.ChannelPermission

func (*Keeper) GetCrossChainApp

func (k *Keeper) GetCrossChainApp(ctx sdk.Context, channelID sdk.ChannelID) sdk.CrossChainApplication

func (*Keeper) GetDestChainID

func (k *Keeper) GetDestChainID(name string) (sdk.ChainID, error)

func (*Keeper) GetDestChainName

func (k *Keeper) GetDestChainName(id sdk.ChainID) (string, error)

func (*Keeper) GetReceiveSequence

func (k *Keeper) GetReceiveSequence(ctx sdk.Context, destChainID sdk.ChainID, channelID sdk.ChannelID) uint64

func (*Keeper) GetSendSequence

func (k *Keeper) GetSendSequence(ctx sdk.Context, destChainID sdk.ChainID, channelID sdk.ChannelID) uint64

func (Keeper) GetSideChainStorePrefix

func (k Keeper) GetSideChainStorePrefix(ctx sdk.Context, sideChainId string) []byte

get side chain store key prefix

func (*Keeper) GetSrcChainID

func (k *Keeper) GetSrcChainID() sdk.ChainID

func (*Keeper) IncrReceiveSequence

func (k *Keeper) IncrReceiveSequence(ctx sdk.Context, destChainID sdk.ChainID, channelID sdk.ChannelID)

func (*Keeper) IncrSendSequence

func (k *Keeper) IncrSendSequence(ctx sdk.Context, destChainID sdk.ChainID, channelID sdk.ChannelID)

func (*Keeper) PrepareCtxForSideChain

func (k *Keeper) PrepareCtxForSideChain(ctx sdk.Context, sideChainId string) (sdk.Context, error)

func (*Keeper) RegisterChannel

func (k *Keeper) RegisterChannel(name string, id sdk.ChannelID, app sdk.CrossChainApplication) error

func (*Keeper) RegisterDestChain

func (k *Keeper) RegisterDestChain(name string, chainID sdk.ChainID) error

internally, we use name as the id of the chain, must be unique

func (*Keeper) SaveChannelSettingChangeToIbc

func (k *Keeper) SaveChannelSettingChangeToIbc(ctx sdk.Context, sideChainId sdk.ChainID, channelId sdk.ChannelID, permission sdk.ChannelPermission) (seq uint64, sdkErr sdk.Error)

func (*Keeper) SetChannelSendPermission

func (k *Keeper) SetChannelSendPermission(ctx sdk.Context, destChainID sdk.ChainID, channelID sdk.ChannelID, permission sdk.ChannelPermission)

func (*Keeper) SetGovKeeper

func (k *Keeper) SetGovKeeper(govKeeper *gov.Keeper)

func (*Keeper) SetIbcKeeper

func (k *Keeper) SetIbcKeeper(ibcKeeper IbcKeeper)

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params Params)

set the params

func (Keeper) SetSideChainIdAndStorePrefix

func (k Keeper) SetSideChainIdAndStorePrefix(ctx sdk.Context, sideChainId string, storePrefix []byte)

TODO: to support multi side chains in the future. We will enable a registration mechanism and add these chain ids to db. then we need to check if the sideChainId already exists

func (*Keeper) SetSrcChainID

func (k *Keeper) SetSrcChainID(srcChainID sdk.ChainID)

type Params

type Params struct {
	AxcSideChainId string `json:"axc_side_chain_id"`
}

func DefaultParams

func DefaultParams() Params

Default parameters used by Cosmos Hub

func (*Params) KeyValuePairs

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

Implements params.ParamStruct

Directories

Path Synopsis
client
cli

Jump to

Keyboard shortcuts

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