UNPKG

stromdao-businessobject

Version:

Abstract BusinessObject for StromDAO Energy Blockchain. Abstraction layer between blockchain technology and business logic providing energy market related entities and use cases.

255 lines (144 loc) 8.06 kB
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> ### Table of Contents - - [fs](#fs) - [StromDAO Business Object](#stromdao-business-object) - [\_createNewPK](#_createnewpk) - [\_waitForTransaction](#_waitfortransaction) - [\_getBlockNumber](#_getblocknumber) - [\_keepObjRef](#_keepobjref) - [\_keepHashRef](#_keephashref) - [getRef](#getref) - [\_loadContract](#_loadcontract) - [\_owner_promise](#_owner_promise) - [\_deployContract](#_deploycontract) - [\_objInstance](#_objinstance) - [dso](#dso) - [mpo](#mpo) - [mpo](#mpo-1) - [StromDAO Business Object: MPO](#stromdao-business-object-mpo) - [provider](#provider) - [billing](#billing) - [delivery](#delivery) - [stromkonto](#stromkonto) - [roleLookup](#rolelookup) - [approveMP](#approvemp) - [storeReading](#storereading) - [storeReading](#storereading-1) - [lastDelivery](#lastdelivery) - [readings](#readings) ## fs [StromDAONode.js:9-9](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L9-L9 "Source code on GitHub") # StromDAO Business Object [DE] Binding für den StromDAO Node zur Anbindung der Energy Blockchain und Arbeit mit den unterschiedlichen BC Objekten (SmartContracts) [EN] Binding for StromDAO Node to the Energy Blockchain. **Meta** - **author**: Thorsten Zoerner thorsten.zoerner@stromdao.de ## \_createNewPK [StromDAONode.js:23-30](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L23-L30 "Source code on GitHub") Core Function to create a new key-pair. ## \_waitForTransaction [StromDAONode.js:36-38](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L36-L38 "Source code on GitHub") Core Function to wait for a transaction to be processed **Parameters** - `tx` - `Transaction` hash to wait for ## \_getBlockNumber [StromDAONode.js:48-50](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L48-L50 "Source code on GitHub") Core Function - Get latest Block Number in Energy Blockchain ## \_keepObjRef [StromDAONode.js:68-77](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L68-L77 "Source code on GitHub") Keeps a reference of the object in local persitance store **Parameters** - `address` - `contract_type` ## \_keepHashRef [StromDAONode.js:82-85](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L82-L85 "Source code on GitHub") Keeps transaction receipt for in local persistance store (Key=Hash, Value=Receipt) **Parameters** - `transaction` ## getRef [StromDAONode.js:90-92](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L90-L92 "Source code on GitHub") Retrieves a value fromm local persistance store (Key=>Value) **Parameters** - `ref` ## \_loadContract [StromDAONode.js:97-115](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L97-L115 "Source code on GitHub") Load a contract to be used in BO Instance **Parameters** - `address` - `contract_type` - `roles_address` ## \_owner_promise [StromDAONode.js:120-127](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L120-L127 "Source code on GitHub") Promise to retrieve general Owner() Function of SmartContracts **Parameters** - `instance` ## \_deployContract [StromDAONode.js:132-162](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L132-L162 "Source code on GitHub") Deploy a new contract to the Energy Blockchain **Parameters** - `contract_type` - `roles_address` ## \_objInstance [StromDAONode.js:167-174](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L167-L174 "Source code on GitHub") Get generic instance of a smart contract as object **Parameters** - `obj_or_address` - `type_of_object` ## dso [StromDAONode.js:179-179](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L179-L179 "Source code on GitHub") Bridge to DSO Smart Contract ## mpo [StromDAONode.js:184-184](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L184-L184 "Source code on GitHub") Bridge to MPO Smart Contract ## mpo [MPO.js:12-124](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/MPO.js#L12-L124 "Source code on GitHub") # StromDAO Business Object: MPO Meter Point Operator handling for StromDAO Energy Blockchain. In general a Meter Point Operating (Contract) handles meter readings and issues Deliverables as soon as a new reading is received. **Parameters** - `obj_or_address` **Meta** - **author**: Thorsten Zoerner thorsten.zoerner@stromdao.de ## provider [StromDAONode.js:189-189](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L189-L189 "Source code on GitHub") Bridge to Provider Smart Contract ## billing [StromDAONode.js:194-194](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L194-L194 "Source code on GitHub") Bridge to Billing Smart Contract ## delivery [StromDAONode.js:199-199](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L199-L199 "Source code on GitHub") Bridge to Delivery Smart Contract ## stromkonto [StromDAONode.js:204-204](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L204-L204 "Source code on GitHub") Bridge to Stromkonto Smart Contract ## roleLookup [StromDAONode.js:209-209](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/StromDAONode.js#L209-L209 "Source code on GitHub") Bridge to RoleLookup Smart Contract ## approveMP [MPO.js:25-32](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/MPO.js#L25-L32 "Source code on GitHub") Approve a new Blockchain Address to this contract instance. Limit: Only-Owner **Parameters** - `_meter` address - `_role` Eq. to 4= Consumer or 5= Producer ## storeReading [MPO.js:38-46](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/MPO.js#L38-L46 "Source code on GitHub") - **See: approveMP()** Stores a reading to this contract instance. Requires sender to be approved Meter-Point **Parameters** - `_reading` ## storeReading [MPO.js:51-59](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/MPO.js#L51-L59 "Source code on GitHub") Allows a test commit to check if it fails. Promise that might be used to validate a Meter-Point is fully connected. **Parameters** - `_reading` ## lastDelivery [MPO.js:64-71](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/MPO.js#L64-L71 "Source code on GitHub") Returns last delivery issued for a Meter-Point **Parameters** - `_meterpoint` ## readings [MPO.js:76-83](https://github.com/energychain/StromDAO-BusinessObject/blob/b78d7bf63853a782fc353ddd4c5acf26b381e9ea/MPO.js#L76-L83 "Source code on GitHub") Returns last reading for a Meter-Point **Parameters** - `_meterpoint`