diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..a982029e1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,52 @@ +# Changelog +All notable changes to this project will be documented in this file. + +## [Unreleased](https://github.com/PolymathNetwork/polymath-core_v2/compare/npm-publish-2...master) + +[__0.2.0__](https://www.npmjs.com/package/polymath-core_v2?activeTab=readme) __26-03-18__ + +## Added +* ModuleRegistry contract will provide the list of modules by there types. +* `SecurityTokenRegistry` is now work on the basis of the proxy version of the securitytoken contract. For that SecurityTokenRegistry has one more variable in the constructor called _STVersionProxy . +* `setProtocolVersion` new function added in the SecurityTokenRegistry to set the protocol version followed to generate the securityToken. Only be called by the `polymath admin`. +* `SecurityToken` now have the integaration with polyToken. At the time of `addModule()` SecurityToken approve the cost of the module to moduleFactory as the spender. +* New function `withdrawPoly(uint256 _amount)` is added to withdrawl the unsed POLY from the securityToken contract. Called only by the owner of the contract. +* `checkPermission(address _delegate, address _module, bytes32 _perm)` function is added to check the permissions on the service providers(delegate). +* `STVersionProxy_001.sol` & `STVersionProxy_002.sol` are the two new contract added. Both of those are the proxy contract use to generate the SecurityToken. Both contract construtor takes two variables address of `transferManagerFactory` address of the +`permissionManagerFactory`. +* New Module type is added called `PermissionManager`. It have three contracts called GeneralPermissionManagerFactory, GeneralPermissionManager, IPermissionManager. +* `GeneralPermissionManger` is all about providing the permission to the delegate corresponds to the SecurityToken. Major functionality are add, check , change the permission of the delegate. +* Two more functions added for each factory type i.e `getDescription()` & `getTitle()`. +* `CappedSTO` is now Configurable by chossing the type of fundraise. Either POLY or ETH. +* `CappedSTO` takes 3 more constructor arguments fundRaiseType (uint8), address of the polyToken & address of the funds receiver. +* `buyTokensWithPoly(address _beneficiary, uint256 _investedPoly)` new function added in cappedSTO to facilitate the funds raising with the POLY. +* `verifyInvestment(address _beneficiary, uint256 _fundsAmount)` new function added in ISTO to check whether the investor provide the allowance to the CappedSTO or not. +* `LogModifyWhitelist` event of GeneralTransferManager emit two more variables. i.e address which added the investor in whitelist(`_addedBy`) and record the timestamp at which modification in whitelist happen(`_dateAdded`). +* `permissions()` function added in GeneralTransferManager to get all permissions. +* `PolyToken.sol` contract is added at contracts/helpers/PolyToken.sol. For now it have no big use. + +## Changed +* ModuleRegistry only holds the module type of modules only not there names or cost anymore. +* No More ModuleReputation struct for counting the reputation of module. Now `reputation` mapping only contains the list of the addresses those used that module factory. +* `checkModule()` of ModuleRegistry contract rename to `useModule()` with same function parameters. +* Event `LogModuleAdded` emit only 5 variables instead of 6. timestamp is no longer be a part of the event. +* `SecurityTokenRegistrar` now renamed as `SecurityTokenRegistry`. +* Deployment of the securityToken is now performed by the proxy contracts and call being generated form the SecurityTokenRegistry. +* `TickerRegistrar` renamed as `TickerRegistry`. +* TickerRegistry is now Ownable contract. +* `setTokenRegistrar` functio of TickerRegistry renamed to `setTokenRegistry`. +* SecurityToken constructor has one change in the variable. i.e `_moduleRegistry` contract address is replaced by the `_owner` address. +* Their is no `_perm` parameter in the `addModule()` function of the securityToken contract. Now only 4 parameters left. +* Type of Mudules changed + - Permission has a type 1   + - TransferManager has a type 2 + - STO has a type 3 +* Location of SecurityToken changed to `contracts/token/SecurityToken.sol` +* GeneralTransferManager takes only 1 variables as constructor argument i.e address of the securityToken. +* Functions of GeneralTransferManager earlier controlled by the owner only, now those can be controlled by the delegates as well with haiving proper permissions. + +## Removed +* `getCost()` is removed from the ModuleRegistry contract. +* `SafeMath.sol` contract is replaced by the zeppelin-solidity library contract .   +* No more `SecurityTokens` and `symbol` information will be directly part of the SecurityTokenRegistry. Those information will accessed by inheriting the `ISecurityTokenRegistry`. +* Remove the Delegable.sol, AclHelpers.sol, DelegablePorting.sol contracts. Now permission manager factory takes their place . * `delegates` mapping removed from the GeneralTransferManager. \ No newline at end of file diff --git a/contracts/SecurityTokenRegistry.sol b/contracts/SecurityTokenRegistry.sol index e7ef14493..41d8e6f15 100644 --- a/contracts/SecurityTokenRegistry.sol +++ b/contracts/SecurityTokenRegistry.sol @@ -24,14 +24,14 @@ contract SecurityTokenRegistry is Ownable, ISecurityTokenRegistry { /** * @dev Creates a new Security Token and saves it to the registry - * @param _name Name of the security token + * @param _name Name of the token * @param _symbol Ticker symbol of the security token * @param _decimals Decimals value for token * @param _tokenDetails off-chain details of the token */ function generateSecurityToken(string _name, string _symbol, uint8 _decimals, bytes32 _tokenDetails) public { require(bytes(_name).length > 0 && bytes(_symbol).length > 0); - ITickerRegistry(tickerRegistry).checkValidity(_symbol, msg.sender); + require(ITickerRegistry(tickerRegistry).checkValidity(_symbol, msg.sender, _name)); address newSecurityTokenAddress = ISTProxy(protocolVersionST[protocolVersion]).deployToken( _name, diff --git a/contracts/TickerRegistry.sol b/contracts/TickerRegistry.sol index 0bbae6b66..2f07c7767 100644 --- a/contracts/TickerRegistry.sol +++ b/contracts/TickerRegistry.sol @@ -21,9 +21,6 @@ contract TickerRegistry is ITickerRegistry, Ownable { // For now it's value is 90 days; uint256 public expiryLimit = 90 * 1 days; - // Ethereum address of the admin (Control some functions of the contract) - address public admin; - // SecuirtyToken Registry contract address address public STRAddress; @@ -31,7 +28,7 @@ contract TickerRegistry is ITickerRegistry, Ownable { struct SymbolDetails { address owner; uint256 timestamp; - string contact; + string tokenName; bool status; } @@ -39,7 +36,7 @@ contract TickerRegistry is ITickerRegistry, Ownable { mapping(string => SymbolDetails) registeredSymbols; // Emit after the symbol registration - event LogRegisterTicker(address _owner, string _symbol, uint256 _timestamp); + event LogRegisterTicker(address indexed _owner, string _symbol, string _name, uint256 _timestamp); // Emit when the token symbol expiry get changed event LogChangeExpiryLimit(uint256 _oldExpiry, uint256 _newExpiry); @@ -53,21 +50,19 @@ contract TickerRegistry is ITickerRegistry, Ownable { its ownership, until unless the symbol get expired and its issuer doesn't used it for its issuance. * @param _symbol token symbol - * @param _contact token contract details e.g. email + * @param _tokenName Name of the token */ - function registerTicker(string _symbol, string _contact) public { - require(bytes(_contact).length > 0); + function registerTicker(string _symbol, string _tokenName) public { require(expiryCheck(_symbol)); - registeredSymbols[_symbol] = SymbolDetails(msg.sender, now, _contact, false); - LogRegisterTicker(msg.sender, _symbol, now); + registeredSymbols[_symbol] = SymbolDetails(msg.sender, now, _tokenName, false); + LogRegisterTicker(msg.sender, _symbol, _tokenName, now); } /** * @dev Change the expiry time for the token symbol * @param _newExpiry new time period for token symbol expiry */ - function changeExpiryLimit(uint256 _newExpiry) public { - require(msg.sender == admin); + function changeExpiryLimit(uint256 _newExpiry) public onlyOwner { uint256 _oldExpiry = expiryLimit; expiryLimit = _newExpiry; LogChangeExpiryLimit(_oldExpiry, _newExpiry); @@ -104,13 +99,17 @@ contract TickerRegistry is ITickerRegistry, Ownable { * @dev Check the validity of the symbol * @param _symbol token symbol * @param _owner address of the owner + * @param _tokenName Name of the token + * @return bool */ - function checkValidity(string _symbol, address _owner) public { + function checkValidity(string _symbol, address _owner, string _tokenName) public returns(bool) { require(msg.sender == STRAddress); require(registeredSymbols[_symbol].status != true); require(registeredSymbols[_symbol].owner == _owner); require(registeredSymbols[_symbol].timestamp.add(expiryLimit) >= now); + registeredSymbols[_symbol].tokenName = _tokenName; registeredSymbols[_symbol].status = true; + return true; } /** @@ -123,7 +122,7 @@ contract TickerRegistry is ITickerRegistry, Ownable { ( registeredSymbols[_symbol].owner, registeredSymbols[_symbol].timestamp, - registeredSymbols[_symbol].contact, + registeredSymbols[_symbol].tokenName, registeredSymbols[_symbol].status ); } diff --git a/contracts/interfaces/IST20.sol b/contracts/interfaces/IST20.sol index 36cdde72a..bf9eea3f0 100644 --- a/contracts/interfaces/IST20.sol +++ b/contracts/interfaces/IST20.sol @@ -6,7 +6,7 @@ contract IST20 { bytes32 public tokenDetails; //transfer, transferFrom must respect use respect the result of verifyTransfer - function verifyTransfer(address _from, address _to, uint256 _amount) public returns (bool success); + function verifyTransfer(address _from, address _to, uint256 _amount) view public returns (bool success); //used to create tokens function mint(address _investor, uint256 _amount) public returns (bool success); diff --git a/contracts/interfaces/ISecurityTokenRegistry.sol b/contracts/interfaces/ISecurityTokenRegistry.sol index 9a4f804cc..1f220342a 100644 --- a/contracts/interfaces/ISecurityTokenRegistry.sol +++ b/contracts/interfaces/ISecurityTokenRegistry.sol @@ -21,7 +21,7 @@ contract ISecurityTokenRegistry { /** * @dev Creates a new Security Token and saves it to the registry - * @param _name Name of the security token + * @param _name Name of the token * @param _symbol Ticker symbol of the security token * @param _decimals Decimals value for token * @param _tokenDetails off-chain details of the token diff --git a/contracts/interfaces/ITickerRegistry.sol b/contracts/interfaces/ITickerRegistry.sol index 8c3a0cb09..706b32147 100644 --- a/contracts/interfaces/ITickerRegistry.sol +++ b/contracts/interfaces/ITickerRegistry.sol @@ -5,8 +5,10 @@ interface ITickerRegistry { * @dev Check the validity of the symbol * @param _symbol token symbol * @param _owner address of the owner + * @param _tokenName Name of the token + * @return bool */ - function checkValidity(string _symbol, address _owner) public; + function checkValidity(string _symbol, address _owner, string _tokenName) public returns(bool); /** * @dev Returns the owner and timestamp for a given symbol diff --git a/contracts/tokens/SecurityToken.sol b/contracts/tokens/SecurityToken.sol index 78081c9cf..37c6b493d 100644 --- a/contracts/tokens/SecurityToken.sol +++ b/contracts/tokens/SecurityToken.sol @@ -40,8 +40,8 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { // Other modules TBD mapping (uint8 => ModuleData) public modules; - event LogModuleAdded(uint8 _type, bytes32 _name, address _moduleFactory, address _module, uint256 _moduleCost, uint256 _budget, uint256 _timestamp); - event LogModuleBudgetChanged(uint8 _moduleType, address _module, uint256 _budget); + event LogModuleAdded(uint8 indexed _type, bytes32 _name, address _moduleFactory, address _module, uint256 _moduleCost, uint256 _budget, uint256 _timestamp); + event LogModuleBudgetChanged(uint8 indexed _moduleType, address _module, uint256 _budget); event Mint(address indexed to, uint256 amount); //if _fallback is true, then we only allow the module if it is set, if it is not set we only allow the owner @@ -137,7 +137,7 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { // Permissions this to a TransferManager module, which has a key of 2 // If no TransferManager return true - function verifyTransfer(address _from, address _to, uint256 _amount) public returns (bool success) { + function verifyTransfer(address _from, address _to, uint256 _amount) view public returns (bool success) { if (modules[2].moduleAddress == address(0)) { return true; } diff --git a/migrations/2_deploy_contracts.js b/migrations/2_deploy_contracts.js index 80a7fbf17..2f6e1023e 100644 --- a/migrations/2_deploy_contracts.js +++ b/migrations/2_deploy_contracts.js @@ -67,7 +67,7 @@ module.exports = async (deployer, network, accounts) => { // ----------- SECURITY TOKEN & STO DEPLOYMENT ------------ // 1. Register ticker symbol - await tickerRegistry.registerTicker(symbol, "poly@polymath.network", { from: Issuer }); + await tickerRegistry.registerTicker(symbol, name, { from: Issuer }); // 2. Deploy Token let STRegistry = await SecurityTokenRegistry.deployed(); diff --git a/package.json b/package.json index 9136ecc7a..6b167fa17 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "polymath-core_v2", - "version": "0.1.0", + "version": "0.2.0", "description": "Polymath Network Core Smart Contracts v2", "main": "truffle.js", "directories": {