Documentation ¶
Index ¶
- Variables
- type Assets
- type Broker
- type Config
- type Engine
- func (e *Engine) AddVote(ctx context.Context, cmd types.VoteSubmission, party string) error
- func (e *Engine) Checkpoint() ([]byte, error)
- func (e *Engine) FinaliseEnactment(ctx context.Context, prop *types.Proposal)
- func (e *Engine) GetState(k string) ([]byte, []types.StateProvider, error)
- func (e *Engine) Hash() []byte
- func (e *Engine) Keys() []string
- func (e *Engine) Load(ctx context.Context, data []byte) error
- func (e *Engine) LoadState(ctx context.Context, p *types.Payload) ([]types.StateProvider, error)
- func (e *Engine) Name() types.CheckpointName
- func (e *Engine) Namespace() types.SnapshotNamespace
- func (e *Engine) OnTick(ctx context.Context, t time.Time) ([]*ToEnact, []*VoteClosed)
- func (e *Engine) RejectProposal(ctx context.Context, p *types.Proposal, r types.ProposalError, ...) error
- func (e *Engine) ReloadConf(cfg Config)
- func (e *Engine) Stopped() bool
- func (e *Engine) SubmitProposal(ctx context.Context, psub types.ProposalSubmission, id, party string) (ts *ToSubmit, err error)
- func (e *Engine) ValidatorKeyChanged(ctx context.Context, oldKey, newKey string)
- type Markets
- type NetParams
- type NewMarketVoteClosed
- type NodeValidation
- type ProposalParameters
- type StakingAccounts
- type TimeService
- type ToEnact
- func (t ToEnact) IsFreeform() bool
- func (t ToEnact) IsNewAsset() bool
- func (t ToEnact) IsNewAssetDetails() bool
- func (t ToEnact) IsNewMarket() bool
- func (t *ToEnact) IsUpdateAsset() bool
- func (t ToEnact) IsUpdateMarket() bool
- func (t ToEnact) IsUpdateNetworkParameter() bool
- func (t *ToEnact) NewAsset() *types.Asset
- func (t *ToEnact) NewAssetDetails() *types.AssetDetails
- func (t *ToEnact) NewFreeform() *ToEnactFreeform
- func (t *ToEnact) NewMarket() *ToEnactNewMarket
- func (t *ToEnact) Proposal() *types.Proposal
- func (t *ToEnact) ProposalData() *proposal
- func (t *ToEnact) UpdateAsset() *types.Asset
- func (t *ToEnact) UpdateMarket() *types.Market
- func (t *ToEnact) UpdateNetworkParameter() *types.NetworkParameter
- type ToEnactFreeform
- type ToEnactNewMarket
- type ToSubmit
- type ToSubmitNewMarket
- type VoteClosed
- type Witness
Constants ¶
This section is empty.
Variables ¶
var ( ErrProposalDoesNotExist = errors.New("proposal does not exist") ErrMarketDoesNotExist = errors.New("market does not exist") ErrMarketNotEnactedYet = errors.New("market has been enacted yet") ErrProposalNotOpenForVotes = errors.New("proposal is not open for votes") ErrProposalIsDuplicate = errors.New("proposal with given ID already exists") ErrVoterInsufficientTokens = errors.New("vote requires more tokens than the party has") ErrUnsupportedProposalType = errors.New("unsupported proposal type") ErrUnsupportedAssetSourceType = errors.New("unsupported asset source type") ErrExpectedERC20Asset = errors.New("expected an ERC20 asset but was not") ErrErc20AddressAlreadyInUse = errors.New("erc20 address already in use") )
var ( // ErrMissingProduct is returned if selected product is nil. ErrMissingProduct = errors.New("missing product") // ErrUnsupportedProduct is returned if selected product is not supported. ErrUnsupportedProduct = errors.New("product type is not supported") // ErrUnsupportedRiskParameters is returned if risk parameters supplied via governance are not yet supported. ErrUnsupportedRiskParameters = errors.New("risk model parameters are not supported") // ErrMissingRiskParameters ... ErrMissingRiskParameters = errors.New("missing risk parameters") // ErrMissingDataSourceSpecBinding is returned when the data source spec binding is absent. ErrMissingDataSourceSpecBinding = errors.New("missing data source spec binding") // ErrMissingDataSourceSpecForSettlementData is returned when the data source spec for settlement data is absent. ErrMissingDataSourceSpecForSettlementData = errors.New("missing data source spec for settlement data") // ErrMissingDataSourceSpecForTradingTermination is returned when the data source spec for trading termination is absent. ErrMissingDataSourceSpecForTradingTermination = errors.New("missing data source spec for trading termination") // ErrDataSourceSpecTerminationTimeBeforeEnactment is returned when termination time is before enactment // for time triggered termination condition. ErrDataSourceSpecTerminationTimeBeforeEnactment = errors.New("data source spec termination time before enactment") // ErrMissingFutureProduct is returned when future product is absent from the instrument. ErrMissingFutureProduct = errors.New("missing future product") // ErrInvalidRiskParameter ... ErrInvalidRiskParameter = errors.New("invalid risk parameter") )
var ( ErrEmptyNetParamKey = errors.New("empty network parameter key") ErrEmptyNetParamValue = errors.New("empty network parameter value") )
Functions ¶
This section is empty.
Types ¶
type Assets ¶
type Assets interface { NewAsset(ctx context.Context, ref string, assetDetails *types.AssetDetails) (string, error) Get(assetID string) (*assets.Asset, error) IsEnabled(string) bool SetRejected(ctx context.Context, assetID string) error SetPendingListing(ctx context.Context, assetID string) error ValidateAsset(assetID string) error ExistsForEthereumAddress(address string) bool }
type Config ¶
Config represents governance specific configuration.
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig creates an instance of the package specific configuration.
type Engine ¶
type Engine struct { Config // contains filtered or unexported fields }
Engine is the governance engine that handles proposal and vote lifecycle.
func (*Engine) Checkpoint ¶
func (*Engine) FinaliseEnactment ¶
FinaliseEnactment receives the enact proposal and updates the state in our enactedProposal list to have the current state of the proposals. This is entirely so that when we restore from a snapshot we can propagate the proposal with the latest state back into the API service.
func (*Engine) Name ¶
func (e *Engine) Name() types.CheckpointName
func (*Engine) Namespace ¶
func (e *Engine) Namespace() types.SnapshotNamespace
func (*Engine) RejectProposal ¶
func (*Engine) ReloadConf ¶
ReloadConf updates the internal configuration of the governance engine.
func (*Engine) SubmitProposal ¶
func (e *Engine) SubmitProposal( ctx context.Context, psub types.ProposalSubmission, id, party string, ) (ts *ToSubmit, err error)
SubmitProposal submits new proposal to the governance engine so it can be voted on, passed and enacted. Only open can be submitted and validated at this point. No further validation happens.
type Markets ¶
type Markets interface { MarketExists(market string) bool GetMarket(market string) (types.Market, bool) GetMarketState(market string) (types.MarketState, error) RestoreMarket(ctx context.Context, marketConfig *types.Market) error StartOpeningAuction(ctx context.Context, marketID string) error UpdateMarket(ctx context.Context, marketConfig *types.Market) error }
Markets allows to get the market data for use in the market update proposal computation.
type NetParams ¶
type NetParams interface { Validate(string, string) error Update(context.Context, string, string) error GetDecimal(string) (num.Decimal, error) GetInt(string) (int64, error) GetUint(string) (*num.Uint, error) GetDuration(string) (time.Duration, error) GetJSONStruct(string, netparams.Reset) error Get(string) (string, error) }
type NewMarketVoteClosed ¶
type NewMarketVoteClosed struct {
// contains filtered or unexported fields
}
func (*NewMarketVoteClosed) Rejected ¶
func (t *NewMarketVoteClosed) Rejected() bool
func (*NewMarketVoteClosed) StartAuction ¶
func (t *NewMarketVoteClosed) StartAuction() bool
type NodeValidation ¶
type NodeValidation struct {
// contains filtered or unexported fields
}
func NewNodeValidation ¶
func (*NodeValidation) Hash ¶
func (n *NodeValidation) Hash() []byte
func (*NodeValidation) IsNodeValidationRequired ¶
func (n *NodeValidation) IsNodeValidationRequired(p *types.Proposal) bool
IsNodeValidationRequired returns true if the given proposal require validation from a node.
func (*NodeValidation) OnTick ¶
func (n *NodeValidation) OnTick(t time.Time) (accepted []*proposal, rejected []*proposal)
OnTick returns validated proposal by all nodes.
type ProposalParameters ¶
type ProposalParameters struct { MinClose time.Duration MaxClose time.Duration MinEnact time.Duration MaxEnact time.Duration RequiredParticipation num.Decimal RequiredMajority num.Decimal MinProposerBalance *num.Uint MinVoterBalance *num.Uint RequiredParticipationLP num.Decimal RequiredMajorityLP num.Decimal }
ProposalParameters stores proposal specific parameters.
type StakingAccounts ¶
type StakingAccounts interface { GetAvailableBalance(party string) (*num.Uint, error) GetStakingAssetTotalSupply() *num.Uint }
StakingAccounts ...
type ToEnact ¶
type ToEnact struct {
// contains filtered or unexported fields
}
ToEnact wraps the proposal in a type that has a convenient interface to quickly work out what change we're dealing with, and get the data.
func (ToEnact) IsFreeform ¶
func (ToEnact) IsNewAsset ¶
func (ToEnact) IsNewAssetDetails ¶
func (ToEnact) IsNewMarket ¶
func (*ToEnact) IsUpdateAsset ¶
func (ToEnact) IsUpdateMarket ¶
func (ToEnact) IsUpdateNetworkParameter ¶
func (*ToEnact) NewAssetDetails ¶
func (t *ToEnact) NewAssetDetails() *types.AssetDetails
func (*ToEnact) NewFreeform ¶
func (t *ToEnact) NewFreeform() *ToEnactFreeform
func (*ToEnact) NewMarket ¶
func (t *ToEnact) NewMarket() *ToEnactNewMarket
func (*ToEnact) ProposalData ¶
func (t *ToEnact) ProposalData() *proposal
func (*ToEnact) UpdateAsset ¶
func (*ToEnact) UpdateMarket ¶
func (*ToEnact) UpdateNetworkParameter ¶
func (t *ToEnact) UpdateNetworkParameter() *types.NetworkParameter
type ToEnactFreeform ¶
type ToEnactFreeform struct{}
ToEnactFreeform there is nothing to enact with a freeform proposal.
type ToEnactNewMarket ¶
type ToEnactNewMarket struct{}
ToEnactNewMarket is just a empty struct, to signal an enacted market. nothing to be done with it for now (later maybe add information to check end of opening auction or so).
type ToSubmit ¶
type ToSubmit struct {
// contains filtered or unexported fields
}
ToSubmit wraps the proposal in a type that has a convenient interface to quickly work out what change we're dealing with, and get the data This cover every kind of proposal which requires action after a proposal is submitted.
func (ToSubmit) IsNewMarket ¶
func (*ToSubmit) NewMarket ¶
func (t *ToSubmit) NewMarket() *ToSubmitNewMarket
type ToSubmitNewMarket ¶
type ToSubmitNewMarket struct {
// contains filtered or unexported fields
}
func (*ToSubmitNewMarket) Market ¶
func (t *ToSubmitNewMarket) Market() *types.Market
type VoteClosed ¶
type VoteClosed struct {
// contains filtered or unexported fields
}
func (*VoteClosed) IsNewMarket ¶
func (t *VoteClosed) IsNewMarket() bool
func (*VoteClosed) NewMarket ¶
func (t *VoteClosed) NewMarket() *NewMarketVoteClosed
func (*VoteClosed) Proposal ¶
func (t *VoteClosed) Proposal() *types.Proposal