contract

package
v1.21.42 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: BSD-3-Clause Imports: 29 Imported by: 0

Documentation

Overview

Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Index

Constants

This section is empty.

Variables

View Source
var ErrFailedReceiptStatus = fmt.Errorf("failed receipt status")

Functions

func CallToMethod

func CallToMethod(
	rpcURL string,
	contractAddress luxcommon.Address,
	methodSpec string,
	params ...interface{},
) ([]interface{}, error)

func ContractAddressIsInGenesisData

func ContractAddressIsInGenesisData(
	genesisData []byte,
	contractAddress crypto.Address,
) (bool, error)

func DebugTraceCall

func DebugTraceCall(
	rpcURL string,
	from luxcommon.Address,
	privateKey string,
	contractAddress luxcommon.Address,
	payment *big.Int,
	methodSpec string,
	params ...interface{},
) (map[string]interface{}, error)

func DeployContract

func DeployContract(
	rpcURL string,
	privateKey string,
	binBytes []byte,
	methodSpec string,
	params ...interface{},
) (luxcommon.Address, error)

func DeployERC20

func DeployERC20(
	rpcURL string,
	privateKey string,
	symbol string,
	funded crypto.Address,
	supply *big.Int,
) (crypto.Address, error)

func GetBlockchainAirdropKeyInfo

func GetBlockchainAirdropKeyInfo(
	app *application.Lux,
	network models.Network,
	blockchainName string,
	genesisData []byte,
) (string, string, string, error)

from a given genesis, look for known private keys inside it, giving preference to the ones expected to be default it searches for: 1) default CLI allocation key for blockchains 2) all other stored keys managed by CLI returns address + private key when found

func GetBlockchainDesc

func GetBlockchainDesc(
	chainSpec ChainSpec,
) (string, error)

func GetBlockchainEndpoints

func GetBlockchainEndpoints(
	app *application.Lux,
	network models.Network,
	chainSpec ChainSpec,
	promptForRPCEndpoint bool,
	promptForWSEndpoint bool,
) (string, string, error)

func GetBlockchainGenesis

func GetBlockchainGenesis(
	app *application.Lux,
	network models.Network,
	chainSpec ChainSpec,
) ([]byte, error)

get the deployed blockchain genesis

func GetBlockchainID

func GetBlockchainID(
	app *application.Lux,
	network models.Network,
	chainSpec ChainSpec,
) (ids.ID, error)

func GetCChainWarpInfo

func GetCChainWarpInfo(
	app *application.Lux,
	network models.Network,
) (string, string, error)

func GetContractOwner

func GetContractOwner(
	rpcURL string,
	contractAddress crypto.Address,
) (crypto.Address, error)

GetContractOwner gets owner for https://docs.openzeppelin.com/contracts/2.x/api/ownership#Ownable-owner contracts

func GetDefaultBlockchainAirdropKeyInfo

func GetDefaultBlockchainAirdropKeyInfo(
	app *application.Lux,
	blockchainName string,
) (string, string, string, error)

returns information for the blockchain default allocation key if found, returns key name, address, private key

func GetEVMSubnetGenesisNativeMinterAdmin

func GetEVMSubnetGenesisNativeMinterAdmin(
	app *application.Lux,
	network models.Network,
	chainSpec ChainSpec,
) (bool, bool, string, string, string, error)

func GetEVMSubnetGenesisNativeMinterManager

func GetEVMSubnetGenesisNativeMinterManager(
	app *application.Lux,
	network models.Network,
	chainSpec ChainSpec,
) (bool, bool, string, string, string, error)

func GetEVMSubnetGenesisSupply

func GetEVMSubnetGenesisSupply(
	app *application.Lux,
	network models.Network,
	chainSpec ChainSpec,
) (*big.Int, error)

func GetEVMSubnetPrefundedKey

func GetEVMSubnetPrefundedKey(
	app *application.Lux,
	network models.Network,
	chainSpec ChainSpec,
) (string, string, error)

get the deployed blockchain genesis, and then look for known private keys inside it returns address + private key when found

func GetSmartContractCallResult

func GetSmartContractCallResult[T any](methodName string, out []interface{}) (T, error)

func GetSubnetID

func GetSubnetID(
	app *application.Lux,
	network models.Network,
	chainSpec ChainSpec,
) (ids.ID, error)

func GetWarpInfo

func GetWarpInfo(
	app *application.Lux,
	network models.Network,
	chainSpec ChainSpec,
	promptForRegistry bool,
	promptForMessenger bool,
	defaultToLatestReleasedMessenger bool,
) (string, string, error)

func ParseSpec

func ParseSpec(
	esp string,
	indexedFields []int,
	constructor bool,
	event bool,
	paid bool,
	view bool,
	params ...interface{},
) (string, string, error)

func PromptChain

func PromptChain(
	app *application.Lux,
	network models.Network,
	prompt string,
	blockchainNameToAvoid string,
	chainSpec *ChainSpec,
) (bool, error)

func SearchForManagedKey

func SearchForManagedKey(
	app *application.Lux,
	network models.Network,
	address crypto.Address,
) (bool, string, string, string, error)

func TransferOwnership

func TransferOwnership(
	rpcURL string,
	contractAddress crypto.Address,
	ownerPrivateKey string,
	newOwner crypto.Address,
) error

func TxToMethod

func TxToMethod(
	rpcURL string,
	generateRawTxOnly bool,
	from luxcommon.Address,
	privateKey string,
	contractAddress luxcommon.Address,
	payment *big.Int,
	description string,
	errorSignatureToError map[string]error,
	methodSpec string,
	params ...interface{},
) (*types.Transaction, *types.Receipt, error)

get method name and types from [methodsSpec], then call it at the smart contract [contractAddress] with the given [params]. also send [payment] tokens to it

func TxToMethodWithWarpMessage

func TxToMethodWithWarpMessage(
	rpcURL string,
	generateRawTxOnly bool,
	from luxcommon.Address,
	privateKey string,
	contractAddress luxcommon.Address,
	warpMessage *luxWarp.Message,
	payment *big.Int,
	description string,
	errorSignatureToError map[string]error,
	methodSpec string,
	params ...interface{},
) (*types.Transaction, *types.Receipt, error)

get method name and types from [methodsSpec], then call it at the smart contract [contractAddress] with the given [params]. send [warpMessage] on the same call, whose signature is going to be verified previously to pass it to the method also send [payment] tokens to it

func UnpackLog

func UnpackLog(
	eventSpec string,
	indexedFields []int,
	log types.Log,
	event interface{},
) error

Types

type ChainSpec

type ChainSpec struct {
	BlockchainName string

	CChain bool

	PChain bool

	XChain bool

	BlockchainID string

	OnlySOV bool
	// contains filtered or unexported fields
}

func (*ChainSpec) AddToCmd

func (cs *ChainSpec) AddToCmd(
	cmd *cobra.Command,
	goalFmt string,
)

func (*ChainSpec) CheckMutuallyExclusiveFields

func (cs *ChainSpec) CheckMutuallyExclusiveFields() error

func (*ChainSpec) Defined

func (cs *ChainSpec) Defined() bool

func (*ChainSpec) SetEnabled

func (cs *ChainSpec) SetEnabled(
	blockchainNameFlagEnabled bool,
	cChainFlagEnabled bool,
	pChainFlagEnabled bool,
	xChainFlagEnabled bool,
	blockchainIDFlagEnabled bool,
)

func (*ChainSpec) SetFlagNames

func (cs *ChainSpec) SetFlagNames(
	blockchainNameFlagName string,
	cChainFlagName string,
	pChainFlagName string,
	xChainFlagName string,
	blockchainIDFlagName string,
)

type PrivateKeyFlags

type PrivateKeyFlags struct {
	PrivateKey string
	KeyName    string
	GenesisKey bool
	// contains filtered or unexported fields
}

func (*PrivateKeyFlags) AddToCmd

func (pkf *PrivateKeyFlags) AddToCmd(
	cmd *cobra.Command,
	goal string,
)

func (*PrivateKeyFlags) GetPrivateKey

func (pkf *PrivateKeyFlags) GetPrivateKey(
	app *application.Lux,
	genesisPrivateKey string,
) (string, error)

func (*PrivateKeyFlags) SetFlagNames

func (pkf *PrivateKeyFlags) SetFlagNames(
	privateKeyFlagName string,
	keyFlagName string,
	genesisKeyFlagName string,
)

Jump to

Keyboard shortcuts

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