Skip to content

Commit f79da51

Browse files
authored
Update migrating_V1_to_V2.md
1 parent 2d8e919 commit f79da51

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

docs/migrating_V1_to_V2.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
v1) to the new version presents complexities.
1+
# Migrating from Contract v1 to v2
2+
3+
In the evolution of our smart contract environment, we embark on deploying a more stable and robust version 2 (v2). However, the path to directly transfer user balances from the original contract (v1) to the new version presents complexities.
24

35
This document outlines a plan to migrate funds safely from v1 to v2, ensuring the v1 token frontend's address remains operational as a legacy interface.
46

@@ -8,7 +10,7 @@ Our aim is to facilitate a seamless transition, maintaining continuity for our u
810
To proceed with the migration process, ensure the following prerequisites are met:
911

1012
- [ ] The SmartController is upgraded to version **1.2.2**, incorporating the `pausable` feature.
11-
- [ ] Possession of the `TokenFrontend `address.
13+
- [ ] Possession of the `TokenFrontend` address.
1214
- [ ] Access to the **version 2 (v2) foundry repository**, including all dependencies.
1315

1416
## Versions
@@ -23,10 +25,12 @@ To proceed with the migration process, ensure the following prerequisites are me
2325

2426
## Architectural Overview
2527
*Legacy V1 architecture VS the new V2 architecture*
26-
![[Pasted image 20240329134835.png]]
28+
29+
![Pasted image 20240329134835](https://github.com/monerium/smart-contracts/assets/17710875/42f6b845-28c0-44aa-8be0-cd9b63a8535f)
2730

2831
*V2 architecture with retro compatibility with the legacy V1 frontend*
29-
![[Screenshot 2024-03-29 at 13.49.49.png]]
32+
![Screenshot 2024-03-29 at 13 49 49](https://github.com/monerium/smart-contracts/assets/17710875/51e96b4d-014d-4f11-9a2e-262f85fcbd3b)
33+
3034

3135
The objective is to migrate the assets currently held within `TokenStorage` to the storage system of the `Proxy`
3236

@@ -49,7 +53,7 @@ To initiate the deployment of the V2 contract, follow these steps within the V2
4953

5054
1. Set the following environment variables in your terminal:
5155

52-
```
56+
```sh
5357
export PRIVATE_KEY=<your_key>
5458
export RPC_URL=<your_provider>
5559
export ETHERSCAN_API_KEY=<your_api_key>
@@ -60,11 +64,12 @@ export ETHERSCAN_API_KEY=<your_api_key>
6064
```sh
6165
forge script script/deploy.s.sol:ControllerEUR --rpc-url $RPC_URL --broadcast --etherscan-api-key $ETHERSCAN_API_KEY --verify $VERIFIER_URL
6266
```
63-
3. Your V2 `Proxy` and `Implementation` contracts are now deployed and verified on the blockchain explorer.
67+
68+
Your V2 `Proxy` and `Implementation` contracts are now deployed and verified on the blockchain explorer.
6469

6570
### 2. Configuring the `V2` contract.
6671

67-
Provide `admin` and `system` roles to the `wallet` used for the migration (the same one used for deployment). These roles are crucial early in the fund migration process for adding `MintAllowance`.
72+
Provide `admin` and `system` roles to the `wallet` used for the migration (the same one used for deployment). These roles are crucial early in the fund migration process to set `MintAllowance`.
6873

6974
1. Set the following environment variables in your terminal:
7075
```sh
@@ -77,7 +82,8 @@ Provide `admin` and `system` roles to the `wallet` used for the migration (the s
7782
```sh
7883
forge script script/setAdminAndSystem.s.sol --rpc-url $RPC_URL --broadcast
7984
```
80-
3. Your `V2` contract is now ready to launch the Migration script.
85+
86+
Your `V2` contract is now ready to launch the Migration script.
8187

8288
### 3. Pause the `V1` token
8389

@@ -102,7 +108,7 @@ A JavaScript script crafts a Solidity script by using `V1` and `V2` token addres
102108
The generated Solidity script then sets `V2`'s mint allowance to equal `V1`'s `totalSupply`.
103109
For each holder, the script uses `V1`'s `balanceOf` function to determine the amount to mint in `V2`.
104110

105-
The process concludes with `toalSupply` check between `V2` and `V1`.
111+
The process concludes with `totalSupply` check between `V2` and `V1`.
106112

107113
1. To create the migration script, execute the following command:
108114
```sh
@@ -131,7 +137,6 @@ With the funds successfully migrated to the `V2` contract, the next step involve
131137
```
132138
2. Configure the `V2` token with `admins`, `system` and `maxMintAllowance`
133139
```sh
134-
export PRIVATE_KEY=<owner_key>
135140
export TOKEN_ADDRESS=<proxy_address>
136141
export SYSTEM_ADDRESS=<system_address>
137142
export ADMIN_ADDRESS=<admin_address>
@@ -140,11 +145,10 @@ forge script script/configureToken.s.sol --rpc-url $RPC_URL --broadcast
140145
```
141146
4. Configure the `V2` token with minting allowance
142147

143-
Refer to this page.
148+
Use the `admin safe` to set mint allowance.
144149

145150
5. Connect the `V2` proxy as `controller` for the `V1` `TokenFrontend`
146151
```sh
147-
export PRIVATE_KEY=<owner_key>
148152
export TOKEN_ADDRESS=<v2_proxy_address>
149153
export FRONTEND_ADDRESS=<v1_frontend_address>
150154
export OWNER_ADDRESS=<final_owner_address>

0 commit comments

Comments
 (0)