keeper

package
v0.0.0-...-2dee25a Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Copyright (c) 2016-2021 Shanghai Bianjie AI Technology Inc. (licensed under the Apache License, Version 2.0) Modifications Copyright (c) 2021, CRO Protocol Labs ("Crypto.org") (licensed under the Apache License, Version 2.0)

Copyright (c) 2016-2021 Shanghai Bianjie AI Technology Inc. (licensed under the Apache License, Version 2.0) Modifications Copyright (c) 2021, CRO Protocol Labs ("Crypto.org") (licensed under the Apache License, Version 2.0)

Copyright (c) 2016-2021 Shanghai Bianjie AI Technology Inc. (licensed under the Apache License, Version 2.0) Modifications Copyright (c) 2021, CRO Protocol Labs ("Crypto.org") (licensed under the Apache License, Version 2.0)

Copyright (c) 2016-2021 Shanghai Bianjie AI Technology Inc. (licensed under the Apache License, Version 2.0) Modifications Copyright (c) 2021, CRO Protocol Labs ("Crypto.org") (licensed under the Apache License, Version 2.0)

Copyright (c) 2016-2021 Shanghai Bianjie AI Technology Inc. (licensed under the Apache License, Version 2.0) Modifications Copyright (c) 2021, CRO Protocol Labs ("Crypto.org") (licensed under the Apache License, Version 2.0)

Copyright (c) 2016-2021 Shanghai Bianjie AI Technology Inc. (licensed under the Apache License, Version 2.0) Modifications Copyright (c) 2021, CRO Protocol Labs ("Crypto.org") (licensed under the Apache License, Version 2.0)

Copyright (c) 2016-2021 Shanghai Bianjie AI Technology Inc. (licensed under the Apache License, Version 2.0) Modifications Copyright (c) 2021, CRO Protocol Labs ("Crypto.org") (licensed under the Apache License, Version 2.0)

Copyright (c) 2016-2021 Shanghai Bianjie AI Technology Inc. (licensed under the Apache License, Version 2.0) Modifications Copyright (c) 2021, CRO Protocol Labs ("Crypto.org") (licensed under the Apache License, Version 2.0)

Copyright (c) 2016-2021 Shanghai Bianjie AI Technology Inc. (licensed under the Apache License, Version 2.0) Modifications Copyright (c) 2021, CRO Protocol Labs ("Crypto.org") (licensed under the Apache License, Version 2.0)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllInvariants

func AllInvariants(k Keeper) sdk.Invariant

AllInvariants runs all invariants of the NFT module.

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the NFT MsgServer interface for the provided Keeper.

func NewQuerier

func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

NewQuerier is the module level router for state queries

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers all supply invariants

func SupplyInvariant

func SupplyInvariant(k Keeper) sdk.Invariant

SupplyInvariant checks that the total amount of NFTs on collections matches the total amount owned by addresses

Types

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(cdc codec.Marshaler, storeKey sdk.StoreKey) Keeper

NewKeeper creates a new instance of the NFT Keeper

func (Keeper) BurnNFT

func (k Keeper) BurnNFT(ctx sdk.Context, denomID, tokenID string, owner sdk.AccAddress) error

BurnNFT deletes a specified NFT

func (Keeper) CloneMintNFT

func (k Keeper) CloneMintNFT(
	ctx sdk.Context, denomID, tokenID, tokenNm,
	tokenURI string, owner sdk.AccAddress,
) error

CloneMintNFT mints an NFT by cloning existing one

func (Keeper) Collection

func (Keeper) Denom

func (Keeper) Denoms

func (Keeper) EditNFT

func (k Keeper) EditNFT(
	ctx sdk.Context, denomID, tokenID, tokenNm string, owner sdk.AccAddress,
) error

EditNFT updates an already existing NFT

func (Keeper) GetCollection

func (k Keeper) GetCollection(ctx sdk.Context, denomID string) (types.Collection, error)

GetCollection returns the collection by the specified denom ID

func (Keeper) GetCollections

func (k Keeper) GetCollections(ctx sdk.Context) (cs []types.Collection)

GetCollections returns all the collections

func (Keeper) GetDenom

func (k Keeper) GetDenom(ctx sdk.Context, id string) (denom types.Denom, err error)

GetDenom returns the denom by id

func (Keeper) GetDenomByName

func (k Keeper) GetDenomByName(ctx sdk.Context, name string) (denom types.Denom, err error)

GetDenom returns the denom by name

func (Keeper) GetDenoms

func (k Keeper) GetDenoms(ctx sdk.Context) (denoms []types.Denom)

GetDenoms returns all the denoms

func (Keeper) GetNFT

func (k Keeper) GetNFT(ctx sdk.Context, denomID, tokenID string) (nft exported.NFT, err error)

GetNFT gets the the specified NFT

func (Keeper) GetNFTs

func (k Keeper) GetNFTs(ctx sdk.Context, denom string) (nfts []exported.NFT)

GetNFTs returns all NFTs by the specified denom ID

func (Keeper) GetOwner

func (k Keeper) GetOwner(ctx sdk.Context, address sdk.AccAddress, denom string) (types.Owner, error)

GetOwner gets all the ID collections owned by an address and denom ID

func (Keeper) GetOwners

func (k Keeper) GetOwners(ctx sdk.Context) (owners types.Owners, err error)

GetOwners gets all the ID collections

func (Keeper) GetPaginateCollection

func (k Keeper) GetPaginateCollection(ctx sdk.Context, request *types.QueryCollectionRequest, denomID string) (types.Collection, *query.PageResponse, error)

GetPaginateCollection returns the collection by the specified denom ID

func (Keeper) GetTotalSupply

func (k Keeper) GetTotalSupply(ctx sdk.Context, denomID string) uint64

GetTotalSupply returns the number of NFTs by the specified denom ID

func (Keeper) GetTotalSupplyOfOwner

func (k Keeper) GetTotalSupplyOfOwner(ctx sdk.Context, id string, owner sdk.AccAddress) (supply uint64)

GetTotalSupplyOfOwner returns the amount of NFTs by the specified conditions

func (Keeper) HasDenomID

func (k Keeper) HasDenomID(ctx sdk.Context, id string) bool

HasDenomID returns whether the specified denom ID exists

func (Keeper) HasDenomNm

func (k Keeper) HasDenomNm(ctx sdk.Context, name string) bool

HasDenomNm returns whether the specified denom name exists

func (Keeper) HasNFT

func (k Keeper) HasNFT(ctx sdk.Context, denomID, tokenID string) bool

HasNFT checks if the specified NFT exists

func (Keeper) IsDenomCreator

func (k Keeper) IsDenomCreator(ctx sdk.Context, denomID string, address sdk.AccAddress) (types.Denom, error)

IsDenomCreator checks if address is the creator of Denom Return the Denom if true, an error otherwise

func (Keeper) IsOwner

func (k Keeper) IsOwner(ctx sdk.Context, denomID, tokenID string, owner sdk.AccAddress) (types.BaseNFT, error)

IsOwner checks if the sender is the owner of the given NFT Return the NFT if true, an error otherwise

func (Keeper) IssueDenom

func (k Keeper) IssueDenom(ctx sdk.Context,
	id, name string, creators []string, splitShares []sdk.Dec, royaltyShare sdk.Dec, sender sdk.AccAddress) error

IssueDenom issues a denom according to the given params

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) MintNFT

func (k Keeper) MintNFT(
	ctx sdk.Context, denomID, tokenID, tokenNm,
	tokenURI string, sender, owner sdk.AccAddress, isPrimary bool,
) error

MintNFT mints an NFT and manages the NFT's existence within Collections and Owners

func (Keeper) MintNFTUnverified

func (k Keeper) MintNFTUnverified(ctx sdk.Context, denomID, tokenID, tokenNm, tokenURI string, owner sdk.AccAddress, isPrimary bool) error

MintNFTUnverified mints an NFT without verifying if the owner is the creator of denom Needed during genesis initialization

func (Keeper) NFT

func (Keeper) Owner

func (Keeper) SetCollection

func (k Keeper) SetCollection(ctx sdk.Context, collection types.Collection, sender sdk.AccAddress) error

SetCollection saves all NFTs and returns an error if there already exists or any one of the owner's bech32 account address is invalid or any NFT's owner is not the creator of denomination

func (Keeper) SetDenom

func (k Keeper) SetDenom(ctx sdk.Context, denom types.Denom) error

SetDenom is responsible for saving the definition of denom

func (Keeper) SetGenesisCollection

func (k Keeper) SetGenesisCollection(ctx sdk.Context, collection types.Collection) error

SetGenesisCollection saves all NFTs and returns an error if there already exists or any one of the owner's bech32 account address is invalid

func (Keeper) SetNFT

func (k Keeper) SetNFT(ctx sdk.Context, denomID string, nft types.BaseNFT)

func (Keeper) Supply

func (Keeper) TransferOwner

func (k Keeper) TransferOwner(
	ctx sdk.Context, denomID, tokenID string, srcOwner, dstOwner sdk.AccAddress,
) error

TransferOwner transfers the ownership of the given NFT to the new owner

Jump to

Keyboard shortcuts

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