diff --git a/.gitmodules b/.gitmodules index f093843..92b3b7a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,9 +4,6 @@ [submodule "lib/openzeppelin-contracts"] path = lib/openzeppelin-contracts url = https://github.com/OpenZeppelin/openzeppelin-contracts -[submodule "lib/openzeppelin-contracts-upgradeable"] - path = lib/openzeppelin-contracts-upgradeable - url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable [submodule "lib\\openzeppelin-foundry-upgrades"] path = lib\\openzeppelin-foundry-upgrades url = https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades diff --git a/script/RaidGeld.s.sol b/script/RaidGeld.s.sol index 526059d..e83ebcb 100644 --- a/script/RaidGeld.s.sol +++ b/script/RaidGeld.s.sol @@ -15,7 +15,7 @@ contract RaidGeldScript is Script { address _proxyAddress = Upgrades.deployTransparentProxy( "RaidGeld.sol", msg.sender, - abi.encodeCall(RaidGeld.initialize, (msg.sender)) + abi.encodeCall(RaidGeld.initialize, ()) ); // Get the implementation address @@ -24,7 +24,5 @@ contract RaidGeldScript is Script { ); vm.stopBroadcast(); - - return (implementationAddress, _proxyAddress); } } diff --git a/src/RaidGeld.sol b/src/RaidGeld.sol index 146b6b5..4201131 100644 --- a/src/RaidGeld.sol +++ b/src/RaidGeld.sol @@ -24,7 +24,7 @@ contract RaidGeld is Initializable, ERC20Upgradeable, OwnableUpgradeable { function initialize() public initializer { __ERC20_init("Raid Geld", "GELD"); - __Ownable_init(); + __Ownable_init(msg.sender); } // This effectively registers the user diff --git a/test/RaidGeld.t.sol b/test/RaidGeld.t.sol index 378e289..03a151d 100644 --- a/test/RaidGeld.t.sol +++ b/test/RaidGeld.t.sol @@ -2,11 +2,14 @@ pragma solidity ^0.8.13; import {Test, console} from "forge-std/Test.sol"; +import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; import {RaidGeld, Army, Player} from "../src/RaidGeld.sol"; import "../src/RaidGeldUtils.sol"; contract raid_geldTest is Test { RaidGeld public raid_geld; + address implementationAddress; + address payable proxyAddress; address public player1; address public player2; address public owner; @@ -17,7 +20,16 @@ contract raid_geldTest is Test { vm.deal(owner, 10 ether); vm.deal(player1, 10 ether); vm.prank(owner); - raid_geld = new RaidGeld(); + + // Deploy the upgradeable contract + address _proxyAddress = Upgrades.deployTransparentProxy( + "RaidGeld.sol", + msg.sender, + abi.encodeCall(RaidGeld.initialize, ()) + ); + + proxyAddress = payable(_proxyAddress); + raid_geld = RaidGeld(proxyAddress); } function registerPlayer() private {