bep3

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeCreateAtomicSwap      = types.EventTypeCreateAtomicSwap
	EventTypeClaimAtomicSwap       = types.EventTypeClaimAtomicSwap
	EventTypeRefundAtomicSwap      = types.EventTypeRefundAtomicSwap
	EventTypeSwapsExpired          = types.EventTypeSwapsExpired
	AttributeValueCategory         = types.AttributeValueCategory
	AttributeKeySender             = types.AttributeKeySender
	AttributeKeyRecipient          = types.AttributeKeyRecipient
	AttributeKeyAtomicSwapID       = types.AttributeKeyAtomicSwapID
	AttributeKeyRandomNumberHash   = types.AttributeKeyRandomNumberHash
	AttributeKeyTimestamp          = types.AttributeKeyTimestamp
	AttributeKeySenderOtherChain   = types.AttributeKeySenderOtherChain
	AttributeKeyExpireTimestamp    = types.AttributeKeyExpireTimestamp
	AttributeKeyAmount             = types.AttributeKeyAmount
	AttributeKeyDirection          = types.AttributeKeyDirection
	AttributeKeyClaimSender        = types.AttributeKeyClaimSender
	AttributeKeyRandomNumber       = types.AttributeKeyRandomNumber
	AttributeKeyRefundSender       = types.AttributeKeyRefundSender
	AttributeKeyAtomicSwapIDs      = types.AttributeKeyAtomicSwapIDs
	AttributeExpirationBlock       = types.AttributeExpirationBlock
	ModuleName                     = types.ModuleName
	StoreKey                       = types.StoreKey
	RouterKey                      = types.RouterKey
	QuerierRoute                   = types.QuerierRoute
	DefaultParamspace              = types.DefaultParamspace
	DefaultLongtermStorageDuration = types.DefaultLongtermStorageDuration
	CreateAtomicSwap               = types.CreateAtomicSwap
	ClaimAtomicSwap                = types.ClaimAtomicSwap
	RefundAtomicSwap               = types.RefundAtomicSwap
	CalcSwapID                     = types.CalcSwapID
	Int64Size                      = types.Int64Size
	RandomNumberHashLength         = types.RandomNumberHashLength
	RandomNumberLength             = types.RandomNumberLength
	AddrByteCount                  = types.AddrByteCount
	MaxOtherChainAddrLength        = types.MaxOtherChainAddrLength
	SwapIDLength                   = types.SwapIDLength
	MaxExpectedIncomeLength        = types.MaxExpectedIncomeLength
	QueryGetAssetSupply            = types.QueryGetAssetSupply
	QueryGetAssetSupplies          = types.QueryGetAssetSupplies
	QueryGetAtomicSwap             = types.QueryGetAtomicSwap
	QueryGetAtomicSwaps            = types.QueryGetAtomicSwaps
	QueryGetParams                 = types.QueryGetParams
	NULL                           = types.NULL
	Open                           = types.Open
	Completed                      = types.Completed
	Expired                        = types.Expired
	INVALID                        = types.INVALID
	Incoming                       = types.Incoming
	Outgoing                       = types.Outgoing
)
View Source
const (

	// Simulation operation weights constants
	OpWeightMsgCreateAtomicSwap = "op_weight_msg_create_atomic_swap"
)

Variables

View Source
var (
	// functions aliases
	NewKeeper                  = keeper.NewKeeper
	NewQuerier                 = keeper.NewQuerier
	NewAssetSupply             = types.NewAssetSupply
	NewGenesisState            = types.NewGenesisState
	DefaultGenesisState        = types.DefaultGenesisState
	GenerateSecureRandomNumber = types.GenerateSecureRandomNumber
	CalculateRandomHash        = types.CalculateRandomHash
	CalculateSwapID            = types.CalculateSwapID
	GetAtomicSwapByHeightKey   = types.GetAtomicSwapByTimestampKey
	NewMsgCreateAtomicSwap     = types.NewMsgCreateAtomicSwap
	NewMsgClaimAtomicSwap      = types.NewMsgClaimAtomicSwap
	NewMsgRefundAtomicSwap     = types.NewMsgRefundAtomicSwap
	NewParams                  = types.NewParams
	DefaultParams              = types.DefaultParams
	NewAssetParam              = types.NewAssetParam
	ParamKeyTable              = types.ParamKeyTable
	NewQueryAssetSupply        = types.NewQueryAssetSupply
	NewQueryAssetSupplies      = types.NewQueryAssetSupplies
	NewQueryAtomicSwapByID     = types.NewQueryAtomicSwapByID
	NewQueryAtomicSwaps        = types.NewQueryAtomicSwaps
	NewAtomicSwap              = types.NewAtomicSwap
	NewSwapStatusFromString    = types.NewSwapStatusFromString
	NewSwapDirectionFromString = types.NewSwapDirectionFromString
	NewAugmentedAtomicSwap     = types.NewAugmentedAtomicSwap

	// variable aliases
	ModuleCdc                       = types.ModuleCdc
	ErrInvalidTimestamp             = types.ErrInvalidTimestamp
	ErrInvalidTimeSpan              = types.ErrInvalidTimeSpan
	ErrInsufficientAmount           = types.ErrInsufficientAmount
	ErrAssetNotSupported            = types.ErrAssetNotSupported
	ErrAssetNotActive               = types.ErrAssetNotActive
	ErrAssetSupplyNotFound          = types.ErrAssetSupplyNotFound
	ErrExceedsSupplyLimit           = types.ErrExceedsSupplyLimit
	ErrExceedsAvailableSupply       = types.ErrExceedsAvailableSupply
	ErrInvalidCurrentSupply         = types.ErrInvalidCurrentSupply
	ErrInvalidIncomingSupply        = types.ErrInvalidIncomingSupply
	ErrInvalidOutgoingSupply        = types.ErrInvalidOutgoingSupply
	ErrInvalidClaimSecret           = types.ErrInvalidClaimSecret
	ErrAtomicSwapAlreadyExists      = types.ErrAtomicSwapAlreadyExists
	ErrAtomicSwapNotFound           = types.ErrAtomicSwapNotFound
	ErrSwapNotRefundable            = types.ErrSwapNotRefundable
	ErrSwapNotClaimable             = types.ErrSwapNotClaimable
	ErrInvalidAmount                = types.ErrInvalidAmount
	ErrInvalidSwapAccount           = types.ErrInvalidSwapAccount
	AtomicSwapKeyPrefix             = types.AtomicSwapKeyPrefix
	AtomicSwapByBlockPrefix         = types.AtomicSwapByBlockPrefix
	AtomicSwapLongtermStoragePrefix = types.AtomicSwapLongtermStoragePrefix
	AtomicSwapCoinsAccAddr          = types.AtomicSwapCoinsAccAddr
	KeyAssetParams                  = types.KeyAssetParams
	DefaultPreviousBlockTime        = types.DefaultPreviousBlockTime
	DefaultSwapBlockTimestamp       = types.DefaultSwapBlockTimestamp
	DefaultSwapTimeSpanMinutes      = types.DefaultSwapTimeSpanMinutes
	ModulePermissionsUpgradeTime    = types.ModulePermissionsUpgradeTime
)
View Source
var (
	ConsistentDenoms   = [3]string{"bnb", "xrp", "btc"}
	MaxSupplyLimit     = 1000000000000
	MinSupplyLimit     = 100000000
	MinSwapAmountLimit = 999

	MinBlockLock = uint64(5)
)

Functions

func BeginBlocker

func BeginBlocker(ctx sdk.Context, k Keeper)

BeginBlocker on every block expires outdated atomic swaps and removes closed swap from long term storage (default storage time of 1 week)

func GenAssetSupply added in v0.3.0

func GenAssetSupply(r *rand.Rand, denom string) types.AssetSupply

GenSupplyLimit generates a random SupplyLimit

func GenMaxBlockLock added in v0.3.0

func GenMaxBlockLock(r *rand.Rand, minBlockLock uint64) uint64

GenMaxBlockLock randomized MaxBlockLock

func GenMaxSwapAmount added in v0.3.0

func GenMaxSwapAmount(r *rand.Rand, minAmount sdk.Int, supplyMax sdk.Int) sdk.Int

GenMaxSwapAmount randomized MaxAmount

func GenMinBlockLock added in v0.3.0

func GenMinBlockLock(r *rand.Rand) uint64

GenMinBlockLock randomized MinBlockLock

func GenMinSwapAmount added in v0.3.0

func GenMinSwapAmount(r *rand.Rand) sdk.Int

GenMinSwapAmount randomized MinAmount in range [1, 1000]

func GenRandBnbDeputy added in v0.3.0

func GenRandBnbDeputy(r *rand.Rand) simtypes.Account

GenRandBnbDeputy randomized BnbDeputyAddress

func GenRandFixedFee added in v0.3.0

func GenRandFixedFee(r *rand.Rand) sdk.Int

GenRandFixedFee randomized FixedFee in range [1, 10000]

func GenSupplyLimit added in v0.3.0

func GenSupplyLimit(r *rand.Rand, max int) sdk.Int

GenSupplyLimit generates a random SupplyLimit

func GenSupportedAssets added in v0.3.0

func GenSupportedAssets(r *rand.Rand) types.AssetParams

GenSupportedAssets gets randomized SupportedAssets

func InitGenesis

func InitGenesis(ctx sdk.Context, keeper Keeper, accountKeeper types.AccountKeeper, gs GenesisState)

InitGenesis initializes the store state from a genesis state.

func NewDecodeStore added in v0.3.0

func NewDecodeStore(cdc CodecUnmarshaler) func(kvA, kvB kv.Pair) string

NewDecodeStore returns a decoder function closure that unmarshals the KVPair's Value to the corresponding type.

func NewHandler

func NewHandler(k Keeper) sdk.Handler

NewHandler creates an sdk.Handler for all the bep3 type messages

func ParamChanges added in v0.3.0

func ParamChanges(r *rand.Rand) []simtypes.ParamChange

ParamChanges defines the parameters that can be modified by param change proposals

func RandomizedGenState added in v0.3.0

func RandomizedGenState(simState *module.SimulationState)

RandomizedGenState generates a random GenesisState https://github.com/cosmos/cosmos-sdk/blob/1c6e2679641d0892a3f35d778d7c2316a2937a7c/x/bank/simulation/genesis.go#L54

func SimulateMsgCreateAtomicSwap added in v0.3.0

func SimulateMsgCreateAtomicSwap(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation

SimulateMsgCreateAtomicSwap generates a MsgCreateAtomicSwap with random values

func WeightedOperations added in v0.3.0

WeightedOperations returns all the operations from the module with their respective weights

Types

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

AppModule implements the sdk.AppModule interface.

func NewAppModule

func NewAppModule(keeper Keeper, accountKeeper bep3types.AccountKeeper, bankKeeper bep3types.BankKeeper) AppModule

NewAppModule creates a new AppModule object

func (AppModule) BeginBlock

func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock)

BeginBlock returns the begin blocker for the bep3 module.

func (AppModule) EndBlock

EndBlock returns the end blocker for the bep3 module. It returns no validator updates.

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json.RawMessage

ExportGenesis returns the exported genesis state as raw bytes for the bep3 module.

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate

InitGenesis performs genesis initialization for the bep3 module. It returns no validator updates.

func (AppModule) LegacyQuerierHandler added in v0.3.0

func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

func (AppModule) Name

func (AppModule) Name() string

Name returns the bep3 module's name.

func (AppModule) NewHandler

func (am AppModule) NewHandler() sdk.Handler

NewHandler returns an sdk.Handler for the bep3 module.

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

NewQuerierHandler returns the bep3 module sdk.Querier.

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

QuerierRoute returns the bep3 module's querier route name.

func (AppModule) RegisterInvariants

func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry)

RegisterInvariants registers the bep3 module invariants.

func (AppModule) RegisterServices added in v0.3.0

func (am AppModule) RegisterServices(cfg module.Configurator)

func (AppModule) Route

func (am AppModule) Route() sdk.Route

Route returns the message routing key for the bep3 module.

func (AppModule) WeightedOperations

func (am AppModule) WeightedOperations(simState module.SimulationState) []sdksim.WeightedOperation

WeightedOperations returns the all the bep3 module operations with their respective weights.

type AppModuleBasic

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

AppModuleBasic defines the basic application module used by the bep3 module.

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis(cdc codec.JSONMarshaler) json.RawMessage

DefaultGenesis returns default genesis state as raw bytes for the bep3 module.

func (AppModuleBasic) GenerateGenesisState

func (AppModuleBasic) GenerateGenesisState(simState *module.SimulationState)

GenerateGenesisState creates a randomized GenState of the bep3 module

func (AppModuleBasic) GetQueryCmd

func (AppModuleBasic) GetQueryCmd() *cobra.Command

GetQueryCmd returns no root query command for the bep3 module.

func (AppModuleBasic) GetTxCmd

func (AppModuleBasic) GetTxCmd() *cobra.Command

GetTxCmd returns the root tx command for the bep3 module.

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

Name returns the bep3 module's name.

func (AppModuleBasic) ProposalContents

ProposalContents doesn't return any content functions for governance proposals.

func (AppModuleBasic) RandomizedParams

func (AppModuleBasic) RandomizedParams(r *rand.Rand) []sdksim.ParamChange

RandomizedParams returns nil because bep3 has no params.

func (AppModuleBasic) RegisterGRPCGatewayRoutes added in v0.3.0

func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux)

func (AppModuleBasic) RegisterInterfaces added in v0.3.0

func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)

func (AppModuleBasic) RegisterLegacyAminoCodec added in v0.3.0

func (ab AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterLegacyAminoCodec registers the bep3 module's types for Amino.

func (AppModuleBasic) RegisterRESTRoutes

func (AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router)

RegisterRESTRoutes registers the REST routes for the bep3 module.

func (AppModuleBasic) RegisterStoreDecoder

func (ab AppModuleBasic) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry)

RegisterStoreDecoder registers a decoder for bep3 module's types

func (AppModuleBasic) ValidateGenesis

func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, config client.TxEncodingConfig, bz json.RawMessage) error

ValidateGenesis performs genesis state validation for the bep3 module.

type AssetParam

type AssetParam = types.AssetParam

type AssetParams

type AssetParams = types.AssetParams

type AssetSupplies

type AssetSupplies = types.AssetSupplies

type AssetSupply

type AssetSupply = types.AssetSupply

type AtomicSwap

type AtomicSwap = types.AtomicSwap

type AtomicSwaps

type AtomicSwaps = types.AtomicSwaps

type AugmentedAtomicSwap

type AugmentedAtomicSwap = types.AugmentedAtomicSwap

type AugmentedAtomicSwaps

type AugmentedAtomicSwaps = types.AugmentedAtomicSwaps

type CodecUnmarshaler added in v0.3.0

type CodecUnmarshaler interface {
	MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr interface{})
}

type EncodingConfig added in v0.3.0

type EncodingConfig struct {
	InterfaceRegistry types.InterfaceRegistry
	Marshaller        codec.Marshaler
	TxConfig          client.TxConfig
	Amino             *codec.LegacyAmino
}

EncodingConfig specifies the concrete encoding types to use for a given app. This is provided for compatibility between protobuf and amino implementations.

func MakeAminoEncodingConfig added in v0.3.0

func MakeAminoEncodingConfig() EncodingConfig

MakeAminoEncodingConfig creates an EncodingConfig for an amino based configuration.

func MakeEncodingConfig added in v0.3.0

func MakeEncodingConfig() EncodingConfig

MakeEncodingConfig creates an EncodingConfig for a selected codec.

func MakeProtoEncodingConfig added in v0.3.0

func MakeProtoEncodingConfig() EncodingConfig

MakeProtoEncodingConfig creates an EncodingConfig for a protobuf based configuration.

type GenesisState

type GenesisState = types.GenesisState

func ExportGenesis

func ExportGenesis(ctx sdk.Context, k Keeper) (data *GenesisState)

ExportGenesis writes the current store values to a genesis file, which can be imported again with InitGenesis

type Keeper

type Keeper = keeper.Keeper

type MsgClaimAtomicSwap

type MsgClaimAtomicSwap = types.MsgClaimAtomicSwap

type MsgCreateAtomicSwap

type MsgCreateAtomicSwap = types.MsgCreateAtomicSwap

type MsgRefundAtomicSwap

type MsgRefundAtomicSwap = types.MsgRefundAtomicSwap

type Params

type Params = types.Params

type QueryAssetSupplies

type QueryAssetSupplies = types.QueryAssetSupplies

type QueryAssetSupply

type QueryAssetSupply = types.QueryAssetSupply

type QueryAtomicSwapByID

type QueryAtomicSwapByID = types.QueryAtomicSwapByID

type QueryAtomicSwaps

type QueryAtomicSwaps = types.QueryAtomicSwaps

type SupplyLimit

type SupplyLimit = types.SupplyLimit

type SwapDirection

type SwapDirection = types.SwapDirection

type SwapStatus

type SwapStatus = types.SwapStatus

Directories

Path Synopsis
client
cli
Package types is a reverse proxy.
Package types is a reverse proxy.

Jump to

Keyboard shortcuts

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