industrialtoken

package
v0.0.0-...-da3d57c Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RateDecimal = 8
)

Decimals const

Variables

View Source
var File_ext_config_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type DistribRequest

type DistribRequest struct {
	TransactionID string              `json:"transactionId"`
	UserAddress   *types.Address      `json:"userAddress"`
	GroupsAmounts map[string]*big.Int `json:"groupsAmounts"`
	Ref           string              `json:"ref"`
}

DistribRequest base struct

type ExtConfig

type ExtConfig struct {
	Name             string        `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Decimals         uint32        `protobuf:"varint,2,opt,name=decimals,proto3" json:"decimals,omitempty"`
	UnderlyingAsset  string        `protobuf:"bytes,3,opt,name=underlying_asset,json=underlyingAsset,proto3" json:"underlying_asset,omitempty"`
	DeliveryForm     string        `protobuf:"bytes,4,opt,name=delivery_form,json=deliveryForm,proto3" json:"delivery_form,omitempty"`
	UnitOfMeasure    string        `protobuf:"bytes,5,opt,name=unit_of_measure,json=unitOfMeasure,proto3" json:"unit_of_measure,omitempty"`
	TokensForUnit    string        `protobuf:"bytes,6,opt,name=tokens_for_unit,json=tokensForUnit,proto3" json:"tokens_for_unit,omitempty"`
	PaymentTerms     string        `protobuf:"bytes,7,opt,name=payment_terms,json=paymentTerms,proto3" json:"payment_terms,omitempty"`
	Price            string        `protobuf:"bytes,8,opt,name=price,proto3" json:"price,omitempty"`
	Issuer           *proto.Wallet `protobuf:"bytes,9,opt,name=issuer,proto3" json:"issuer,omitempty"`
	FeeSetter        *proto.Wallet `protobuf:"bytes,10,opt,name=fee_setter,json=feeSetter,proto3" json:"fee_setter,omitempty"`
	FeeAddressSetter *proto.Wallet `protobuf:"bytes,11,opt,name=fee_address_setter,json=feeAddressSetter,proto3" json:"fee_address_setter,omitempty"`
	// contains filtered or unexported fields
}

func (*ExtConfig) Descriptor deprecated

func (*ExtConfig) Descriptor() ([]byte, []int)

Deprecated: Use ExtConfig.ProtoReflect.Descriptor instead.

func (*ExtConfig) GetDecimals

func (x *ExtConfig) GetDecimals() uint32

func (*ExtConfig) GetDeliveryForm

func (x *ExtConfig) GetDeliveryForm() string

func (*ExtConfig) GetFeeAddressSetter

func (x *ExtConfig) GetFeeAddressSetter() *proto.Wallet

func (*ExtConfig) GetFeeSetter

func (x *ExtConfig) GetFeeSetter() *proto.Wallet

func (*ExtConfig) GetIssuer

func (x *ExtConfig) GetIssuer() *proto.Wallet

func (*ExtConfig) GetName

func (x *ExtConfig) GetName() string

func (*ExtConfig) GetPaymentTerms

func (x *ExtConfig) GetPaymentTerms() string

func (*ExtConfig) GetPrice

func (x *ExtConfig) GetPrice() string

func (*ExtConfig) GetTokensForUnit

func (x *ExtConfig) GetTokensForUnit() string

func (*ExtConfig) GetUnderlyingAsset

func (x *ExtConfig) GetUnderlyingAsset() string

func (*ExtConfig) GetUnitOfMeasure

func (x *ExtConfig) GetUnitOfMeasure() string

func (*ExtConfig) ProtoMessage

func (*ExtConfig) ProtoMessage()

func (*ExtConfig) ProtoReflect

func (x *ExtConfig) ProtoReflect() protoreflect.Message

func (*ExtConfig) Reset

func (x *ExtConfig) Reset()

func (*ExtConfig) String

func (x *ExtConfig) String() string

func (*ExtConfig) Validate

func (m *ExtConfig) Validate() error

Validate checks the field values on ExtConfig with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*ExtConfig) ValidateAll

func (m *ExtConfig) ValidateAll() error

ValidateAll checks the field values on ExtConfig with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ExtConfigMultiError, or nil if none found.

type ExtConfigMultiError

type ExtConfigMultiError []error

ExtConfigMultiError is an error wrapping multiple validation errors returned by ExtConfig.ValidateAll() if the designated constraints aren't met.

func (ExtConfigMultiError) AllErrors

func (m ExtConfigMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ExtConfigMultiError) Error

func (m ExtConfigMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ExtConfigValidationError

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

ExtConfigValidationError is the validation error returned by ExtConfig.Validate if the designated constraints aren't met.

func (ExtConfigValidationError) Cause

func (e ExtConfigValidationError) Cause() error

Cause function returns cause value.

func (ExtConfigValidationError) Error

func (e ExtConfigValidationError) Error() string

Error satisfies the builtin error interface

func (ExtConfigValidationError) ErrorName

func (e ExtConfigValidationError) ErrorName() string

ErrorName returns error name.

func (ExtConfigValidationError) Field

func (e ExtConfigValidationError) Field() string

Field function returns field value.

func (ExtConfigValidationError) Key

Key function returns key value.

func (ExtConfigValidationError) Reason

func (e ExtConfigValidationError) Reason() string

Reason function returns reason value.

type Group

type Group struct {
	ID       string
	Emission uint64
	Maturity string
	Note     string
}

Group base struct

type ITInterface

type ITInterface interface {
	core.BaseContractInterface

	GetRateAndLimits(string, string) (*proto.TokenRate, bool, error)
}

ITInterface - base method for an industrial token prototype

type IndustrialToken

type IndustrialToken struct {
	core.BaseContract
	// contains filtered or unexported fields
}

IndustrialToken base struct

func (*IndustrialToken) ApplyExtConfig

func (it *IndustrialToken) ApplyExtConfig(cfgBytes []byte) error

func (*IndustrialToken) ChangeGroupMetadata

func (it *IndustrialToken) ChangeGroupMetadata(groupName string, maturityDate time.Time, note string) error

ChangeGroupMetadata changes metadata for a group of token

func (*IndustrialToken) CheckLimitsAndPrice

func (it *IndustrialToken) CheckLimitsAndPrice(
	method string,
	amount *big.Int,
	currency string,
) (*big.Int, error)

CheckLimitsAndPrice - checks limits and prices

func (*IndustrialToken) FeeAddressSetter

func (it *IndustrialToken) FeeAddressSetter() *types.Address

func (*IndustrialToken) FeeSetter

func (it *IndustrialToken) FeeSetter() *types.Address

func (*IndustrialToken) GetID

func (it *IndustrialToken) GetID() string

GetID returns token id

func (*IndustrialToken) GetRateAndLimits

func (it *IndustrialToken) GetRateAndLimits(dealType string, currency string) (*proto.TokenRate, bool, error)

GetRateAndLimits returns token rate and limits from metadata

func (*IndustrialToken) Initialize

func (it *IndustrialToken) Initialize(groups []Group) error

Initialize - token initialization

func (*IndustrialToken) Issuer

func (it *IndustrialToken) Issuer() *types.Address

func (*IndustrialToken) QueryAllowedBalanceOf

func (it *IndustrialToken) QueryAllowedBalanceOf(address *types.Address, token string) (*big.Int, error)

QueryAllowedBalanceOf - returns allowed balance of the token for user address

func (*IndustrialToken) QueryDistribRequestsList

func (it *IndustrialToken) QueryDistribRequestsList() ([]DistribRequest, error)

QueryDistribRequestsList returns list of distribution requests

func (*IndustrialToken) QueryDocumentsList

func (it *IndustrialToken) QueryDocumentsList() ([]core.Doc, error)

QueryDocumentsList - returns list of emission documents

func (*IndustrialToken) QueryIndustrialBalanceOf

func (it *IndustrialToken) QueryIndustrialBalanceOf(address *types.Address) (map[string]string, error)

QueryIndustrialBalanceOf - returns balance of the token for user address WARNING: DO NOT USE CODE LIKE THIS IN REAL TOKENS AS `map[string]string` IS NOT ORDERED AND WILL CAUSE ENDORSEMENT MISMATCH ON PEERS. THIS IS FOR TESTING PURPOSES ONLY. NOTE: THIS APPROACH IS USED DUE TO LEGACY CODE IN THE FOUNDATION LIBRARY. IMPLEMENTING A PROPER SOLUTION WOULD REQUIRE SIGNIFICANT CHANGES.

func (*IndustrialToken) QueryMCRequestsList

func (it *IndustrialToken) QueryMCRequestsList() ([]MaturityChangeRequest, error)

QueryMCRequestsList returns list of maturity dates change requests

func (*IndustrialToken) QueryMetadata

func (it *IndustrialToken) QueryMetadata() (Metadata, error)

QueryMetadata returns token Metadata

func (*IndustrialToken) QueryPredictFee

func (it *IndustrialToken) QueryPredictFee(amount *big.Int) (Predict, error)

QueryPredictFee calculates fee

func (*IndustrialToken) QueryRedeemRequestsList

func (it *IndustrialToken) QueryRedeemRequestsList() ([]RedeemRequest, error)

QueryRedeemRequestsList returns list of redemption requests

func (*IndustrialToken) TxAcceptDistribRequest

func (it *IndustrialToken) TxAcceptDistribRequest(sender *types.Sender, requestID, _ string) error

TxAcceptDistribRequest - accepts request for tokens distribution

func (*IndustrialToken) TxAcceptMCRequest

func (it *IndustrialToken) TxAcceptMCRequest(sender *types.Sender, requestID, _ string) error

TxAcceptMCRequest - accepts request for tokens maturity date change

func (*IndustrialToken) TxAcceptRedeemRequest

func (it *IndustrialToken) TxAcceptRedeemRequest(sender *types.Sender, requestID string, amount *big.Int, _ string) error

TxAcceptRedeemRequest - accepts request for tokens redemption

func (*IndustrialToken) TxAddDocs

func (it *IndustrialToken) TxAddDocs(sender *types.Sender, rawDocs string) error

TxAddDocs - adds docs to a token

func (*IndustrialToken) TxChangeGroupNote

func (it *IndustrialToken) TxChangeGroupNote(sender *types.Sender, groupName, note string) error

TxChangeGroupNote changes token group note

func (*IndustrialToken) TxCreateDistribRequest

func (it *IndustrialToken) TxCreateDistribRequest(sender *types.Sender, args, ref string) error

TxCreateDistribRequest creates distribution request

func (*IndustrialToken) TxCreateMCRequest

func (it *IndustrialToken) TxCreateMCRequest(sender *types.Sender, groupName, maturityDateString, ref string) error

TxCreateMCRequest creates maturity date change request

func (*IndustrialToken) TxCreateRedeemRequest

func (it *IndustrialToken) TxCreateRedeemRequest(sender *types.Sender, groupName string, amount *big.Int, ref string) error

TxCreateRedeemRequest creates redeem request

func (*IndustrialToken) TxDeleteDoc

func (it *IndustrialToken) TxDeleteDoc(sender *types.Sender, docID string) error

TxDeleteDoc - deletes doc from state

func (*IndustrialToken) TxDenyDistribRequest

func (it *IndustrialToken) TxDenyDistribRequest(sender *types.Sender, requestID string) error

TxDenyDistribRequest - denys request for tokens distribution

func (*IndustrialToken) TxDenyMCRequest

func (it *IndustrialToken) TxDenyMCRequest(sender *types.Sender, requestID string) error

TxDenyMCRequest - denys request for tokens maturity date change

func (*IndustrialToken) TxDenyRedeemRequest

func (it *IndustrialToken) TxDenyRedeemRequest(sender *types.Sender, requestID string) error

TxDenyRedeemRequest - denys request for tokens redemption

func (*IndustrialToken) TxIndustrialBuyBack

func (it *IndustrialToken) TxIndustrialBuyBack(
	sender *types.Sender,
	group string,
	amount *big.Int,
	currency string,
) error

TxIndustrialBuyBack - method for token buyback

func (*IndustrialToken) TxSetFee

func (it *IndustrialToken) TxSetFee(sender *types.Sender, currency string, fee *big.Int, floor *big.Int, cap *big.Int) error

TxSetFee sets fee values to config

func (*IndustrialToken) TxSetFeeAddress

func (it *IndustrialToken) TxSetFeeAddress(sender *types.Sender, address *types.Address) error

TxSetFeeAddress sets fee address

func (*IndustrialToken) TxSetLimits

func (it *IndustrialToken) TxSetLimits(sender *types.Sender, dealType string, currency string, min *big.Int, max *big.Int) error

TxSetLimits sets limits for a deal type and an asset

func (*IndustrialToken) TxSetRate

func (it *IndustrialToken) TxSetRate(sender *types.Sender, dealType string, currency string, rate *big.Int) error

TxSetRate sets token rate to an asset for a type of deal

func (*IndustrialToken) TxTransferIndustrial

func (it *IndustrialToken) TxTransferIndustrial(sender *types.Sender, to *types.Address, group string, amount *big.Int, _ string) error

TxTransferIndustrial transfers token to user address

func (*IndustrialToken) ValidateExtConfig

func (it *IndustrialToken) ValidateExtConfig(cfgBytes []byte) error

type MaturityChangeRequest

type MaturityChangeRequest struct {
	TransactionID string         `json:"transactionId"`
	UserAddress   *types.Address `json:"userAddress"`
	GroupName     string         `json:"groupName"`
	MaturityDate  time.Time      `json:"maturityDate"`
	Ref           string         `json:"ref"`
}

MaturityChangeRequest base struct

type Metadata

type Metadata struct {
	Name            string          `json:"name"`
	Symbol          string          `json:"symbol"`
	Decimals        uint            `json:"decimals"`
	UnderlyingAsset string          `json:"underlying_asset"`
	Issuer          string          `json:"issuer"`
	DeliveryForm    string          `json:"deliveryForm"`
	UnitOfMeasure   string          `json:"unitOfMeasure"`
	TokensForUnit   string          `json:"tokensForUnit"`
	PaymentTerms    string          `json:"paymentTerms"`
	Price           string          `json:"price"`
	Methods         []string        `json:"methods"`
	Groups          []MetadataGroup `json:"groups"`
	Fee             fee             `json:"fee"`
	Rates           []metadataRate  `json:"rates"`
}

type MetadataGroup

type MetadataGroup struct {
	Name         string    `json:"name"`
	Amount       *big.Int  `json:"amount"`
	MaturityDate time.Time `json:"maturityDate"`
	Note         string    `json:"note"`
}

MetadataGroup struct

type Predict

type Predict struct {
	Currency string   `json:"currency"`
	Fee      *big.Int `json:"fee"`
}

type RedeemRequest

type RedeemRequest struct {
	TransactionID string         `json:"transactionId"`
	UserAddress   *types.Address `json:"userAddress"`
	GroupName     string         `json:"groupName"`
	Amount        *big.Int       `json:"amounts"`
	Ref           string         `json:"ref"`
}

RedeemRequest base struct

Jump to

Keyboard shortcuts

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