keeper

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 28 Imported by: 2

Documentation

Index

Constants

View Source
const BASE_WASM_URL = "https://raw.githubusercontent.com/UptickNetwork/uptick/main/release/wasm/"
View Source
const UPTICK_CW721_LABLE = "Uptick CW721"
View Source
const UPTICK_CW721_NAME = "Uptick CW721"
View Source
const UPTICK_CW721_SYMBOL = "UCW721"

Variables

This section is empty.

Functions

This section is empty.

Types

type AllNftAccess

type AllNftAccess struct {
	Owner string `json:"owner"`
}

type AllNftData

type AllNftData struct {
	TokenUri  string      `json:"token_uri"`
	Extension interface{} `json:"extension"`
}

type AllNftInfo

type AllNftInfo struct {
	Access AllNftAccess `json:"access"`
	Info   AllNftData   `json:"info"`
}

type ContractInfo

type ContractInfo struct {
	Data ContractInfoData `json:"data"`
}

ContractInfo {"data":{"name":"uptick test collection","symbol":"uptick-test-01"}}

type ContractInfoData

type ContractInfoData struct {
	Name   string `json:"name"`
	Symbol string `json:"symbol"`
}

type InstantiateInfo

type InstantiateInfo struct {
	Name   string `json:"name"`
	Symbol string `json:"symbol"`
	Minter string `json:"minter"`
}

type Keeper

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

Keeper of this module maintains collections of cw721.

func NewKeeper

NewKeeper creates new instances of the cw721 Keeper

func (Keeper) ConvertCW721

func (k Keeper) ConvertCW721(
	goCtx context.Context,
	msg *types.MsgConvertCW721,
) (
	*types.MsgConvertCW721, error,
)

ConvertCW721 converts CW721 tokens into native Cosmos nft for both Cosmos-native and CW721 TokenPair Owners

func (Keeper) ConvertNFT

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

ConvertNFT ConvertCoin converts native Cosmos nft into CW721 tokens for both Cosmos-native and CW721 TokenPair Owners

func (Keeper) CreateNFTClass

func (k Keeper) CreateNFTClass(ctx sdk.Context, msg *types.MsgConvertCW721) error

CreateNFTClass generates the metadata to represent the CW721 token .

func (Keeper) DeleteCW721Map

func (k Keeper) DeleteCW721Map(ctx sdk.Context, cw721 common.Address)

DeleteCW721Map deletes the token pair id for the given address

func (Keeper) DeleteCwAddressByContractTokenId

func (k Keeper) DeleteCwAddressByContractTokenId(ctx sdk.Context, evmContractAddress string, evmTokenId string)

func (Keeper) DeleteNFTPairByNFTID

func (k Keeper) DeleteNFTPairByNFTID(ctx sdk.Context, classID string, nftID string)

func (Keeper) DeleteNFTPairByTokenID

func (k Keeper) DeleteNFTPairByTokenID(ctx sdk.Context, contractAddress string, tokenID string)

func (Keeper) DeleteNFTUIDPairByNFTUID

func (k Keeper) DeleteNFTUIDPairByNFTUID(ctx sdk.Context, nftUID string)

func (Keeper) DeleteNFTUIDPairByTokenUID

func (k Keeper) DeleteNFTUIDPairByTokenUID(ctx sdk.Context, tokenUID string)

func (Keeper) DeleteTokenPair

func (k Keeper) DeleteTokenPair(ctx sdk.Context, tokenPair types.TokenPair)

DeleteTokenPair removes a token pair.

func (Keeper) ExecWasmMsg

ExecWasmMsg exec the contract and get the result

func (Keeper) GetCW721Map

func (k Keeper) GetCW721Map(ctx sdk.Context, cw721 string) []byte

GetCW721Map returns the token pair id for the given address

func (Keeper) GetClassIDAndNFTID

func (k Keeper) GetClassIDAndNFTID(ctx sdk.Context, msg *types.MsgConvertCW721) (string, []string, error)

GetClassIDAndNFTID sets the erc20 parameters to the param space.

func (Keeper) GetClassMap

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

GetClassMap returns the token pair id for the given class

func (Keeper) GetContractAddressAndTokenIds

func (k Keeper) GetContractAddressAndTokenIds(ctx sdk.Context, msg *types.MsgConvertNFT) (string, []string, error)

GetContractAddressAndTokenIds sets the CW721 parameters to the param space.

func (Keeper) GetCwAddressByContractTokenId

func (k Keeper) GetCwAddressByContractTokenId(ctx sdk.Context, evmContractAddress string, evmTokenId string) []byte

func (Keeper) GetNFTPairByClassNFTID

func (k Keeper) GetNFTPairByClassNFTID(ctx sdk.Context, classID string, nftID string) []byte

func (Keeper) GetNFTPairByContractTokenID

func (k Keeper) GetNFTPairByContractTokenID(ctx sdk.Context, contractAddress string, tokenID string) []byte

func (Keeper) GetNFTUIDPairByTokenUID

func (k Keeper) GetNFTUIDPairByTokenUID(ctx sdk.Context, tokenUID string) []byte

func (Keeper) GetPair

func (k Keeper) GetPair(
	ctx sdk.Context,
	token string,
) (types.TokenPair, error)

GetPair checks that:

  • the global parameter for cw721 conversion is enabled
  • minting is enabled for the given (cw721,nft) token pair

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams returns the total set of erc20 parameters.

func (Keeper) GetTokenPair

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

GetTokenPair - get registered token pair from the identifier

func (Keeper) GetTokenPairID

func (k Keeper) GetTokenPairID(ctx sdk.Context, token string) []byte

GetTokenPairID returns the pair id from either of the registered tokens.

func (Keeper) GetTokenPairs

func (k Keeper) GetTokenPairs(ctx sdk.Context) []types.TokenPair

GetTokenPairs - get all registered token tokenPairs

func (Keeper) GetTokenUIDPairByNFTUID

func (k Keeper) GetTokenUIDPairByNFTUID(ctx sdk.Context, nftUID string) []byte

func (*Keeper) GetVoucherClassID

func (k *Keeper) GetVoucherClassID(port string, channel string, classId string) string

func (Keeper) GetWasmCode

func (k Keeper) GetWasmCode(ctx sdk.Context, account string) []byte

GetWasmCode stores a WasmCode

func (Keeper) InstantiateWasmContract

func (k Keeper) InstantiateWasmContract(
	ctx sdk.Context,
	senderAddr string,
	codeId uint64,
	label string,
	name string,
	symbol string,
	minter string,
) (string, error)

InstantiateWasmContract creates and deploys an CW721 contract on the EVM with the erc721 module account as owner.

func (Keeper) IsCW721Registered

func (k Keeper) IsCW721Registered(ctx sdk.Context, cw721 string) bool

IsCW721Registered check if registered CW721 token is registered

func (Keeper) IsClassRegistered

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

IsClassRegistered check if registered nft class is registered

func (Keeper) IsTokenPairRegistered

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

IsTokenPairRegistered - check if registered token tokenPair is registered

func (Keeper) LoadCw721Base

func (k Keeper) LoadCw721Base(ctx sdk.Context) (error, uint64)

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MintCw721

func (k Keeper) MintCw721(
	ctx sdk.Context,
	contractAddress string,
	tokenId string,
	sender string,
	tokenUri string,
) (*wasmtypes.MsgExecuteContractResponse, error)

MintCw721 the contract and get the result

func (Keeper) Params

Params returns the params of the erc20 module

func (Keeper) QueryCW721

func (k Keeper) QueryCW721(
	ctx sdk.Context,
	contractAddress string,
) (types.CW721Data, error)

QueryCW721 returns the data of a deployed CW721 contract

func (Keeper) QueryCW721AllNftInfo

func (k Keeper) QueryCW721AllNftInfo(
	ctx sdk.Context,
	contractAddress string,
	tokenId string,
) (AllNftInfo, error)

QueryCW721AllNftInfo returns the owner of given tokenID QueryCW721TokenOwner -> QueryCW721TokenOwner

func (Keeper) QueryCW721Token

func (k Keeper) QueryCW721Token(
	ctx sdk.Context,
	contract common.Address,
) (types.CW721TokenData, error)

QueryCW721Token returns the data of a CW721 token TODO

func (Keeper) QueryClassEnhance

func (k Keeper) QueryClassEnhance(
	ctx sdk.Context,
	contract common.Address,
) (types.ClassEnhance, error)

QueryClassEnhance returns the data of a deployed CW721 contract TODO

func (Keeper) QueryNFTEnhance

func (k Keeper) QueryNFTEnhance(
	ctx sdk.Context,
	contract common.Address,
	tokenID *big.Int,
) (types.NFTEnhance, error)

QueryNFTEnhance returns the data of a deployed CW721 contract TODO

func (Keeper) QueryWasmState

QueryWasmState for query (rsp *types.QuerySmartContractStateResponse, err error) func (q grpcQuerier) SmartContractState(c context.Context, req *types.QuerySmartContractStateRequest) (rsp *types.QuerySmartContractStateResponse, err error) {

func (Keeper) RefundPacketToken

func (k Keeper) RefundPacketToken(
	ctx sdk.Context,
	data ibcnfttransfertypes.NonFungibleTokenPacketData,
) error

RefundPacketToken handles the erc721 conversion for a native erc721 token pair:

  • escrow tokens on module account
  • mint nft to the receiver: nftId: tokenAddress|tokenID

func (Keeper) RegisterCW721

func (k Keeper) RegisterCW721(ctx sdk.Context, msg *types.MsgConvertCW721) (*types.TokenPair, error)

RegisterCW721 creates a Cosmos coin and registers the token pair between the nft and the CW721

func (Keeper) RegisterNFT

func (k Keeper) RegisterNFT(ctx sdk.Context, msg *types.MsgConvertNFT) (*types.TokenPair, error)

RegisterNFT deploys an cw721 contract and creates the token pair for the existing cosmos coin

func (Keeper) SetCW721Map

func (k Keeper) SetCW721Map(ctx sdk.Context, cw721 string, id []byte)

SetCW721Map sets the token pair id for the given address

func (Keeper) SetClassMap

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

SetClassMap sets the token pair id for the classID

func (Keeper) SetCwAddressByContractTokenId

func (k Keeper) SetCwAddressByContractTokenId(ctx sdk.Context, evmContractAddress string, evmTokenId string, evmAddress string)

SetCwAddressByContractTokenId

func (*Keeper) SetICS4Wrapper

func (k *Keeper) SetICS4Wrapper(ics4Wrapper porttypes.ICS4Wrapper)

SetICS4Wrapper sets the ICS4 wrapper to the keeper. It panics if already set

func (Keeper) SetNFTPairByClassNFTID

func (k Keeper) SetNFTPairByClassNFTID(ctx sdk.Context, classID string, nftID string, contractAddress string, tokenID string)

func (Keeper) SetNFTPairByContractTokenID

func (k Keeper) SetNFTPairByContractTokenID(ctx sdk.Context, contractAddress string, tokenID string, classID string, nftID string)

func (Keeper) SetNFTPairs

func (k Keeper) SetNFTPairs(ctx sdk.Context, contractAddress string, tokenID string, classID string, nftID string)

func (Keeper) SetNFTUIDPairByNFTUID

func (k Keeper) SetNFTUIDPairByNFTUID(ctx sdk.Context, nftUID string, tokenUID string)

func (Keeper) SetNFTUIDPairByTokenUID

func (k Keeper) SetNFTUIDPairByTokenUID(ctx sdk.Context, tokenUID string, nftUID string)

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the erc20 parameters to the param space.

func (Keeper) SetTokenPair

func (k Keeper) SetTokenPair(ctx sdk.Context, tokenPair types.TokenPair)

SetTokenPair stores a token pair

func (Keeper) SetWasmCode

func (k Keeper) SetWasmCode(ctx sdk.Context, account string, codeId uint64)

SetWasmCode stores a WasmCode

func (Keeper) StoreWasmContract

func (k Keeper) StoreWasmContract(
	ctx sdk.Context,
	contractFile string,
	creator string,
) (uint64, error)

StoreWasmContract creates and deploys an CW721 contract on the EVM with the erc721 module account as owner.

func (Keeper) ToggleConversion

func (k Keeper) ToggleConversion(ctx sdk.Context, token string) (types.TokenPair, error)

ToggleConversion toggles conversion for a given token pair

func (Keeper) TokenPair

TokenPair returns a given registered token pair

func (Keeper) TokenPairs

TokenPairs returns all registered pairs

func (Keeper) TransferCW721

func (k Keeper) TransferCW721(
	goCtx context.Context,
	msg *types.MsgTransferCW721,
) (
	*types.MsgTransferCW721Response, error,
)

TransferCW721 converts CW721 tokens into native Cosmos nft for both Cosmos-native and CW721 TokenPair Owners and transfer through IBC

func (Keeper) TransferCw721

func (k Keeper) TransferCw721(
	ctx sdk.Context,
	contractAddress string,
	tokenId string,
	recipient string,
	sender string,
) (*wasmtypes.MsgExecuteContractResponse, error)

TransferCw721 the contract and get the result

func (Keeper) WasmContract

WasmContract returns a given registered token pair

type Migrator

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

type MintInfo

type MintInfo struct {
	Mint MintInfoData `json:"mint"`
}

MintInfo {"mint":{"token_id":"abc126","owner":"uptick100s3yp8l3atuuvx98jmftttxzy4ee5mg2n79fx","token_uri":"http://test.com"}}

type MintInfoData

type MintInfoData struct {
	TokenId  string `json:"token_id"`
	Owner    string `json:"owner"`
	TokenUri string `json:"token_uri"`
}

type Result

type Result struct {
	Data *string `json:"data,omitempty"`
}

type StoreCache

type StoreCache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

type TransferNftData

type TransferNftData struct {
	Recipient string `json:"recipient"`
	TokenId   string `json:"token_id"`
}

type TransferNftInfo

type TransferNftInfo struct {
	TransferNft TransferNftData `json:"transfer_nft"`
}

TransferNftInfo {"transfer_nft":{"recipient":"uptick1n3t0zuwq4u47ke48qm3pfhj96f4ujhs70f52sg","token_id":"abc123"}}

Jump to

Keyboard shortcuts

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