Documentation
¶
Index ¶
- func ABIBuiltIn(abiFile string) (*abi.ABI, error)
- func ABIOpenFile(abiFile string) (*abi.ABI, error)
- func ABIOpenURL(abiFile string) (*abi.ABI, error)
- func Base(b int64) *big.Int
- func CompileSolidityString(ctx context.Context, source, solcVersion, evmVersion string, optimize bool) (map[string]*Contract, error)
- func ConvertArgument(abiType abi.Type, param interface{}) (interface{}, error)
- func ConvertArguments(args abi.Arguments, params []interface{}) ([]interface{}, error)
- func ConvertInt(signed bool, size int, i *big.Int) (interface{}, error)
- func ConvertToAddress(i interface{}) (common.Address, error)
- func DecToInt(d decimal.Decimal, decimals int32) *big.Int
- func FloatAsInt(amountF *big.Float, decimals int) *big.Int
- func GetABI(abiFile string) (*abi.ABI, error)
- func Gwei(g int64) *big.Int
- func IntAsFloat(i *big.Int, decimals int) *big.Float
- func IntToDec(i *big.Int, decimals int32) decimal.Decimal
- func ParseAmount(amount string) (*big.Int, error)
- func ParseBase(b string) (*big.Int, error)
- func ParseBigInt(value string) (*big.Int, error)
- func ParseCombinedJSON(combinedJSON []byte, source string, languageVersion string, ...) (map[string]*Contract, error)
- func ParseGwei(g string) (*big.Int, error)
- func WeiAsBase(w *big.Int) string
- func WeiAsGwei(w *big.Int) string
- type CallMsg
- type Contract
- type ContractInfo
- type ID
- type Snapshot
- type Solidity
- type Tally
- type Vote
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompileSolidityString ¶
func CompileSolidityString(ctx context.Context, source, solcVersion, evmVersion string, optimize bool) (map[string]*Contract, error)
CompileSolidityString builds and returns all the contracts contained within a source string.
func ConvertArgument ¶
ConvertArgument attempts to convert argument to the provided ABI type and size. Unrecognized types are passed through unmodified.
func ConvertArguments ¶
ConvertArguments attempts to convert each param to the matching args type. Unrecognized param types are passed through unmodified.
Note: The encoding/json package uses float64 for numbers by default, which is inaccurate for many web3 types, and unsupported here. The json.Decoder method UseNumber() will switch to using json.Number instead, which is accurate (full precision, backed by the original string) and supported here.
func ConvertInt ¶
ConvertInt converts a big.Int in to the provided type.
func ConvertToAddress ¶
func FloatAsInt ¶
FloatAsInt converts a float to a *big.Int based on the decimals passed in
func IntAsFloat ¶
IntAsFloat converts a *big.Int (ie: wei), to *big.Float (ie: ETH)
func ParseAmount ¶
ParseAmount parses a string (human readable amount with units ie 1go, 1nanogo...) and returns big.Int value of this string in wei/atto
func ParseBigInt ¶
ParseBigInt parses a string (base 10 only) and returns big.Int value of this string in wei/atto
func ParseCombinedJSON ¶
Types ¶
type CallMsg ¶
type CallMsg struct { From *accounts.Address // the sender of the 'transaction' To *accounts.Address // the destination contract (nil for contract creation) Gas uint64 // if 0, the call executes with near-infinite gas GasPrice *big.Int // wei <-> gas exchange ratio GasTipCap *big.Int GasFeeCap *big.Int Value *big.Int // amount of wei sent along with the call Data []byte // input data, usually an ABI-encoded contract method invocation }
type Contract ¶
type Contract struct { Code string `json:"code"` RuntimeCode string `json:"runtime-code"` Info ContractInfo `json:"info"` Hashes map[string]string `json:"hashes"` }
Contract contains information about a compiled contract, alongside its code and runtime code.
type ContractInfo ¶
type ContractInfo struct { Source string `json:"source"` Language string `json:"language"` LanguageVersion string `json:"languageVersion"` CompilerVersion string `json:"compilerVersion"` CompilerOptions string `json:"compilerOptions"` SrcMap interface{} `json:"srcMap"` SrcMapRuntime string `json:"srcMapRuntime"` AbiDefinition interface{} `json:"abiDefinition"` UserDoc interface{} `json:"userDoc"` DeveloperDoc interface{} `json:"developerDoc"` Metadata string `json:"metadata"` }
ContractInfo contains information about a compiled contract, including access to the ABI definition, source mapping, user and developer docs, and metadata.
Depending on the source, language version, compiler version, and compiler options will provide information about how the contract was compiled.
type Solidity ¶
Solidity specifies the solidity compiler configuration.
func SolidityVersion ¶
SolidityVersion runs solc and parses its version output.