incentivisation

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 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 types.PublicWhisperAPI, 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
}

Jump to

Keyboard shortcuts

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