Documentation ¶
Index ¶
- Constants
- Variables
- type BaseToken
- func (bt *BaseToken) ApplyTokenConfig(config *proto.TokenConfig) error
- func (bt *BaseToken) CheckLimitsAndPrice(method string, amount *big.Int, currency string) (*big.Int, error)
- func (bt *BaseToken) EmissionAdd(amount *big.Int) error
- func (bt *BaseToken) EmissionSub(amount *big.Int) error
- func (bt *BaseToken) FeeAddressSetter() *types.Address
- func (bt *BaseToken) FeeSetter() *types.Address
- func (bt *BaseToken) GetID() string
- func (bt *BaseToken) GetRateAndLimits(dealType string, currency string) (*proto.TokenRate, bool, error)
- func (bt *BaseToken) Issuer() *types.Address
- func (bt *BaseToken) QueryAllowedBalanceOf(address *types.Address, token string) (*big.Int, error)
- func (bt *BaseToken) QueryBalanceOf(address *types.Address) (*big.Int, error)
- func (bt *BaseToken) QueryDocumentsList() ([]core.Doc, error)
- func (bt *BaseToken) QueryGetFeeTransfer(req FeeTransferRequestDTO) (*FeeTransferResponseDTO, error)
- func (bt *BaseToken) QueryLockedAllowedBalanceOf(address *types.Address, token string) (*big.Int, error)
- func (bt *BaseToken) QueryLockedBalanceOf(address *types.Address) (*big.Int, error)
- func (bt *BaseToken) QueryMetadata() (*Metadata, error)
- func (bt *BaseToken) QueryPredictFee(amount *big.Int) (*Predict, error)
- func (bt *BaseToken) TokenConfig() *proto.TokenConfig
- func (bt *BaseToken) TxAddDocs(sender *types.Sender, rawDocs string) error
- func (bt *BaseToken) TxAllowedIndustrialBalanceTransfer(sender *types.Sender, recipient *types.Address, rawAssets string, _ string) error
- func (bt *BaseToken) TxBuyBack(sender *types.Sender, amount *big.Int, currency string) error
- func (bt *BaseToken) TxBuyToken(sender *types.Sender, amount *big.Int, currency string) error
- func (bt *BaseToken) TxDeleteDoc(sender *types.Sender, docID string) error
- func (bt *BaseToken) TxDeleteRate(sender *types.Sender, dealType string, currency string) error
- func (bt *BaseToken) TxSetFee(sender *types.Sender, currency string, fee *big.Int, floor *big.Int, ...) error
- func (bt *BaseToken) TxSetFeeAddress(sender *types.Sender, address *types.Address) error
- func (bt *BaseToken) TxSetLimits(sender *types.Sender, dealType string, currency string, min *big.Int, ...) error
- func (bt *BaseToken) TxSetRate(sender *types.Sender, dealType string, currency string, rate *big.Int) error
- func (bt *BaseToken) TxTransfer(sender *types.Sender, recipient *types.Address, amount *big.Int, _ string) error
- func (bt *BaseToken) ValidateTokenConfig(config []byte) error
- type Fee
- type FeeTransferRequestDTO
- type FeeTransferResponseDTO
- type Metadata
- type MetadataRate
- type Predict
- type Tokener
- type VT
Constants ¶
const (
// RateDecimal is the number of decimal places in the rate
RateDecimal = 8
)
Variables ¶
var ErrFeeAddressNotConfigured = errors.New("fee address is not set in token config")
Functions ¶
This section is empty.
Types ¶
type BaseToken ¶
type BaseToken struct { core.BaseContract // contains filtered or unexported fields }
BaseToken represents a chaincode with configurable token-attributes. Implements core.BaseContractInterface by embedding core.BaseContract.
func (*BaseToken) ApplyTokenConfig ¶
func (bt *BaseToken) ApplyTokenConfig(config *proto.TokenConfig) error
func (*BaseToken) CheckLimitsAndPrice ¶
func (bt *BaseToken) CheckLimitsAndPrice(method string, amount *big.Int, currency string) (*big.Int, error)
CheckLimitsAndPrice checks limits and price
func (*BaseToken) EmissionAdd ¶
EmissionAdd adds emission
func (*BaseToken) EmissionSub ¶
EmissionSub subtracts emission
func (*BaseToken) FeeAddressSetter ¶
FeeAddressSetter returns the fee address setter of the token
func (*BaseToken) GetRateAndLimits ¶
func (bt *BaseToken) GetRateAndLimits(dealType string, currency string) (*proto.TokenRate, bool, error)
GetRateAndLimits returns rate and limits for the deal type and currency
func (*BaseToken) QueryAllowedBalanceOf ¶
QueryAllowedBalanceOf returns allowed balance
func (*BaseToken) QueryBalanceOf ¶
QueryBalanceOf returns balance
func (*BaseToken) QueryDocumentsList ¶
QueryDocumentsList - returns list of emission documents
func (*BaseToken) QueryGetFeeTransfer ¶
func (bt *BaseToken) QueryGetFeeTransfer(req FeeTransferRequestDTO) (*FeeTransferResponseDTO, error)
func (*BaseToken) QueryLockedAllowedBalanceOf ¶ added in v0.0.2
func (*BaseToken) QueryLockedBalanceOf ¶ added in v0.0.2
QueryLockedBalanceOf returns locked balance
func (*BaseToken) QueryMetadata ¶
QueryMetadata returns Metadata
func (*BaseToken) QueryPredictFee ¶
QueryPredictFee returns the predicted fee
func (*BaseToken) TokenConfig ¶
func (bt *BaseToken) TokenConfig() *proto.TokenConfig
func (*BaseToken) TxAllowedIndustrialBalanceTransfer ¶
func (bt *BaseToken) TxAllowedIndustrialBalanceTransfer(sender *types.Sender, recipient *types.Address, rawAssets string, _ string) error
TxAllowedIndustrialBalanceTransfer transfers tokens from one account to another
func (*BaseToken) TxBuyToken ¶
TxBuyToken buys tokens for an asset
func (*BaseToken) TxDeleteDoc ¶
TxDeleteDoc - deletes doc from state
func (*BaseToken) TxDeleteRate ¶
TxDeleteRate - deletes rate from state
func (*BaseToken) TxSetFee ¶
func (bt *BaseToken) TxSetFee(sender *types.Sender, currency string, fee *big.Int, floor *big.Int, cap *big.Int) error
TxSetFee sets the fee
func (*BaseToken) TxSetFeeAddress ¶
TxSetFeeAddress sets the fee address
func (*BaseToken) TxSetLimits ¶
func (bt *BaseToken) 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 (*BaseToken) TxSetRate ¶
func (bt *BaseToken) 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 (*BaseToken) TxTransfer ¶
func (bt *BaseToken) TxTransfer( sender *types.Sender, recipient *types.Address, amount *big.Int, _ string, ) error
TxTransfer transfers tokens from one account to another
func (*BaseToken) ValidateTokenConfig ¶
type Fee ¶
type Fee struct { Address string `json:"address"` Currency string `json:"currency"` Fee *big.Int `json:"fee"` Floor *big.Int `json:"floor"` Cap *big.Int `json:"cap"` }
Fee is a struct for fee
type FeeTransferRequestDTO ¶
type FeeTransferRequestDTO struct { SenderAddress *types.Address `json:"sender_address,omitempty"` RecipientAddress *types.Address `json:"recipient_address,omitempty"` Amount *big.Int `json:"amount,omitempty"` }
func (FeeTransferRequestDTO) Validate ¶
func (r FeeTransferRequestDTO) Validate() error
type FeeTransferResponseDTO ¶
type Metadata ¶
type Metadata struct { Name string `json:"name"` Symbol string `json:"symbol"` Decimals uint `json:"decimals"` UnderlyingAsset string `json:"underlying_asset"` //nolint:tagliatelle Issuer string `json:"issuer"` Methods []string `json:"methods"` TotalEmission *big.Int `json:"total_emission"` //nolint:tagliatelle Fee *Fee `json:"fee"` Rates []*MetadataRate `json:"rates"` }
Metadata is a struct for metadata
type MetadataRate ¶
type MetadataRate struct { DealType string `json:"deal_type"` //nolint:tagliatelle Currency string `json:"currency"` Rate *big.Int `json:"rate"` Min *big.Int `json:"min"` Max *big.Int `json:"max"` }
MetadataRate is a struct for rate
type Predict ¶
type Predict struct { // Currency is the currency of the fee Currency string `json:"currency"` // Fee is the predicted fee Fee *big.Int `json:"fee"` }
Predict is a struct for fee prediction