marketplace

package
v0.0.0-...-07bb99b Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName                 = types.ModuleName
	RouterKey                  = types.RouterKey
	StoreKey                   = types.StoreKey
	RegisterCurrencyKey        = types.RegisterCurrency
	AuctionKey                 = types.AuctionKey
	DeletedNFTKey              = types.DeletedNFTKey
	FungibleTokenCreationPrice = types.FungibleTokenCreationPrice
	FungibleCommissionAddress  = types.FungibleCommissionAddress

	MaxBeneficiaryCommission = types.FlagMaxCommission
)
View Source
const (
	QueryNFT            = "nft"
	QueryNFTs           = "nfts"
	QueryFungibleToken  = "fungible_token"
	QueryFungibleTokens = "fungible_tokens"
	QueryAuctionLot     = "auction_lot"
	QueryAuctionLots    = "auction_lots"
)

query endpoints supported by the marketplace Querier

Variables

View Source
var (
	NewNFT          = types.NewNFT
	ModuleCdc       = types.ModuleCdc
	RegisterCodec   = types.RegisterCodec
	EventKeyOfferID = types.AttributeKeyOfferID
)

Functions

func CustomIBCHandler

func CustomIBCHandler(ibcKeeper *ibc.Keeper, mpKeeper *Keeper) sdk.Handler

func CustomNFTHandler

func CustomNFTHandler(nftKeeper *nft.Keeper, mpKeeper *Keeper) sdk.Handler

CustomNFTHandler routes the messages to the handlers

func GetBalances

func GetBalances(ctx sdk.Context, mpKeeper *Keeper, addrs ...sdk.AccAddress) []*balance

func GetCommission

func GetCommission(price sdk.Coins, rat64 float64) sdk.Coins

func HandleMsgBurnNFTMarketplace

func HandleMsgBurnNFTMarketplace(ctx sdk.Context, msg nft.MsgBurnNFT, nftKeeper *nft.Keeper, mpKeeper *Keeper) sdk.Result

func HandleMsgMintNFTMarketplace

func HandleMsgMintNFTMarketplace(ctx sdk.Context, msg nft.MsgMintNFT, nftKeeper *nft.Keeper, mpKeeper *Keeper) sdk.Result

HandleMsgMintNFTMarketplace handles MsgMintNFT

func HandleMsgRecvPacket

func HandleMsgRecvPacket(ctx sdk.Context, mpKeeper *Keeper, k *ibc.Keeper, msg transfer.MsgRecvPacket) (res sdk.Result)

func HandleMsgTransferNFTByIBC

func HandleMsgTransferNFTByIBC(ctx sdk.Context, k *Keeper, msg MsgTransferNFTByIBC) sdk.Result

func HandleMsgTransferNFTMarketplace

func HandleMsgTransferNFTMarketplace(ctx sdk.Context, msg nft.MsgTransferNFT, nftKeeper *nft.Keeper, mpKeeper *Keeper) sdk.Result

HandleMsgMintNFTMarketplace handles MsgMintNFT

func InitGenesis

func InitGenesis(ctx sdk.Context, keeper *Keeper, data GenesisState) []abci.ValidatorUpdate

func NewHandler

func NewHandler(keeper *Keeper) sdk.Handler

NewHandler returns a handler for "marketplace" type messages.

func NewQuerier

func NewQuerier(keeper *Keeper, nftKeeper *nft.Keeper) sdk.Querier

NewQuerier is the module level router for state queries

func RollbackCommissions

func RollbackCommissions(ctx sdk.Context, mpKeeper *Keeper, logger log.Logger, initialBalances []*balance)

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

Types

type AccountResponse

type AccountResponse struct {
	Result struct {
		Value struct {
			AccountNumber uint64 `json:"account_number,string"`
			Sequence      uint64 `json:"sequence,string"`
		} `json:"value"`
	} `json:"result"`
}

type AppModule

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

func NewAppModule

func NewAppModule(k *Keeper, bankKeeper bank.Keeper, nftKeeper *nft.Keeper) AppModule

NewAppModule creates a new AppModule Object

func (AppModule) BeginBlock

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

func (AppModule) EndBlock

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage

func (AppModule) InitGenesis

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

func (AppModule) Name

func (AppModule) Name() string

func (AppModule) NewHandler

func (am AppModule) NewHandler() sdk.Handler

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

func (AppModule) QuerierRoute

func (am AppModule) QuerierRoute() string

func (AppModule) RegisterInvariants

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

func (AppModule) Route

func (am AppModule) Route() string

type AppModuleBasic

type AppModuleBasic struct{}

app module Basics object

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis() json.RawMessage

func (AppModuleBasic) GetQueryCmd

func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command

Get the root query command of this module

func (AppModuleBasic) GetTxCmd

func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command

Get the root tx command of this module

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

func (AppModuleBasic) RegisterCodec

func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)

func (AppModuleBasic) RegisterRESTRoutes

func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)

Register rest routes

func (AppModuleBasic) ValidateGenesis

func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error

Validation check of the Genesis

type AuctionLotRecord

type AuctionLotRecord struct {
	TokenID        string
	ExpirationTime time.Time
}

type BaseReq

type BaseReq struct {
	From          string       `json:"from,omitempty"`
	Memo          string       `json:"memo,omitempty"`
	ChainID       string       `json:"chain_id,omitempty"`
	AccountNumber uint64       `json:"account_number,string,omitempty"`
	Sequence      uint64       `json:"sequence,string,omitempty"`
	Fees          sdk.Coins    `json:"fees,omitempty"`
	GasPrices     sdk.DecCoins `json:"gas_prices,omitempty"`
	Gas           string       `json:"gas,omitempty"`
	GasAdjustment string       `json:"gas_adjustment,omitempty"`
	Simulate      bool         `json:"simulate,omitempty"`
}

type FinishAuctionReq

type FinishAuctionReq struct {
	BaseReq BaseReq `json:"base_req"`

	Name     string `json:"name"`
	Password string `json:"password"`

	TokenID string `json:"token_id"`
}

type FungibleToken

type FungibleToken = types.FungibleToken

type GenesisState

type GenesisState struct {
	NFTRecords           []*NFT          `json:"nft_records"`
	RegisteredCurrencies []FungibleToken `json:"registered_tokens"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func ExportGenesis

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

func NewGenesisState

func NewGenesisState(nftRecords []*NFT) GenesisState

type IBCModuleMarketplace

type IBCModuleMarketplace struct {
	ibc.AppModule
	// contains filtered or unexported fields
}

func NewIBCModuleMarketplace

func NewIBCModuleMarketplace(appModule ibc.AppModule, ibcKeeper *ibc.Keeper, mpKeeper *Keeper) *IBCModuleMarketplace

func (IBCModuleMarketplace) NewHandler

func (m IBCModuleMarketplace) NewHandler() sdk.Handler

type Keeper

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

Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine

func NewKeeper

func NewKeeper(
	coinKeeper bank.Keeper,
	stakingKeeper staking.Keeper,
	distrKeeper distribution.Keeper,
	storeKey sdk.StoreKey,
	deletedStoreKey *sdk.KVStoreKey,
	currencyRegistryStoreKey *sdk.KVStoreKey,
	auctionStoreKey *sdk.KVStoreKey,
	cdc *codec.Codec,
	cfg *config.MPServerConfig,
	msgMetr *common.MsgMetrics,
	nftKeeper *nft.Keeper,
	supplyKeeper *supply.Keeper,
	accKeeper *auth.AccountKeeper,
	ibcKeeper *ibc.Keeper,
) *Keeper

NewKeeper creates new instances of the marketplace Keeper

func (*Keeper) BurnFungibleTokens

func (k *Keeper) BurnFungibleTokens(ctx sdk.Context, currencyOwner sdk.AccAddress, denom string, amount int64) error

func (*Keeper) BurnNFT

func (k *Keeper) BurnNFT(ctx sdk.Context, id string) error

func (*Keeper) BuyLotOnAuction

func (k *Keeper) BuyLotOnAuction(ctx sdk.Context, buyer, buyerBeneficiary sdk.AccAddress,
	price sdk.Coins, lot *types.AuctionLot, buyerCommission string) error

buyout the lot

func (*Keeper) CheckFinishedAuctions

func (k *Keeper) CheckFinishedAuctions(ctx sdk.Context)

func (*Keeper) CreateFungibleToken

func (k *Keeper) CreateFungibleToken(ctx sdk.Context, creator sdk.AccAddress, denom string, amount int64) error

Creates a new fungible token with given supply and denom for FungibleTokenCreationPrice

func (*Keeper) GetAuctionLot

func (k *Keeper) GetAuctionLot(ctx sdk.Context, id string) (*types.AuctionLot, error)

func (*Keeper) GetAuctionLotsIterator

func (k *Keeper) GetAuctionLotsIterator(ctx sdk.Context) sdk.Iterator

func (*Keeper) GetFungibleToken

func (k *Keeper) GetFungibleToken(ctx sdk.Context, name string) (*FungibleToken, error)

func (*Keeper) GetFungibleTokensIterator

func (k *Keeper) GetFungibleTokensIterator(ctx sdk.Context) sdk.Iterator

Get an iterator over all Fungible Tokens

func (*Keeper) GetNFT

func (k *Keeper) GetNFT(ctx sdk.Context, id string) (*NFT, error)

func (*Keeper) GetNFTsIterator

func (k *Keeper) GetNFTsIterator(ctx sdk.Context) sdk.Iterator

Get an iterator over all NFTs.

func (*Keeper) GetRegisteredCurrenciesIterator

func (k *Keeper) GetRegisteredCurrenciesIterator(ctx sdk.Context) sdk.Iterator

Get an iterator over all registered currencies

func (*Keeper) IsDenomExist

func (k *Keeper) IsDenomExist(ctx sdk.Context, coins sdk.Coins) bool

func (*Keeper) MintNFT

func (k *Keeper) MintNFT(ctx sdk.Context, nft *NFT) error

func (*Keeper) PutNFTOnAuction

func (k *Keeper) PutNFTOnAuction(ctx sdk.Context, id string, owner, beneficiary sdk.AccAddress,
	openingPrice, buyoutPrice sdk.Coins, expirationTime time.Time) error

func (*Keeper) PutNFTOnMarket

func (k *Keeper) PutNFTOnMarket(ctx sdk.Context, id string, owner, beneficiary sdk.AccAddress, price sdk.Coins) error

func (*Keeper) ReceiveNFTByIBCTransferTx

func (k *Keeper) ReceiveNFTByIBCTransferTx(ctx sdk.Context, data types.NFTPacketData, packet exported.PacketI) error

func (*Keeper) RegisterBasicDenoms

func (k *Keeper) RegisterBasicDenoms(ctx sdk.Context)

Should be run just once

func (*Keeper) RemoveNFTFromAuction

func (k *Keeper) RemoveNFTFromAuction(ctx sdk.Context, id string, owner sdk.AccAddress) error

important! must do all necessary checks before evoking this function

func (*Keeper) RemoveNFTFromMarket

func (k *Keeper) RemoveNFTFromMarket(ctx sdk.Context, id string, owner sdk.AccAddress) error

func (*Keeper) SendFinish

func (k *Keeper) SendFinish(id string, acc exported.Account) error

func (*Keeper) SendNFTByIBCTransferTx

func (k *Keeper) SendNFTByIBCTransferTx(ctx sdk.Context, id, denom, tokenURI, sourcePort, sourceChannel string,
	sender, receiver sdk.AccAddress, isSourceChain bool) error

func (*Keeper) TransferFungibleTokens

func (k *Keeper) TransferFungibleTokens(ctx sdk.Context, currencyOwner, recipient sdk.AccAddress, denom string, amount int64) error

Transfers amount of fungible tokens from one account to another

func (*Keeper) TransferNFT

func (k *Keeper) TransferNFT(ctx sdk.Context, id string, sender, recipient sdk.AccAddress) error

func (*Keeper) UpdateAuctionLot

func (k *Keeper) UpdateAuctionLot(ctx sdk.Context, lot *types.AuctionLot) error

func (*Keeper) UpdateNFT

func (k *Keeper) UpdateNFT(ctx sdk.Context, newToken *NFT) error

type MsgAcceptOffer

type MsgAcceptOffer = types.MsgAcceptOffer

type MsgBatchBuyOnMarket

type MsgBatchBuyOnMarket = types.MsgBatchBuyOnMarket

type MsgBatchPutOnMarket

type MsgBatchPutOnMarket = types.MsgBatchPutOnMarket

type MsgBatchRemoveFromMarket

type MsgBatchRemoveFromMarket = types.MsgBatchRemoveFromMarket

type MsgBatchTransfer

type MsgBatchTransfer = types.MsgBatchTransfer

type MsgBurnFungibleToken

type MsgBurnFungibleToken = types.MsgBurnFungibleTokens

type MsgBuyNFT

type MsgBuyNFT = types.MsgBuyNFT

type MsgBuyoutOnAuction

type MsgBuyoutOnAuction = types.MsgBuyoutOnAuction

type MsgCreateFungibleToken

type MsgCreateFungibleToken = types.MsgCreateFungibleToken

type MsgFinishAuction

type MsgFinishAuction = types.MsgFinishAuction

type MsgMakeBidOnAuction

type MsgMakeBidOnAuction = types.MsgMakeBidOnAuction

type MsgMakeOffer

type MsgMakeOffer = types.MsgMakeOffer

type MsgPutNFTOnAuction

type MsgPutNFTOnAuction = types.MsgPutNFTOnAuction

type MsgPutNFTOnMarket

type MsgPutNFTOnMarket = types.MsgPutNFTOnMarket

type MsgRemoveNFTFromAuction

type MsgRemoveNFTFromAuction = types.MsgRemoveNFTFromAuction

type MsgRemoveNFTFromMarket

type MsgRemoveNFTFromMarket = types.MsgRemoveNFTFromMarket

type MsgRemoveOffer

type MsgRemoveOffer = types.MsgRemoveOffer

type MsgTransferFungibleTokens

type MsgTransferFungibleTokens = types.MsgTransferFungibleTokens

type MsgTransferNFTByIBC

type MsgTransferNFTByIBC = types.MsgTransferNFTByIBC

type MsgUpdateNFTParams

type MsgUpdateNFTParams = types.MsgUpdateNFTParams

type NFT

type NFT = types.NFT

type NFTInfo

type NFTInfo = types.NFTInfo

type NFTModuleMarketplace

type NFTModuleMarketplace struct {
	nft.AppModule
	// contains filtered or unexported fields
}

NFTModuleMarketplace overrides the NFT module for custom handlers

func NewNFTModuleMarketplace

func NewNFTModuleMarketplace(appModule nft.AppModule, nftKeeper *nft.Keeper, mpKeeper *Keeper) *NFTModuleMarketplace

NewNFTModuleMarketplace generates a new NFT Module

func (NFTModuleMarketplace) NewHandler

func (m NFTModuleMarketplace) NewHandler() sdk.Handler

NewHandler module handler for the NFTModuleMarketplace

Directories

Path Synopsis
client
cli

Jump to

Keyboard shortcuts

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