contract

package
v0.0.0-...-bc0c157 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetFormatBytesWithPrefix

func SetFormatBytesWithPrefix(v bool)

Types

type ABIDefinition

type ABIDefinition struct {
	Name     string    `json:"name"`
	Type     string    `json:"type"`
	Payable  bool      `json:"payable"`
	Inputs   []ABIType `json:"inputs"`
	Outputs  []ABIType `json:"outputs"`
	Constant bool      `json:"constant"`

	// Event
	Anonymous bool `json:"anonymous"`
}

type ABIType

type ABIType struct {
	Name string `json:"name"`
	Type string `json:"type"`

	// Event
	Indexed bool `json:"indexed"`
}

type Bytes

type Bytes []byte

func (Bytes) MarshalJSON

func (b Bytes) MarshalJSON() ([]byte, error)

func (Bytes) String

func (b Bytes) String() string

func (*Bytes) UnmarshalJSON

func (b *Bytes) UnmarshalJSON(data []byte) error

type CompiledContract

type CompiledContract struct {
	// Where the contract is defined
	Source string          `json:"source"`
	Name   string          `json:"name"`
	ABI    []ABIDefinition `json:"abi"`
	Bin    Bytes           `json:"bin"`
	// KECAAK256 of bytecode without auxdata
	BinKeccak256 Bytes `json:"binhash"`
}

func (*CompiledContract) EncodingABI

func (c *CompiledContract) EncodingABI() (*abi.ABI, error)

func (*CompiledContract) ToBytes

func (c *CompiledContract) ToBytes(jsonParams []byte) (Bytes, error)

type CompiledContracts

type CompiledContracts map[string]*CompiledContract

type ContractsRepository

type ContractsRepository struct {
	Contracts DeployedContracts `json:"contracts"`
	Libraries DeployedContracts `json:"libraries"`

	// ABI definitions related to the contracts, but not deployed.
	Related CompiledContracts `json:"related"`
	// contains filtered or unexported fields
}

func OpenContractsRepository

func OpenContractsRepository(filepath string) (repo *ContractsRepository, err error)

func (*ContractsRepository) Commit

func (r *ContractsRepository) Commit() (err error)

func (*ContractsRepository) Confirm

func (r *ContractsRepository) Confirm(name string) (err error)

func (*ContractsRepository) ConfirmAll

func (r *ContractsRepository) ConfirmAll(updateProgress func(i, total int), confirmer func(c *DeployedContract) error) (err error)

Confirm checks the RPC server to see if all the contracts are confirmed by the blockchain.

func (*ContractsRepository) Exists

func (r *ContractsRepository) Exists(name string) bool

func (*ContractsRepository) Get

func (*ContractsRepository) GetLib

func (r *ContractsRepository) GetLib(name string) (*DeployedContract, bool)

func (*ContractsRepository) Len

func (r *ContractsRepository) Len() int

func (*ContractsRepository) LibExists

func (r *ContractsRepository) LibExists(name string) bool

func (*ContractsRepository) Set

func (r *ContractsRepository) Set(name string, c *DeployedContract)

func (*ContractsRepository) SetLib

func (r *ContractsRepository) SetLib(name string, c *DeployedContract)

func (*ContractsRepository) SortedContracts

func (r *ContractsRepository) SortedContracts() []*DeployedContract

func (*ContractsRepository) UnconfirmedContracts

func (r *ContractsRepository) UnconfirmedContracts() []*DeployedContract

type DeployedContract

type DeployedContract struct {
	CompiledContract
	Name          string    `json:"name"`
	DeployName    string    `json:"deployName"`
	Address       Bytes     `json:"address"`
	TransactionID Bytes     `json:"txid"`
	CreatedAt     time.Time `json:"createdAt"`
	Confirmed     bool      `json:"confirmed"`

	// qtum
	Sender    string `json:"sender,omitempty"`
	SenderHex string `json:"senderHex,omitempty"`
}

type DeployedContracts

type DeployedContracts map[string]*DeployedContract

type RawCompiledContract

type RawCompiledContract struct {
	RawMetadata string `json:"metadata"`
	Bin         []byte
	Metadata    struct {
		Output struct {
			Version  int64
			Language string
			ABI      []ABIDefinition `json:"abi"`
		}
	}
}

func (*RawCompiledContract) BinHash256

func (c *RawCompiledContract) BinHash256() []byte

func (*RawCompiledContract) BinWithoutAuxData

func (c *RawCompiledContract) BinWithoutAuxData() []byte

func (*RawCompiledContract) UnmarshalJSON

func (c *RawCompiledContract) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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