// SPDX-License-Identifier: MIT import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; pragma solidity ^0.8.5; /************************************** INTERFACES **************************************/ interface IRoles { function isAddressManager(address account) external view returns(bool); function isPauser(address account) external view returns(bool); } /************************************** CONTRACT **************************************/ contract AddressSmartContract is Initializable, UUPSUpgradeable, PausableUpgradeable, AccessControlUpgradeable, OwnableUpgradeable { address private rolesSC; address private registryPart1; address private registryPart2; address private atlasSC; address private walletAddress; function initialize( address RolesContractAddress, address RegistryPart1Address, address RegistryPart2Address, address AtlasContractAddress) public initializer { rolesSC = RolesContractAddress; registryPart1 = RegistryPart1Address; registryPart2 = RegistryPart2Address; atlasSC = AtlasContractAddress; walletAddress = msg.sender; __Pausable_init(); __AccessControl_init(); __Ownable_init(); } function _authorizeUpgrade(address) internal virtual override onlyOwner {} //----------------------- SET ADDRESS FUNCTIONS -----------------------// function setRolesContractAddress(address RolesContractAddress) public whenNotPaused { require(IRoles(rolesSC).isAddressManager(msg.sender), "Access Denied: Caller is NOT Address Manager!"); require(RolesContractAddress != address(0), "Account: Zero or Invalid address!"); rolesSC = RolesContractAddress; } function setRegistryPart1Address(address RegistryPart1Address) public whenNotPaused { require(IRoles(rolesSC).isAddressManager(msg.sender), "Access Denied: Caller is NOT Address Manager!"); require(RegistryPart1Address != address(0), "Account: Zero or Invalid address!"); registryPart1 = RegistryPart1Address; } function setRegistryPart2Address(address RegistryPart2Address) public whenNotPaused { require(IRoles(rolesSC).isAddressManager(msg.sender), "Access Denied: Caller is NOT Address Manager!"); require(RegistryPart2Address != address(0), "Account: Zero or Invalid address!"); registryPart2 = RegistryPart2Address; } function setAtlasAddress(address AtlasContractAddress) public whenNotPaused { require(IRoles(rolesSC).isAddressManager(msg.sender), "Access Denied: Caller is NOT Address Manager!"); require(AtlasContractAddress != address(0), "Account: Zero or Invalid address!"); atlasSC = AtlasContractAddress; } function setWalletAddress(address WalletAddress) public whenNotPaused { require(IRoles(rolesSC).isAddressManager(msg.sender), "Access Denied: Caller is NOT Address Manager!"); require(WalletAddress != address(0), "Wallet Address: Zero or Invalid address!"); walletAddress = WalletAddress; } function getRolesContractAddress() public view returns (address) { return rolesSC; } function getRegistryPart1Address() public view returns (address) { return registryPart1; } function getRegistryPart2Address() public view returns (address) { return registryPart2; } function getAtlasAddress() public view returns (address) { return atlasSC; } function getWalletAddress() public view returns (address) { return walletAddress; } //----------------- PAUSER FUNCTION ----------------// function pauseContract() public whenNotPaused { require(IRoles(rolesSC).isPauser(msg.sender), "Access Denied: Caller is NOT Pauser!"); _pause(); } function unpauseContract() public whenPaused { require(IRoles(rolesSC).isPauser(msg.sender), "Access Denied: Caller is NOT Pauser!"); _unpause(); } }