TokenMarketNet/smart-contracts

Fix preico customer ID bugs / features

Opened this issue · 1 comments

Both rawinvestments.py and distributetokens.py have bugs of not including customer ID for preico. After talking to Mikko Ohtamaa, my understanding is that the concept to use buyWithCustomerId on behalf of customers without account / address and investWithCustomerId for customers have account /address. I understand that is incomplete process, as an experiment, I've added writing customer Id to an csv file in awinvestments.py, and distributetokens.py to read customer ID from the csv file. I have also added customer ID as an input parameter in distributetokens.py, the it can actually check and to transfer tokens to customer account based on the condition of only when the customer ID from input matches to the customers reading from the csv file. There are still some issues:

(1) buyWithCustomerId does not work to use owner address, but works to use a non-owner address which seems contradict to the concept of on behalf of customers without account / address

For example the following statement would have an exception:
txid = investor_contract.transact({"from": owner_address, "value": to_wei(0.01, ether")}).buyWithCustomerId(customerId)

(2) The txid = issuer.transact(transaction).issue(addr, tokens) in distributetokens.py is not working either.

I haven't looked at the contracts seriously, could that problems be in wrong state? I called bothfunctions at the state of PreFunding, should both functions be valid in Finalized state?