Skip to content

Commit

Permalink
Synchronise the ISTR with STR (#682)
Browse files Browse the repository at this point in the history
* synchronise the ISTR with STR

* fix the interface problem

* minor fixes

* add some function in interface

* add comment in STR

* consistency in interfaces of contracts

* improve the st interface

* remove shadow declaration

* add #706 new function declartion in the ISTR

* add missing functions in interface
  • Loading branch information
satyamakgec authored and adamdossa committed Jun 13, 2019
1 parent 9fae133 commit 6d61c1c
Show file tree
Hide file tree
Showing 17 changed files with 607 additions and 119 deletions.
2 changes: 0 additions & 2 deletions contracts/FeatureRegistry.sol
Expand Up @@ -9,8 +9,6 @@ import "./interfaces/IFeatureRegistry.sol";
contract FeatureRegistry is IFeatureRegistry, ReclaimTokens {
mapping(bytes32 => bool) public featureStatus;

event ChangeFeatureStatus(string _nameKey, bool _newStatus);

/**
* @notice Get the status of a feature
* @param _nameKey is the key for the feature status mapping
Expand Down
23 changes: 1 addition & 22 deletions contracts/ModuleRegistry.sol
Expand Up @@ -43,28 +43,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage {
bytes32 constant POLYMATHREGISTRY = 0x90eeab7c36075577c7cc5ff366e389fefa8a18289b949bab3529ab4471139d4d; //keccak256("polymathRegistry")
bytes32 constant FEATURE_REGISTRY = 0xed9ca06607835ad25ecacbcb97f2bc414d4a51ecf391b5ae42f15991227ab146; //keccak256("featureRegistry")
bytes32 constant SECURITY_TOKEN_REGISTRY = 0x12ada4f7ee6c2b7b933330be61fefa007a1f497dc8df1b349b48071a958d7a81; //keccak256("securityTokenRegistry")

///////////
// Events
//////////

// Emit when network becomes paused
event Pause(address account);
// Emit when network becomes unpaused
event Unpause(address account);
// Emit when Module is used by the SecurityToken
event ModuleUsed(address indexed _moduleFactory, address indexed _securityToken);
// Emit when the Module Factory gets registered on the ModuleRegistry contract
event ModuleRegistered(address indexed _moduleFactory, address indexed _owner);
// Emit when the module gets verified by Polymath
event ModuleVerified(address indexed _moduleFactory);
// Emit when the module gets unverified by Polymath or the factory owner
event ModuleUnverified(address indexed _moduleFactory);
// Emit when a ModuleFactory is removed by Polymath
event ModuleRemoved(address indexed _moduleFactory, address indexed _decisionMaker);
// Emit when ownership gets transferred
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);


///////////////
//// Modifiers
///////////////
Expand Down
5 changes: 2 additions & 3 deletions contracts/PolymathRegistry.sol
@@ -1,15 +1,14 @@
pragma solidity 0.5.8;

import "./ReclaimTokens.sol";
import "./interfaces/IPolymathRegistry.sol";

/**
* @title Core functionality for registry upgradability
*/
contract PolymathRegistry is ReclaimTokens {
contract PolymathRegistry is ReclaimTokens, IPolymathRegistry {
mapping(bytes32 => address) public storedAddresses;

event ChangeAddress(string _nameKey, address indexed _oldAddress, address indexed _newAddress);

/**
* @notice Gets the contract address
* @param _nameKey is the key for the contract address mapping
Expand Down
11 changes: 9 additions & 2 deletions contracts/SecurityTokenRegistry.sol
@@ -1,10 +1,17 @@
pragma solidity 0.5.8;
/**
//
IMPORTANT: Developer should update the ISecurityTokenRegistry.sol (Interface) if there is any change in
function signature or addition/removal of the functions from SecurityTokenRegistry & STRGetter contract.
//
*/

pragma solidity ^0.5.0;

import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IOwnable.sol";
import "./interfaces/ISTFactory.sol";
import "./interfaces/ISecurityTokenRegistry.sol";
import "./interfaces/ISecurityToken.sol";
import "./interfaces/IPolymathRegistry.sol";
import "./interfaces/IOracle.sol";
Expand Down
11 changes: 11 additions & 0 deletions contracts/interfaces/IFeatureRegistry.sol
Expand Up @@ -4,6 +4,17 @@ pragma solidity 0.5.8;
* @title Interface for managing polymath feature switches
*/
interface IFeatureRegistry {

event ChangeFeatureStatus(string _nameKey, bool _newStatus);

/**
* @notice change a feature status
* @dev feature status is set to false by default
* @param _nameKey is the key for the feature status mapping
* @param _newStatus is the new feature status
*/
function setFeatureStatus(string calldata _nameKey, bool _newStatus) external;

/**
* @notice Get the status of a feature
* @param _nameKey is the key for the feature status mapping
Expand Down
24 changes: 24 additions & 0 deletions contracts/interfaces/IModuleFactory.sol
Expand Up @@ -91,4 +91,28 @@ interface IModuleFactory {
*/
function upperSTVersionBounds() external view returns(uint8[] memory upperBounds);

/**
* @notice Updates the tags of the ModuleFactory
* @param _tagsData New list of tags
*/
function changeTags(bytes32[] calldata _tagsData) external;

/**
* @notice Updates the name of the ModuleFactory
* @param _name New name that will replace the old one.
*/
function changeName(bytes32 _name) external;

/**
* @notice Updates the description of the ModuleFactory
* @param _description New description that will replace the old one.
*/
function changeDescription(string calldata _description) external;

/**
* @notice Updates the title of the ModuleFactory
* @param _title New Title that will replace the old one.
*/
function changeTitle(string calldata _title) external;

}
47 changes: 46 additions & 1 deletion contracts/interfaces/IModuleRegistry.sol
Expand Up @@ -4,6 +4,29 @@ pragma solidity 0.5.8;
* @title Interface for the Polymath Module Registry contract
*/
interface IModuleRegistry {

///////////
// Events
//////////

// Emit when network becomes paused
event Pause(address account);
// Emit when network becomes unpaused
event Unpause(address account);
// Emit when Module is used by the SecurityToken
event ModuleUsed(address indexed _moduleFactory, address indexed _securityToken);
// Emit when the Module Factory gets registered on the ModuleRegistry contract
event ModuleRegistered(address indexed _moduleFactory, address indexed _owner);
// Emit when the module gets verified by Polymath
event ModuleVerified(address indexed _moduleFactory);
// Emit when the module gets unverified by Polymath or the factory owner
event ModuleUnverified(address indexed _moduleFactory);
// Emit when a ModuleFactory is removed by Polymath
event ModuleRemoved(address indexed _moduleFactory, address indexed _decisionMaker);
// Emit when ownership gets transferred
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);


/**
* @notice Called by a security token to notify the registry it is using a module
* @param _moduleFactory is the address of the relevant module factory
Expand Down Expand Up @@ -78,7 +101,7 @@ interface IModuleRegistry {
* @param _moduleType Type of Module
* @return address array that contains the list of addresses of module factory contracts.
*/
function getAllModulesByType(uint8 _moduleType) external view returns(address[] memory);
function getAllModulesByType(uint8 _moduleType) external view returns(address[] memory factories);
/**
* @notice Returns the list of addresses of Module Factory of a particular type
* @param _moduleType Type of Module
Expand Down Expand Up @@ -111,4 +134,26 @@ interface IModuleRegistry {
*/
function isPaused() external view returns(bool paused);

/**
* @notice Reclaims all ERC20Basic compatible tokens
* @param _tokenContract The address of the token contract
*/
function reclaimERC20(address _tokenContract) external;

/**
* @notice Called by the owner to pause, triggers stopped state
*/
function pause() external;

/**
* @notice Called by the owner to unpause, returns to normal state
*/
function unpause() external;

/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) external;

}
10 changes: 10 additions & 0 deletions contracts/interfaces/IPolymathRegistry.sol
@@ -1,11 +1,21 @@
pragma solidity 0.5.8;

interface IPolymathRegistry {

event ChangeAddress(string _nameKey, address indexed _oldAddress, address indexed _newAddress);

/**
* @notice Returns the contract address
* @param _nameKey is the key for the contract address mapping
* @return address
*/
function getAddress(string calldata _nameKey) external view returns(address registryAddress);

/**
* @notice Changes the contract address
* @param _nameKey is the key for the contract address mapping
* @param _newAddress is the new contract address
*/
function changeAddress(string calldata _nameKey, address _newAddress) external;

}
42 changes: 40 additions & 2 deletions contracts/interfaces/ISTFactory.sol
Expand Up @@ -4,6 +4,15 @@ pragma solidity 0.5.8;
* @title Interface for security token proxy deployment
*/
interface ISTFactory {

event LogicContractSet(string _version, address _logicContract, bytes _upgradeData);
event TokenUpgraded(
address indexed _securityToken,
uint256 indexed _version
);
event DefaultTransferManagerUpdated(address indexed _oldTransferManagerFactory, address indexed _newTransferManagerFactory);
event DefaultDataStoreUpdated(address indexed _oldDataStoreFactory, address indexed _newDataStoreFactory);

/**
* @notice Deploys the token and adds default modules like permission manager and transfer manager.
* Future versions of the proxy can attach different modules or pass some other paramters.
Expand All @@ -25,7 +34,36 @@ interface ISTFactory {
bool _divisible,
address _treasuryWallet,
address _polymathRegistry
)
external
)
external
returns(address tokenAddress);

/**
* @notice Used to set a new token logic contract
* @param _version Version of upgraded module
* @param _logicContract Address of deployed module logic contract referenced from proxy
* @param _initializationData Initialization data that used to intialize value in the securityToken
* @param _upgradeData Data to be passed in call to upgradeToAndCall when a token upgrades its module
*/
function setLogicContract(string calldata _version, address _logicContract, bytes calldata _initializationData, bytes calldata _upgradeData) external;

/**
* @notice Used to upgrade a token
* @param _maxModuleType maximum module type enumeration
*/
function upgradeToken(uint8 _maxModuleType) external;

/**
* @notice Used to set a new default transfer manager
* @dev Setting this to address(0) means don't deploy a default TM
* @param _transferManagerFactory Address of new default transfer manager factory
*/
function updateDefaultTransferManager(address _transferManagerFactory) external;

/**
* @notice Used to set a new default data store
* @dev Setting this to address(0) means don't deploy a default data store
* @param _dataStoreFactory Address of new default data store factory
*/
function updateDefaultDataStore(address _dataStoreFactory) external;
}
17 changes: 17 additions & 0 deletions contracts/interfaces/ISTO.sol
Expand Up @@ -4,9 +4,26 @@ pragma solidity 0.5.8;
* @title Interface to be implemented by all STO modules
*/
interface ISTO {

enum FundRaiseType {ETH, POLY, SC}

// Event
event SetFundRaiseTypes(FundRaiseType[] _fundRaiseTypes);

/**
* @notice Returns the total no. of tokens sold
*/
function getTokensSold() external view returns(uint256 soldTokens);

/**
* @notice Returns funds raised by the STO
*/
function getRaised(FundRaiseType _fundRaiseType) external view returns(uint256 raisedAmount);

/**
* @notice Pause (overridden function)
* @dev Only securityToken owner restriction applied on the super function
*/
function pause() external;

}

0 comments on commit 6d61c1c

Please sign in to comment.