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

Ownableコンストラクタの初期化を追加 #458

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

nakmr
Copy link
Contributor

@nakmr nakmr commented Oct 7, 2023

変更内容

Shieldコントラクトが継承しているOwnableコントラクトの初期化処理が無いため追加した。

背景

Section 2 > Lesson 2 にて、OwnableのSolidityバージョンが^0.8.20であったため、コンパイラのバージョンを 19 → 20 にあげた。すると、Ownableコントラクトが初期化されていないためにコンパイルエラーが出た。下記の通り、Ownableコントラクトには初期化が必要なコンストラクタがあるため、初期化処理を追加した。

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

abstract contract Ownable is Context {

...

    /**
    * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
    */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

...

}

備考

@nakmr nakmr requested a review from a team October 7, 2023 09:52
@neila neila requested a review from yk-saito October 11, 2023 07:52
Copy link
Member

@neila neila left a comment

Choose a reason for hiding this comment

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

LGTM

@yk-saito yk-saito changed the base branch from main to feature/polygon-whitelist-nft/update-openzeppelin October 12, 2023 04:50
Copy link
Contributor

@yk-saito yk-saito left a comment

Choose a reason for hiding this comment

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

lgtm!

@yk-saito yk-saito merged commit 663dbbe into unchain-tech:feature/polygon-whitelist-nft/update-openzeppelin Oct 12, 2023
3 checks passed
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