From f38cb5aae96f0eaf2445bd93e7dbc104d0b64bcd Mon Sep 17 00:00:00 2001 From: auyua9-bot Date: Sun, 20 Sep 2026 13:48:18 +0800 Subject: [PATCH] fix(Languages): add missing Ownable(msg.sender) initializer to 5 localized 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. --- Languages/en/S03_Centralization_en/Centralization.sol | 2 +- .../en/S04_AccessControlExploit_en/AccessControlExploit.sol | 2 +- Languages/en/S10_Honeypot_en/Honeypot.sol | 2 +- Languages/pt-br/S03_Centralization/Centralization.sol | 2 +- .../pt-br/S04_AccessControlExploit/AccessControlExploit.sol | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Languages/en/S03_Centralization_en/Centralization.sol b/Languages/en/S03_Centralization_en/Centralization.sol index 4124ae936..5198f9b77 100644 --- a/Languages/en/S03_Centralization_en/Centralization.sol +++ b/Languages/en/S03_Centralization_en/Centralization.sol @@ -5,7 +5,7 @@ import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract Centralization is ERC20, Ownable { - constructor() ERC20("Centralization", "Cent") { + constructor() ERC20("Centralization", "Cent") Ownable(msg.sender) { address exposedAccount = 0xe16C1623c1AA7D919cd2241d8b36d9E79C1Be2A2; transferOwnership(exposedAccount); } diff --git a/Languages/en/S04_AccessControlExploit_en/AccessControlExploit.sol b/Languages/en/S04_AccessControlExploit_en/AccessControlExploit.sol index 48fc43a83..13a4cee02 100644 --- a/Languages/en/S04_AccessControlExploit_en/AccessControlExploit.sol +++ b/Languages/en/S04_AccessControlExploit_en/AccessControlExploit.sol @@ -8,7 +8,7 @@ import "@openzeppelin/contracts/access/Ownable.sol"; // Access Control Exploit Example contract AccessControlExploit is ERC20, Ownable { // Constructor: Initialize token name and symbol - constructor() ERC20("Wrong Access", "WA") {} + constructor() ERC20("Wrong Access", "WA") Ownable(msg.sender) {} // Bad mint function without access control function badMint(address to, uint amount) public { diff --git a/Languages/en/S10_Honeypot_en/Honeypot.sol b/Languages/en/S10_Honeypot_en/Honeypot.sol index af06cc6ad..36954fac6 100644 --- a/Languages/en/S10_Honeypot_en/Honeypot.sol +++ b/Languages/en/S10_Honeypot_en/Honeypot.sol @@ -9,7 +9,7 @@ import "@openzeppelin/contracts/access/Ownable.sol"; contract HoneyPot is ERC20, Ownable { address public pair; // Constructor: Initialize token name and symbol - constructor() ERC20("HoneyPot", "Pi Xiu") { + constructor() ERC20("HoneyPot", "Pi Xiu") Ownable(msg.sender) { address factory = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f; // goerli uniswap v2 factory address tokenA = address(this); // Honeypot token address address tokenB = 0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6; // goerli WETH diff --git a/Languages/pt-br/S03_Centralization/Centralization.sol b/Languages/pt-br/S03_Centralization/Centralization.sol index 4124ae936..5198f9b77 100644 --- a/Languages/pt-br/S03_Centralization/Centralization.sol +++ b/Languages/pt-br/S03_Centralization/Centralization.sol @@ -5,7 +5,7 @@ import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract Centralization is ERC20, Ownable { - constructor() ERC20("Centralization", "Cent") { + constructor() ERC20("Centralization", "Cent") Ownable(msg.sender) { address exposedAccount = 0xe16C1623c1AA7D919cd2241d8b36d9E79C1Be2A2; transferOwnership(exposedAccount); } diff --git a/Languages/pt-br/S04_AccessControlExploit/AccessControlExploit.sol b/Languages/pt-br/S04_AccessControlExploit/AccessControlExploit.sol index 3f5b7027a..c306dd551 100644 --- a/Languages/pt-br/S04_AccessControlExploit/AccessControlExploit.sol +++ b/Languages/pt-br/S04_AccessControlExploit/AccessControlExploit.sol @@ -7,7 +7,7 @@ import "@openzeppelin/contracts/access/Ownable.sol"; // Exemplo de erro de gerenciamento de permissões contract AccessControlExploit is ERC20, Ownable { // Construtor: inicializa o nome e o código do token - constructor() ERC20("Wrong Access", "WA") {} + constructor() ERC20("Wrong Access", "WA") Ownable(msg.sender) {} // Função mint incorreta, sem restrição de permissão function badMint(address to, uint amount) public {