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
Get the majority of the configuration from the environment.
183
-
Mostly of it is derived from the configuration of the original ERC-20 token.
182
+
Get the majority of the configuration from the environment.
183
+
Mostly of it is derived from the configuration of the original ERC-20 token.
184
184
185
-
Note that there is no `owner` here.
186
-
This `SuperchainERC20` contract does not need an owner, because minting and burning are handled by the users themselves (by locking and unlocking the original tokens).
185
+
Note that there is no `owner` here.
186
+
This `SuperchainERC20` contract does not need an owner, because minting and burning are handled by the users themselves (by locking and unlocking the original tokens).
Users call this function to transfer original tokens to the contract and mint themselves an equivalent number of lockbox tokens.
229
-
This function has several tests to make sure it can be called.
228
+
Users call this function to transfer original tokens to the contract and mint themselves an equivalent number of lockbox tokens.
229
+
This function has several tests to make sure it can be called.
230
230
231
-
* Check the chain ID.
232
-
Locking and redeeming tokens can only be done on the original token's chain.
233
-
* Use [`transferFrom`](https://ethereum.org/en/developers/tutorials/erc20-annotated-code/#transferFrom) to transfer the tokens to ourselves.
234
-
This call typically reverts when it fails, but it can also return `false`.
235
-
In that case, we revert.
236
-
There are two reasons it may fail.
237
-
* The user (in this case, the `LockboxSuperchainERC20` contract) does not have [the allowance](https://ethereum.org/en/developers/tutorials/erc20-annotated-code/#_approve) to spend that amount of tokens from the original owner (`msg.sender`).
238
-
* The original owner (`msg.sender`) does not have enough tokens to transfer.
231
+
* Check the chain ID.
232
+
Locking and redeeming tokens can only be done on the original token's chain.
233
+
* Use [`transferFrom`](https://ethereum.org/en/developers/tutorials/erc20-annotated-code/#transferFrom) to transfer the tokens to ourselves.
234
+
This call typically reverts when it fails, but it can also return `false`.
235
+
In that case, we revert.
236
+
There are two reasons it may fail.
237
+
* The user (in this case, the `LockboxSuperchainERC20` contract) does not have [the allowance](https://ethereum.org/en/developers/tutorials/erc20-annotated-code/#_approve) to spend that amount of tokens from the original owner (`msg.sender`).
238
+
* The original owner (`msg.sender`) does not have enough tokens to transfer.
239
239
240
-
If the tests are successful, mint the requested amount for `msg.sender`.
240
+
If the tests are successful, mint the requested amount for `msg.sender`.
Users call this function to redeem their existing lockbox tokens and replace them with the original tokens.
246
-
It also has multiple tests.
245
+
Users call this function to redeem their existing lockbox tokens and replace them with the original tokens.
246
+
It also has multiple tests.
247
247
248
-
* Again, check chain ID.
249
-
* Try to `_burn` the amount of lockbox tokens.
250
-
[The solady `_burn` function](https://github.com/Vectorized/solady/blob/main/src/tokens/ERC20.sol#L539-L542), the one we inherit from `SuperchainERC20`, reverts if the user does not have enough tokens to burn.
251
-
* Transfer the amount of the original ERC-20 redeemed to
252
-
the caller.
253
-
This should never fail, because lockbox ERC-20 tokens are supposed to always be backed by an equal number of the original tokens.
254
-
However, if it does fail for some reason, revert.
255
-
</details>
248
+
* Again, check chain ID.
249
+
* Try to `_burn` the amount of lockbox tokens.
250
+
[The solady `_burn` function](https://github.com/Vectorized/solady/blob/main/src/tokens/ERC20.sol#L539-L542), the one we inherit from `SuperchainERC20`, reverts if the user does not have enough tokens to burn.
251
+
* Transfer the amount of the original ERC-20 redeemed to
252
+
the caller.
253
+
This should never fail, because lockbox ERC-20 tokens are supposed to always be backed by an equal number of the original tokens.
254
+
However, if it does fail for some reason, revert.
255
+
</details>
256
256
257
257
2. Actually deploy the contract.
258
258
259
-
<Tabsitems={['Supersim', 'Devnets']}>
260
-
<Tabs.Tab>
261
-
```sh
262
-
pnpm contracts:deploy:token
263
-
```
264
-
</Tabs.Tab>
259
+
<Tabsitems={['Supersim', 'Devnets']}>
260
+
<Tabs.Tab>
261
+
```sh
262
+
pnpm contracts:deploy:token
263
+
```
264
+
</Tabs.Tab>
265
265
266
-
<Tabs.Tab>
267
-
To deploy to the [development networks](/stack/interop/tools/devnet), follow the steps [in the tutorial](/stack/interop/tutorials/deploy-superchain-erc20#prepare-for-deployment) before you deploy the contract.
266
+
<Tabs.Tab>
267
+
To deploy to the [development networks](/stack/interop/tools/devnet), follow the steps [in the tutorial](/stack/interop/tutorials/deploy-superchain-erc20#prepare-for-deployment) before you deploy the contract.
268
268
269
-
Then, update `packages/contracts/.env` and deploy the token.
269
+
Then, update `packages/contracts/.env` and deploy the token.
0 commit comments