Documentation ¶
Index ¶
- Constants
- Variables
- func FlogTx(w io.Writer, msg string, tx *types.Transaction)
- func HashToAddress(h common.Hash) (common.Address, errstack.E)
- func IncNonce(nonce *big.Int) *big.Int
- func IncTxoNonce(txo *bind.TransactOpts, tx *types.Transaction)
- func IsZeroAddr(a common.Address) bool
- func LogTx(msg string, tx *types.Transaction)
- func MustHaveEvents(e abi.ABI, eventNames ...string)
- func MustParseABI(name string, ctrABI string) abi.ABI
- func ParseAddress(addr string) (a common.Address, err errstack.E)
- func ParseAddressErrp(addr string, errp errstack.Putter) common.Address
- func SubscribeSimple(ctx context.Context, client *ethclient.Client, topics [][]common.Hash, ...) (<-chan types.Log, ethereum.Subscription, errstack.E)
- func UnmarshalEvent(dest interface{}, data []byte, e abi.Event) errstack.E
- type ContractFactory
- type KeySimple
- type NetSchema
- type PgtAddress
- type PgtHash
- type Schema
- type SchemaFactory
- type TxrFactory
Constants ¶
const ( CtrBRG = "BridgeToken" CtrForwarderFactory = "ForwarderFactory" CtrRoot = "Root" CtrSWC = "SweetToken" CtrSWCqueue = "SWCqueue" CtrSWClogic = "SweetTokenLogic" CtrTokenLogic = "TokenLogic" CtrTreasury = "Treasury" CtrUserDirectory = "UserDirectory" CtrVault = "Vault" CtrVaultConfig = "VaultConfig" CtrWallet = "Wallet" )
Contract names
Variables ¶
var ZeroAddress = common.HexToAddress("00")
ZeroAddress represents Ethereum unknown or invalid address
Functions ¶
func FlogTx ¶
func FlogTx(w io.Writer, msg string, tx *types.Transaction)
FlogTx logs transaction into a Writer
func HashToAddress ¶
HashToAddress encodes address from hash data
func IncTxoNonce ¶
func IncTxoNonce(txo *bind.TransactOpts, tx *types.Transaction)
IncTxoNonce increments transaction options nonce
func IsZeroAddr ¶
IsZeroAddr check if `a` is zero or invalid address
func LogTx ¶
func LogTx(msg string, tx *types.Transaction)
LogTx is a handy function to create debug log for successful transaction
func MustHaveEvents ¶
MustHaveEvents ensures that the ABI object has listed events
func MustParseABI ¶
MustParseABI parses abi string
func ParseAddress ¶
ParseAddress converts hex string to Ethereum address
func ParseAddressErrp ¶
ParseAddressErrp calls ToAddress and sets the error in the putter
Types ¶
type ContractFactory ¶
type ContractFactory interface { GetBRG() (*contracts.BridgeToken, common.Address, errstack.E) GetSWC() (*contracts.SweetToken, common.Address, errstack.E) GetSWClogic() (*contracts.SweetTokenLogic, common.Address, errstack.E) GetSWCqueue() (*contracts.SWCqueue, common.Address, errstack.E) GetForwarderFactory() (*contracts.ForwarderFactory, common.Address, errstack.E) Client() *ethclient.Client TxrFactory }
ContractFactory delivers methods to easily construct contracts
func NewContractFactory ¶
func NewContractFactory(c *ethclient.Client, sf SchemaFactory, txrF TxrFactory, isTestRPC bool) ContractFactory
NewContractFactory is a default contract provider based on truffle schema files.
type KeySimple ¶
KeySimple is a simple version of keystore.Key structure
func MustReadKeySimple ¶
MustReadKeySimple calls ReadKeySimple and panics if it get's an error
func ReadKeySimple ¶
ReadKeySimple reads the JSON key into the key object
func (*KeySimple) UnmarshalJSON ¶
UnmarshalJSON implement interface for json.Unmrashall
type PgtAddress ¶
PgtAddress is a ethereum Address wrapper to provide DB interface
func (*PgtAddress) Scan ¶
func (a *PgtAddress) Scan(src interface{}) error
Scan implements sql.Sanner interface
type PgtHash ¶
PgtHash is an ethereum common.Hash wrapper to provide DB interface
type Schema ¶
type Schema struct { Name string `json:"contractName"` Networks map[int]NetSchema SchemaVersion string `json:"schemaVersion"` UpdatedAt string `json:"updatedAt"` }
Schema is a type representing truffle-schema contract file
type SchemaFactory ¶
SchemaFactory is a structure which provides contract schema functions and data
func NewSchemaFactory ¶
func NewSchemaFactory(contractsPath string, network int) (SchemaFactory, errstack.E)
NewSchemaFactory creates new SchemaFactory.
func (SchemaFactory) MustReadGetAddress ¶
func (sf SchemaFactory) MustReadGetAddress(name string) (Schema, common.Address)
MustReadGetAddress returns contract schema and address and panics on error
func (SchemaFactory) Read ¶
func (sf SchemaFactory) Read(name string) (s Schema, err errstack.E)
Read reads truffle-schema file. The name should not finish with ".json"
func (SchemaFactory) ReadGetAddress ¶
ReadGetAddress reads schema using `Read` and extract contract address using then network identifier.
type TxrFactory ¶
type TxrFactory interface { Txo() *bind.TransactOpts Addr() common.Address }
TxrFactory wraps parameters to create bind.TransactOpts
func NewJSONTxrFactory ¶
func NewJSONTxrFactory(filename, passphrase string) (TxrFactory, errstack.E)
NewJSONTxrFactory creates TxrFactory using on JSON account file and passphrase
func NewPrivKeyTxrFactory ¶
func NewPrivKeyTxrFactory(hexkey string) (TxrFactory, errstack.E)
NewPrivKeyTxrFactory creates new transactor using a hex string of a ECDSA key.