yurigabrich / microgrid-dapp Goto Github PK
View Code? Open in Web Editor NEWMicrogrid Transactive Energy Smart Contract
Home Page: https://yurigabrich.github.io/microgrid-dapp/?utm_source=gh&utm_medium=cv&utm_campaign=spread_out
License: Other
Microgrid Transactive Energy Smart Contract
Home Page: https://yurigabrich.github.io/microgrid-dapp/?utm_source=gh&utm_medium=cv&utm_campaign=spread_out
License: Other
The NeoCompiler automatic identifies all the functions and variables defined as public
and displays an invoke option to it following the order they appear on the algorithm.
However, how can it confuse a user to select the right operation described on the smart contract through the Main
?
Data validation of the bid value is made with variable type byte
(L.216) while the argument for the function Bid
is provided as BigInteger
(L.224).
Is it ok to use the former on this way to limit its size and keep the latter as is to be compliant with NEO VM variables format?
microgrid-dapp/neo-dapp/microgrid-dapp.cs
Line 216 in 506dadd
microgrid-dapp/neo-dapp/microgrid-dapp.cs
Line 224 in 506dadd
The crucial classification between ID's created by the MTEsm and by NEO blockchain can be set by the type of the variable. While the former is defined as string
, the latter is byte[]
.
However, they can be easily interchangeable when the variable is passed as object
, and all the evaluations defined so far does not reach a good outcome.
For instance, the current method to distinguish them (box code below) considers the input variable object
as type string
, and checks the first letter of the variable. So, if the member address APLJBPhtRg2XLhtpxEHd6aRNL7YSLGH2ZL
is correctly invoked, i.e., the variable is passed on the Main()
as a scripthash equal to 52eaab8b2aab608902c651912db34de36e7a2b0f
, the function evaluates the hash as Rê«�*«`��ÆQ�-³Mãnz+�
. Consequently, the result is wrong.
microgrid-dapp/neo-dapp/microgrid-dapp.cs
Lines 1025 to 1028 in b1ad137
Other alternative is to evaluate the size of the variable. Such as the commit b44cd74 has tried to do (reproduced below).
Again, the output may be wrong, since a variable like RT9vtMQDGVS5uKFD4bLLChXEKAcPLh
, which corresponds to a referendum ID (i.e. a string
), could be evaluated as a byte[]
with scripthash equal to aa49805a44e08e67c0c5f92da3d21fdbba829416
, and then the size of the variable will be 20 too.
microgrid-dapp/neo-dapp/microgrid-dapp.cs
Lines 398 to 401 in b44cd74
microgrid-dapp/neo-dapp/microgrid-dapp.cs
Lines 535 to 541 in b44cd74
With this in mind, what the main difference between this variables?
The code still have a lot of minor bugs and decisions waiting to be fixed. At commit ecd4b01 there are 25 --PENDING-- "tags". The list below tracks all of them accordingly with different scopes:
Business subjects
:53
Define the factor between 1kW and 1SEB. And then, review at PowerUP() last operations if its right (pay attention to units).:935
Review calculation of 'tokens' (pay attention to units).:938
Review calculation of 'quota' (pay attention to units).:1319
When refunding a member, the Trade()
unit is SEB or R$? Is there missing some more operation?:1326
Why delete a crowdfunding process data when its not succeeded? Why not keep this information?NEO API feature
:62
How to identify the smart contract caller?:112
Dependent on the caller address.Lack of expertise on coding
:77
How to guarantee to the first contract invoker (the contract owner) to automatically be the first member? How to allow this operation to happen only once?:95
CheckWitness
requires a variable of type byte[]
but members' address are being registered as string
.:128
CheckWitness
requires a variable of type byte[]
but members' address are being registered as string
.:144
CheckWitness
requires a variable of type byte[]
but members' address are being registered as string
.:169
CheckWitness
requires a variable of type byte[]
but members' address are being registered as string
.:306
Review dataset of each 'key' after the modifications made on the storage configuration. 'Key' is of type string
and might represent the ID of a member, a PP or a Referendum.:834
Should split the variable 'notes' to get further information.Missing code validation
:231
Test second argument of Change()
because of its length (array of arrays).:712
Test variable convertion.:714
Test variable convertion.:753
Something to review when updating a member registration data. ("missing dependency"?):793
Something to review when updating a PP data. ("missing dependency"?):1048
Review how to definitely remove a member data from the private storage.:1160
Review how to definitely remove a PP data from the private storage.:1193
Review what variable type is returned from GetRef()
. byte[]
or object
? This influences on other operations along the smart contract.:1251
Review what variable type is returned from UpCrowd()
. byte[]
or object
? This influences on other operations along the smart contract.:1257
Review what variable type is returned from UpBid()
. Should it return something?:1271
Still missing to update other 'crowd' values (!?) when doing a UpBid()
.Reorganize the algorithm by the structure of 'classes' in order to provide inheritance and better readability.
😉 Get note from here.
The analysis of C# is not working right. There are missing configs.
File e9dc768
To fix:
To improve:
May an address be differently invoked depending on the function used? In other words, sometimes the variable is passed as a byte[]
(hexstring), and sometimes as string
(Base58).
Does it hurt usability?
How can I use the CheckWitness
and evaluate if the address is a member at the same time?
microgrid-dapp/neo-dapp/microgrid-dapp.cs
Lines 235 to 236 in 506dadd
Address
at the same invoke function with a conversion such as .AsByteArray()
? Or an explicit conversion like the below is enough?microgrid-dapp/neo-dapp/microgrid-dapp.cs
Lines 235 to 239 in 506dadd
The most updated version of the smart contract (on the master branch) must be directly open in the EcoLab just clicking a link.
All the statements made so far that use the operator is
to evaluate a string
against an object
are wrong, since is
evaluates if one variable can be converted to the other (ref). Therefore all the clauses must be rewrote to keep the algorithm behaviour reliable.
In total, there are 6 cases concerning this, and all of them share the attribute of testing an object "id". In summary, they can be found at:
Discern PPid (string) and address (byte[]). — operation option change
microgrid-dapp/neo-dapp/microgrid-dapp.cs
Line 281 in 12f35f8
Discern the change of a bid (BigInteger) to other PP change operations (string) — operation option change
microgrid-dapp/neo-dapp/microgrid-dapp.cs
Line 289 in 12f35f8
Discern PPid (string), Refid (string) and address (byte[]) — function Summary()
microgrid-dapp/neo-dapp/microgrid-dapp.cs
Line 407 in 12f35f8
Discern PPid (string) and address (byte[]) — function Change()
microgrid-dapp/neo-dapp/microgrid-dapp.cs
Line 546 in 12f35f8
To limit the change of a member profile data (string, up to personal decision) to a member registration data (BigInteger, upon request to the group) — function Change()
microgrid-dapp/neo-dapp/microgrid-dapp.cs
Line 550 in 12f35f8
microgrid-dapp/neo-dapp/microgrid-dapp.cs
Line 559 in 12f35f8
Discern PPid (string) and address (byte[]) — function ShowContributedValues()
microgrid-dapp/neo-dapp/microgrid-dapp.cs
Line 1016 in 12f35f8
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.