From db3a4ded449fb2cc100a2bbfa47542c418548873 Mon Sep 17 00:00:00 2001 From: alleycatdev Date: Sat, 6 Mar 2021 22:39:36 -0500 Subject: [PATCH] removes ecosystem from DAO exists and passes daoAddress instead of ecosystem in TOken --- src/core/ElasticDAO.sol | 17 ++++++----------- src/core/ElasticDAOFactory.sol | 4 ++-- src/libraries/SafeMath.sol | 5 +---- src/models/DAO.sol | 2 +- src/models/Token.sol | 8 ++------ 5 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/core/ElasticDAO.sol b/src/core/ElasticDAO.sol index 0b13285..a13548a 100644 --- a/src/core/ElasticDAO.sol +++ b/src/core/ElasticDAO.sol @@ -28,21 +28,13 @@ contract ElasticDAO is ReentryProtection { event ElasticGovernanceTokenDeployed(address indexed tokenAddress); event MaxVotingLambdaChanged(bytes32 settingName, uint256 value); event ControllerChanged(bytes32 settingName, address value); - event ExitDAO( - address indexed memberAddress, - uint256 shareAmount, - uint256 ethAmount - ); + event ExitDAO(address indexed memberAddress, uint256 shareAmount, uint256 ethAmount); event FailedToFullyPenalize( address indexed memberAddress, uint256 attemptedAmount, uint256 actualAmount ); - event JoinDAO( - address indexed memberAddress, - uint256 shareAmount, - uint256 ethAmount - ); + event JoinDAO(address indexed memberAddress, uint256 shareAmount, uint256 ethAmount); event SeedDAO(address indexed summonerAddress, uint256 amount); event SummonedDAO(address indexed summonedBy); @@ -54,7 +46,10 @@ contract ElasticDAO is ReentryProtection { modifier onlyAfterTokenInitialized() { Ecosystem.Instance memory ecosystem = _getEcosystem(); bool tokenInitialized = - Token(ecosystem.tokenModelAddress).exists(ecosystem.governanceTokenAddress, ecosystem); + Token(_getEcosystem().tokenModelAddress).exists( + ecosystem.governanceTokenAddress, + ecosystem.daoAddress + ); require(tokenInitialized, 'ElasticDAO: Please call initializeToken first'); _; } diff --git a/src/core/ElasticDAOFactory.sol b/src/core/ElasticDAOFactory.sol index d1074d3..1612ce8 100644 --- a/src/core/ElasticDAOFactory.sol +++ b/src/core/ElasticDAOFactory.sol @@ -142,8 +142,8 @@ contract ElasticDAOFactory is ReentryProtection { /** * @notice returns deployed DAO count */ - function deployedDAOCount() external view returns (uint) { - return deployedDAOAddresses.length; + function deployedDAOCount() external view returns (uint256) { + return deployedDAOAddresses.length; } /** diff --git a/src/libraries/SafeMath.sol b/src/libraries/SafeMath.sol index 092036d..da3c4bc 100644 --- a/src/libraries/SafeMath.sol +++ b/src/libraries/SafeMath.sol @@ -103,10 +103,7 @@ library SafeMath { * Requirements: * - The divisor cannot be zero. */ - function div( - uint256 a, - uint256 b - ) internal pure returns (uint256) { + function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 uint256 c = a / b; require(c > 0, 'SafeMath: division by zero'); diff --git a/src/models/DAO.sol b/src/models/DAO.sol index 02e67fb..17eb045 100644 --- a/src/models/DAO.sol +++ b/src/models/DAO.sol @@ -53,7 +53,7 @@ contract DAO is EternalModel, ReentryProtection { * @param _uuid - address of the unique user ID * @return recordExists bool */ - function exists(address _uuid, Ecosystem.Instance memory) external view returns (bool) { + function exists(address _uuid) external view returns (bool) { return _exists(_uuid); } diff --git a/src/models/Token.sol b/src/models/Token.sol index a63dc21..b5effdb 100644 --- a/src/models/Token.sol +++ b/src/models/Token.sol @@ -69,12 +69,8 @@ contract Token is EternalModel, ReentryProtection { return record; } - function exists(address _uuid, Ecosystem.Instance memory _ecosystem) - external - view - returns (bool) - { - return _exists(_uuid, _ecosystem.daoAddress); + function exists(address _uuid, address _daoAddress) external view returns (bool) { + return _exists(_uuid, _daoAddress); } /**