Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.
Open
Changes from 2 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
13 changes: 11 additions & 2 deletions contracts/SecurityTokenRegistrar.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@ pragma solidity ^0.4.18;
import './interfaces/ISecurityTokenRegistrar.sol';
import './interfaces/IERC20.sol';
import './SecurityToken.sol';
import './NameSpaceRegistrar.sol';

/**
* @title SecurityTokenRegistrar
* @dev Contract use to register the security token on Polymath platform
*/

contract SecurityTokenRegistrar is ISecurityTokenRegistrar {

string public VERSION = "2";
IERC20 public PolyToken; // Address of POLY token
address public polyCustomersAddress; // Address of the polymath-core Customers contract address
address public polyComplianceAddress; // Address of the polymath-core Compliance contract address
NameSpaceRegistrar public polyNameSpaceRegistrar; // NameSpaceRegistrar contract pointer

struct NameSpaceData {
address owner;
Expand Down Expand Up @@ -49,15 +50,18 @@ contract SecurityTokenRegistrar is ISecurityTokenRegistrar {
function SecurityTokenRegistrar(
address _polyTokenAddress,
address _polyCustomersAddress,
address _polyComplianceAddress
address _polyComplianceAddress,
address _polyNameSpaceRegistrarAddress
) public
{
require(_polyTokenAddress != address(0));
require(_polyCustomersAddress != address(0));
require(_polyComplianceAddress != address(0));
require(_polyNameSpaceRegistrarAddress != address(0));
PolyToken = IERC20(_polyTokenAddress);
polyCustomersAddress = _polyCustomersAddress;
polyComplianceAddress = _polyComplianceAddress;
polyNameSpaceRegistrar = NameSpaceRegistrar(_polyNameSpaceRegistrarAddress);
}

/**
Expand Down Expand Up @@ -128,7 +132,12 @@ contract SecurityTokenRegistrar is ISecurityTokenRegistrar {
require(nameSpace.owner != address(0));
require(_owner != address(0));
require(bytes(_name).length > 0 && bytes(_ticker).length > 0);

var(, _tickerTimeStamp) = polyNameSpaceRegistrar.getDetails(_nameSpaceName, _ticker);
require(_tickerTimeStamp + 90 days <= now);

require(PolyToken.transferFrom(msg.sender, nameSpace.owner, nameSpace.fee));

address newSecurityTokenAddress = new SecurityToken(
_name,
_ticker,
Expand Down