assetmgmt

package module
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 11 Imported by: 4

README

Asset Management Interface

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetManagement

type AssetManagement struct {
	shim.Chaincode
	// contains filtered or unexported fields
}

AssetManagement provides functions to manage asset locks by calling suitable functions in the interop contract

func (*AssetManagement) ClaimAsset

func (am *AssetManagement) ClaimAsset(stub shim.ChaincodeStubInterface, assetAgreement *common.AssetExchangeAgreement, claimInfo *common.AssetClaim) (bool, error)

func (*AssetManagement) ClaimAssetUsingContractId

func (am *AssetManagement) ClaimAssetUsingContractId(stub shim.ChaincodeStubInterface, contractId string, claimInfo *common.AssetClaim) (bool, error)

func (*AssetManagement) ClaimFungibleAsset

func (am *AssetManagement) ClaimFungibleAsset(stub shim.ChaincodeStubInterface, contractId string, claimInfo *common.AssetClaim) (bool, error)

func (*AssetManagement) Configure

func (am *AssetManagement) Configure(interopChaincodeId string)

Utility functions

func (*AssetManagement) GetAllAssetsLockedUntil

func (am *AssetManagement) GetAllAssetsLockedUntil(stub shim.ChaincodeStubInterface, lockExpiryTimeSecs uint64) ([]string, error)

Assumption is that the caller is either the recipient or the locker in each element in the list, but we will let the interop CC take care of it

func (*AssetManagement) GetAllFungibleLockedAssets

func (am *AssetManagement) GetAllFungibleLockedAssets(stub shim.ChaincodeStubInterface, lockRecipient string, locker string) ([]string, error)

func (*AssetManagement) GetAllLockedAssets

func (am *AssetManagement) GetAllLockedAssets(stub shim.ChaincodeStubInterface, lockRecipient string, locker string) ([]string, error)

func (*AssetManagement) GetAllLockedAssetsFunc

func (am *AssetManagement) GetAllLockedAssetsFunc(stub shim.ChaincodeStubInterface, funcName string, lockRecipient string, locker string) ([]string, error)

'lockRecipient': if blank, assume caller 'locker': if blank, assume caller

func (*AssetManagement) GetAllNonFungibleLockedAssets

func (am *AssetManagement) GetAllNonFungibleLockedAssets(stub shim.ChaincodeStubInterface, lockRecipient string, locker string) ([]string, error)

func (*AssetManagement) GetAssetTimeToRelease

func (am *AssetManagement) GetAssetTimeToRelease(stub shim.ChaincodeStubInterface, assetAgreement *common.AssetExchangeAgreement) (uint64, error)

'lockRecipient': if blank, assume caller 'locker': if blank, assume caller

func (*AssetManagement) GetFungibleAssetTimeToRelease

func (am *AssetManagement) GetFungibleAssetTimeToRelease(stub shim.ChaincodeStubInterface, assetAgreement *common.FungibleAssetExchangeAgreement) (uint64, error)

'lockRecipient': if blank, assume caller 'locker': if blank, assume caller

func (*AssetManagement) GetHTLCHash added in v1.5.7

func (am *AssetManagement) GetHTLCHash(stub shim.ChaincodeStubInterface, assetAgreement *common.AssetExchangeAgreement) (string, error)

func (*AssetManagement) GetHTLCHashByContractId added in v1.5.7

func (am *AssetManagement) GetHTLCHashByContractId(stub shim.ChaincodeStubInterface, contractId string) (string, error)

func (*AssetManagement) GetHTLCHashPreImage added in v1.5.7

func (am *AssetManagement) GetHTLCHashPreImage(stub shim.ChaincodeStubInterface, assetAgreement *common.AssetExchangeAgreement) (string, error)

func (*AssetManagement) GetHTLCHashPreImageByContractId added in v1.5.7

func (am *AssetManagement) GetHTLCHashPreImageByContractId(stub shim.ChaincodeStubInterface, contractId string) (string, error)

func (*AssetManagement) GetTotalFungibleLockedAssets

func (am *AssetManagement) GetTotalFungibleLockedAssets(stub shim.ChaincodeStubInterface, assetType string) (uint64, error)

func (*AssetManagement) IsAssetLocked

func (am *AssetManagement) IsAssetLocked(stub shim.ChaincodeStubInterface, assetAgreement *common.AssetExchangeAgreement) (bool, error)

If 'assetAgreement.Locker' or 'assetAgreement.Recipient' is blank, assume it's the caller

func (*AssetManagement) IsAssetLockedQueryUsingContractId

func (am *AssetManagement) IsAssetLockedQueryUsingContractId(stub shim.ChaincodeStubInterface, contractId string) (bool, error)

func (*AssetManagement) IsFungibleAssetLocked

func (am *AssetManagement) IsFungibleAssetLocked(stub shim.ChaincodeStubInterface, contractId string) (bool, error)

func (*AssetManagement) LockAsset

func (am *AssetManagement) LockAsset(stub shim.ChaincodeStubInterface, assetAgreement *common.AssetExchangeAgreement, lockInfo *common.AssetLock) (string, error)

func (*AssetManagement) LockFungibleAsset

func (am *AssetManagement) LockFungibleAsset(stub shim.ChaincodeStubInterface, assetAgreement *common.FungibleAssetExchangeAgreement, lockInfo *common.AssetLock) (string, error)

func (*AssetManagement) UnlockAsset

func (am *AssetManagement) UnlockAsset(stub shim.ChaincodeStubInterface, assetAgreement *common.AssetExchangeAgreement) (bool, error)

func (*AssetManagement) UnlockAssetUsingContractId

func (am *AssetManagement) UnlockAssetUsingContractId(stub shim.ChaincodeStubInterface, contractId string) (bool, error)

func (*AssetManagement) UnlockFungibleAsset

func (am *AssetManagement) UnlockFungibleAsset(stub shim.ChaincodeStubInterface, contractId string) (bool, error)

type AssetManagementContract

type AssetManagementContract struct {
	contractapi.Contract
	// contains filtered or unexported fields
}

AssetManagementContract implements asset locking and claiming chaincode operations that can be inherited by another contract

func (*AssetManagementContract) ClaimAsset

func (amc *AssetManagementContract) ClaimAsset(ctx contractapi.TransactionContextInterface, assetAgreementSerializedProto64 string, claimInfoSerializedProto64 string) (bool, error)

func (*AssetManagementContract) ClaimAssetUsingContractId

func (amc *AssetManagementContract) ClaimAssetUsingContractId(ctx contractapi.TransactionContextInterface, contractId, claimInfoSerializedProto64 string) (bool, error)

func (*AssetManagementContract) ClaimFungibleAsset

func (amc *AssetManagementContract) ClaimFungibleAsset(ctx contractapi.TransactionContextInterface, contractId, claimInfoSerializedProto64 string) (bool, error)

func (*AssetManagementContract) Configure

func (amc *AssetManagementContract) Configure(interopChaincodeId string)

Utility functions

func (*AssetManagementContract) ContractIdAssetsLookupMap

func (amc *AssetManagementContract) ContractIdAssetsLookupMap(ctx contractapi.TransactionContextInterface, assetType, assetId, contractId string) error

write to the ledger the details needed at the time of unlock/claim

func (*AssetManagementContract) ContractIdFungibleAssetsLookupMap

func (amc *AssetManagementContract) ContractIdFungibleAssetsLookupMap(ctx contractapi.TransactionContextInterface, assetType string, numUnits uint64, contractId string) error

write to the ledger the details needed at the time of unlock/claim

func (*AssetManagementContract) DeleteAssetLookupMaps

func (amc *AssetManagementContract) DeleteAssetLookupMaps(ctx contractapi.TransactionContextInterface, assetType, assetId string) error

func (*AssetManagementContract) DeleteAssetLookupMapsOnlyUsingContractId

func (amc *AssetManagementContract) DeleteAssetLookupMapsOnlyUsingContractId(ctx contractapi.TransactionContextInterface, contractId string) error

func (*AssetManagementContract) DeleteAssetLookupMapsUsingContractId

func (amc *AssetManagementContract) DeleteAssetLookupMapsUsingContractId(ctx contractapi.TransactionContextInterface, assetType, assetId, contractId string) error

func (*AssetManagementContract) DeleteFungibleAssetLookupMap

func (amc *AssetManagementContract) DeleteFungibleAssetLookupMap(ctx contractapi.TransactionContextInterface, contractId string) error

func (*AssetManagementContract) FetchFromContractIdAssetLookupMap

func (amc *AssetManagementContract) FetchFromContractIdAssetLookupMap(ctx contractapi.TransactionContextInterface, contractId string) (string, string, error)

Fetch the contracted bond asset type and id from the ledger

func (*AssetManagementContract) FetchFromContractIdFungibleAssetLookupMap

func (amc *AssetManagementContract) FetchFromContractIdFungibleAssetLookupMap(ctx contractapi.TransactionContextInterface, contractId string) (string, uint64, error)

Fetch the contracted fungible asset type and numUnits from the ledger

func (*AssetManagementContract) GetAllAssetsLockedUntil

func (amc *AssetManagementContract) GetAllAssetsLockedUntil(ctx contractapi.TransactionContextInterface, lockExpiryTimeSecs uint64) ([]string, error)

func (*AssetManagementContract) GetAllFungibleLockedAssets

func (amc *AssetManagementContract) GetAllFungibleLockedAssets(ctx contractapi.TransactionContextInterface, lockRecipient string, locker string) ([]string, error)

func (*AssetManagementContract) GetAllLockedAssets

func (amc *AssetManagementContract) GetAllLockedAssets(ctx contractapi.TransactionContextInterface, lockRecipient string, locker string) ([]string, error)

func (*AssetManagementContract) GetAllNonFungibleLockedAssets

func (amc *AssetManagementContract) GetAllNonFungibleLockedAssets(ctx contractapi.TransactionContextInterface, lockRecipient string, locker string) ([]string, error)

func (*AssetManagementContract) GetAssetTimeToRelease

func (amc *AssetManagementContract) GetAssetTimeToRelease(ctx contractapi.TransactionContextInterface, assetAgreementSerializedProto64 string) (uint64, error)

func (*AssetManagementContract) GetFungibleAssetTimeToRelease

func (amc *AssetManagementContract) GetFungibleAssetTimeToRelease(ctx contractapi.TransactionContextInterface, fungibleAssetExchangeAgreementSerializedProto64 string) (uint64, error)

func (*AssetManagementContract) GetHTLCHash added in v1.5.7

func (amc *AssetManagementContract) GetHTLCHash(ctx contractapi.TransactionContextInterface, assetAgreementSerializedProto64 string) (string, error)

func (*AssetManagementContract) GetHTLCHashByContractId added in v1.5.7

func (amc *AssetManagementContract) GetHTLCHashByContractId(ctx contractapi.TransactionContextInterface, contractId string) (string, error)

func (*AssetManagementContract) GetHTLCHashPreImage added in v1.5.7

func (amc *AssetManagementContract) GetHTLCHashPreImage(ctx contractapi.TransactionContextInterface, assetAgreementSerializedProto64 string) (string, error)

func (*AssetManagementContract) GetHTLCHashPreImageByContractId added in v1.5.7

func (amc *AssetManagementContract) GetHTLCHashPreImageByContractId(ctx contractapi.TransactionContextInterface, contractId string) (string, error)

func (*AssetManagementContract) GetTotalFungibleLockedAssets

func (amc *AssetManagementContract) GetTotalFungibleLockedAssets(ctx contractapi.TransactionContextInterface, assetType string) (uint64, error)

func (*AssetManagementContract) IsAssetLocked

func (amc *AssetManagementContract) IsAssetLocked(ctx contractapi.TransactionContextInterface, assetAgreementSerializedProto64 string) (bool, error)

func (*AssetManagementContract) IsAssetLockedQueryUsingContractId

func (amc *AssetManagementContract) IsAssetLockedQueryUsingContractId(ctx contractapi.TransactionContextInterface, contractId string) (bool, error)

func (*AssetManagementContract) IsFungibleAssetLocked

func (amc *AssetManagementContract) IsFungibleAssetLocked(ctx contractapi.TransactionContextInterface, contractId string) (bool, error)

func (*AssetManagementContract) LockAsset

func (amc *AssetManagementContract) LockAsset(ctx contractapi.TransactionContextInterface, assetAgreementSerializedProto64 string, lockInfoSerializedProto64 string) (string, error)

func (*AssetManagementContract) LockFungibleAsset

func (amc *AssetManagementContract) LockFungibleAsset(ctx contractapi.TransactionContextInterface, fungibleAssetExchangeAgreementSerializedProto64 string, lockInfoSerializedProto64 string) (string, error)

func (*AssetManagementContract) UnlockAsset

func (amc *AssetManagementContract) UnlockAsset(ctx contractapi.TransactionContextInterface, assetAgreementSerializedProto64 string) (bool, error)

func (*AssetManagementContract) UnlockAssetUsingContractId

func (amc *AssetManagementContract) UnlockAssetUsingContractId(ctx contractapi.TransactionContextInterface, contractId string) (bool, error)

func (*AssetManagementContract) UnlockFungibleAsset

func (amc *AssetManagementContract) UnlockFungibleAsset(ctx contractapi.TransactionContextInterface, contractId string) (bool, error)

func (*AssetManagementContract) ValidateAndExtractAssetAgreement

func (amc *AssetManagementContract) ValidateAndExtractAssetAgreement(assetAgreementSerializedProto64 string) (*common.AssetExchangeAgreement, error)

func (*AssetManagementContract) ValidateAndExtractClaimInfo

func (amc *AssetManagementContract) ValidateAndExtractClaimInfo(claimInfoSerializedProto64 string) (*common.AssetClaim, error)

func (*AssetManagementContract) ValidateAndExtractFungibleAssetAgreement

func (amc *AssetManagementContract) ValidateAndExtractFungibleAssetAgreement(fungibleAssetExchangeAgreementSerializedProto64 string) (*common.FungibleAssetExchangeAgreement, error)

func (*AssetManagementContract) ValidateAndExtractLockInfo

func (amc *AssetManagementContract) ValidateAndExtractLockInfo(lockInfoSerializedProto64 string) (*common.AssetLock, error)

type ContractedAsset

type ContractedAsset struct {
	Type string `json:"type"`
	Id   string `json:"id"`
}

Object used in the map, contractId --> contracted-asset

type ContractedFungibleAsset

type ContractedFungibleAsset struct {
	Type     string `json:"type"`
	NumUnits uint64 `json:"id"`
}

Object used in the map, contractId --> contracted-fungible-asset

Jump to

Keyboard shortcuts

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