chaincode

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	TId   string
	CId   string
	TTs   float64
	ID    string  `json:"id"`
	Ts    int64   `json:"ts"`
	Sym   string  `json:"sym"`
	Size  float64 `json:"size"`
	Side  string  `json:"side"`
	Price float64 `json:"price"`
	TP    float64 `json:"tp"`
	SL    float64 `json:"sl"`
}

Asset describes basic details of what makes up a simple asset

type SmartContract

type SmartContract struct {
	contractapi.Contract
}

SmartContract provides functions for managing an Asset

func (*SmartContract) AssetExists

AssetExists returns true when asset with given ID exists in world state

func (*SmartContract) CreateAsset

func (s *SmartContract) CreateAsset(ctx contractapi.TransactionContextInterface, id string, ts int64, sym string, size float64, side string, price float64, tp float64, sl float64) error

CreateAsset issues a new asset to the world state with given details.

func (*SmartContract) DeleteAsset

DeleteAsset deletes an given asset from the world state.

func (*SmartContract) GetAllAssets

GetAllAssets returns all assets found in world state

func (*SmartContract) InitLedger

InitLedger adds a base set of assets to the ledger

func (*SmartContract) ReadAsset

ReadAsset returns the asset stored in the world state with given id.

func (*SmartContract) UpdateAsset

func (s *SmartContract) UpdateAsset(ctx contractapi.TransactionContextInterface, id string, ts int64, sym string, size float64, side string, price float64, tp float64, sl float64) error

UpdateAsset updates an existing asset in the world state with provided parameters.

Jump to

Keyboard shortcuts

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