The Token Problem (DIP20)

Hi!
I’ve noticed a few problems here. They look like very difficult ones.
1)When completely reinstalling the canister with tokens. All accounts (which had tokens) lose them.
The next problem comes from the first one.
2)When you try to restore the balances of other accounts, the transaction amount doubles.

At the moment, I have used the DIP20(DIP20/spec.md at main · Psychedelic/DIP20 · GitHub) code base with minor changes (which do not concern accounting), I think that other implemented standards will have similar problems. ( I haven’t used other variations yet)

The resulting problems:
To reset all token balances, it is enough to overwrite the canister (accidentally or intentionally)

You wouldn’t want to do a canister reinstall unless your willing to lose all your canister’s data. If you’re trying to upgrade the code for a canister that is controlled by your manager.mo/main.mo canister (which would be any canister that was instantiate by the manager.mo/main.mo canister), you’ll have to do so a different way.

It’s not as simple as upgrading the code for that child canister because your machine technically isn’t the controller for the child canister. The main.mo canister is the controller, and your machine controls the main.mo canister. So to actually upgrade that canister, you’ll have to create a method in your manager.mo/main.mo file that upgrades the code for the child canister which in this case, sounds like your token canister.

Here’s a thread that will show you how you go about creating and calling that method for installing the code to upgrade child canisters:

Well, if upgrading a token canister wipes out all token balances, then that seems like a bad implementation. Shouldn’t token balances be stored in stable memory?

EDIT: In fact, they are.