NEP5 Template for NEO3#187
NEP5 Template for NEO3#187lightszero merged 30 commits intoneo-project:masterfrom belane:nep5-template
Conversation
|
We need to wait for neo-project/neo#1432 |
|
Good work, I'll test this. |
|
I tried this nep5 template on my local environment. It was deployed successfully and then I invoked some static methods such like |
|
Cosigners should be [0], not null, @superboyiii please check neo-project/neo-node#539 |
|
Format needs to be modified |
@shargon I've checked neo-project/neo-node#539, that's OK. But there's another issue that Cosigners is always [0] here which makes usage is always null so that checkwitness isn't able to pass when invoke |
|
You received HALT, and should be FAULT, isn't it? @superboyiii |
Yes, that's it. Now I add some logs on every step of |
|
This |
|
Yes, that's strange. |
@erikzhang yes, what do you prefer? move it, merge or close? |
|
@erikzhang I think two different templates could exist together since they're in absolutely different repositories. We just need to ensure their methods all meet nep5 standard and work well. This template is using Object-oriented style which is valueable for testing purpose. We can test many features on it. |
|
@erikzhang Both templates are great works. The NEP5 template in the neo/example provides users with a basic Token template, while the Belance's is an extension to meet deeper needs, or we can modify the name of Belance's template to Crowdfunding template. |
| { | ||
| return false; | ||
| } | ||
| Contract.Update(script, manifest); |
There was a problem hiding this comment.
Shall we send our neo and gas to the next contract or this should be made in the core? 🤔
There was a problem hiding this comment.
I think we should move asset to the next contract in the core, as NEO, GAS and data all are protocol layer things. For me, we can treat NEO and GAS as one special data type/properties in contract, so when we update or destory contract, we should handle them.
What do you think? @erikzhang @lightszero
There was a problem hiding this comment.
Not sure which is the best option. 🤔
It would prevent losing assets in hyperspace, but on the other hand, it may exceed the functions of the core.
| return false; | ||
| } | ||
|
|
||
| Contract.Destroy(); |
There was a problem hiding this comment.
Shall we send our neo and gas to the owner or this should be made in the core? 🤔
There was a problem hiding this comment.
Perhaps there should be a check, if there is neo or gas it returns false.
There was a problem hiding this comment.
If one contract hasn't set the verificaiton trigger correctly, it may can't be destoryed never.
There was a problem hiding this comment.
These kind of controls are good, we've recommended before, but they are specific to each project.
Each project must implement the measures that fit its business model. As @Tommo-L says if a contract does not include Verification, it is enough to send 1 GAS to prevent them from migrating (or destroy) the contract.
lightszero
left a comment
There was a problem hiding this comment.
code like this is very slow,very very very slow.
and it's expensive,I don't think it is a good idea in template.
//this is a function,compiler do not optimize it.,it will write 20 times
Owner=>new byte[] { 0xf6, 0x64, 0x43, 0x49, 0x8d, 0x38, 0x78, 0xd3, 0x2b, 0x99, 0x4e, 0x4e, 0x12, 0x83, 0xc6, 0x93, 0x44, 0x21, 0xda, 0xfe };please use
//compiler can optimze it to a const.
static readonly byte[] owner_var=new byte[] { 0xf6, 0x64, 0x43, 0x49, 0x8d, 0x38, 0x78, 0xd3, 0x2b, 0x99, 0x4e, 0x4e, 0x12, 0x83, 0xc6, 0x93, 0x44, 0x21, 0xda, 0xfe };|
We need to send notification when destroying the sc, otherwise the plugin RpcNep5Tracker won't know it, the balance of the asset will still exist in its storage. |
|
You can check the change set in |
In the past we haven't used this kind of notifications, as Erik says you can use |
|
@lightszero Could you review it again? I think it's OK now. |
* sc and tests * dotnet format * Prepare for new SYSCALL * Add FeaturesAttribute * post build SC compilation * revert GetCurrentTransaction * Add ContractId * fix Deploy * check null balances * updates from master * Update crowdsale get balance Co-Authored-By: Luchuan <luchuan@ngd.neo.org> * ToBigInteger * dotnet format * migrate args * NeoToken little-endian Co-Authored-By: GripZhang <xiuboard@foxmail.com> * GasToken little-endian Co-Authored-By: GripZhang <xiuboard@foxmail.com> * totalSupply and ut * supply factor * shargon improvements * li optimizations * more changes * add 214 Co-authored-by: Shargon <Shargon@gmail.com> Co-authored-by: Luchuan <luchuan@ngd.neo.org> Co-authored-by: GripZhang <xiuboard@foxmail.com> Co-authored-by: lights li <lightsever@hotmail.com>
* sc and tests * dotnet format * Prepare for new SYSCALL * Add FeaturesAttribute * post build SC compilation * revert GetCurrentTransaction * Add ContractId * fix Deploy * check null balances * updates from master * Update crowdsale get balance Co-Authored-By: Luchuan <luchuan@ngd.neo.org> * ToBigInteger * dotnet format * migrate args * NeoToken little-endian Co-Authored-By: GripZhang <xiuboard@foxmail.com> * GasToken little-endian Co-Authored-By: GripZhang <xiuboard@foxmail.com> * totalSupply and ut * supply factor * shargon improvements * li optimizations * more changes * add 214 Co-authored-by: Shargon <Shargon@gmail.com> Co-authored-by: Luchuan <luchuan@ngd.neo.org> Co-authored-by: GripZhang <xiuboard@foxmail.com> Co-authored-by: lights li <lightsever@hotmail.com>







C Sharp version of the NEP5 template for NEO3 (https://github.com/neo-project/neo/issues/973).
As the nep-5 standard, it includes
totalSupply,name,symbol,decimals,balanceOfandtransfermethods, and thetransferevent.