Documentation ¶
Index ¶
- Variables
- func LoadGenesisState(bytes []byte) (map[string]*types.AssetDetails, error)
- type Asset
- func (a *Asset) BuiltinAsset() (*builtin.Builtin, bool)
- func (a *Asset) DecimalPlaces() uint64
- func (a *Asset) ERC20() (*erc20.ERC20, bool)
- func (a *Asset) IsBuiltinAsset() bool
- func (a *Asset) IsERC20() bool
- func (a *Asset) ToAssetType() *types.Asset
- func (a *Asset) Update(updatedAsset *Asset) error
- type AssetDetails
- type BuiltinAsset
- type Config
- type ERC20BridgeView
- type Erc20
- type GenesisState
- type Notary
- type Service
- func (s *Service) ApplyAssetUpdate(ctx context.Context, assetID string) error
- func (s *Service) Checkpoint() ([]byte, error)
- func (s *Service) Enable(ctx context.Context, assetID string) error
- func (s *Service) EnactPendingAsset(id string)
- func (s *Service) Get(assetID string) (*Asset, error)
- func (s *Service) GetEnabledAssets() []*types.Asset
- func (s *Service) GetState(k string) ([]byte, []types.StateProvider, error)
- func (s *Service) GetVegaIDFromEthereumAddress(address string) string
- func (s *Service) IsEnabled(assetID string) bool
- func (s *Service) Keys() []string
- func (s *Service) Load(ctx context.Context, cp []byte) error
- func (s *Service) LoadState(ctx context.Context, p *types.Payload) ([]types.StateProvider, error)
- func (*Service) Name() types.CheckpointName
- func (s *Service) Namespace() types.SnapshotNamespace
- func (s *Service) NewAsset(ctx context.Context, proposalID string, assetDetails *types.AssetDetails) (string, error)
- func (s *Service) OnStateLoaded(ctx context.Context) error
- func (s *Service) OnTick(_ context.Context, _ time.Time)
- func (s *Service) ReloadConf(cfg Config)
- func (s *Service) SetBridgeChainID(chainID string, primary bool)
- func (s *Service) SetPendingListing(ctx context.Context, assetID string) error
- func (s *Service) SetRejected(ctx context.Context, assetID string) error
- func (s *Service) StageAssetUpdate(updatedAssetProto *types.Asset) error
- func (s *Service) Stopped() bool
- func (s *Service) ValidateAsset(assetID string) error
- func (s *Service) ValidateAssetNonValidator(assetID string) error
- func (s *Service) ValidateEthereumAddress(address, chainID string) error
- type Source
Constants ¶
This section is empty.
Variables ¶
var ( ErrAssetDoesNotExist = errors.New("asset does not exist") ErrUnknownAssetSource = errors.New("unknown asset source") ErrErc20AddressAlreadyInUse = errors.New("erc20 address already in use") ErrUnknownChainID = errors.New("erc20 chain-id does not correspond to a bridge") )
var ErrUpdatingAssetWithDifferentTypeOfAsset = errors.New("updating asset with different type of asset")
Functions ¶
func LoadGenesisState ¶
func LoadGenesisState(bytes []byte) (map[string]*types.AssetDetails, error)
Types ¶
type Asset ¶
type Asset struct {
// contains filtered or unexported fields
}
func (*Asset) DecimalPlaces ¶
func (*Asset) IsBuiltinAsset ¶
func (*Asset) ToAssetType ¶
type AssetDetails ¶
type AssetDetails struct { Name string `json:"name"` Symbol string `json:"symbol"` Decimals uint64 `json:"decimals"` Quantum string `json:"quantum"` Source *Source `json:"source"` }
func (*AssetDetails) IntoProto ¶
func (a *AssetDetails) IntoProto() (*types.AssetDetails, error)
type BuiltinAsset ¶
type BuiltinAsset struct {
MaxFaucetAmountMint string `json:"max_faucet_amount_mint"`
}
type Config ¶
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig creates an instance of the package specific configuration, given a pointer to a logger instance to be used for logging within the package.
type ERC20BridgeView ¶
type ERC20BridgeView interface {
FindAsset(asset *types.AssetDetails) error
}
type GenesisState ¶
type GenesisState map[string]AssetDetails
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
type Notary ¶ added in v0.55.0
type Notary interface { StartAggregate(resID string, kind types.NodeSignatureKind, signature []byte) OfferSignatures(kind types.NodeSignatureKind, f func(id string) []byte) }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New( ctx context.Context, log *logging.Logger, cfg Config, nw nweth.EthereumWallet, primaryEthClient erc20.ETHClient, secondaryEthClient erc20.ETHClient, broker broker.Interface, primaryBridgeView ERC20BridgeView, secondaryBridgeView ERC20BridgeView, notary Notary, isValidator bool, ) (*Service, error)
func (*Service) ApplyAssetUpdate ¶
func (*Service) Checkpoint ¶
func (*Service) Enable ¶
Enable move the state of an from pending the list of valid and accepted assets.
func (*Service) EnactPendingAsset ¶ added in v0.55.0
EnactPendingAsset the given id for an asset has just been enacted by the governance engine so we now need to generate signatures so that the asset can be listed.
func (*Service) GetEnabledAssets ¶
func (*Service) GetVegaIDFromEthereumAddress ¶
func (*Service) Name ¶
func (*Service) Name() types.CheckpointName
func (*Service) Namespace ¶
func (s *Service) Namespace() types.SnapshotNamespace
func (*Service) NewAsset ¶
func (s *Service) NewAsset(ctx context.Context, proposalID string, assetDetails *types.AssetDetails) (string, error)
NewAsset add a new asset to the pending list of assets the ref is the reference of proposal which submitted the new asset returns the assetID and an error.
func (*Service) OnStateLoaded ¶ added in v0.76.0
func (*Service) ReloadConf ¶
ReloadConf updates the internal configuration.
func (*Service) SetBridgeChainID ¶ added in v0.76.0
SetBridgeChainID sets the chain-ids for the bridge once we have processed the network parameters this is necessary so that non-validator nodes (which cannot just ask the eth-client) can know what they are.
func (*Service) SetPendingListing ¶
SetPendingListing update the state of an asset from proposed to pending listing on the bridge.
func (*Service) SetRejected ¶
SetRejected update the state of an asset from proposed to pending listing on the bridge.
func (*Service) StageAssetUpdate ¶
func (*Service) ValidateAsset ¶
func (*Service) ValidateAssetNonValidator ¶
ValidateAssetNonValidator is only to be used by non-validators at startup when loading genesis file. We just assume assets are valid.
func (*Service) ValidateEthereumAddress ¶ added in v0.76.0
ValidateEthereumAddress checks that the given ERC20 address and chainID corresponds to one of Vega's bridges and isn't the address of an asset that already exists.
type Source ¶
type Source struct { BuiltinAsset *BuiltinAsset `json:"builtin_asset,omitempty"` Erc20 *Erc20 `json:"erc20,omitempty"` }