marketplace

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: GPL-3.0 Imports: 23 Imported by: 0

README

NFT Marketplace Module Specification

Overview

A module for trading NFTs on the CUDOS network. The module supports publishing collection for sale which is optional step to set mint royalties and resale royalties which will be deducted from the payments for all the NFTs traded from the given collection. If user tries to sell NFT that has no royalties the seller will be paid the full price. The NFTs can be minted via the marketplace which allows distribution of royalties on mint. When NFT is published for sale, it will be soft locked in the NFT module, so the seller will remain owner but wont be able to transfer it.

Module Interface

Transaction
Command Description
publish-collection Publishes denom@NFT Module from NFT module for sale with specified royalties, creates Collection in the marketplace store.
create-collection Creates denom@NFT Module from NFT module for sale with specified royalties, creates Collection in the marketplace store and verifies it
update-royalties Update royalties of already published collection.
publish-nft Publish NFT@NFT Module from NFT module for sale with given price, creates NFT in marketplace store.
update-price Updates price of already published or sale NFT.
mint-nft Mint NFT@NFT Module via NFT module, state of marketplace is not affected anyhow.
buy-nft Buy NFT@NFT Module and removes the NFT from marketplace store.
remove-nft Remove NFT from marketplace store.
verify-collection Verify Collection.
unverify-collection Unverify Collection.
add-admin Add admin
remove-admin Remove admin
Query
Command Description
list-collections Queries all Collection
list-nfts Queries all NFT
show-collection Show Collection by Id
show-nft Show NFT by Id
collection-by-denom-id Show Collection by denom Id
list-admins Queries all marketplace admins

Object types:

Collection

References denom created by NFT module and has details about royalties on mint and resale for all NFTs traded from the referenced denom.

type Collection struct {
	Id              uint64    `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	DenomId         string    `protobuf:"bytes,2,opt,name=denomId,proto3" json:"denomId,omitempty"`
	MintRoyalties   []Royalty `protobuf:"bytes,3,rep,name=mintRoyalties,proto3" json:"mintRoyalties"`
	ResaleRoyalties []Royalty `protobuf:"bytes,4,rep,name=resaleRoyalties,proto3" json:"resaleRoyalties"`
	Verified        bool      `protobuf:"varint,5,opt,name=verified,proto3" json:"verified,omitempty"`
	Owner           string    `protobuf:"bytes,6,opt,name=owner,proto3" json:"owner,omitempty"`
}

type Royalty struct {
	Address string                                 `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	Percent github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=percent,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"percent"`
}
NFT

References nft created by NFT module and has details about its sale price.

type Nft struct {
	Id      uint64     `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	TokenId string     `protobuf:"bytes,2,opt,name=tokenId,proto3" json:"tokenId,omitempty"`
	DenomId string     `protobuf:"bytes,3,opt,name=denomId,proto3" json:"denomId,omitempty"`
	Price   types.Coin `protobuf:"bytes,4,opt,name=price,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"price"`
	Owner   string     `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"`
}
Events

The events that are emitted after certain operations

	EventPublishCollectionType       = "publish_collection"
	EventPublishNftType              = "publish_nft"
	EventBuyNftType                  = "buy_nft"
	EventMintNftType                 = "mint_nft"
	EventRemoveNftType               = "remove_nft"
	EventVerifyCollectionType        = "verify_collection"
	EventUnverifyCollectionType      = "unverify_collection"
  EventCreateCollectionType        = "create_collection"
	EventUpdateRoyaltiesType         = "update_royalties"
	EventUpdatePriceType             = "update_price"
	EventAddAdminType                = "add_admin"
	EventRemoveAdminType             = "remove_admin"

Full commands info

Transactions
publish-collection

Publish collection for sale with optional royalties. Only owner of collection can publish it for sale.

  • arguments:
    • denom-id string Denom to publish for sale required: true
  • flags:
    • --mint-royalties string Royalties that will be distributed when NFTs are minted on demand via the marketplace. required: false
    • --resale-royalties string Royalties that will be distributed when reselling NFTs on the marketplace. required: false

Royalties are represented in the format "address1:percent,address2:percent". For resale royalties first royalties are paid and whatever is left is paid to the seller. If there are no royalties set, the full amount is paid to the seller. Mint royalties are required to sum to 100% because for some cases we could have one owner of collection onchain that manages it and someone else who should receive the bigger part of the amount (ex. Aura Pool).

cudos-noded tx marketplace publish-collection <denom-id> --mint-royalties="cudos1kztarv5vlckzt5j7z3y5u0dj6q6q6axyz4pe60;0.01,cudos14vjzkqs505xvs4tp3kdkzq3mzh6vutngnlqamz:11.22" --resale-royalties="cudos18687hmplu9mfxr47um0adne6ml29turydgm64j:50" --keyring-backend=<keyring> --chain-id=<chain-id> --gas=auto --gas-adjustment=1.3 --gas-prices=5000000000000acudos --from=<from-key>
create-collection

Creates denom, publishes for sale with optional royalties and can also verify it if executed by marketplace admin.

  • arguments:
    • denom-id string Denom to publish for sale required: true
  • flags:
    • --name string The unique name of the denom. required: true
    • --symbol string The unique symbol of the denom. required: true
    • --from string The address that is issuing the denom. Will be set as denom creator. Can be either an address or alias to that address required: true
    • --schema string Metadata about the NFT. Schema-content or path to schema.json. required: false
    • --traits string Traits that define the denom behavior and restrictions required: false
    • --description string Text description of the denom required: false
    • --data string Denom metadata required: false
    • --minter string Address that will be allowed to mint NFTs from this denom other than the owner required: false
    • --mint-royalties string Royalties that will be distributed when NFTs are minted on demand via the marketplace. required: false
    • --resale-royalties string Royalties that will be distributed when reselling NFTs on the marketplace. required: false
    • --verified bool Specifies if collection is verified - can be set to true only by admins required: false
cudos-noded tx marketplace create-collection <denom-id> --name=<denom-name> --symbol=<denom-symbol> --verified=true --mint-royalties="cudos1kztarv5vlckzt5j7z3y5u0dj6q6q6axyz4pe60;0.01,cudos14vjzkqs505xvs4tp3kdkzq3mzh6vutngnlqamz:11.22" --resale-royalties="cudos18687hmplu9mfxr47um0adne6ml29turydgm64j:50" --keyring-backend=<keyring> --chain-id=<chain-id> --gas=auto --gas-adjustment=1.3 --gas-prices=5000000000000acudos --from=<from-key>
publish-nft

Publish NFT for sale with price. Only owner, approved operator or approved address can publish it for sale.

  • arguments:
    • token-id string Token id to publish for sale required: true
    • denom-id string Denom to which the token id belongs required: true
    • price string Price for which to publish the NFT for sale required: true
  • flags: none
cudos-noded tx marketplace publish-nft <token-id> <denom-id> 10000000acudos --keyring-backend=<keyring> --chain-id=<chain-id> --gas=auto --gas-adjustment=1.3 --gas-prices=5000000000000acudos --from=<from-key>
mint-nft

Mint NFT via the NFT module and distribute royalties if any.

  • arguments:
    • denom-id string Denom from which to mint the token required: true
    • recipient string Recipient to receive the minted NFT required: true
    • price string Amount to be paid to mint the NFT required: true
    • token-name string Name of token to be minted required: true
  • flags:
    • --uri string Uri for NFT metadata stored offchain. required: false
    • --data string NFT metdata stored onchain. required: false
cudos-noded tx marketplace mint-nft <denom-id> <recipient> 11111acudos <token-name> --uri=<token-uri> --data=<token-data> --keyring-backend=<keyring> --chain-id=<chain-id> --gas=auto --gas-adjustment=1.3 --gas-prices=5000000000000acudos --from=<from-key>
buy-nft

Buy NFT published for sale.

  • arguments:
    • nft-id string Nft id in the marketplace required: true
  • flags: none
cudos-noded tx marketplace buy-nft <nft-id> --keyring-backend=<keyring> --chain-id=cudos-local-network --gas=auto --gas-adjustment=1.3 --gas-prices=5000000000000acudos --from=<from-key>
remove-nft

Remove NFT from marketplace that was previously published for sale. Only owner of the NFT can remove it.

  • arguments:
    • nft-id string Nft id in the marketplace required: true
  • flags: none
cudos-noded tx marketplace remove-nft <nft-id> --keyring-backend=<keyring> --chain-id=cudos-local-network --gas=auto --gas-adjustment=1.3 --gas-prices=5000000000000acudos --from=<from-key>
verify-collection

Verify collection in the marketplace.

  • arguments:
    • collection-id string Collection id in the marketplace required: true
  • flags: none
cudos-noded tx marketplace verify-collection <collection-id> --keyring-backend=<keyring> --chain-id=cudos-local-network --gas=auto --gas-adjustment=1.3 --gas-prices=5000000000000acudos --from=<from-key>
unverify-collection

Unverify collection in the marketplace.

  • arguments:
    • collection-id string Collection id in the marketplace required: true
  • flags: none
cudos-noded tx marketplace unverify-collection <collection-id> --keyring-backend=<keyring> --chain-id=cudos-local-network --gas=auto --gas-adjustment=1.3 --gas-prices=5000000000000acudos --from=<from-key>
transfer-admin-permission

Transfer marketplace admin permission to different address.

  • arguments:
    • new-admin string New marketplace admin address required: true
  • flags: none
cudos-noded tx marketplace transfer-admin-permission <new-admin> --keyring-backend=<keyring> --chain-id=cudos-local-network --gas=auto --gas-adjustment=1.3 --gas-prices=5000000000000acudos --from=<from-key>
update-royalties

Update collection royalties.

  • arguments:
    • collection-id string Collection id in the marketplace required: true
  • flags:
    • --mint-royalties string Royalties that will be distributed when NFTs are minted on demand via the marketplace. required: false
    • --resale-royalties string Royalties that will be distributed when reselling NFTs on the marketplace. required: false
cudos-noded tx marketplace update-royalties <collection-id> --mint-royalties="cudos18x9glvtqk0x43xnjdx7w9lzqm0ganc950ur8n5:50" --resale-royalties="cudos18x9glvtqk0x43xnjdx7w9lzqm0ganc950ur8n5:50" --keyring-backend=<keyring> --chain-id=cudos-local-network --gas=auto --gas-adjustment=1.3 --gas-prices=5000000000000acudos --from=<from-key>
update-price

Update NFT price.

  • arguments:
    • nft-id string NFT id in the marketplace required: true
    • price string New price for the NFT required: true
  • flags: none
cudos-noded tx marketplace update-price <nft-id> <price> --keyring-backend=<keyring> --chain-id=cudos-local-network --gas=auto --gas-adjustment=1.3 --gas-prices=5000000000000acudos --from=<from-key>
add-admin

Add admin.

  • arguments:
    • address string Address to join the admin set required: true
  • flags: none
cudos-noded tx marketplace add-admin <admin-address> --keyring-backend=<keyring> --chain-id=cudos-local-network --gas=auto --gas-adjustment=1.3 --gas-prices=5000000000000acudos --from=<from-key>
remove-admin

Remove admin.

  • arguments:
    • address string Address to be removed from the admin set required: true
  • flags: none
cudos-noded tx marketplace remove-admin <admin-address> --keyring-backend=<keyring> --chain-id=cudos-local-network --gas=auto --gas-adjustment=1.3 --gas-prices=5000000000000acudos --from=<from-key>
Queries
list-collections

List all collections published for sale.

  • arguments:
    • none
  • flags:
    • none
cudos-noded query marketplace list-collections
list-nfts

List all NFTs published for sale.

  • arguments:
    • none
  • flags:
    • none
cudos-noded query marketplace list-nfts
show-collection

Get collection published for sale by its Id in the marketplace.

  • arguments:
    • collection-id string Collection id in the marketplace required: true
  • flags: none
cudos-noded query marketplace show-collection <collection-id>
show-nft

Get NFT published for sale by its Id in the marketplace.

  • arguments:
    • nft-id string Nft id in the marketplace required: true
  • flags: none
cudos-noded query marketplace show-nft <nft-id>
collection-by-denom-id

Get collection published for sale by its denom Id.

  • arguments:
    • denom-id string Denom Id of the collection required: true
  • flags: none
cudos-noded query marketplace collection-by-denom-id <denom-id>
list-admins

List admins.

  • arguments:
    • none
  • flags:
    • none
cudos-noded query marketplace list-admins

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportGenesis

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

ExportGenesis returns the capability module's exported genesis.

func InitGenesis

func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)

InitGenesis initializes the capability module's state from a provided genesis state.

func NewHandler

func NewHandler(k keeper.Keeper) sdk.Handler

NewHandler ...

Types

type AppModule

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

AppModule implements the AppModule interface for the capability module.

func NewAppModule

func NewAppModule(
	cdc codec.Codec,
	keeper keeper.Keeper,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
) AppModule

func (AppModule) BeginBlock

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

BeginBlock executes all ABCI BeginBlock logic respective to the capability module.

func (AppModule) ConsensusVersion

func (AppModule) ConsensusVersion() uint64

ConsensusVersion implements ConsensusVersion.

func (AppModule) EndBlock

EndBlock executes all ABCI EndBlock logic respective to the capability module. It returns no validator updates.

func (AppModule) ExportGenesis

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

ExportGenesis returns the capability module's exported genesis state as raw JSON bytes.

func (AppModule) GenerateGenesisState

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

GenerateGenesisState creates a randomized GenState of the module

func (AppModule) InitGenesis

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

InitGenesis performs the capability module's genesis initialization It returns no validator updates.

func (AppModule) LegacyQuerierHandler

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

LegacyQuerierHandler returns the capability module's Querier.

func (AppModule) Name

func (am AppModule) Name() string

Name returns the capability module's name.

func (AppModule) ProposalContents

ProposalContents doesn't return any content functions for governance proposals

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

QuerierRoute returns the capability module's query routing key.

func (AppModule) RandomizedParams

func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange

RandomizedParams creates randomized param changes for the simulator

func (AppModule) RegisterInvariants

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

RegisterInvariants registers the capability module's invariants.

func (AppModule) RegisterServices

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

RegisterServices registers a GRPC query service to respond to the module-specific GRPC queries.

func (AppModule) RegisterStoreDecoder

func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry)

RegisterStoreDecoder registers a decoder

func (AppModule) Route

func (am AppModule) Route() sdk.Route

Route returns the capability module's message routing key.

func (AppModule) WeightedOperations

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

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

type AppModuleBasic

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

AppModuleBasic implements the AppModuleBasic interface for the capability module.

func NewAppModuleBasic

func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic

func (AppModuleBasic) DefaultGenesis

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

DefaultGenesis returns the capability module's default genesis state.

func (AppModuleBasic) GetQueryCmd

func (AppModuleBasic) GetQueryCmd() *cobra.Command

GetQueryCmd returns the capability module's root query command.

func (AppModuleBasic) GetTxCmd

func (a AppModuleBasic) GetTxCmd() *cobra.Command

GetTxCmd returns the capability module's root tx command.

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

Name returns the capability module's name.

func (AppModuleBasic) RegisterCodec

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

func (AppModuleBasic) RegisterGRPCGatewayRoutes

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

RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.

func (AppModuleBasic) RegisterInterfaces

func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry)

RegisterInterfaces registers the module's interface types

func (AppModuleBasic) RegisterLegacyAminoCodec

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

func (AppModuleBasic) RegisterRESTRoutes

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

RegisterRESTRoutes registers the capability module's REST service handlers.

func (AppModuleBasic) ValidateGenesis

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

ValidateGenesis performs genesis state validation for the capability module.

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