Conversation
ContractMethodAttribute to replace the Main() method of native contractsContractMethodAttribute
Codecov Report
@@ Coverage Diff @@
## master #778 +/- ##
==========================================
- Coverage 37.95% 36.58% -1.37%
==========================================
Files 174 175 +1
Lines 12661 12401 -260
==========================================
- Hits 4805 4537 -268
- Misses 7856 7864 +8
Continue to review full report at Codecov.
|
Co-Authored-By: Shargon <shargon@gmail.com>
vncoelho
left a comment
There was a problem hiding this comment.
I agree with all 3 points, @erikzhang.
Nice insight. This way we gonna keep a good standard that will be quite readable.
| { | ||
| ContractMethodAttribute attribute = method.GetCustomAttribute<ContractMethodAttribute>(); | ||
| if (attribute is null) continue; | ||
| string name = attribute.Name ?? (method.Name.ToLower()[0] + method.Name.Substring(1)); |
There was a problem hiding this comment.
| string name = attribute.Name ?? (method.Name.ToLower()[0] + method.Name.Substring(1)); | |
| string name = attribute.Name ?? method.Name[0].ToString().ToLowerInvariant() + method.Name.Substring(1)); |
| return true; | ||
| } | ||
|
|
||
| [ContractMethod] |
There was a problem hiding this comment.
I think that we can set the name as mandatory
There was a problem hiding this comment.
Because we can prevent future issues like:
Question: I call OnXXXX and it doesn't work
Answer: Is onXXX
😆
There was a problem hiding this comment.
It automatically set the method names in the ABI, so it won't be a problem.
|
Nice commit, Erik: 0f9758b |
ContractMethodAttributeto replace theMain()method of native contracts.ContractMethodAttributeto create ABI for native contracts.ContractMethodAttributeto setsafemethodsfor native contracts.ContractMethodAttributeto describe the price of native contract's method.ContractMethodAttributeto describe the allowed triggers of native contract's method.