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: modify OptimismMintableERC20Factory for convert #17

Merged
merged 8 commits into from
Aug 13, 2024

Conversation

agusduha
Copy link
Member

@agusduha agusduha commented Aug 8, 2024

Closes OPT-185
Closes OPT-186

@agusduha agusduha requested review from 0xng and 0xDiscotech August 8, 2024 14:33
@agusduha agusduha self-assigned this Aug 8, 2024
Copy link

linear bot commented Aug 8, 2024

/// @return _remoteToken The address of the remote token if it is deployed or `address(0)` if not.
function deployments(address _token) external view returns (address _remoteToken);
function deployments(address _localToken) external view returns (address _remoteToken);

Choose a reason for hiding this comment

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

Same question here with the returned arg

Suggested change
function deployments(address _localToken) external view returns (address _remoteToken);
function deployments(address _localToken) external view returns (address remoteToken_);

Copy link
Member Author

Choose a reason for hiding this comment

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

Newer contracts like L2ToL2CrossDomainMessenger have it like that, so not fixing for now unless it is asked for

}

function _createWithCreate3(

Choose a reason for hiding this comment

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

Missing NATSPEC here? Maybe a small one regarding the purpose of the virtual function

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, will add them

/// @custom:storage-location erc7201:optimismMintableERC20FactoryInterop.storage
struct OptimismMintableERC20FactoryInteropStorage {
/// @notice Mapping of local token address to remote token address.
mapping(address => address) deployments;

Choose a reason for hiding this comment

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

I've seen that you implemented it only here, but do we also need it on the OptimismMintableERC20Factory file?

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

The thing is that this OptimismMintableERC20FactoryInterop is the new implementation for the factory predeploy so it will have it anyway. The proxy will point to this new contract that inherits the old one.

Choose a reason for hiding this comment

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

ahh perfect then!

/// @param _symbol ERC20 symbol.
/// @param _decimals ERC20 decimals.
/// @return _localToken Address of the newly created token.
function _createWithCreate3(

Choose a reason for hiding this comment

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

Why do we need to create a public/internal set of function with the exact same NATSPEC? Can't we just leave the logic on the public one?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm let me think about it, maybe we can override a public one and will be enough

Choose a reason for hiding this comment

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

yeah I think so

Base automatically changed from fix/add-generic-factory-interface to sc/liquidity-migration August 9, 2024 17:04
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.

Looks good. We are still waiting for the feedback from their side, as they might prefer to only modify the content of the createOptimismMintableERC20WithDecimals function instead.

@@ -104,29 +109,29 @@ contract OptimismMintableERC20Factory is ISemver, Initializable {
/// @param _name ERC20 name.
/// @param _symbol ERC20 symbol.
/// @param _decimals ERC20 decimals
/// @return Address of the newly created token.
/// @return _localToken Address of the newly created token.

Choose a reason for hiding this comment

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

not sure if there is a convention, but they dont use underscore for localToken in their current version.

function createOptimismMintableERC20WithDecimals(
address _remoteToken,
string memory _name,
string memory _symbol,
uint8 _decimals
)
public
returns (address)
returns (address _localToken)

Choose a reason for hiding this comment

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

They use returns (address) instead of declaring the variable here

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok we can rollback it to make the less changes possible

@agusduha agusduha merged commit 014c25d into sc/liquidity-migration Aug 13, 2024
3 checks passed
@agusduha agusduha deleted the feat/modify-mintable-erc20-factory branch August 13, 2024 13:40
agusduha added a commit that referenced this pull request Aug 22, 2024
* feat: add L2 standrad bridge interop contract

* test: add L2 standard bridge interop unit tests (#13)

* 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

* fix: add generic factory interface (#14)

* test: add L2 standard bridge interop unit tests

* fix: add tests natspec

* fix: add generic factory interface

* feat: modify OptimismMintableERC20Factory for convert (#17)

* 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

* fix: PR fixes

* test: fix address assuming

* test: fix view warning

* fix: snapshots

* test: small fixes
0xng pushed a commit that referenced this pull request Sep 10, 2024
* 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
0xng pushed a commit that referenced this pull request Sep 11, 2024
* 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
0xng pushed a commit that referenced this pull request Sep 11, 2024
* 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
0xng pushed a commit that referenced this pull request Sep 12, 2024
* 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
0xng added a commit that referenced this pull request Sep 12, 2024
* test: add L2 standard bridge interop unit tests (#13)

* 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

* fix: add generic factory interface (#14)

* test: add L2 standard bridge interop unit tests

* fix: add tests natspec

* fix: add generic factory interface

* feat: modify OptimismMintableERC20Factory for convert (#17)

* 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

* fix: PR fixes

* feat: add superchain erc20 factory implementation (#23)

* feat: add superchain erc20 factory implementation

* fix: remove createX comments

* test: add superchain erc20 factory tests (#25)

* test: add superchain erc20 factory tests

* test: add erc20 asserts

* test: fix expect emit

* fix: remove comments

* feat: add constructor to superchain ERC20 beacon (#34)

* test: remove factory predeploy etch

----------

Co-authored-by: 0xng <ng@defi.sucks>
Co-authored-by: 0xParticle <particle@defi.sucks>
Co-authored-by: gotzenx <78360669+gotzenx@users.noreply.github.com>

* fix: set an arbitrary address for superchain erc20 impl

* fix: deploy a proxy for the beacon on genesis (#45)


---------

Co-authored-by: 0xng <ng@defi.sucks>

* fix: conflicts and imports

* fix: interfaces

* chore: add .testdata

* fix: adding back .testdata to gitignore

* fix: new conflicts from ci improvements

---------

Co-authored-by: 0xng <ng@defi.sucks>
Co-authored-by: 0xParticle <particle@defi.sucks>
Co-authored-by: gotzenx <78360669+gotzenx@users.noreply.github.com>
Co-authored-by: Disco <131301107+0xDiscotech@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants