nash-io / neo-ico-template

An ICO Template for NEO projects
GNU General Public License v3.0
117 stars 56 forks source link

Crowdsale KYC Address Issue #10

Closed brianlenz closed 6 years ago

brianlenz commented 6 years ago

Reading through @metachris' great blog post:

https://medium.com/proof-of-working/how-to-build-an-ico-on-neo-with-the-nex-ico-smart-contract-template-1beac1ff0afd

This is the example given to whitelist an address:

neo> testinvoke 70b3f7098a9a3f2361a1f0c312e9842ec4ca6dc6 crowdsale_register ["ATELFGeypfK15uwNvRdQe1zaD3vw38976L"]

This will register that address, and it can be confirmed the address is whitelisted with crowdsale_status.

The issue is that it seems the smart contract isn't set up to check addresses, but instead script hashes? get_asset_attachments() does:

attachment.sender_addr = reference.ScriptHash

which causes the KYC check to be looked up by script hash instead of address:

[I 180116 15:16:51 EventHub:102] [test_mode][SmartContract.Storage.Get] [363a9010afab0cb2a5defeb8c45811d523c1e44c] b'kyc_ok#\xba\'\x03\xc52c\xe8\xd6\xe5"\xdc2 39\xdc\xd8\xee\xe9' -> bytearray(b'')

which will always fail when registering the by the address.

Is there a way to make get_kyc_status use the address instead of the script hash?

brianlenz commented 6 years ago

Please disregard. We found an error is happening that is ultimately causing this problem, so we will need to track this down first:

[E 180116 16:23:26 ExecutionEngine:831] COULD NOT EXECUTE OP: Invalid list operation b'c' JMPIF
[E 180116 16:23:26 ExecutionEngine:832] Invalid list operation
    Traceback (most recent call last):
      File "/Users/brian/Projects/Narrative/neo-python/neo/VM/ExecutionEngine.py", line 829, in StepInto
        self.ExecuteOp(op, self.CurrentContext)
      File "/Users/brian/Projects/Narrative/neo-python/neo/VM/ExecutionEngine.py", line 172, in ExecuteOp
        fValue = estack.Pop().GetBoolean()
      File "/Users/brian/Projects/Narrative/neo-python/neo/VM/RandomAccessStack.py", line 45, in Pop
        return self.Remove(0)
      File "/Users/brian/Projects/Narrative/neo-python/neo/VM/RandomAccessStack.py", line 57, in Remove
        raise Exception("Invalid list operation")
    Exception: Invalid list operation
brianlenz commented 6 years ago

FWIW, the above error is an error in the neo-boa python compiler: CityOfZion/neo-boa#29