Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 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
15 changes: 6 additions & 9 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 Down Expand Up @@ -741,12 +739,11 @@ contract SecurityTokenRegistry is ISecurityTokenRegistry, EternalStorage {
}

/**
* @notice Changes the PolyToken address. Only Polymath.
* @param _newAddress is the address of the polytoken.
* @notice Stores the contract addresses of other key contracts from the PolymathRegistry
*/
function updatePolyTokenAddress(address _newAddress) external onlyOwner {
require(_newAddress != address(0), "Invalid address");
set(POLYTOKEN, _newAddress);
function updateFromRegistry() external onlyOwner {
address _polymathRegistry = getAddress(Encoder.getKey("polymathRegistry"));
set(Encoder.getKey("polyToken"), IPolymathRegistry(_polymathRegistry).getAddress("PolyToken"));
}

/**
Expand Down
5 changes: 2 additions & 3 deletions contracts/interfaces/ISecurityTokenRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,9 @@ interface ISecurityTokenRegistry {
function changeSecurityLaunchFee(uint256 _stLaunchFee) external;

/**
* @notice Change the PolyToken address
* @param _newAddress Address of the polytoken
* @notice Use to get the latest contract address of the regstries
*/
function updatePolyTokenAddress(address _newAddress) external;
function updateFromRegistry() external;

/**
* @notice Gets the security token launch fee
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
20 changes: 12 additions & 8 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,12 @@ contract MockBurnFactory is TrackedRedemptionFactory {
* @return Address Contract address of the Module
*/
function deploy(bytes /*_data*/) external returns(address) {
if(setupCost > 0)
updateFromRegistry(msg.sender);
if (setupCost > 0) {
require(polyToken.transferFrom(msg.sender, owner(), setupCost), "Unable to pay setup cost");
}
//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
11 changes: 6 additions & 5 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,11 @@ contract ERC20DividendCheckpointFactory is ModuleFactory {
* @return Address Contract address of the Module
*/
function deploy(bytes /* _data */) external returns(address) {
if (setupCost > 0)
updateFromRegistry(msg.sender);
if (setupCost > 0) {
require(polyToken.transferFrom(msg.sender, owner(), setupCost), "insufficent allowance");
address erc20DividendCheckpoint = new ERC20DividendCheckpoint(msg.sender, address(polyToken));
}
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
11 changes: 6 additions & 5 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,11 @@ contract EtherDividendCheckpointFactory is ModuleFactory {
* @return address Contract address of the Module
*/
function deploy(bytes /* _data */) external returns(address) {
if(setupCost > 0)
updateFromRegistry(msg.sender);
if (setupCost > 0) {
require(polyToken.transferFrom(msg.sender, owner(), setupCost), "Insufficent allowance or balance");
address ethDividendCheckpoint = new EtherDividendCheckpoint(msg.sender, address(polyToken));
}
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
11 changes: 6 additions & 5 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,11 @@ contract TrackedRedemptionFactory is ModuleFactory {
* @return Address Contract address of the Module
*/
function deploy(bytes /* _data */) external returns(address) {
if (setupCost > 0)
updateFromRegistry(msg.sender);
if (setupCost > 0) {
require(polyToken.transferFrom(msg.sender, owner(), setupCost), "Insufficent allowance or balance");
address trackedRedemption = new TrackedRedemption(msg.sender, address(polyToken));
}
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,11 @@ contract ScheduledCheckpointFactory is ModuleFactory {
* @return address Contract address of the Module
*/
function deploy(bytes /* _data */) external returns(address) {
if(setupCost > 0)
updateFromRegistry(msg.sender);
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));
}
address scheduledCheckpoint = new ScheduledCheckpoint(msg.sender);
emit GenerateModuleFromFactory(scheduledCheckpoint, getName(), address(this), msg.sender, setupCost, now);
return scheduledCheckpoint;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ contract LockupVolumeRestrictionTM is ITransferManager {
/**
* @notice Constructor
* @param _securityToken Address of the security token
* @param _polyAddress Address of the polytoken
*/
constructor (address _securityToken, address _polyAddress)
constructor (address _securityToken)
public
Module(_securityToken, _polyAddress)
Module(_securityToken)
{
}

Expand Down
Loading