types

package
v0.0.0-...-4f02c87 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package types defines structures to represent the Solidity type system. In addition, this package provides convenience types representing Solidity projects, contracts, functions and APIs.

Index

Constants

View Source
const DynamicArrayLength = -1

represents the length of dynamically sized array NOTE: Solidity accepts 0-length array types e.g. uint256[0] is valid.

View Source
const FallbackFunctionName = ""

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	Length int
	Type   Type
}

func (Array) IsDynamic

func (a Array) IsDynamic() bool

func (Array) Map

func (t Array) Map(f func(Type) Type) Type

func (Array) SoliditySignature

func (t Array) SoliditySignature() []byte

type Contract

type Contract struct {
	File       string
	Name       string
	Parents    []*Contract
	NatSpec    string
	Kind       ast.ContractKind
	API        map[string]Function // signature -> Function{...}
	Types      map[string]Type
	Definition ast.ContractDefinition
	Binary     []byte
}

func (Contract) Overloads

func (c Contract) Overloads(name string) []Function

type ContractAddress

type ContractAddress string

func (ContractAddress) Map

func (t ContractAddress) Map(f func(Type) Type) Type

func (ContractAddress) SoliditySignature

func (t ContractAddress) SoliditySignature() []byte

type Elementary

type Elementary string

func (Elementary) Map

func (t Elementary) Map(f func(Type) Type) Type

func (Elementary) SoliditySignature

func (t Elementary) SoliditySignature() []byte

type Enum

type Enum []string

func (Enum) Map

func (t Enum) Map(f func(Type) Type) Type

func (Enum) SoliditySignature

func (t Enum) SoliditySignature() []byte

type Event

type Event struct {
	Name string
	Args []Type
}

func (Event) Map

func (t Event) Map(f func(Type) Type) Type

func (Event) SoliditySignature

func (t Event) SoliditySignature() []byte

type Function

type Function struct {
	Name            string
	NatSpec         string
	Visibility      ast.Visibility
	StateMutability ast.StateMutability
	Inputs          []Type
	Outputs         []Type
	Definition      ast.Node
}

func (Function) IsFallback

func (f Function) IsFallback() bool

func (Function) SoliditySignature

func (f Function) SoliditySignature() []byte

type InterfaceAddress

type InterfaceAddress string

func (InterfaceAddress) Map

func (t InterfaceAddress) Map(f func(Type) Type) Type

func (InterfaceAddress) SoliditySignature

func (t InterfaceAddress) SoliditySignature() []byte

type LibraryAddress

type LibraryAddress string

func (LibraryAddress) Map

func (t LibraryAddress) Map(f func(Type) Type) Type

func (LibraryAddress) SoliditySignature

func (t LibraryAddress) SoliditySignature() []byte

type Map

type Map map[Reference]Type

func (Map) Deref

func (m Map) Deref(ref Reference) Type

type Mapping

type Mapping struct {
	Key   Type
	Value Type
}

func (Mapping) Map

func (t Mapping) Map(f func(Type) Type) Type

func (Mapping) SoliditySignature

func (t Mapping) SoliditySignature() []byte

NOTE: mappings can't be passed as parameters, nevertheless

we provide a Signature method for convenience.

type Named

type Named struct {
	Name string
	Type Type
}

func (Named) Map

func (t Named) Map(f func(Type) Type) Type

func (Named) SoliditySignature

func (t Named) SoliditySignature() []byte

type Project

type Project struct {
	Path  string
	Files map[string]map[string]*Contract // "subdir/Example.sol" -> "Example" -> *Contract{...}
}

type Reference

type Reference int

func (Reference) Map

func (t Reference) Map(f func(Type) Type) Type

func (Reference) SoliditySignature

func (t Reference) SoliditySignature() []byte

type Struct

type Struct struct {
	Keys  []string
	Types []Type
}

func (Struct) Map

func (t Struct) Map(f func(Type) Type) Type

func (Struct) SoliditySignature

func (t Struct) SoliditySignature() []byte

type Tuple

type Tuple []Type

func (Tuple) Map

func (t Tuple) Map(f func(Type) Type) Type

func (Tuple) SoliditySignature

func (t Tuple) SoliditySignature() []byte

type Type

type Type interface {
	SoliditySignature() []byte
	Map(func(Type) Type) Type
}

Jump to

Keyboard shortcuts

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