Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions contracts/SecurityTokenRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
27 changes: 13 additions & 14 deletions contracts/TickerRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,22 @@ 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;

// Details of the symbol that get registered with the polymath platform
struct SymbolDetails {
address owner;
uint256 timestamp;
string contact;
string tokenName;
bool status;
}

// Storage of symbols correspond to their details.
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);

Expand All @@ -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);
Expand Down Expand Up @@ -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;
}

/**
Expand All @@ -123,7 +122,7 @@ contract TickerRegistry is ITickerRegistry, Ownable {
(
registeredSymbols[_symbol].owner,
registeredSymbols[_symbol].timestamp,
registeredSymbols[_symbol].contact,
registeredSymbols[_symbol].tokenName,
registeredSymbols[_symbol].status
);
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IST20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/ISecurityTokenRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion contracts/interfaces/ITickerRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions contracts/tokens/SecurityToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = async (deployer, network, accounts) => {
// ----------- SECURITY TOKEN & STO DEPLOYMENT ------------

// 1. Register ticker symbol
await tickerRegistry.registerTicker(symbol, "[email protected]", { from: Issuer });
await tickerRegistry.registerTicker(symbol, name, { from: Issuer });

// 2. Deploy Token
let STRegistry = await SecurityTokenRegistry.deployed();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down