Repository navigation
Conversation
…lized contracts The English and pt-br localized versions of S03_Centralization, S04_AccessControlExploit, and S10_Honeypot were missing the `Ownable(msg.sender)` initializer in their constructors, unlike the Chinese canonical versions which include it. Without the initializer, `owner()` would be `address(0)` after deployment, breaking any `onlyOwner` modifier usage and the deployer cannot manage the contract. Files aligned: - Languages/en/S03_Centralization_en/Centralization.sol - Languages/en/S04_AccessControlExploit_en/AccessControlExploit.sol - Languages/en/S10_Honeypot_en/Honeypot.sol - Languages/pt-br/S03_Centralization/Centralization.sol - Languages/pt-br/S04_AccessControlExploit/AccessControlExploit.sol Atomic; matches the canonical Chinese version pattern.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
{
"title": "fix(Languages): add missing Ownable(msg.sender) initializer to 5 localized contracts",
"body": "## What this PR does\n\nAdds the missing
Ownable(msg.sender)initializer to the constructors of the English and pt-br localized versions of the following tutorial contracts:\n\n-Languages/en/S03_Centralization_en/Centralization.sol\n-Languages/en/S04_AccessControlExploit_en/AccessControlExploit.sol\n-Languages/en/S10_Honeypot_en/Honeypot.sol\n-Languages/pt-br/S03_Centralization/Centralization.sol\n-Languages/pt-br/S04_AccessControlExploit/AccessControlExploit.sol\n\n## Why\n\nThe canonical Chinese versions (S03_Centralization/Centralization.sol,S04_AccessControlExploit/AccessControlExploit.sol,S10_Honeypot/Honeypot.sol) all declare:\n\nsolidity\nconstructor() ERC20(\"...\", \"...\") Ownable(msg.sender) { ... }\n\n\nThe English and pt-br localized versions, however, omit theOwnable(msg.sender)initializer, so they declare:\n\nsolidity\nconstructor() ERC20(\"...\", \"...\") { ... }\n\n\nThis is a divergence from the teaching material that creates a real bug: after deployment,owner()on these localized contracts isaddress(0), which means:\n\n- The deployer cannot callmint(...)(guarded byonlyOwner).\n- The deployer cannot calltransferOwnership(...)to recover ownership because that function itself requiresonlyOwnerin newer OpenZeppelin versions.\n- TheCentralizationexample explicitly demonstrates transferring ownership to a known address; withoutOwnable(msg.sender)in the constructor, that subsequenttransferOwnership(exposedAccount)call reverts.\n\n## What was changed\n\nMechanical, one-token addition per file, matching the canonical Chinese pattern exactly:\n\ndiff\n- constructor() ERC20(\"Centralization\", \"Cent\") {\n+ constructor() ERC20(\"Centralization\", \"Cent\") Ownable(msg.sender) {\n\n\nSame pattern applied to the other four files (empty-body versions use{}instead of{).\n\n## Scope\n\n- 5 files, 5 insertions, 5 deletions.\n- No imports added;Ownableis already imported in every file.\n- No change to contract storage, logic, or behavior beyond settingowner()to the deployer at construction.\n- Pure code change; no readme/docs/test changes.\n- Does not touch the Chinese canonical versions (already correct).\n- Does not touchlib/openzeppelin-contracts/(vendored library).\n\n## Verification\n\n-git diff --checkpasses (no whitespace errors).\n- All edits mirror the canonical Chinese pattern exactly.\n- OpenZeppelinOwnable(msg.sender)is the documented initializer in the version vendored atlib/openzeppelin-contracts.\n\n## Why this matters for the tutorial\n\nThe repo's mission is "works out of the box for beginners." Students running the English or pt-br Remix walkthrough will seeonlyOwnerguards silently fail (ortransferOwnershiprevert) on first deployment because of this divergence. Aligning the localized contracts with the canonical Chinese version removes that friction for non-Chinese readers.","base": "main",
"head": "auyua9:fix/loc-ownable-constructor-initializers",
"draft": false,
"maintainer_can_modify": true
}