[CLI] Upgrade token
As an admin, I want to upgrade an exiting token
Context
Within the accelerator we give the users the possibility to create a stable coin based in a token with some customizations. When the user creates its stable coin we have some extra features that a common Hedera token does not has it. We achieve this customization focusing to get the peak performance using an hybrid architecture adding extra features to the deployed Smart Contracts and using HTS when necessary to reduce costs or improve throughput.
It is possible that users currently has a deployed token in the Hedera ecosystem and will be interested in adding this features. For that reason, we should be able to give them the possibility to upgrade their current token an add the features that the accelerator provides.
Description
A new option should be added to the main menu before “Configuration” option called: “Upgrade token”.
First of all, we will show a list where the admin key of the tokens in this list matches with the current user key and these tokens are not created using the Accelerator:
- “Select the token:”
- 0.0.1234
- 0.0.2345
If the token has some data in the memo field we should display the following disclaimer:
- “If you upgrade the token adding the accelerator features, all the information in the memo field will be removed. Do you want to proceed? Yes-No”.
If so or memo field is empty, we should start the upgrade process asking the following questions:
- “Should the smart contract be used for all roles management? If so, all the token keys will be assigned to the new smart contract. If no, you will be able to select what keys do you want to be assigned to the smart contract or keep it as is”. The main difference between the stable coin creation and the stable coi upgrade is that when we are creating a stable coin from zero we ask separately for KYC and custom fees but in this case, how the keys should be previously configured, we are able to group them in the same question.
- If so, we must update the current admin key, kyc key, freeze key, fee schedule key, pause key, wipe key, supply key to the smart contract that will be created only if each key has assigned a value different to “None”.
- If no, like we currently asking the user when it wants to creates a stable coin from scratch, we should ask key by key what configuration wants. We should only ask as many questions as keys are set. If there is some not configured key, we should avoid the question.
- The smart contract → The smart contract that will be created and deployed
- Current user key → The public key from the current user
- Current configured key → This key is the one that the current token key has configured
- Other public key → If it selects this option we should give the user the possibility to add any other public key. This option won’t be available for admin key.
If the user selects the smart contract as a supply key, we will modify the treasury account to the smart contract. An informative message will be displayed to the user.
If the user selects its current key as a supply key, we will modify the treasury account to its current key. An informative message will be displayed to the user.
We won’t allow the user to choose a different account because would need that this account sign the transaction too and currently this is out of scope.
- Once keys are configured, we will ask about the features admin like we did in the creation process: [Role batch management & feature admin modification | Ask stable coin creator during the creation what will be the features role admi...](https://www.notion.so/Role-batch-management-feature-admin-modification-2947fcfacde045e39401949783536dac)
- Finally, we should ask for the PoR and if the user wants to use one of the predeployed HederaERC20 implementation like we did in the creation process:
- “Do you want to link the stable coin to a Proof of Reserve?” [PRD Chainlink | Proposal A: Light development](https://www.notion.so/Proof-of-Reserve-354e899314254e1596f1638bf5d50de5)
- “Choose your predeployed HederaERC20 implementation?” [Contract Factory include multiple HederaERC20 versions | Proposal](https://www.notion.so/Contract-Factory-include-multiple-HederaERC20-versions-14df1e8013034f99b1aba11860c57be1)
- When everything would have configured we should display a summary with the chosen configuration and a message: “Do you want to upgrade your token with this configuration? Yes - No”
- If so → Upgrade the token
- If no → Go to main menu
When the token will be successfully created we ask the user if it wants to operate with the newly created stable coin.