incentivisation

package
v0.26.0-alpha.50 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: MPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeMessage

func EncodeMessage(content string, chatID string) ([]byte, error)

func NewMessageEncoder

func NewMessageEncoder(w io.Writer) *transit.Encoder

NewMessageEncoder returns a new Transit encoder that can encode StatusMessage values. More about Transit: https://github.com/cognitect/transit-format

Types

type Contract

type Contract interface {
	Vote(opts *bind.TransactOpts, joinNodes []gethcommon.Address, removeNodes []gethcommon.Address) (*types.Transaction, error)
	GetCurrentSession(opts *bind.CallOpts) (*big.Int, error)
	Registered(opts *bind.CallOpts, publicKey []byte) (bool, error)
	RegisterNode(opts *bind.TransactOpts, publicKey []byte, ip uint32, port uint16) (*types.Transaction, error)
	ActiveNodeCount(opts *bind.CallOpts) (*big.Int, error)
	InactiveNodeCount(opts *bind.CallOpts) (*big.Int, error)
	GetNode(opts *bind.CallOpts, index *big.Int) ([]byte, uint32, uint16, uint32, uint32, error)
	GetInactiveNode(opts *bind.CallOpts, index *big.Int) ([]byte, uint32, uint16, uint32, uint32, error)
	VoteSync(opts *bind.TransactOpts, joinNodes []gethcommon.Address, removeNodes []gethcommon.Address) (*types.Transaction, error)
}

func NewContract

func NewContract(address gethcommon.Address, backend bind.ContractBackend, client *ethclient.Client) (Contract, error)

NewContract creates a new instance of Contract, bound to a specific deployed contract.

type ContractImpl

type ContractImpl struct {
	registry.NodesV2
	// contains filtered or unexported fields
}

func (*ContractImpl) VoteSync

func (c *ContractImpl) VoteSync(opts *bind.TransactOpts, joinNodes []gethcommon.Address, removeNodes []gethcommon.Address) (*types.Transaction, error)

VoteSync votes on the contract and wait until the transaction has been accepted, returns an error otherwise

type Enode

type Enode struct {
	PublicKey      []byte
	IP             net.IP
	Port           uint16
	JoiningSession uint32
	ActiveSession  uint32
	Active         bool
}

func (*Enode) PublicKeyString

func (n *Enode) PublicKeyString() string

type PublicAPI

type PublicAPI struct {
	// contains filtered or unexported fields
}

PublicAPI represents a set of APIs from the `web3.peer` namespace.

func NewAPI

func NewAPI(s *Service) *PublicAPI

NewAPI creates an instance of the peer API.

func (*PublicAPI) Registered

func (api *PublicAPI) Registered(context context.Context) error

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(prv *ecdsa.PrivateKey, w Whisper, config *ServiceConfig, contract Contract) *Service

New returns a new incentivization Service

func (*Service) APIs

func (s *Service) APIs() []rpc.API

APIs returns a list of new APIs.

func (*Service) FetchEnodes

func (s *Service) FetchEnodes() error

func (*Service) GetCurrentSession

func (s *Service) GetCurrentSession() (uint64, error)

func (*Service) Protocols

func (s *Service) Protocols() []p2p.Protocol

Protocols returns a new protocols list. In this case, there are none.

func (*Service) Start

func (s *Service) Start(server *p2p.Server) error

func (*Service) Stop

func (s *Service) Stop() error

Stop is run when a service is stopped.

type ServiceConfig

type ServiceConfig struct {
	RPCEndpoint     string
	ContractAddress string
	IP              string
	Port            uint16
}

type StatusMessage

type StatusMessage struct {
	Text      string
	ContentT  string
	MessageT  string
	Clock     int64
	Timestamp int64
	Content   StatusMessageContent
}

func CreateTextStatusMessage

func CreateTextStatusMessage(text string, chatID string) StatusMessage

CreateTextStatusMessage creates a StatusMessage.

type StatusMessageContent

type StatusMessageContent struct {
	ChatID string
	Text   string
}

type Whisper

type Whisper interface {
	Post(ctx context.Context, req whisper.NewMessage) (hexutil.Bytes, error)
	NewMessageFilter(req whisper.Criteria) (string, error)
	AddPrivateKey(ctx context.Context, privateKey hexutil.Bytes) (string, error)
	DeleteKeyPair(ctx context.Context, key string) (bool, error)
	GenerateSymKeyFromPassword(ctx context.Context, passwd string) (string, error)
	GetFilterMessages(id string) ([]*whisper.Message, error)
}

Jump to

Keyboard shortcuts

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