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
16 changes: 12 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ All notable changes to this project will be documented in this file.

[__3.0.0__](https://www.npmjs.com/package/polymath-core?activeTab=readme) __10-11-18__

## SecurityToken
* Added new function `addModuleWithLabel()` which takes an extra param `_label` that used for giving the customize label to the module for display purpose. #428
* Fixed `addModule` function to be backwards compatible and call the new `addModuleWithLabel` function with an empty label.
## Added
* Added new function `addModuleWithLabel()` which takes an extra param `_label` that used for giving the customize label to the module for display purpose. #428

## Fixed
* Fixed `addModule` function to be backwards compatible and call the new `addModuleWithLabel` function with an empty label.
* Fixed event `ModuleAdded` to also emit `_label`.
* Fixed function `getModule` to also return the respective module label.
* Fixed function `getModule` to also return the respective module label.
* Replaced `updatePolyTokenAddress()` function with `updateFromRegistry()` in `SecurityTokenRegistry`.

## Removed
* Removed `_polyAddress` parameter from constructors of all modules and module factories.
* Removed `_polyToken` parameter from `initialize` function in `SecurityTokenRegistry`.


# v1.5.0 - Release Candidate

Expand Down
28 changes: 15 additions & 13 deletions contracts/SecurityTokenRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IOwnable.sol";
import "./interfaces/ISTFactory.sol";
import "./interfaces/ISecurityTokenRegistry.sol";
import "./interfaces/IPolymathRegistry.sol";
import "./storage/EternalStorage.sol";
import "./libraries/Util.sol";
import "./libraries/Encoder.sol";
Expand Down Expand Up @@ -161,27 +162,24 @@ contract SecurityTokenRegistry is ISecurityTokenRegistry, EternalStorage {
* @param _STFactory is the address of the Proxy contract for Security Tokens
* @param _stLaunchFee is the fee in POLY required to launch a token
* @param _tickerRegFee is the fee in POLY required to register a ticker
* @param _polyToken is the address of the POLY ERC20 token
* @param _owner is the owner of the STR
*/
function initialize(
address _polymathRegistry,
address _STFactory,
uint256 _stLaunchFee,
uint256 _tickerRegFee,
address _polyToken,
address _owner
)
external
payable
{
require(!getBool(INITIALIZE),"already initialized");
require(
_STFactory != address(0) && _polyToken != address(0) && _owner != address(0) && _polymathRegistry != address(0),
_STFactory != address(0) && _owner != address(0) && _polymathRegistry != address(0),
"Invalid address"
);
require(_stLaunchFee != 0 && _tickerRegFee != 0, "Fees should not be 0");
set(POLYTOKEN, _polyToken);
set(STLAUNCHFEE, _stLaunchFee);
set(TICKERREGFEE, _tickerRegFee);
set(EXPIRYLIMIT, uint256(60 * 1 days));
Expand All @@ -190,6 +188,19 @@ contract SecurityTokenRegistry is ISecurityTokenRegistry, EternalStorage {
set(POLYMATHREGISTRY, _polymathRegistry);
_setProtocolVersion(_STFactory, uint8(2), uint8(0), uint8(0));
set(INITIALIZE, true);
_updateFromRegistry();
}

/**
* @notice Used to update the polyToken contract address
*/
function updateFromRegistry() external onlyOwner {
_updateFromRegistry();
}

function _updateFromRegistry() internal {
address polymathRegistry = getAddress(POLYMATHREGISTRY);
set(POLYTOKEN, IPolymathRegistry(polymathRegistry).getAddress("PolyToken"));
}

/////////////////////////////
Expand Down Expand Up @@ -740,15 +751,6 @@ contract SecurityTokenRegistry is ISecurityTokenRegistry, EternalStorage {
return VersionUtils.unpack(uint24(getUint(Encoder.getKey("latestVersion"))));
}

/**
* @notice Changes the PolyToken address. Only Polymath.
* @param _newAddress is the address of the polytoken.
*/
function updatePolyTokenAddress(address _newAddress) external onlyOwner {
require(_newAddress != address(0), "Invalid address");
set(POLYTOKEN, _newAddress);
}

/**
* @notice Gets the security token launch fee
* @return Fee amount
Expand Down
6 changes: 0 additions & 6 deletions contracts/interfaces/ISecurityTokenRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,6 @@ interface ISecurityTokenRegistry {
*/
function changeSecurityLaunchFee(uint256 _stLaunchFee) external;

/**
* @notice Change the PolyToken address
* @param _newAddress Address of the polytoken
*/
function updatePolyTokenAddress(address _newAddress) external;

/**
* @notice Gets the security token launch fee
* @return Fee amount
Expand Down
5 changes: 2 additions & 3 deletions contracts/interfaces/IUSDTieredSTOProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ interface IUSDTieredSTOProxy {
/**
* @notice Deploys the STO.
* @param _securityToken Contract address of the securityToken
* @param _polyAddress Contract address of the PolyToken
* @param _factoryAddress Contract address of the factory
* @param _factoryAddress Contract address of the factory
* @return address Address of the deployed STO
*/
function deploySTO(address _securityToken, address _polyAddress, address _factoryAddress) external returns (address);
function deploySTO(address _securityToken, address _factoryAddress) external returns (address);

/**
* @notice Used to get the init function signature
Expand Down
19 changes: 10 additions & 9 deletions contracts/mocks/MockBurnFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import "../modules/Experimental/Burn/TrackedRedemptionFactory.sol";

contract MockBurnFactory is TrackedRedemptionFactory {

/**
* @notice Constructor
* @param _polyAddress Address of the polytoken
*/
constructor (address _polyAddress, uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
TrackedRedemptionFactory(_polyAddress, _setupCost, _usageCost, _subscriptionCost)
/**
* @notice Constructor
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _subscriptionCost Subscription cost of the module
*/
constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
TrackedRedemptionFactory(_setupCost, _usageCost, _subscriptionCost)
{
}

Expand All @@ -23,10 +25,9 @@ contract MockBurnFactory is TrackedRedemptionFactory {
* @return Address Contract address of the Module
*/
function deploy(bytes /*_data*/) external returns(address) {
if(setupCost > 0)
require(polyToken.transferFrom(msg.sender, owner(), setupCost), "Unable to pay setup cost");
_takeFee();
//Check valid bytes - can only call module init function
MockRedemptionManager mockRedemptionManager = new MockRedemptionManager(msg.sender, address(polyToken));
MockRedemptionManager mockRedemptionManager = new MockRedemptionManager(msg.sender);
/*solium-disable-next-line security/no-block-members*/
emit GenerateModuleFromFactory(address(mockRedemptionManager), getName(), address(this), msg.sender, setupCost, now);
return address(mockRedemptionManager);
Expand Down
11 changes: 7 additions & 4 deletions contracts/mocks/MockFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ import "../modules/STO/DummySTOFactory.sol";
contract MockFactory is DummySTOFactory {

bool public switchTypes = false;
/**

/**
* @notice Constructor
* @param _polyAddress Address of the polytoken
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _subscriptionCost Subscription cost of the module
*/
constructor (address _polyAddress, uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
DummySTOFactory(_polyAddress, _setupCost, _usageCost, _subscriptionCost)
constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
DummySTOFactory(_setupCost, _usageCost, _subscriptionCost)
{

}
Expand Down
5 changes: 2 additions & 3 deletions contracts/mocks/MockRedemptionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ contract MockRedemptionManager is TrackedRedemption {
/**
* @notice Constructor
* @param _securityToken Address of the security token
* @param _polyAddress Address of the polytoken
*/
constructor (address _securityToken, address _polyAddress) public
TrackedRedemption(_securityToken, _polyAddress)
constructor (address _securityToken) public
TrackedRedemption(_securityToken)
{
}

Expand Down
14 changes: 8 additions & 6 deletions contracts/mocks/MockWrongTypeFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ import "../libraries/Util.sol";

contract MockWrongTypeFactory is MockBurnFactory {

/**
* @notice Constructor
* @param _polyAddress Address of the polytoken
*/
constructor (address _polyAddress, uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
MockBurnFactory(_polyAddress, _setupCost, _usageCost, _subscriptionCost)
/**
* @notice Constructor
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _subscriptionCost Subscription cost of the module
*/
constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
MockBurnFactory(_setupCost, _usageCost, _subscriptionCost)
{
}

Expand Down
8 changes: 5 additions & 3 deletions contracts/mocks/TestSTOFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ contract TestSTOFactory is DummySTOFactory {

/**
* @notice Constructor
* @param _polyAddress Address of the polytoken
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _subscriptionCost Subscription cost of the module
*/
constructor (address _polyAddress, uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
DummySTOFactory(_polyAddress, _setupCost, _usageCost, _subscriptionCost)
constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
DummySTOFactory(_setupCost, _usageCost, _subscriptionCost)
{
version = "1.0.0";
name = "TestSTO";
Expand Down
5 changes: 2 additions & 3 deletions contracts/modules/Checkpoint/ERC20DividendCheckpoint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ contract ERC20DividendCheckpoint is DividendCheckpoint {
/**
* @notice Constructor
* @param _securityToken Address of the security token
* @param _polyAddress Address of the polytoken
*/
constructor (address _securityToken, address _polyAddress) public
Module(_securityToken, _polyAddress)
constructor (address _securityToken) public
Module(_securityToken)
{
}

Expand Down
10 changes: 4 additions & 6 deletions contracts/modules/Checkpoint/ERC20DividendCheckpointFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ contract ERC20DividendCheckpointFactory is ModuleFactory {

/**
* @notice Constructor
* @param _polyAddress Address of the polytoken
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _subscriptionCost Subscription cost of the module
*/
constructor (address _polyAddress, uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
ModuleFactory(_polyAddress, _setupCost, _usageCost, _subscriptionCost)
constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
ModuleFactory(_setupCost, _usageCost, _subscriptionCost)
{
version = "1.0.0";
name = "ERC20DividendCheckpoint";
Expand All @@ -31,9 +30,8 @@ contract ERC20DividendCheckpointFactory is ModuleFactory {
* @return Address Contract address of the Module
*/
function deploy(bytes /* _data */) external returns(address) {
if (setupCost > 0)
require(polyToken.transferFrom(msg.sender, owner(), setupCost), "insufficent allowance");
address erc20DividendCheckpoint = new ERC20DividendCheckpoint(msg.sender, address(polyToken));
_takeFee();
address erc20DividendCheckpoint = new ERC20DividendCheckpoint(msg.sender);
/*solium-disable-next-line security/no-block-members*/
emit GenerateModuleFromFactory(erc20DividendCheckpoint, getName(), address(this), msg.sender, setupCost, now);
return erc20DividendCheckpoint;
Expand Down
5 changes: 2 additions & 3 deletions contracts/modules/Checkpoint/EtherDividendCheckpoint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ contract EtherDividendCheckpoint is DividendCheckpoint {
/**
* @notice Constructor
* @param _securityToken Address of the security token
* @param _polyAddress Address of the polytoken
*/
constructor (address _securityToken, address _polyAddress) public
Module(_securityToken, _polyAddress)
constructor (address _securityToken) public
Module(_securityToken)
{
}

Expand Down
10 changes: 4 additions & 6 deletions contracts/modules/Checkpoint/EtherDividendCheckpointFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ contract EtherDividendCheckpointFactory is ModuleFactory {

/**
* @notice Constructor
* @param _polyAddress Address of the polytoken
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _subscriptionCost Subscription cost of the module
*/
constructor (address _polyAddress, uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
ModuleFactory(_polyAddress, _setupCost, _usageCost, _subscriptionCost)
constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
ModuleFactory(_setupCost, _usageCost, _subscriptionCost)
{
version = "1.0.0";
name = "EtherDividendCheckpoint";
Expand All @@ -31,9 +30,8 @@ contract EtherDividendCheckpointFactory is ModuleFactory {
* @return address Contract address of the Module
*/
function deploy(bytes /* _data */) external returns(address) {
if(setupCost > 0)
require(polyToken.transferFrom(msg.sender, owner(), setupCost), "Insufficent allowance or balance");
address ethDividendCheckpoint = new EtherDividendCheckpoint(msg.sender, address(polyToken));
_takeFee();
address ethDividendCheckpoint = new EtherDividendCheckpoint(msg.sender);
/*solium-disable-next-line security/no-block-members*/
emit GenerateModuleFromFactory(ethDividendCheckpoint, getName(), address(this), msg.sender, setupCost, now);
return ethDividendCheckpoint;
Expand Down
5 changes: 2 additions & 3 deletions contracts/modules/Experimental/Burn/TrackedRedemption.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ contract TrackedRedemption is IBurn, Module {
/**
* @notice Constructor
* @param _securityToken Address of the security token
* @param _polyAddress Address of the polytoken
*/
constructor (address _securityToken, address _polyAddress) public
Module(_securityToken, _polyAddress)
constructor (address _securityToken) public
Module(_securityToken)
{
}

Expand Down
10 changes: 4 additions & 6 deletions contracts/modules/Experimental/Burn/TrackedRedemptionFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ contract TrackedRedemptionFactory is ModuleFactory {

/**
* @notice Constructor
* @param _polyAddress Address of the polytoken
* @param _setupCost Setup cost of module
* @param _usageCost Usage cost of module
* @param _subscriptionCost Monthly cost of module
*/
constructor (address _polyAddress, uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
ModuleFactory(_polyAddress, _setupCost, _usageCost, _subscriptionCost)
constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
ModuleFactory(_setupCost, _usageCost, _subscriptionCost)
{
version = "1.0.0";
name = "TrackedRedemption";
Expand All @@ -31,9 +30,8 @@ contract TrackedRedemptionFactory is ModuleFactory {
* @return Address Contract address of the Module
*/
function deploy(bytes /* _data */) external returns(address) {
if (setupCost > 0)
require(polyToken.transferFrom(msg.sender, owner(), setupCost), "Insufficent allowance or balance");
address trackedRedemption = new TrackedRedemption(msg.sender, address(polyToken));
_takeFee();
address trackedRedemption = new TrackedRedemption(msg.sender);
/*solium-disable-next-line security/no-block-members*/
emit GenerateModuleFromFactory(address(trackedRedemption), getName(), address(this), msg.sender, setupCost, now);
return address(trackedRedemption);
Expand Down
5 changes: 2 additions & 3 deletions contracts/modules/Experimental/Mixed/ScheduledCheckpoint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ contract ScheduledCheckpoint is ICheckpoint, ITransferManager {
/**
* @notice Constructor
* @param _securityToken Address of the security token
* @param _polyAddress Address of the polytoken
*/
constructor (address _securityToken, address _polyAddress) public
Module(_securityToken, _polyAddress)
constructor (address _securityToken) public
Module(_securityToken)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ contract ScheduledCheckpointFactory is ModuleFactory {

/**
* @notice Constructor
* @param _polyAddress Address of the polytoken
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _subscriptionCost Subscription cost of the module
*/
constructor (address _polyAddress, uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
ModuleFactory(_polyAddress, _setupCost, _usageCost, _subscriptionCost)
constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
ModuleFactory(_setupCost, _usageCost, _subscriptionCost)
{
version = "1.0.0";
name = "ScheduledCheckpoint";
Expand All @@ -31,9 +30,8 @@ contract ScheduledCheckpointFactory is ModuleFactory {
* @return address Contract address of the Module
*/
function deploy(bytes /* _data */) external returns(address) {
if(setupCost > 0)
require(polyToken.transferFrom(msg.sender, owner(), setupCost), "Failed transferFrom because of sufficent Allowance is not provided");
address scheduledCheckpoint = new ScheduledCheckpoint(msg.sender, address(polyToken));
_takeFee();
address scheduledCheckpoint = new ScheduledCheckpoint(msg.sender);
emit GenerateModuleFromFactory(scheduledCheckpoint, getName(), address(this), msg.sender, setupCost, now);
return scheduledCheckpoint;
}
Expand Down
Loading