neo-project / neo-devpack-dotnet

NEO Development Pack
MIT License
79 stars 102 forks source link

NEP5 template Mint operation fails due to incorrect NEO/GAS token contract hash encoding #342

Closed devhawk closed 4 years ago

devhawk commented 4 years ago

From the NEP 5 template:

static readonly byte[] NeoToken = "0xde5f57d430d3dece511cf975a8d37848cb9e0525".HexToBytes();
static readonly byte[] GasToken = "0x668e0c1f9d7b70a99dd9e06eadd4c784d641afbc".HexToBytes();

However, HexToBytes converts these directly to byte array w/o reversing the order.

2115 PUSHDATA1 DE-5F-57-D4-30-D3-DE-CE-51-1C-F9-75-A8-D3-78-48-CB-9E-05-25 # as script hash: 0x25059ecb4878d3a875f91c51ceded330d4575fde
2138 PUSHDATA1 66-8E-0C-1F-9D-7B-70-A9-9D-D9-E0-6E-AD-D4-C7-84-D6-41-AF-BC # as script hash: 0xbcaf41d684c7d4ad6ee0d99da9707b9d1f0c8e66

So when the Mint operation attempts to compare the script hashes from the notifications array to the NEO/GAS script hashes stored in the contract, they never match

ShawnYun commented 4 years ago

Yes, we should reverse it.