Skip to content

Commit

Permalink
use InitilzieAdminUpgradabilityProxy (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
orenyodfat authored Apr 21, 2020
1 parent 72478fd commit 012d1bc
Show file tree
Hide file tree
Showing 4 changed files with 401 additions and 356 deletions.
13 changes: 7 additions & 6 deletions contracts/utils/DAOFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "@openzeppelin/upgrades/contracts/application/App.sol";
import "@openzeppelin/upgrades/contracts/application/ImplementationDirectory.sol";
import "@openzeppelin/upgrades/contracts/upgradeability/ProxyAdmin.sol";
import "@openzeppelin/upgrades/contracts/upgradeability/AdminUpgradeabilityProxy.sol";
import "@openzeppelin/upgrades/contracts/upgradeability/InitializableAdminUpgradeabilityProxy.sol";
import "solidity-bytes-utils/contracts/BytesLib.sol";
import "../controller/Controller.sol";
import "../libs/Bytes32ToStr.sol";
Expand Down Expand Up @@ -157,10 +157,11 @@ contract DAOFactory is Initializable {
bytes memory _data)
public
payable
returns (AdminUpgradeabilityProxy) {
returns (InitializableAdminUpgradeabilityProxy) {
uint64[3] memory version = getPackageVersion(_packageVersion);
address implementation = getImplementation(version, _contractName);
AdminUpgradeabilityProxy proxy = (new AdminUpgradeabilityProxy).value(msg.value)(implementation, _admin, _data);
InitializableAdminUpgradeabilityProxy proxy = new InitializableAdminUpgradeabilityProxy();
proxy.initialize(implementation, _admin, _data);
emit ProxyCreated(address(proxy), implementation, _contractName, version);
return proxy;
}
Expand Down Expand Up @@ -257,13 +258,13 @@ contract DAOFactory is Initializable {
"_founderlength != _foundersTokenAmount.length");
require(_founders.length == _foundersReputationAmount.length,
"_founderlength != _foundersReputationAmount.length");
AdminUpgradeabilityProxy nativeToken =
InitializableAdminUpgradeabilityProxy nativeToken =
createInstance(packageVersion, "DAOToken", address(this), _tokenInitData);
AdminUpgradeabilityProxy nativeReputation =
InitializableAdminUpgradeabilityProxy nativeReputation =
createInstance(packageVersion, "Reputation", address(this),
abi.encodeWithSignature("initialize(address)", address(this)));

AdminUpgradeabilityProxy avatar = createInstance(packageVersion, "Avatar", address(this),
InitializableAdminUpgradeabilityProxy avatar = createInstance(packageVersion, "Avatar", address(this),
abi.encodeWithSignature(
"initialize(string,address,address,address)",
_orgName,
Expand Down
Loading

0 comments on commit 012d1bc

Please sign in to comment.