extension

package
v0.0.0-...-0599406 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainAccessor

type ChainAccessor interface {
	// GetBlockByHash retrieves a block from the local chain.
	GetBlockByHash(common.Hash) *types.Block
	StateAt(root common.Hash) (*state.StateDB, *state.StateDB, error)
	State() (*state.StateDB, *state.StateDB, error)
	CurrentBlock() *types.Block
}

ChainAccessor provides methods to fetch state and blocks from the local blockchain

type Client

type Client interface {
	SubscribeToLogs(query ethereum.FilterQuery) (<-chan types.Log, ethereum.Subscription, error)
	NextNonce(from common.Address) (uint64, error)
	TransactionByHash(hash common.Hash) (*types.Transaction, error)
	TransactionInBlock(blockHash common.Hash, txIndex uint) (*types.Transaction, error)
}

type DataHandler

type DataHandler interface {
	Load() (map[common.Address]*ExtensionContract, error)

	Save(extensionContracts map[common.Address]*ExtensionContract) error
}

type DefaultServicesFactory

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

func NewServicesFactory

func NewServicesFactory(node *node.Node, ptm private.PrivateTransactionManager, ethService *eth.Ethereum) (*DefaultServicesFactory, error)

func (*DefaultServicesFactory) AccountManager

func (factory *DefaultServicesFactory) AccountManager() *accounts.Manager

func (*DefaultServicesFactory) BackendService

func (factory *DefaultServicesFactory) BackendService() *PrivacyService

func (*DefaultServicesFactory) DataHandler

func (factory *DefaultServicesFactory) DataHandler() DataHandler

func (*DefaultServicesFactory) StateFetcher

func (factory *DefaultServicesFactory) StateFetcher() *StateFetcher

type EthclientManagementContractFacade

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

func (EthclientManagementContractFacade) Caller

func (EthclientManagementContractFacade) Deploy

func (facade EthclientManagementContractFacade) Deploy(args *bind.TransactOpts, toExtend common.Address, recipientAddress common.Address, recipientHash string) (*types.Transaction, error)

func (EthclientManagementContractFacade) GetAllVoters

func (facade EthclientManagementContractFacade) GetAllVoters(addressToVoteOn common.Address) ([]common.Address, error)

func (EthclientManagementContractFacade) Transactor

type ExtensionContract

type ExtensionContract struct {
	ContractExtended          common.Address `json:"contractExtended"`
	Initiator                 common.Address `json:"initiator"`
	Recipient                 common.Address `json:"recipient"`
	ManagementContractAddress common.Address `json:"managementContractAddress"`
	RecipientPtmKey           string         `json:"recipientPtmKey"`
	CreationData              []byte         `json:"creationData"`
}

type InProcessClient

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

func NewInProcessClient

func NewInProcessClient(client *ethclient.Client) *InProcessClient

func (*InProcessClient) NextNonce

func (client *InProcessClient) NextNonce(from common.Address) (uint64, error)

func (*InProcessClient) SubscribeToLogs

func (client *InProcessClient) SubscribeToLogs(query ethereum.FilterQuery) (<-chan types.Log, ethereum.Subscription, error)

func (*InProcessClient) TransactionByHash

func (client *InProcessClient) TransactionByHash(hash common.Hash) (*types.Transaction, error)

func (*InProcessClient) TransactionInBlock

func (client *InProcessClient) TransactionInBlock(blockHash common.Hash, txIndex uint) (*types.Transaction, error)

type JsonFileDataHandler

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

func NewJsonFileDataHandler

func NewJsonFileDataHandler(dataDirectory string) *JsonFileDataHandler

func (*JsonFileDataHandler) Load

func (handler *JsonFileDataHandler) Load() (map[common.Address]*ExtensionContract, error)

func (*JsonFileDataHandler) Save

func (handler *JsonFileDataHandler) Save(extensionContracts map[common.Address]*ExtensionContract) error

type ManagementContractFacade

type ManagementContractFacade interface {
	Transactor(managementAddress common.Address) (*extensionContracts.ContractExtenderTransactor, error)
	Caller(managementAddress common.Address) (*extensionContracts.ContractExtenderCaller, error)
	Deploy(args *bind.TransactOpts, toExtend common.Address, recipientAddress common.Address, recipientHash string) (*types.Transaction, error)

	GetAllVoters(addressToVoteOn common.Address) ([]common.Address, error)
}

func NewManagementContractFacade

func NewManagementContractFacade(client *ethclient.Client) ManagementContractFacade

type PrivacyService

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

func New

func (*PrivacyService) APIs

func (service *PrivacyService) APIs() []rpc.API

func (*PrivacyService) CheckIfContractCreator

func (service *PrivacyService) CheckIfContractCreator(blockHash common.Hash, address common.Address) bool

check if the node had created the contract

func (*PrivacyService) GenerateTransactOptions

func (service *PrivacyService) GenerateTransactOptions(txa ethapi.SendTxArgs) (*bind.TransactOpts, error)

func (*PrivacyService) GetAllParticipants

func (service *PrivacyService) GetAllParticipants(blockHash common.Hash, address common.Address) ([]string, error)

returns the participant list for a given private contract

func (*PrivacyService) Protocols

func (service *PrivacyService) Protocols() []p2p.Protocol

node.Service interface methods:

func (*PrivacyService) Start

func (service *PrivacyService) Start(p2pServer *p2p.Server) error

func (*PrivacyService) Stop

func (service *PrivacyService) Stop() error

type PrivateExtensionAPI

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

func NewPrivateExtensionAPI

func NewPrivateExtensionAPI(privacyService *PrivacyService) *PrivateExtensionAPI

func (*PrivateExtensionAPI) ActiveExtensionContracts

func (api *PrivateExtensionAPI) ActiveExtensionContracts() []ExtensionContract

ActiveExtensionContracts returns the list of all currently outstanding extension contracts

func (*PrivateExtensionAPI) ApproveExtension

func (api *PrivateExtensionAPI) ApproveExtension(addressToVoteOn common.Address, vote bool, txa ethapi.SendTxArgs) (string, error)

ApproveContractExtension submits the vote to the specified extension management contract. The vote indicates whether to extend a given contract to a new participant or not

func (*PrivateExtensionAPI) CancelExtension

func (api *PrivateExtensionAPI) CancelExtension(extensionContract common.Address, txa ethapi.SendTxArgs) (string, error)

CancelExtension allows the creator to cancel the given extension contract, ensuring that no more calls for votes or accepting can be made

func (*PrivateExtensionAPI) ExtendContract

func (api *PrivateExtensionAPI) ExtendContract(toExtend common.Address, newRecipientPtmPublicKey string, recipientAddr common.Address, txa ethapi.SendTxArgs) (string, error)

ExtendContract deploys a new extension management contract to the blockchain to start the process of extending a contract to a new participant Create a new extension contract that signifies that we want to add a new participant to an existing contract This should contain: - arguments for sending a new transaction (the same as sendTransaction) - the contract address we want to extend - the new PTM public key - the Ethereum addresses of who can vote to extend the contract

func (*PrivateExtensionAPI) GetExtensionStatus

func (api *PrivateExtensionAPI) GetExtensionStatus(extensionContract common.Address) (string, error)

Returns the extension status from management contract

type ServicesFactory

type ServicesFactory interface {
	BackendService() *PrivacyService

	AccountManager() *accounts.Manager
	DataHandler() DataHandler
	StateFetcher() *StateFetcher
}

type StateFetcher

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

StateFetcher manages retrieving state from the database and returning it in a usable form by the extension API.

func NewStateFetcher

func NewStateFetcher(chainAccessor ChainAccessor) *StateFetcher

Creates a new StateFetcher from the ethereum service

func (*StateFetcher) GetAddressStateFromBlock

func (fetcher *StateFetcher) GetAddressStateFromBlock(blockHash common.Hash, addressToFetch common.Address) ([]byte, error)

GetAddressStateFromBlock is a public method that combines the other functions of a StateFetcher, retrieving the state of an address at a given block, represented in JSON.

func (*StateFetcher) GetPrivacyMetaData

func (fetcher *StateFetcher) GetPrivacyMetaData(blockHash common.Hash, address common.Address) (*state.PrivacyMetadata, error)

returns the privacy metadata

func (*StateFetcher) GetStorageRoot

func (fetcher *StateFetcher) GetStorageRoot(blockHash common.Hash, address common.Address) (common.Hash, error)

returns the privacy metadata

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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