Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: liquidity migration #10

Closed
wants to merge 14 commits into from
Closed

feat: liquidity migration #10

wants to merge 14 commits into from

Conversation

agusduha
Copy link
Member

@agusduha agusduha commented Aug 5, 2024

Closes OPT-175
Closes OPT-174
Closes OPT-177

interface IOptimismMintableERC20Factory {
function deployments(address) external view returns (address);
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use an interface that is generic with just the deployments function. We currently do this sometimes, it reduces the number of files when verifying a contract and i think it will reduce compile time if we use interfaces everywhere rather than importing full implementations

@tynes
Copy link

tynes commented Aug 6, 2024

This is looking great so far!

Copy link

linear bot commented Aug 6, 2024

@0xDiscotech
Copy link

The contract implementation looks good to me as well!

@agusduha agusduha self-assigned this Aug 6, 2024
* test: add L2 standard bridge interop unit tests

* fix: add tests natspec

* fix: unit tests fixes

* fix: super to legacy tests failing

* fix: mock and expect mint and burn
* test: add L2 standard bridge interop unit tests

* fix: add tests natspec

* fix: add generic factory interface
* test: add L2 standard bridge interop unit tests

* fix: add tests natspec

* fix: add generic factory interface

* feat: modify OptimismMintableERC20Factory for convert

* fix: use only a public function for create3

* feat: rollback interop factory, modify legacy one

* fix: delete local token return variable
Copy link

linear bot commented Aug 13, 2024

Copy link

@0xDiscotech 0xDiscotech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way of handling the new semver is missing: https://github.com/ethereum-optimism/design-docs/blob/main/smart-contract-feature-development.md#handling-semver on L2StandardBridgeInterop.
Also, I think you need to sum a minor patch on the L2StandardBridge contract since you are adding functions and logic to it with the interop extension.

error InvalidTokenPair();

// TODO: Use an existing interface with `mint` and `burn`?
interface MintableAndBurnable is IERC20 {
Copy link

@0xDiscotech 0xDiscotech Aug 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about this?

Suggested change
interface MintableAndBurnable is IERC20 {
interface Mintable {

// 3. Valid SuperchainERC20 check
address _superRemoteToken =
IOptimismERC20Factory(Predeploys.OPTIMISM_SUPERCHAIN_ERC20_FACTORY).deployments(_superAddr);
if (_superRemoteToken == address(0)) revert InvalidSuperchainAddress();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not convinced by the error name. It's understandable in context, but for a first time reader it might be confusing. Maybe InvalidSuperchainERC20Address, even if it sounds ugly. Wdty? I know it also affects the Legacy error, so maybe nay

/// @notice The L2StandardBridgeInterop is an extension of the L2StandardBridge that allows for
/// the conversion of tokens between legacy tokens (OptimismMintableERC20 or StandardL2ERC20)
/// and SuperchainERC20 tokens.
contract L2StandardBridgeInterop is L2StandardBridge {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are extending the standard bridge instead of updating it? did you have this conversation with mark?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// 3. Valid SuperchainERC20 check
address _superRemoteToken =
IOptimismERC20Factory(Predeploys.OPTIMISM_SUPERCHAIN_ERC20_FACTORY).deployments(_superAddr);
if (_superRemoteToken == address(0)) revert InvalidSuperchainAddress();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this check necessary? you are already checking that _legacy !=0 and that _legacy == _super

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is just for the revert error. I'd leave it, doesn't harm since we'll be using an OP chain so gas is not an issue

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, its also a very cheap check. Let's leave it for clarity :)

Copy link

@0xParticle 0xParticle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lesgooo

@0xDiscotech
Copy link

Amazing job sir!

@agusduha agusduha added the hold Do not merge for now label Aug 14, 2024
@agusduha
Copy link
Member Author

External review at ethereum-optimism#11479

@agusduha
Copy link
Member Author

Merged at ethereum-optimism#11479

@agusduha agusduha closed this Aug 22, 2024
@agusduha agusduha deleted the sc/liquidity-migration branch August 22, 2024 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hold Do not merge for now
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants