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: upgradeable beacon proxy #11

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

thaixuandang
Copy link
Collaborator

Description

Checklist

  • I have clearly commented on all the main functions following the NatSpec Format
  • The box that allows repo maintainers to update this PR is checked
  • I tested locally to make sure this feature/fix works

@thaixuandang thaixuandang mentioned this pull request Aug 7, 2024
Comment on lines +27 to +28
address poolImplementation = address(new KatanaV3Pool());
beacon = address(new UpgradeableBeacon(poolImplementation));
Copy link

@huyhuynh3103 huyhuynh3103 Aug 16, 2024

Choose a reason for hiding this comment

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

Any reason to deploy UpgradeableBeacon and pool implementation within factory constructor?

function initializeImmutables(address factory_, address token0_, address token1_, uint24 fee_, int24 tickSpacing_)
public
{
require(!_immutablesInitialized);

Choose a reason for hiding this comment

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

add revert message

Copy link

@huyhuynh3103 huyhuynh3103 left a comment

Choose a reason for hiding this comment

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

Please provide some explanations for choosing this approach/design

constructor() BeaconProxy(address(0), "") { }

/// @dev This function will be called with zero arguments but modified to include the pool's immutable parameters.
function _setBeacon(address beacon, bytes memory data) internal virtual override {

Choose a reason for hiding this comment

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

This param should be ignored since we always set the beacon using the address stored in factory.

Suggested change
function _setBeacon(address beacon, bytes memory data) internal virtual override {
function _setBeacon(address, bytes memory data) internal virtual override {

/// @dev This function will be called with zero arguments but modified to include the pool's immutable parameters.
function _setBeacon(address beacon, bytes memory data) internal virtual override {
(address factory, address token0, address token1, uint24 fee, int24 tickSpacing) =
IKatanaV3PoolDeployer(msg.sender).parameters();

Choose a reason for hiding this comment

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

This method is called whenever the UpgradeableBeacon is updated. However by this time, the parameters stored in PoolDeployer has already been deleted and always return 0 for all.

Copy link
Collaborator

@TuDo1403 TuDo1403 left a comment

Choose a reason for hiding this comment

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

provide some comment in the PR description.

@thaixuandang thaixuandang changed the base branch from feature/rename-and-format to release/v1.0.0 August 19, 2024 03:58
…upgradeable-beacon-proxy

chore(`upgradeable-beacon-proxy`): merge from `release/v1.0.0`
@thaixuandang
Copy link
Collaborator Author

Already refactored in PR#13

@thaixuandang thaixuandang merged commit ff771e7 into release/v1.0.0 Aug 26, 2024
1 check passed
@thaixuandang thaixuandang deleted the feature/upgradeable-beacon-proxy branch August 26, 2024 07:45
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