keeper

package
v0.0.0-...-6012569 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateERC721TokenID

func GenerateERC721TokenID(classId string, nftId string) *big.Int

GenerateERC721TokenID generates an ERC721 token ID

func GenerateNativeTokenID

func GenerateNativeTokenID(erc721 common.Address, tokenId *big.Int) string

GenerateNativeTokenID generates an ERC721 token ID

Types

type Keeper

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

Keeper of this module maintains collections of erc721.

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey storetypes.StoreKey,
	ak types.AccountKeeper,
	evmKeeper types.EVMKeeper,
	nftKeeper types.NFTKeeper,
) Keeper

func (Keeper) Burn

func (k Keeper) Burn(ctx sdk.Context,
	contractAddress common.Address,
	contractABI abi.ABI,
	sender common.Address,
	tokenId *big.Int,
) error

Burn burns an NFT

func (Keeper) CallEVM

func (k Keeper) CallEVM(
	ctx sdk.Context,
	contractABI abi.ABI,
	from, to common.Address,
	commit bool,
	method string,
	args ...interface{},
) (*evmtypes.MsgEthereumTxResponse, error)

CallEVM performs a smart contract method call using given args

func (Keeper) CallEVMWithData

func (k Keeper) CallEVMWithData(
	ctx sdk.Context,
	from common.Address,
	contractAddress *common.Address,
	data []byte,
	commit bool,
) (*evmtypes.MsgEthereumTxResponse, error)

CallEVMWithData performs a smart contract method call using contract data

func (Keeper) ClassData

func (k Keeper) ClassData(
	ctx sdk.Context,
	contractABI abi.ABI,
	contractAddress common.Address,
) (string, error)

ClassData queries an account's class data for a given ERC721 contract

func (Keeper) ClassPair

ClassPair returns a given registered token pair

func (Keeper) ClassPairs

ClassPairs returns all registered pairs

func (Keeper) ClassURI

func (k Keeper) ClassURI(
	ctx sdk.Context,
	contractABI abi.ABI,
	contractAddress common.Address,
) (string, error)

ClassURI queries an account's class URI for a given ERC721 contract

func (Keeper) ConvertERC721

ConvertERC721 converts an ERC721 token to an native Cosmos token

func (Keeper) ConvertERC721Burn

func (k Keeper) ConvertERC721Burn(ctx sdk.Context,
	pair types.ClassPair,
	msg *types.MsgConvertERC721,
	receiver sdk.AccAddress,
	sender common.Address,
) (string, error)

ConvertERC721Burn converts a native Cosmos token to an erc721 token

func (Keeper) ConvertERC721Mint

func (k Keeper) ConvertERC721Mint(ctx sdk.Context,
	pair types.ClassPair,
	msg *types.MsgConvertERC721,
	receiver sdk.AccAddress,
	sender common.Address,
) (string, error)

ConvertERC721Mint converts a erc721 token to an native Cosmos token

func (Keeper) ConvertNFT

func (k Keeper) ConvertNFT(goCtx context.Context, msg *types.MsgConvertNFT) (*types.MsgConvertNFTResponse, error)

ConvertNFT converts a native Cosmos token to an ERC721 token

func (Keeper) ConvertNFTBurn

func (k Keeper) ConvertNFTBurn(ctx sdk.Context,
	pair types.ClassPair,
	msg *types.MsgConvertNFT,
	receiver common.Address,
	sender sdk.AccAddress) (*big.Int, error)

ConvertNFTBurn converts a erc721 token to an native Cosmos token

func (Keeper) ConvertNFTMint

func (k Keeper) ConvertNFTMint(
	ctx sdk.Context,
	pair types.ClassPair,
	msg *types.MsgConvertNFT,
	receiver common.Address,
	sender sdk.AccAddress,
) (*big.Int, error)

ConvertNFTMint converts a native Cosmos token to an ERC721 token

func (Keeper) ConvertValidator

func (k Keeper) ConvertValidator(
	ctx sdk.Context,
	sender, receiver sdk.AccAddress,
	token string,
) (types.ClassPair, error)

ConvertValidator is the validator for Convert

func (Keeper) DeleteClassPair

func (k Keeper) DeleteClassPair(ctx sdk.Context, ClassPair types.ClassPair)

DeleteClassPair removes a token pair.

func (Keeper) DeleteERC721TokenIdMap

func (k Keeper) DeleteERC721TokenIdMap(ctx sdk.Context, erc721 common.Address, tokenId *big.Int)

DeleteERC721TokenIdMap deletes a token id pair erc721/tokenId = sha256.sum(classId/nftId)

func (Keeper) DeleteNativeNftIdMap

func (k Keeper) DeleteNativeNftIdMap(ctx sdk.Context, classId, nftId string)

DeleteNativeNftIdMap deletes a token id pair classId/nftId = tokenId

func (Keeper) DeployERC721Contract

func (k Keeper) DeployERC721Contract(ctx sdk.Context, deployer common.Address,
	name, symbol, baseURI, classData string, owner common.Address) (common.Address, error)

func (Keeper) ERC721Keeper

func (k Keeper) ERC721Keeper() erc721Keeper

func (Keeper) ExportGenesis

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

func (Keeper) GetClassCollections

func (k Keeper) GetClassCollections(ctx sdk.Context) []types.ClassCollection

GetClassCollections - get all the registered class pairs and their tokens Genesis state only

func (Keeper) GetClassMap

func (k Keeper) GetClassMap(ctx sdk.Context, denom string) []byte

GetClassMap returns the token pair id for the given class

func (Keeper) GetClassPair

func (k Keeper) GetClassPair(ctx sdk.Context, id []byte) (types.ClassPair, bool)

GetClassPair gets a registered token pair from the identifier.

func (Keeper) GetClassPairID

func (k Keeper) GetClassPairID(ctx sdk.Context, class string) []byte

GetClassPairID returns the pair id from either of the registered tokens. Hex address or ClassId can be used as token argument.

func (Keeper) GetERC721Map

func (k Keeper) GetERC721Map(ctx sdk.Context, erc721 common.Address) []byte

GetERC721Map returns the token pair id for the given address

func (Keeper) GetERC721TokenIdMap

func (k Keeper) GetERC721TokenIdMap(ctx sdk.Context, classId, nftId string) *big.Int

GetERC721TokenIdMap classId/nftId = tokenId

func (Keeper) GetNativeNftIdMap

func (k Keeper) GetNativeNftIdMap(ctx sdk.Context, erc721 common.Address, tokenId *big.Int) string

GetNativeNftIdMap erc721/tokenId = sha256.sum(classId/nftId)

func (Keeper) InitGenesis

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

func (Keeper) IsClassPairRegistered

func (k Keeper) IsClassPairRegistered(ctx sdk.Context, id []byte) bool

IsClassPairRegistered - check if registered token ClassPair is registered

func (Keeper) IsClassRegistered

func (k Keeper) IsClassRegistered(ctx sdk.Context, classId string) bool

IsClassRegistered check if registered cosmos x/nft Class

func (Keeper) IsERC721Registered

func (k Keeper) IsERC721Registered(ctx sdk.Context, erc721 common.Address) bool

IsERC721Registered check if registered ERC20 token is registered

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) Mint

func (k Keeper) Mint(ctx sdk.Context,
	contractAddress common.Address,
	contractABI abi.ABI,
	to common.Address,
	tokenId *big.Int,
	tokenURI string,
	tokenData string,
) error

Mint mints an NFT

func (Keeper) OwnerOf

func (k Keeper) OwnerOf(
	ctx sdk.Context,
	contractABI abi.ABI,
	contractAddress common.Address,
	tokenID *big.Int,
) (common.Address, error)

OwnerOf queries an account's owner for a given ERC721 contract

func (Keeper) QueryERC721

func (k Keeper) QueryERC721(
	ctx sdk.Context,
	contractAddress common.Address,
	contractABI abi.ABI,
	isSystem bool,
) (types.ERC721Data, error)

QueryERC721 queries an ERC721 contract

func (Keeper) QueryERC721Token

func (k Keeper) QueryERC721Token(
	ctx sdk.Context,
	contractAddress common.Address,
	contractABI abi.ABI,
	tokenId *big.Int,
	isSystem bool,
) (types.ERC721TokenData, error)

QueryERC721Token queries an ERC721 token

func (Keeper) SaveRegisteredClass

func (k Keeper) SaveRegisteredClass(ctx sdk.Context, sender sdk.AccAddress, classId string) (common.Address, error)

SaveRegisteredClass saves the registered denom to the store

func (Keeper) SaveRegisteredERC721

func (k Keeper) SaveRegisteredERC721(ctx sdk.Context, contract common.Address) (string, error)

SaveRegisteredERC721 saves the registered ERC721 to the store

func (Keeper) SetClass

func (k Keeper) SetClass(ctx sdk.Context, contract common.Address, uri string, data string) error

SetClass sets a class

func (Keeper) SetClassMap

func (k Keeper) SetClassMap(ctx sdk.Context, classId string, id []byte)

SetClassMap sets the token pair id for the given class

func (Keeper) SetClassPair

func (k Keeper) SetClassPair(ctx sdk.Context, ClassPair types.ClassPair)

SetClassPair stores a token pair

func (Keeper) SetERC721Map

func (k Keeper) SetERC721Map(ctx sdk.Context, erc721 common.Address, id []byte)

SetERC721Map sets the token pair id for the given address

func (Keeper) SetERC721TokenIdMap

func (k Keeper) SetERC721TokenIdMap(ctx sdk.Context, erc721 common.Address, tokenId *big.Int, nftId string)

SetERC721TokenIdMap stores a token id pair erc721/tokenId = sha256.sum(classId/nftId)

func (Keeper) SetNativeNftIdMap

func (k Keeper) SetNativeNftIdMap(ctx sdk.Context, classId, nftId string, tokenId *big.Int)

SetNativeNftIdMap stores a token id pair classId/nftId = tokenId

func (Keeper) SupportsInterface

func (k Keeper) SupportsInterface(ctx sdk.Context,
	contractABI abi.ABI,
	contractAddress common.Address,
	interfaceId [4]byte,
) (bool, error)

SupportsInterface checks if the contract supports an interface

func (Keeper) TokenData

func (k Keeper) TokenData(
	ctx sdk.Context,
	contractABI abi.ABI,
	contractAddress common.Address,
	tokenID *big.Int,
) (string, error)

TokenData queries an account's token data for a given ERC721 contract

func (Keeper) TokenTrace

TokenTrace returns a cross-chain token trace

func (Keeper) TokenURI

func (k Keeper) TokenURI(
	ctx sdk.Context,
	contractABI abi.ABI,
	contractAddress common.Address,
	tokenID *big.Int,
) (string, error)

TokenURI queries an account's token URI for a given ERC721 contract

func (Keeper) TransferFrom

func (k Keeper) TransferFrom(ctx sdk.Context,
	contractAddress common.Address,
	contractABI abi.ABI,
	from common.Address,
	to common.Address,
	tokenId *big.Int,
) error

TransferFrom transfers an NFT

Jump to

Keyboard shortcuts

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