keeper

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QuerySupply       = "supply"
	QueryOwner        = "owner"
	QueryOwnerByDenom = "ownerByDenom"
	QueryCollection   = "collection"
	QueryDenoms       = "denoms"
	QueryNFT          = "nft"
	QuerySubTokens    = "sub_tokens"
)

query endpoints supported by the NFT Querier

View Source
const (
	DefaultBondDenom = "del"
)

Variables

View Source
var PowerReduction = sdk.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil))

Functions

func AllInvariants

func AllInvariants(k Keeper) sdk.Invariant

AllInvariants runs all invariants of the nfts module.

func MakeTestCodec

func MakeTestCodec() *codec.Codec

MakeTestCodec creates a codec for testing

func NewQuerier

func NewQuerier(k Keeper) 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 {
	BaseDenom *string
	// 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 CreateTestInput

func CreateTestInput(t *testing.T, isCheckTx bool, initPower int64) (sdk.Context, Keeper)

Hogpodge of all sorts of input required for testing. `initPower` is converted to an amount of tokens. If `initPower` is 0, no addrs get created.

func NewKeeper

func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey, supplyKeeper supply.Keeper, baseDenom string) Keeper

NewKeeper creates new instances of the nft Keeper

func (Keeper) BurnTokens

func (k Keeper) BurnTokens(ctx sdk.Context, amount sdk.Coins) error

func (Keeper) DeleteNFT

func (k Keeper) DeleteNFT(ctx sdk.Context, denom, id string, subTokenIDs []int64) error

DeleteNFT deletes an existing NFT from store

func (Keeper) ExistTokenID

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

func (Keeper) ExistTokenURI

func (k Keeper) ExistTokenURI(ctx sdk.Context, tokenURI string) bool

func (Keeper) GetCollection

func (k Keeper) GetCollection(ctx sdk.Context, denom string) (collection types.Collection, found bool)

GetCollection returns a collection of NFTs

func (Keeper) GetCollections

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

GetCollections returns all the NFTs collections

func (Keeper) GetDenoms

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

GetDenoms returns all the NFT denoms

func (Keeper) GetLastSubTokenID

func (k Keeper) GetLastSubTokenID(ctx sdk.Context, denom, id string) int64

func (Keeper) GetNFT

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

GetNFT gets the entire NFT metadata struct for a uint64

func (Keeper) GetOwner

func (k Keeper) GetOwner(ctx sdk.Context, address sdk.AccAddress) (owner types.Owner)

GetOwner gets all the ID Collections owned by an address

func (Keeper) GetOwnerByDenom

func (k Keeper) GetOwnerByDenom(ctx sdk.Context, owner sdk.AccAddress, denom string) (idCollection types.IDCollection, found bool)

GetOwnerByDenom gets the ID Collection owned by an address of a specific denom

func (Keeper) GetOwners

func (k Keeper) GetOwners(ctx sdk.Context) (owners []types.Owner)

GetOwners returns all the Owners ID Collections

func (Keeper) GetReservedPool

func (k Keeper) GetReservedPool(ctx sdk.Context) exported.ModuleAccountI

func (Keeper) GetSubToken

func (k Keeper) GetSubToken(ctx sdk.Context, denom, id string, subTokenID int64) (sdk.Int, bool)

func (Keeper) IsNFT

func (k Keeper) IsNFT(ctx sdk.Context, denom, id string) (exists bool)

IsNFT returns whether an NFT exists

func (Keeper) IterateCollections

func (k Keeper) IterateCollections(ctx sdk.Context, handler func(collection types.Collection) (stop bool))

IterateCollections iterates over collections and performs a function

func (Keeper) IterateIDCollections

func (k Keeper) IterateIDCollections(ctx sdk.Context, prefix []byte,
	handler func(owner sdk.AccAddress, idCollection types.IDCollection) (stop bool))

IterateIDCollections iterates over the IDCollections by Owner and performs a function

func (Keeper) IterateOwners

func (k Keeper) IterateOwners(ctx sdk.Context, handler func(owner types.Owner) (stop bool))

IterateOwners iterates over all Owners and performs a function

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, denom, id string, reserve, quantity sdk.Int,
	creator, owner sdk.AccAddress, tokenURI string, allowMint bool) (int64, error)

MintNFT mints an NFT and manages that NFTs existence within Collections and Owners

func (Keeper) RemoveSubToken

func (k Keeper) RemoveSubToken(ctx sdk.Context, denom, id string, subTokenID int64)

func (Keeper) ReserveTokens

func (k Keeper) ReserveTokens(ctx sdk.Context, amount sdk.Coins, address sdk.AccAddress) error

func (Keeper) SetBaseDenom

func (k Keeper) SetBaseDenom()

func (Keeper) SetCollection

func (k Keeper) SetCollection(ctx sdk.Context, denom string, collection types.Collection)

SetCollection sets the entire collection of a single denom

func (Keeper) SetLastSubTokenID

func (k Keeper) SetLastSubTokenID(ctx sdk.Context, denom, id string, lastSubTokenID int64)

func (Keeper) SetOwner

func (k Keeper) SetOwner(ctx sdk.Context, owner types.Owner)

SetOwner sets an entire Owner

func (Keeper) SetOwnerByDenom

func (k Keeper) SetOwnerByDenom(ctx sdk.Context, owner sdk.AccAddress, denom string, ids []string)

SetOwnerByDenom sets a collection of NFT IDs owned by an address

func (Keeper) SetOwners

func (k Keeper) SetOwners(ctx sdk.Context, owners []types.Owner)

SetOwners sets all Owners

func (Keeper) SetSubToken

func (k Keeper) SetSubToken(ctx sdk.Context, denom, id string, subTokenID int64, reserve sdk.Int)

func (Keeper) SetTokenIDIndex

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

func (Keeper) SetTokenURI

func (k Keeper) SetTokenURI(ctx sdk.Context, tokenURI string)

func (Keeper) SwapOwners

func (k Keeper) SwapOwners(ctx sdk.Context, denom string, id string, oldAddress sdk.AccAddress, newAddress sdk.AccAddress) (err error)

SwapOwners swaps the owners of a NFT ID

func (Keeper) UpdateNFT

func (k Keeper) UpdateNFT(ctx sdk.Context, denom string, nft exported.NFT) (err error)

UpdateNFT updates an already existing NFTs

func (Keeper) UpdateNFTReserve added in v1.2.6

func (k Keeper) UpdateNFTReserve(ctx sdk.Context, denom, id string, subTokenIDs []int64, newReserve sdk.Int) error

UpdateNFTReserve function to increase the minimum reserve of the NFT token

Jump to

Keyboard shortcuts

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