From cb8071ad331afc132efbc5a523111c29f1532c5c Mon Sep 17 00:00:00 2001 From: satyam Date: Mon, 27 May 2019 04:28:54 +0530 Subject: [PATCH 01/10] synchronise the ISTR with STR --- contracts/SecurityTokenRegistry.sol | 3 +- .../interfaces/ISecurityTokenRegistry.sol | 78 ++++++++++++++++++- 2 files changed, 78 insertions(+), 3 deletions(-) diff --git a/contracts/SecurityTokenRegistry.sol b/contracts/SecurityTokenRegistry.sol index f16baab30..8d752da65 100644 --- a/contracts/SecurityTokenRegistry.sol +++ b/contracts/SecurityTokenRegistry.sol @@ -2,6 +2,7 @@ pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; +import "./interfaces/ISecurityTokenRegistry.sol"; import "./interfaces/IOwnable.sol"; import "./interfaces/ISTFactory.sol"; import "./interfaces/ISecurityTokenRegistry.sol"; @@ -18,7 +19,7 @@ import "./proxy/Proxy.sol"; /** * @title Registry contract for issuers to register their tickers and security tokens */ -contract SecurityTokenRegistry is EternalStorage, Proxy { +contract SecurityTokenRegistry is ISecurityTokenRegistry, EternalStorage, Proxy { /** * @notice state variables diff --git a/contracts/interfaces/ISecurityTokenRegistry.sol b/contracts/interfaces/ISecurityTokenRegistry.sol index 3f8acf8ed..216091333 100644 --- a/contracts/interfaces/ISecurityTokenRegistry.sol +++ b/contracts/interfaces/ISecurityTokenRegistry.sol @@ -25,6 +25,45 @@ interface ISecurityTokenRegistry { uint256 _protocolVersion ) external; + /** + * @notice Deploys an instance of a new Security Token and records it to the registry + * @param _name is the name of the token + * @param _ticker is the ticker symbol of the security token + * @param _tokenDetails is the off-chain details of the token + * @param _divisible is whether or not the token is divisible + * @param _treasuryWallet Ethereum address which will holds the STs. + * @param _protocolVersion Version of securityToken contract + * - `_protocolVersion` is the packed value of uin8[3] array (it will be calculated offchain) + * - if _protocolVersion == 0 then latest version of securityToken will be generated + */ + function generateNewSecurityToken( + string calldata _name, + string calldata _ticker, + string calldata _tokenDetails, + bool _divisible, + address _treasuryWallet, + uint256 _protocolVersion + ) + external; + + /** + * @notice Deploys an instance of a new Security Token and replaces the old one in the registry + * This can be used to upgrade from version 2.0 of ST to 3.0 or in case something goes wrong with earlier ST + * @dev This function needs to be in STR 3.0. Defined public to avoid stack overflow + * @param _name is the name of the token + * @param _ticker is the ticker symbol of the security token + * @param _tokenDetails is the off-chain details of the token + * @param _divisible is whether or not the token is divisible + */ + function refreshSecurityToken( + string calldata _name, + string calldata _ticker, + string calldata _tokenDetails, + bool _divisible, + address _treasuryWallet + ) + external returns (address); + /** * @notice Adds a new custom Security Token and saves it to the registry. (Token should follow the ISecurityToken interface) * @param _name Name of the token @@ -195,17 +234,52 @@ interface ISecurityTokenRegistry { */ function changeFeesAmountAndCurrency(uint256 _tickerRegFee, uint256 _stLaunchFee, bool _isFeeInPoly) external; + /** + * @notice Changes the SecurityToken contract for a particular factory version + * @notice Used only by Polymath to upgrade the SecurityToken contract and add more functionalities to future versions + * @notice Changing versions does not affect existing tokens. + * @param _STFactoryAddress is the address of the proxy. + * @param _major Major version of the proxy. + * @param _minor Minor version of the proxy. + * @param _patch Patch version of the proxy + */ + function setProtocolFactory(address _STFactoryAddress, uint8 _major, uint8 _minor, uint8 _patch) external; + + /** + * @notice Removes a STFactory + * @param _major Major version of the proxy. + * @param _minor Minor version of the proxy. + * @param _patch Patch version of the proxy + */ + function removeProtocolFactory(uint8 _major, uint8 _minor, uint8 _patch) external; + + /** + * @notice Changes the default protocol version + * @notice Used only by Polymath to upgrade the SecurityToken contract and add more functionalities to future versions + * @notice Changing versions does not affect existing tokens. + * @param _major Major version of the proxy. + * @param _minor Minor version of the proxy. + * @param _patch Patch version of the proxy + */ + function setLatestVersion(uint8 _major, uint8 _minor, uint8 _patch) external; + /** * @notice Gets the security token launch fee * @return Fee amount */ - function getSecurityTokenLaunchFee() external view returns(uint256); + function getSecurityTokenLaunchFee() external returns(uint256); /** * @notice Gets the ticker registration fee * @return Fee amount */ - function getTickerRegistrationFee() external view returns(uint256); + function getTickerRegistrationFee() external returns(uint256); + + /** + * @notice Returns the usd & poly fee for a particular feetype + * @param _feeType Key corresponding to fee type + */ + function getFees(bytes32 _feeType) external returns (uint256 usdFee, uint256 polyFee); /** * @notice Returns the list of tokens to which the delegate has some access From 397c6f2ccbd5e2dc661879578f7256dbc18c22ba Mon Sep 17 00:00:00 2001 From: satyam Date: Mon, 27 May 2019 06:16:27 +0530 Subject: [PATCH 02/10] fix the interface problem --- contracts/SecurityTokenRegistry.sol | 4 +--- contracts/interfaces/ISecurityTokenRegistry.sol | 13 +------------ 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/contracts/SecurityTokenRegistry.sol b/contracts/SecurityTokenRegistry.sol index 8d752da65..762c4accb 100644 --- a/contracts/SecurityTokenRegistry.sol +++ b/contracts/SecurityTokenRegistry.sol @@ -2,10 +2,8 @@ pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; -import "./interfaces/ISecurityTokenRegistry.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"; @@ -19,7 +17,7 @@ import "./proxy/Proxy.sol"; /** * @title Registry contract for issuers to register their tickers and security tokens */ -contract SecurityTokenRegistry is ISecurityTokenRegistry, EternalStorage, Proxy { +contract SecurityTokenRegistry is EternalStorage, Proxy { /** * @notice state variables diff --git a/contracts/interfaces/ISecurityTokenRegistry.sol b/contracts/interfaces/ISecurityTokenRegistry.sol index 216091333..d9fb865af 100644 --- a/contracts/interfaces/ISecurityTokenRegistry.sol +++ b/contracts/interfaces/ISecurityTokenRegistry.sol @@ -93,17 +93,6 @@ interface ISecurityTokenRegistry { */ function registerTicker(address _owner, string calldata _ticker, string calldata _tokenName) external; - /** - * @notice Changes the protocol version and the SecurityToken contract - * @notice Used only by Polymath to upgrade the SecurityToken contract and add more functionalities to future versions - * @notice Changing versions does not affect existing tokens. - * @param _STFactoryAddress Address of the proxy. - * @param _major Major version of the proxy. - * @param _minor Minor version of the proxy. - * @param _patch Patch version of the proxy - */ - function setProtocolVersion(address _STFactoryAddress, uint8 _major, uint8 _minor, uint8 _patch) external; - /** * @notice Check that Security Token is registered * @param _securityToken Address of the Scurity token @@ -143,7 +132,7 @@ interface ISecurityTokenRegistry { /** * @notice Get Protocol version */ - function getProtocolVersion() external view returns(uint8[] memory); + function getLatestProtocolVersion() external view returns(uint8[] memory); /** * @notice Used to get the ticker list as per the owner From cce1f2ccc48f7ae1d80e95a279a1db60ded7a7ed Mon Sep 17 00:00:00 2001 From: satyam Date: Wed, 29 May 2019 19:54:03 +0530 Subject: [PATCH 03/10] minor fixes --- .../interfaces/ISecurityTokenRegistry.sol | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/contracts/interfaces/ISecurityTokenRegistry.sol b/contracts/interfaces/ISecurityTokenRegistry.sol index d9fb865af..c29c8996b 100644 --- a/contracts/interfaces/ISecurityTokenRegistry.sol +++ b/contracts/interfaces/ISecurityTokenRegistry.sol @@ -6,24 +6,20 @@ pragma solidity ^0.5.0; interface ISecurityTokenRegistry { /** - * @notice Deploys an instance of a new Security Token and records it to the registry + * @notice Deploys an instance of a new Security Token of version 2.0 and records it to the registry + * @dev this function is for backwards compatibilty with 2.0 dApp. * @param _name is the name of the token * @param _ticker is the ticker symbol of the security token * @param _tokenDetails is the off-chain details of the token * @param _divisible is whether or not the token is divisible - * @param _treasuryWallet Ethereum address which will holds the STs. - * @param _protocolVersion Version of securityToken contract - * - `_protocolVersion` is the packed value of uin8[3] array (it will be calculated offchain) - * - if _protocolVersion == 0 then latest version of securityToken will be generated */ function generateSecurityToken( string calldata _name, string calldata _ticker, string calldata _tokenDetails, - bool _divisible, - address _treasuryWallet, - uint256 _protocolVersion - ) external; + bool _divisible + ) + external; /** * @notice Deploys an instance of a new Security Token and records it to the registry @@ -252,6 +248,17 @@ interface ISecurityTokenRegistry { */ function setLatestVersion(uint8 _major, uint8 _minor, uint8 _patch) external; + /** + * @notice Changes the PolyToken address. Only Polymath. + * @param _newAddress is the address of the polytoken. + */ + function updatePolyTokenAddress(address _newAddress) external; + + /** + * @notice Used to update the polyToken contract address + */ + function updateFromRegistry() external; + /** * @notice Gets the security token launch fee * @return Fee amount @@ -264,6 +271,12 @@ interface ISecurityTokenRegistry { */ function getTickerRegistrationFee() external returns(uint256); + /** + * @notice Set the getter contract address + * @param _getterContract Address of the contract + */ + function setGetterRegistry(address _getterContract) public; + /** * @notice Returns the usd & poly fee for a particular feetype * @param _feeType Key corresponding to fee type From 56fef1649c3700018328d55a0db42abbbb816d07 Mon Sep 17 00:00:00 2001 From: satyam Date: Wed, 29 May 2019 20:02:04 +0530 Subject: [PATCH 04/10] add some function in interface --- .../interfaces/ISecurityTokenRegistry.sol | 45 ++++++++++++++----- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/contracts/interfaces/ISecurityTokenRegistry.sol b/contracts/interfaces/ISecurityTokenRegistry.sol index c29c8996b..374fcdd3b 100644 --- a/contracts/interfaces/ISecurityTokenRegistry.sol +++ b/contracts/interfaces/ISecurityTokenRegistry.sol @@ -110,21 +110,26 @@ interface ISecurityTokenRegistry { function getSecurityTokenAddress(string calldata _ticker) external view returns(address); /** - * @notice Get security token data by its address - * @param _securityToken Address of the Scurity token. - * @return string Symbol of the Security Token. - * @return address Address of the issuer of Security Token. - * @return string Details of the Token. - * @return uint256 Timestamp at which Security Token get launched on Polymath platform - * @return version of the securityToken - */ - function getSecurityTokenData(address _securityToken) external view returns(string memory, address, string memory, uint256, uint8[] memory); + * @notice Returns the security token data by address + * @param _securityToken is the address of the security token. + * @return string is the ticker of the security Token. + * @return address is the issuer of the security Token. + * @return string is the details of the security token. + * @return uint256 is the timestamp at which security Token was deployed. + */ + function getSecurityTokenData(address _securityToken) external view returns (string memory, address, string memory, uint256); /** * @notice Get the current STFactory Address */ function getSTFactoryAddress() external view returns(address); + /** + * @notice Returns the STFactory Address of a particular version + * @param _protocolVersion Packed protocol version + */ + function getSTFactoryAddressOfVersion(uint256 _protocolVersion) external view returns(address); + /** * @notice Get Protocol version */ @@ -275,7 +280,7 @@ interface ISecurityTokenRegistry { * @notice Set the getter contract address * @param _getterContract Address of the contract */ - function setGetterRegistry(address _getterContract) public; + function setGetterRegistry(address _getterContract) external; /** * @notice Returns the usd & poly fee for a particular feetype @@ -296,6 +301,26 @@ interface ISecurityTokenRegistry { */ function getExpiryLimit() external view returns(uint256); + /** + * @notice Gets the status of the ticker + * @param _ticker Ticker whose status need to determine + * @return bool + */ + function getTickerStatus(string memory _ticker) external view returns(bool); + + /** + * @notice Gets the fee currency + * @return true = poly, false = usd + */ + function getIsFeeInPoly() external view returns(bool); + + /** + * @notice Gets the owner of the ticker + * @param _ticker Ticker whose owner need to determine + * @return address Address of the owner + */ + function getTickerOwner(string memory _ticker) external view returns(address); + /** * @notice Checks whether the registry is paused or not * @return bool From f7f32ab0ae3e929717d26249666b576928d75438 Mon Sep 17 00:00:00 2001 From: satyam Date: Thu, 30 May 2019 03:28:02 +0530 Subject: [PATCH 05/10] add comment in STR --- contracts/SecurityTokenRegistry.sol | 8 ++++++++ contracts/interfaces/ISecurityTokenRegistry.sol | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/contracts/SecurityTokenRegistry.sol b/contracts/SecurityTokenRegistry.sol index 762c4accb..5bb919340 100644 --- a/contracts/SecurityTokenRegistry.sol +++ b/contracts/SecurityTokenRegistry.sol @@ -1,3 +1,11 @@ +/** + // + 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"; diff --git a/contracts/interfaces/ISecurityTokenRegistry.sol b/contracts/interfaces/ISecurityTokenRegistry.sol index 374fcdd3b..d1149d59e 100644 --- a/contracts/interfaces/ISecurityTokenRegistry.sol +++ b/contracts/interfaces/ISecurityTokenRegistry.sol @@ -306,7 +306,7 @@ interface ISecurityTokenRegistry { * @param _ticker Ticker whose status need to determine * @return bool */ - function getTickerStatus(string memory _ticker) external view returns(bool); + function getTickerStatus(string calldata _ticker) external view returns(bool); /** * @notice Gets the fee currency @@ -319,7 +319,7 @@ interface ISecurityTokenRegistry { * @param _ticker Ticker whose owner need to determine * @return address Address of the owner */ - function getTickerOwner(string memory _ticker) external view returns(address); + function getTickerOwner(string calldata _ticker) external view returns(address); /** * @notice Checks whether the registry is paused or not From 02c6bb5d243e80a32402799818d55c79f50ed188 Mon Sep 17 00:00:00 2001 From: satyam Date: Thu, 30 May 2019 21:59:42 +0530 Subject: [PATCH 06/10] consistency in interfaces of contracts --- contracts/FeatureRegistry.sol | 2 - contracts/ModuleRegistry.sol | 23 +---- contracts/PolymathRegistry.sol | 5 +- contracts/interfaces/IFeatureRegistry.sol | 11 +++ contracts/interfaces/IModuleFactory.sol | 28 +++++- contracts/interfaces/IModuleRegistry.sol | 45 ++++++++++ contracts/interfaces/IPolymathRegistry.sol | 10 +++ contracts/interfaces/ISTFactory.sol | 37 ++++++++ contracts/interfaces/ISTO.sol | 17 ++++ contracts/interfaces/ISecurityToken.sol | 61 ++++++++++++- .../interfaces/ISecurityTokenRegistry.sol | 85 +++++++++++++++++++ contracts/interfaces/IUSDTieredSTOProxy.sol | 22 ----- contracts/modules/STO/STO.sol | 5 -- 13 files changed, 294 insertions(+), 57 deletions(-) delete mode 100644 contracts/interfaces/IUSDTieredSTOProxy.sol diff --git a/contracts/FeatureRegistry.sol b/contracts/FeatureRegistry.sol index 1fbbb2134..7cdb25d71 100644 --- a/contracts/FeatureRegistry.sol +++ b/contracts/FeatureRegistry.sol @@ -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 diff --git a/contracts/ModuleRegistry.sol b/contracts/ModuleRegistry.sol index 59a02af74..5eb75ef83 100644 --- a/contracts/ModuleRegistry.sol +++ b/contracts/ModuleRegistry.sol @@ -42,28 +42,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 /////////////// diff --git a/contracts/PolymathRegistry.sol b/contracts/PolymathRegistry.sol index f80144b43..ce96eaec8 100644 --- a/contracts/PolymathRegistry.sol +++ b/contracts/PolymathRegistry.sol @@ -1,15 +1,14 @@ pragma solidity ^0.5.0; 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 diff --git a/contracts/interfaces/IFeatureRegistry.sol b/contracts/interfaces/IFeatureRegistry.sol index 563a1a9b8..367fca1aa 100644 --- a/contracts/interfaces/IFeatureRegistry.sol +++ b/contracts/interfaces/IFeatureRegistry.sol @@ -4,6 +4,17 @@ pragma solidity ^0.5.0; * @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 diff --git a/contracts/interfaces/IModuleFactory.sol b/contracts/interfaces/IModuleFactory.sol index 040ad8b30..b6a059496 100644 --- a/contracts/interfaces/IModuleFactory.sol +++ b/contracts/interfaces/IModuleFactory.sol @@ -68,9 +68,9 @@ interface IModuleFactory { /** * @notice Used to change the usage fee - * @param _newUsageCost New usage fee + * @param _usageCost New usage fee */ - function changeUsageCost(uint256 _newUsageCost) external; + function changeUsageCost(uint256 _usageCost) external; /** * @notice Used to change the currency and amount of usage and setup cost @@ -109,4 +109,28 @@ interface IModuleFactory { */ function upperSTVersionBounds() external view returns(uint8[] memory); + /** + * @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; + } diff --git a/contracts/interfaces/IModuleRegistry.sol b/contracts/interfaces/IModuleRegistry.sol index a1bff3dcb..25964f8ff 100644 --- a/contracts/interfaces/IModuleRegistry.sol +++ b/contracts/interfaces/IModuleRegistry.sol @@ -4,6 +4,29 @@ pragma solidity ^0.5.0; * @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 @@ -104,4 +127,26 @@ interface IModuleRegistry { */ function isPaused() external view returns(bool); + /** + * @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; + } diff --git a/contracts/interfaces/IPolymathRegistry.sol b/contracts/interfaces/IPolymathRegistry.sol index 91a057d54..e6792f8b4 100644 --- a/contracts/interfaces/IPolymathRegistry.sol +++ b/contracts/interfaces/IPolymathRegistry.sol @@ -1,6 +1,9 @@ pragma solidity ^0.5.0; 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 @@ -8,4 +11,11 @@ interface IPolymathRegistry { */ function getAddress(string calldata _nameKey) external view returns(address); + /** + * @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; + } diff --git a/contracts/interfaces/ISTFactory.sol b/contracts/interfaces/ISTFactory.sol index d5d01f79c..2ddb9f60b 100644 --- a/contracts/interfaces/ISTFactory.sol +++ b/contracts/interfaces/ISTFactory.sol @@ -4,6 +4,15 @@ pragma solidity ^0.5.0; * @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. @@ -28,4 +37,32 @@ interface ISTFactory { ) external returns(address); + + /** + * @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 _upgradeData Data to be passed in call to upgradeToAndCall when a token upgrades its module + */ + function setLogicContract(string calldata _version, address _logicContract, 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; } diff --git a/contracts/interfaces/ISTO.sol b/contracts/interfaces/ISTO.sol index 248274e39..5c6d8baf1 100644 --- a/contracts/interfaces/ISTO.sol +++ b/contracts/interfaces/ISTO.sol @@ -4,9 +4,26 @@ pragma solidity ^0.5.0; * @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); + /** + * @notice Returns funds raised by the STO + */ + function getRaised(FundRaiseType _fundRaiseType) external view returns(uint256); + + /** + * @notice Pause (overridden function) + * @dev Only securityToken owner restriction applied on the super function + */ + function pause() external; + } diff --git a/contracts/interfaces/ISecurityToken.sol b/contracts/interfaces/ISecurityToken.sol index 7fba2be46..078138b7d 100644 --- a/contracts/interfaces/ISecurityToken.sol +++ b/contracts/interfaces/ISecurityToken.sol @@ -17,6 +17,47 @@ interface ISecurityToken { event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); + // Emit at the time when module get added + event ModuleAdded( + uint8[] _types, + bytes32 indexed _name, + address indexed _moduleFactory, + address _module, + uint256 _moduleCost, + uint256 _budget, + bytes32 _label, + bool _archived + ); + + // Emit when the token details get updated + event UpdateTokenDetails(string _oldDetails, string _newDetails); + // Emit when the token name get updated + event UpdateTokenName(string _oldName, string _newName); + // Emit when the granularity get changed + event GranularityChanged(uint256 _oldGranularity, uint256 _newGranularity); + // Emit when is permanently frozen by the issuer + event FreezeIssuance(); + // Emit when transfers are frozen or unfrozen + event FreezeTransfers(bool _status); + // Emit when new checkpoint created + event CheckpointCreated(uint256 indexed _checkpointId, uint256 _investorLength); + // Events to log controller actions + event SetController(address indexed _oldController, address indexed _newController); + //Event emit when the global treasury wallet address get changed + event TreasuryWalletChanged(address _oldTreasuryWallet, address _newTreasuryWallet); + event DisableController(); + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + event TokenUpgraded(uint8 _major, uint8 _minor, uint8 _patch); + + // Emit when Module get archived from the securityToken + event ModuleArchived(uint8[] _types, address _module); //Event emitted by the tokenLib. + // Emit when Module get unarchived from the securityToken + event ModuleUnarchived(uint8[] _types, address _module); //Event emitted by the tokenLib. + // Emit when Module get removed from the securityToken + event ModuleRemoved(uint8[] _types, address _module); //Event emitted by the tokenLib. + // Emit when the budget allocated to a module is changed + event ModuleBudgetChanged(uint8[] _moduleTypes, address _module, uint256 _oldBudget, uint256 _budget); //Event emitted by the tokenLib. + /** * @notice Transfers of securities may fail for a number of reasons. So this function will used to understand the * cause of failure by getting the byte value. Which will be the ESC that follows the EIP 1066. ESC can be mapped @@ -479,7 +520,7 @@ interface ISecurityToken { * @notice Used by the issuer to permanently disable controller functionality * @dev enabled via feature switch "disableControllerAllowed" */ - function disableController() external; + function disableController(bytes calldata _signature) external; /** * @notice Used to get the version of the securityToken @@ -622,4 +663,22 @@ interface ISecurityToken { * @notice Returns if transfers are currently frozen or not */ function transfersFrozen() external view returns (bool); + + /** + * @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; + + /** + * @return true if `msg.sender` is the owner of the contract. + */ + function isOwner() external view returns (bool); + + /** + * @return the address of the owner. + */ + function owner() external view returns (address); + + function updateFromRegistry() external; } diff --git a/contracts/interfaces/ISecurityTokenRegistry.sol b/contracts/interfaces/ISecurityTokenRegistry.sol index d1149d59e..8a7669fbb 100644 --- a/contracts/interfaces/ISecurityTokenRegistry.sol +++ b/contracts/interfaces/ISecurityTokenRegistry.sol @@ -5,6 +5,75 @@ pragma solidity ^0.5.0; */ interface ISecurityTokenRegistry { + // Emit when network becomes paused + event Pause(address account); + // Emit when network becomes unpaused + event Unpause(address account); + // Emit when the ticker is removed from the registry + event TickerRemoved(string _ticker, address _removedBy); + // Emit when the token ticker expiry is changed + event ChangeExpiryLimit(uint256 _oldExpiry, uint256 _newExpiry); + // Emit when changeSecurityLaunchFee is called + event ChangeSecurityLaunchFee(uint256 _oldFee, uint256 _newFee); + // Emit when changeTickerRegistrationFee is called + event ChangeTickerRegistrationFee(uint256 _oldFee, uint256 _newFee); + // Emit when Fee currency is changed + event ChangeFeeCurrency(bool _isFeeInPoly); + // Emit when ownership gets transferred + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + // Emit when ownership of the ticker gets changed + event ChangeTickerOwnership(string _ticker, address indexed _oldOwner, address indexed _newOwner); + // Emit at the time of launching a new security token of version 3.0+ + event NewSecurityTokenCreated( + string _ticker, + string _name, + address indexed _securityTokenAddress, + address indexed _owner, + uint256 _addedAt, + address _registrant, + bool _fromAdmin, + uint256 _usdFee, + uint256 _polyFee, + uint256 _protocolVersion + ); + // Emit at the time of launching a new security token v2.0. + // _registrationFee is in poly + event NewSecurityToken( + string _ticker, + string _name, + address indexed _securityTokenAddress, + address indexed _owner, + uint256 _addedAt, + address _registrant, + bool _fromAdmin, + uint256 _registrationFee + ); + // Emit after ticker registration + // _registrationFee is in poly + // fee in usd is not being emitted to maintain backwards compatibility + event RegisterTicker( + address indexed _owner, + string _ticker, + string _name, + uint256 indexed _registrationDate, + uint256 indexed _expiryDate, + bool _fromAdmin, + uint256 _registrationFee + ); + // Emit at when issuer refreshes exisiting token + event SecurityTokenRefreshed( + string _ticker, + string _name, + address indexed _securityTokenAddress, + address indexed _owner, + uint256 _addedAt, + address _registrant, + uint256 _protocolVersion + ); + event ProtocolFactorySet(address indexed _STFactory, uint8 _major, uint8 _minor, uint8 _patch); + event LatestVersionSet(uint8 _major, uint8 _minor, uint8 _patch); + event ProtocolFactoryRemoved(address indexed _STFactory, uint8 _major, uint8 _minor, uint8 _patch); + /** * @notice Deploys an instance of a new Security Token of version 2.0 and records it to the registry * @dev this function is for backwards compatibilty with 2.0 dApp. @@ -327,6 +396,22 @@ interface ISecurityTokenRegistry { */ function isPaused() external view returns(bool); + /** + * @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; + + /** + * @notice Reclaims all ERC20Basic compatible tokens + * @param _tokenContract is the address of the token contract + */ + function reclaimERC20(address _tokenContract) external; + /** * @notice Gets the owner of the contract * @return address owner diff --git a/contracts/interfaces/IUSDTieredSTOProxy.sol b/contracts/interfaces/IUSDTieredSTOProxy.sol deleted file mode 100644 index bcbf2b2d9..000000000 --- a/contracts/interfaces/IUSDTieredSTOProxy.sol +++ /dev/null @@ -1,22 +0,0 @@ -pragma solidity ^0.5.0; - -/** - * @title Interface for security token proxy deployment - */ -interface IUSDTieredSTOProxy { - /** - * @notice Deploys the STO. - * @param _securityToken Contract address of the securityToken - * @param _factoryAddress Contract address of the factory - * @return address Address of the deployed STO - */ - function deploySTO(address _securityToken, address _factoryAddress) external returns(address); - - /** - * @notice Used to get the init function signature - * @param _contractAddress Address of the STO contract - * @return bytes4 - */ - function getInitFunction(address _contractAddress) external returns(bytes4); - -} diff --git a/contracts/modules/STO/STO.sol b/contracts/modules/STO/STO.sol index d80c9d139..4c6e4b68c 100644 --- a/contracts/modules/STO/STO.sol +++ b/contracts/modules/STO/STO.sol @@ -12,11 +12,6 @@ import "../../interfaces/ISTO.sol"; contract STO is ISTO, STOStorage, Module { using SafeMath for uint256; - enum FundRaiseType {ETH, POLY, SC} - - // Event - event SetFundRaiseTypes(FundRaiseType[] _fundRaiseTypes); - /** * @notice Returns funds raised by the STO */ From f78d7cebb1f6374f6df7657e34823267c2b495bb Mon Sep 17 00:00:00 2001 From: satyam Date: Fri, 31 May 2019 08:44:25 +0530 Subject: [PATCH 07/10] improve the st interface --- contracts/interfaces/ISecurityToken.sol | 140 ++++++++++++++++++------ 1 file changed, 107 insertions(+), 33 deletions(-) diff --git a/contracts/interfaces/ISecurityToken.sol b/contracts/interfaces/ISecurityToken.sol index 078138b7d..4772e725c 100644 --- a/contracts/interfaces/ISecurityToken.sol +++ b/contracts/interfaces/ISecurityToken.sol @@ -5,15 +5,17 @@ pragma solidity ^0.5.0; */ interface ISecurityToken { // Standard ERC20 interface + function symbol() external view returns (string memory); + function name() external view returns (string memory); function decimals() external view returns(uint8); function totalSupply() external view returns(uint256); - function balanceOf(address _owner) external view returns(uint256); - function allowance(address _owner, address _spender) external view returns(uint256); - function transfer(address _to, uint256 _value) external returns(bool); - function transferFrom(address _from, address _to, uint256 _value) external returns(bool); - function approve(address _spender, uint256 _value) external returns(bool); - function decreaseApproval(address _spender, uint _subtractedValue) external returns(bool); - function increaseApproval(address _spender, uint _addedValue) external returns(bool); + function balanceOf(address owner) external view returns(uint256); + function allowance(address owner, address spender) external view returns(uint256); + function transfer(address to, uint256 value) external returns(bool); + function transferFrom(address from, address to, uint256 value) external returns(bool); + function approve(address spender, uint256 value) external returns(bool); + function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool); + function increaseAllowance(address spender, uint256 addedValue) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); @@ -58,6 +60,53 @@ interface ISecurityToken { // Emit when the budget allocated to a module is changed event ModuleBudgetChanged(uint8[] _moduleTypes, address _module, uint256 _oldBudget, uint256 _budget); //Event emitted by the tokenLib. + // Transfer Events + event TransferByPartition( + bytes32 indexed _fromPartition, + address _operator, + address indexed _from, + address indexed _to, + uint256 _value, + bytes _data, + bytes _operatorData + ); + + // Operator Events + event AuthorizedOperator(address indexed operator, address indexed tokenHolder); + event RevokedOperator(address indexed operator, address indexed tokenHolder); + event AuthorizedOperatorByPartition(bytes32 indexed partition, address indexed operator, address indexed tokenHolder); + event RevokedOperatorByPartition(bytes32 indexed partition, address indexed operator, address indexed tokenHolder); + + // Issuance / Redemption Events + event IssuedByPartition(bytes32 indexed partition, address indexed to, uint256 value, bytes data); + event RedeemedByPartition(bytes32 indexed partition, address indexed operator, address indexed from, uint256 value, bytes data, bytes operatorData); + + // Document Events + event DocumentRemoved(bytes32 indexed _name, string _uri, bytes32 _documentHash); + event DocumentUpdated(bytes32 indexed _name, string _uri, bytes32 _documentHash); + + // Controller Events + event ControllerTransfer( + address _controller, + address indexed _from, + address indexed _to, + uint256 _value, + bytes _data, + bytes _operatorData + ); + + event ControllerRedemption( + address _controller, + address indexed _tokenHolder, + uint256 _value, + bytes _data, + bytes _operatorData + ); + + // Issuance / Redemption Events + event Issued(address indexed _operator, address indexed _to, uint256 _value, bytes _data); + event Redeemed(address indexed _operator, address indexed _from, uint256 _value, bytes _data); + /** * @notice Transfers of securities may fail for a number of reasons. So this function will used to understand the * cause of failure by getting the byte value. Which will be the ESC that follows the EIP 1066. ESC can be mapped @@ -76,21 +125,7 @@ interface ISecurityToken { * @dev Expected to be called atomically with the proxy being created, by the owner of the token * @dev Can only be called once */ - function initialize() external; - - /** - * @notice Transfers of securities may fail for a number of reasons. So this function will used to understand the - * cause of failure by getting the byte value. Which will be the ESC that follows the EIP 1066. ESC can be mapped - * with a reson string to understand the failure cause, table of Ethereum status code will always reside off-chain - * @param _from address The address which you want to send tokens from - * @param _to address The address which you want to transfer to - * @param _value uint256 the amount of tokens to be transferred - * @param _data The `bytes _data` allows arbitrary data to be submitted alongside the transfer. - * @return bool It signifies whether the transaction will be executed or not. - * @return byte Ethereum status code (ESC) - * @return bytes32 Application specific reason code - */ - function canTransferFrom(address _from, address _to, uint256 _value, bytes calldata _data) external view returns (bool, byte, bytes32); + function initialize(address _getterDelegate) external; /** * @notice The standard provides an on-chain function to determine whether a transfer will succeed, @@ -104,7 +139,30 @@ interface ISecurityToken { * @return Application specific reason codes with additional details * @return The partition to which the transferred tokens were allocated for the _to address */ - function canTransferByPartition(address _from, address _to, bytes32 _partition, uint256 _value, bytes calldata _data) external view returns (byte, bytes32, bytes32); + function canTransferByPartition( + address _from, + address _to, + bytes32 _partition, + uint256 _value, + bytes calldata _data + ) + external + view + returns (byte esc, bytes32 appStatusCode, bytes32 toPartition); + + /** + * @notice Transfers of securities may fail for a number of reasons. So this function will used to understand the + * cause of failure by getting the byte value. Which will be the ESC that follows the EIP 1066. ESC can be mapped + * with a reson string to understand the failure cause, table of Ethereum status code will always reside off-chain + * @param _from address The address which you want to send tokens from + * @param _to address The address which you want to transfer to + * @param _value uint256 the amount of tokens to be transferred + * @param _data The `bytes _data` allows arbitrary data to be submitted alongside the transfer. + * @return bool It signifies whether the transaction will be executed or not. + * @return byte Ethereum status code (ESC) + * @return bytes32 Application specific reason code + */ + function canTransferFrom(address _from, address _to, uint256 _value, bytes calldata _data) external view returns (bool success, byte reasonCode, bytes32 appCode); /** * @notice Used to attach a new document to the contract, or update the URI or hash of an existing attached document @@ -227,10 +285,6 @@ interface ISecurityToken { bytes calldata _operatorData ) external; - // Issuance / Redemption Events - event Issued(address indexed _operator, address indexed _to, uint256 _value, bytes _data); - event Redeemed(address indexed _operator, address indexed _from, uint256 _value, bytes _data); - /** * @notice Validate permissions with PermissionManager if it exists, If no Permission return false * @dev Note that IModule withPerm will allow ST owner all permissions anyway @@ -298,11 +352,11 @@ interface ISecurityToken { function getCheckpointTimes() external view returns(uint256[] memory); /** - * @notice Gets length of investors array - * NB - this length may differ from investorCount if the list has not been pruned of zero-balance investors - * @return Length + * @notice returns an array of investors + * NB - this length may differ from investorCount as it contains all investors that ever held tokens + * @return list of addresses */ - function getInvestors() external view returns(address[] memory); + function getInvestors() external view returns(address[] memory investors); /** * @notice returns an array of investors at a given checkpoint @@ -424,9 +478,10 @@ interface ISecurityToken { function unfreezeTransfers() external; /** - * @notice Ends token minting period permanently + * @notice Permanently freeze issuance of this security token. + * @dev It MUST NOT be possible to increase `totalSuppy` after this function is called. */ - function freezeIssuance() external; + function freezeIssuance(bytes calldata _signature) external; /** * @notice Attachs a module to the SecurityToken @@ -681,4 +736,23 @@ interface ISecurityToken { function owner() external view returns (address); function updateFromRegistry() external; + + function controller() external view returns(address); + + function moduleRegistry() external view returns(address); + + function securityTokenRegistry() external view returns(address); + + function polyToken() external view returns(address); + + function tokenFactory() external view returns(address); + + function getterDelegate() external view returns(address); + + function controllerDisabled() external view returns(bool); + + function initialized() external view returns(bool); + + function tokenDetails() external view returns(string memory); + } From 1182699a3c5bd1f880a8cc131a8fbc95416d8f91 Mon Sep 17 00:00:00 2001 From: satyam Date: Thu, 13 Jun 2019 11:13:34 +0530 Subject: [PATCH 08/10] remove shadow declaration --- contracts/interfaces/ISTFactory.sol | 3 ++- contracts/interfaces/ISecurityToken.sol | 6 +++--- contracts/tokens/STFactory.sol | 1 + contracts/tokens/STGetter.sol | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/contracts/interfaces/ISTFactory.sol b/contracts/interfaces/ISTFactory.sol index 3ad502a2f..a2b911f9d 100644 --- a/contracts/interfaces/ISTFactory.sol +++ b/contracts/interfaces/ISTFactory.sol @@ -42,9 +42,10 @@ interface ISTFactory { * @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 _upgradeData) external; + function setLogicContract(string calldata _version, address _logicContract, bytes calldata _initializationData, bytes calldata _upgradeData) external; /** * @notice Used to upgrade a token diff --git a/contracts/interfaces/ISecurityToken.sol b/contracts/interfaces/ISecurityToken.sol index 76aef7765..67a2dc2f8 100644 --- a/contracts/interfaces/ISecurityToken.sol +++ b/contracts/interfaces/ISecurityToken.sol @@ -733,15 +733,15 @@ interface ISecurityToken { /** * @return the address of the owner. */ - function owner() external view returns (address owner); + function owner() external view returns (address ownerAddress); - function controller() external view returns(address controller); + function controller() external view returns(address controllerAddress); function moduleRegistry() external view returns(address moduleRegistryAddress); function securityTokenRegistry() external view returns(address securityTokenRegistryAddress); - function polyToken() external view returns(address polyToken); + function polyToken() external view returns(address polyTokenAddress); function tokenFactory() external view returns(address tokenFactoryAddress); diff --git a/contracts/tokens/STFactory.sol b/contracts/tokens/STFactory.sol index 5b78e057c..2f01f7e96 100644 --- a/contracts/tokens/STFactory.sol +++ b/contracts/tokens/STFactory.sol @@ -138,6 +138,7 @@ contract STFactory is ISTFactory, Ownable { * @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 onlyOwner { diff --git a/contracts/tokens/STGetter.sol b/contracts/tokens/STGetter.sol index f78d99043..efea1793a 100644 --- a/contracts/tokens/STGetter.sol +++ b/contracts/tokens/STGetter.sol @@ -230,7 +230,7 @@ contract STGetter is OZStorage, SecurityTokenStorage { * @notice Return all partitions * @return List of partitions */ - function partitionsOf(address /*_tokenHolder*/) external view returns (bytes32[] memory) { + function partitionsOf(address /*_tokenHolder*/) external pure returns (bytes32[] memory) { bytes32[] memory result = new bytes32[](2); result[0] = UNLOCKED; result[1] = LOCKED; From 520e20f00d39728ff5d9c5cad740f80f6985914e Mon Sep 17 00:00:00 2001 From: satyam Date: Thu, 13 Jun 2019 11:16:44 +0530 Subject: [PATCH 09/10] add #706 new function declartion in the ISTR --- contracts/interfaces/ISecurityTokenRegistry.sol | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/contracts/interfaces/ISecurityTokenRegistry.sol b/contracts/interfaces/ISecurityTokenRegistry.sol index 52ff05ac4..05b386303 100644 --- a/contracts/interfaces/ISecurityTokenRegistry.sol +++ b/contracts/interfaces/ISecurityTokenRegistry.sol @@ -158,6 +158,15 @@ interface ISecurityTokenRegistry { */ function registerTicker(address _owner, string calldata _ticker, string calldata _tokenName) external; + /** + * @notice Registers the token ticker to the selected owner + * @notice Once the token ticker is registered to its owner then no other issuer can claim + * @notice its ownership. If the ticker expires and its issuer hasn't used it, then someone else can take it. + * @param _owner is address of the owner of the token + * @param _ticker is unique token ticker + */ + function registerNewTicker(address _owner, string calldata _ticker) external; + /** * @notice Check that Security Token is registered * @param _securityToken Address of the Scurity token From 758ff1522f4f30814f6ba94f1a0a5146a0f8caae Mon Sep 17 00:00:00 2001 From: satyam Date: Thu, 13 Jun 2019 13:25:25 +0530 Subject: [PATCH 10/10] add missing functions in interface --- .../interfaces/ISecurityTokenRegistry.sol | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/contracts/interfaces/ISecurityTokenRegistry.sol b/contracts/interfaces/ISecurityTokenRegistry.sol index 05b386303..9af0392a7 100644 --- a/contracts/interfaces/ISecurityTokenRegistry.sol +++ b/contracts/interfaces/ISecurityTokenRegistry.sol @@ -48,6 +48,16 @@ interface ISecurityTokenRegistry { bool _fromAdmin, uint256 _registrationFee ); + // Emit when new ticker get registers + event RegisterTicker( + address indexed _owner, + string _ticker, + uint256 indexed _registrationDate, + uint256 indexed _expiryDate, + bool _fromAdmin, + uint256 _registrationFeePoly, + uint256 _registrationFeeUsd + ); // Emit after ticker registration // _registrationFee is in poly // fee in usd is not being emitted to maintain backwards compatibility @@ -148,6 +158,41 @@ interface ISecurityTokenRegistry { ) external; + /** + * @notice Adds a new custom Security Token and saves it to the registry. (Token should follow the ISecurityToken interface) + * @param _ticker is the ticker symbol of the security token + * @param _owner is the owner of the token + * @param _securityToken is the address of the securityToken + * @param _tokenDetails is the off-chain details of the token + * @param _deployedAt is the timestamp at which the security token is deployed + */ + function modifyExistingSecurityToken( + string calldata _ticker, + address _owner, + address _securityToken, + string calldata _tokenDetails, + uint256 _deployedAt + ) + external; + + /** + * @notice Modifies the ticker details. Only Polymath has the ability to do so. + * @notice Only allowed to modify the tickers which are not yet deployed. + * @param _owner is the owner of the token + * @param _ticker is the token ticker + * @param _registrationDate is the date at which ticker is registered + * @param _expiryDate is the expiry date for the ticker + * @param _status is the token deployment status + */ + function modifyExistingTicker( + address _owner, + string calldata _ticker, + uint256 _registrationDate, + uint256 _expiryDate, + bool _status + ) + external; + /** * @notice Registers the token ticker for its particular owner * @notice once the token ticker is registered to its owner then no other issuer can claim