assets

package
v0.70.3 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAssetInvalid       = errors.New("asset invalid")
	ErrAssetDoesNotExist  = errors.New("asset does not exist")
	ErrUnknownAssetSource = errors.New("unknown asset source")
)
View Source
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 NewAsset

func NewAsset(a isAsset) *Asset

func (*Asset) BuiltinAsset

func (a *Asset) BuiltinAsset() (*builtin.Builtin, bool)

func (*Asset) DecimalPlaces

func (a *Asset) DecimalPlaces() uint64

func (*Asset) ERC20

func (a *Asset) ERC20() (*erc20.ERC20, bool)

func (*Asset) IsBuiltinAsset

func (a *Asset) IsBuiltinAsset() bool

func (*Asset) IsERC20

func (a *Asset) IsERC20() bool

func (*Asset) ToAssetType

func (a *Asset) ToAssetType() *types.Asset

func (*Asset) Update

func (a *Asset) Update(updatedAsset *Asset) error

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

type Config struct {
	Level encoding.LogLevel `long:"log-level"`
}

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 Erc20

type Erc20 struct {
	ContractAddress   string `json:"contract_address"`
	LifetimeLimit     string `json:"lifetime_limit"`
	WithdrawThreshold string `json:"withdraw_threshold"`
}

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)
}

type Service

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

func New

func New(
	log *logging.Logger,
	cfg Config,
	nw *nodewallets.NodeWallets,
	ethClient erc20.ETHClient,
	broker broker.Interface,
	bridgeView ERC20BridgeView,
	notary Notary,
	isValidator bool,
) *Service

func (*Service) ApplyAssetUpdate

func (s *Service) ApplyAssetUpdate(ctx context.Context, assetID string) error

func (*Service) Checkpoint

func (s *Service) Checkpoint() ([]byte, error)

func (*Service) Enable

func (s *Service) Enable(ctx context.Context, assetID string) error

Enable move the state of an from pending the list of valid and accepted assets.

func (*Service) EnactPendingAsset added in v0.55.0

func (s *Service) EnactPendingAsset(id string)

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) ExistsForEthereumAddress added in v0.58.0

func (s *Service) ExistsForEthereumAddress(address string) bool

func (*Service) Get

func (s *Service) Get(assetID string) (*Asset, error)

func (*Service) GetEnabledAssets

func (s *Service) GetEnabledAssets() []*types.Asset

func (*Service) GetState

func (s *Service) GetState(k string) ([]byte, []types.StateProvider, error)

func (*Service) GetVegaIDFromEthereumAddress

func (s *Service) GetVegaIDFromEthereumAddress(address string) string

func (*Service) IsEnabled

func (s *Service) IsEnabled(assetID string) bool

func (*Service) Keys

func (s *Service) Keys() []string

func (*Service) Load

func (s *Service) Load(ctx context.Context, cp []byte) error

func (*Service) LoadState

func (s *Service) LoadState(ctx context.Context, p *types.Payload) ([]types.StateProvider, error)

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) ReloadConf

func (s *Service) ReloadConf(cfg Config)

ReloadConf updates the internal configuration.

func (*Service) SetPendingListing

func (s *Service) SetPendingListing(ctx context.Context, assetID string) error

SetPendingListing update the state of an asset from proposed to pending listing on the bridge.

func (*Service) SetRejected

func (s *Service) SetRejected(ctx context.Context, assetID string) error

SetRejected update the state of an asset from proposed to pending listing on the bridge.

func (*Service) StageAssetUpdate

func (s *Service) StageAssetUpdate(updatedAssetProto *types.Asset) error

func (*Service) Stopped

func (s *Service) Stopped() bool

func (*Service) ValidateAsset

func (s *Service) ValidateAsset(assetID string) error

func (*Service) ValidateAssetNonValidator

func (s *Service) ValidateAssetNonValidator(assetID string) error

ValidateAssetNonValidator is only to be used by non-validators at startup when loading genesis file. We just assume assets are valid.

type Source

type Source struct {
	BuiltinAsset *BuiltinAsset `json:"builtin_asset,omitempty"`
	Erc20        *Erc20        `json:"erc20,omitempty"`
}

Directories

Path Synopsis
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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