You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/stack/interop/tutorials/upgrade-to-superchain-erc20/lockbox.mdx
+1-1
Original file line number
Diff line number
Diff line change
@@ -49,7 +49,7 @@ show what is possible, it does the exact job needed.
49
49
50
50
Create a lockbox `SuperchainERC20` contract to permissionlessly enable interop.
51
51
52
-
## Step by step
52
+
## Instructions
53
53
54
54
Some steps depend on whether you want to deploy on [supersim](/stack/interop/tools/supersim) or on the [development network](/stack/interop/tools/devnet).
This guide explains how to upgrade an ERC20 to a [`SuperchainERC20`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/SuperchainERC20.sol) that can teleport across the [Superchain interop cluster](/stack/interop/explainer#superchain-interop-cluster)using the [`SuperchainTokenBridge`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/SuperchainTokenBridge.sol)contract. For more information on how it works, [see the explainer](/stack/interop/superchain-erc20).
18
+
This guide explains how to upgrade an ERC20 to a [`SuperchainERC20`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/SuperchainERC20.sol) that can teleport across the [Superchain interop cluster](/stack/interop/explainer#superchain-interop-cluster)when the original ERC20 contract was placed behind a proxy to enable future upgrades.
19
19
20
20
<details>
21
21
<summary>About this tutorial</summary>
@@ -48,7 +48,40 @@ show what is possible, it does the exact job needed.
48
48
49
49
* Upgrade an existing ERC-20 that uses [the proxy pattern](https://docs.openzeppelin.com/upgrades-plugins/proxies) to comply with interop requirements (with the proper authority).
50
50
51
-
## Step by step
51
+
52
+
## How beacon proxies work
53
+
54
+
```mermaid
55
+
sequenceDiagram
56
+
Actor User
57
+
User->>BeaconProxy: transfer(<address>, <amount>)
58
+
BeaconProxy->>UpgradeableBeacon: What is the implementation address?
59
+
UpgradeableBeacon->>BeaconProxy: It is 0xBAD0...60A7
A [beacon proxy](https://docs.openzeppelin.com/contracts/3.x/api/proxy#BeaconProxy) uses two contracts.
64
+
The [`UpgradeableBeacon`](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/beacon/UpgradeableBeacon.sol) contract holds the address of the implementation contract.
65
+
The [`BeaconProxy`](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/beacon/BeaconProxy.sol) contract is the one called for the functionality, the one that holds the storage.
66
+
When a user (or another contract) calls `BeaconProxy`, it asks `UpgradeableBeacon` for the implementation address and then uses [`delegatecall`](https://www.evm.codes/?fork=cancun#f4) to call that contract.
67
+
68
+
```mermaid
69
+
sequenceDiagram
70
+
Actor User
71
+
Actor Owner
72
+
Participant BeaconProxy
73
+
Participant 0x600D...60A7
74
+
Owner->>UpgradeableBeacon: Your new implementation address is 0x600D...60A7
75
+
User->>BeaconProxy: transfer(<address>, <amount>)
76
+
BeaconProxy->>UpgradeableBeacon: What is the implementation address?
77
+
UpgradeableBeacon->>BeaconProxy: It is 0x600D...60A7
To upgrade the contract, an authorized address (typically the `Owner`) calls `UpgradeableBeacon` directly to specify the new implementation contract address.
82
+
After that happens, all new calls are sent to the new implementation.
83
+
84
+
## Instructions
52
85
53
86
Some steps depend on whether you want to deploy on [supersim](/stack/interop/tools/supersim) or on the [development network](/stack/interop/tools/devnet).
54
87
@@ -274,7 +307,7 @@ Some steps depend on whether you want to deploy on [supersim](/stack/interop/too
0 commit comments