1

If I mint a token and the contract doesn't have all the features I needed from the offset, is there a way I could develop a new contract for a new token and create a way in which people can send the Old token and be returned the new one?

I had a client who was eager to mint coins to distribute to early private investors but the actual way the token will be used or interacted with will change over time, so I'm not too sure how to go about this.

Or perhaps I'm missing something and we can extend the contract.

3

Yes it is entirely possible. Create contract A that is standard ERC20. When it is time to upgrade, create contract B with your new features.

contract B has a function upgradeFrom(address old, uint amount)

Investors then use call approve(B, uint amount) on A. This allows contract B to retrieve the funds from A.

Investors then call upgradeFrom(B, uint amount), and the upgradeFrom function withdraws the funds from A and does any other logic to set up the investor in contract B.

Another way:

If you don't care about contract A after contract B is in production, you can just have a single function in contract B called upgrade() that checks the balance of the sender in contract A and updates it in contract B. You will also want to make sure you record who has already upgraded as people could call the function multiple times.

0

You can create a contract where a function looks for transfer events of a specific token (this original token), and then fires some when it sees that it has been transferred tokens. This would probably be the best way to do it.

Creating a new token would use this same strategy ^^^ but be really un-user friendly, and unnecessary.

For some inspiration, look at how Ether Delta does it, they have a very robust smart contract with this implemented.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.