diff --git a/contracts/PolymathRegistry.sol b/contracts/PolymathRegistry.sol index 15e34ff6f..f80144b43 100644 --- a/contracts/PolymathRegistry.sol +++ b/contracts/PolymathRegistry.sol @@ -17,7 +17,7 @@ contract PolymathRegistry is ReclaimTokens { */ function getAddress(string calldata _nameKey) external view returns(address) { bytes32 key = keccak256(bytes(_nameKey)); - require(storedAddresses[key] != address(0), "Invalid address key"); + require(storedAddresses[key] != address(0), "Invalid key"); return storedAddresses[key]; } diff --git a/contracts/SecurityTokenRegistry.sol b/contracts/SecurityTokenRegistry.sol index 60c085e72..dfd7eca32 100644 --- a/contracts/SecurityTokenRegistry.sol +++ b/contracts/SecurityTokenRegistry.sol @@ -11,6 +11,8 @@ import "./libraries/Util.sol"; import "./libraries/Encoder.sol"; import "./libraries/VersionUtils.sol"; import "./proxy/Proxy.sol"; +import "./interfaces/IOracle.sol"; +import "./libraries/DecimalMath.sol"; /** * @title Registry contract for issuers to register their tickers and security tokens @@ -74,6 +76,8 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { bytes32 constant POLYMATHREGISTRY = 0x90eeab7c36075577c7cc5ff366e389fefa8a18289b949bab3529ab4471139d4d; bytes32 constant STRGETTER = 0x982f24b3bd80807ec3cb227ba152e15c07d66855fa8ae6ca536e689205c0e2e9; + string constant POLY_ORACLE = "PolyUsdOracle"; + // Emit when network becomes paused event Pause(uint256 _timestammp); // Emit when network becomes unpaused @@ -99,7 +103,8 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { uint256 _addedAt, address _registrant, bool _fromAdmin, - uint256 _registrationFee + uint256 _usdFee, + uint256 _polyFee ); // Emit after ticker registration event RegisterTicker( @@ -109,7 +114,8 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { uint256 indexed _registrationDate, uint256 indexed _expiryDate, bool _fromAdmin, - uint256 _registrationFee + uint256 _usdFee, + uint256 _polyFee ); ///////////////////////////// @@ -159,8 +165,8 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { * @notice Initializes instance of STR * @param _polymathRegistry is the address of the Polymath Registry * @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 _stLaunchFee is the fee in USD required to launch a token + * @param _tickerRegFee is the fee in USD required to register a ticker * @param _owner is the owner of the STR, * @param _getterContract Contract address of the contract which consists getter functions. */ @@ -205,6 +211,19 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { set(POLYTOKEN, IPolymathRegistry(polymathRegistry).getAddress("PolyToken")); } + /** + * @notice Converts USD fees into POLY amounts + */ + function _takeFee(bytes32 _feeType) internal returns (uint256, uint256){ + address polymathRegistry = getAddressValue(POLYMATHREGISTRY); + uint256 polyRate = IOracle(IPolymathRegistry(polymathRegistry).getAddress(POLY_ORACLE)).getPrice(); + uint256 usdFee = getUintValue(_feeType); + uint256 polyFee = DecimalMath.div(usdFee, polyRate); + if (polyFee > 0) + require(IERC20(getAddressValue(POLYTOKEN)).transferFrom(msg.sender, address(this), polyFee), "Insufficent allowance"); + return (usdFee, polyFee); + } + /** * @notice Set the getter contract address * @param _getterContract Address of the contract @@ -233,10 +252,8 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { function registerTicker(address _owner, string calldata _ticker, string calldata _tokenName) external whenNotPausedOrOwner { require(_owner != address(0), "Owner should not be 0x"); require(bytes(_ticker).length > 0 && bytes(_ticker).length <= 10, "Ticker length range (0,10]"); - // Attempt to charge the reg fee if it is > 0 POLY - uint256 tickerFee = getUintValue(TICKERREGFEE); - if (tickerFee > 0) - require(IERC20(getAddressValue(POLYTOKEN)).transferFrom(msg.sender, address(this), tickerFee), "Insufficent allowance"); + // Attempt to charge the reg fee if it is > 0 USD + (uint256 _usdFee, uint256 _polyFee) = _takeFee(TICKERREGFEE); string memory ticker = Util.upper(_ticker); require(_tickerAvailable(ticker), "Ticker is reserved"); // Check whether ticker was previously registered (and expired) @@ -245,7 +262,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { _deleteTickerOwnership(previousOwner, ticker); } /*solium-disable-next-line security/no-block-members*/ - _addTicker(_owner, ticker, _tokenName, now, now.add(getUintValue(EXPIRYLIMIT)), false, false, tickerFee); + _addTicker(_owner, ticker, _tokenName, now, now.add(getUintValue(EXPIRYLIMIT)), false, false, _usdFee, _polyFee); } /** @@ -259,13 +276,14 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { uint256 _expiryDate, bool _status, bool _fromAdmin, - uint256 _fee + uint256 _usdFee, + uint256 _polyFee ) internal { _setTickerOwnership(_owner, _ticker); _storeTickerDetails(_ticker, _owner, _registrationDate, _expiryDate, _tokenName, _status); - emit RegisterTicker(_owner, _ticker, _tokenName, _registrationDate, _expiryDate, _fromAdmin, _fee); + emit RegisterTicker(_owner, _ticker, _tokenName, _registrationDate, _expiryDate, _fromAdmin, _usdFee, _polyFee); } /** @@ -321,7 +339,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { if (_status) { require(getAddressValue(Encoder.getKey("tickerToSecurityToken", _ticker)) != address(0), "Token not registered"); } - _addTicker(_owner, _ticker, _tokenName, _registrationDate, _expiryDate, _status, true, uint256(0)); + _addTicker(_owner, _ticker, _tokenName, _registrationDate, _expiryDate, _status, true, uint256(0), uint256(0)); } function _tickerOwner(string memory _ticker) internal view returns(address) { @@ -478,10 +496,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { require(_tickerOwner(ticker) == msg.sender, "Not authorised"); /*solium-disable-next-line security/no-block-members*/ require(getUintValue(Encoder.getKey("registeredTickers_expiryDate", ticker)) >= now, "Ticker gets expired"); - - uint256 launchFee = getUintValue(STLAUNCHFEE); - if (launchFee > 0) - require(IERC20(getAddressValue(POLYTOKEN)).transferFrom(msg.sender, address(this), launchFee), "Insufficient allowance"); + (uint256 _usdFee, uint256 _polyFee) = _takeFee(STLAUNCHFEE); address newSecurityTokenAddress = ISTFactory(getAddressValue(Encoder.getKey("protocolVersionST", getUintValue(Encoder.getKey("latestVersion"))))).deployToken( _name, @@ -497,7 +512,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { _storeSecurityTokenData(newSecurityTokenAddress, ticker, _tokenDetails, now); set(Encoder.getKey("tickerToSecurityToken", ticker), newSecurityTokenAddress); /*solium-disable-next-line security/no-block-members*/ - emit NewSecurityToken(ticker, _name, newSecurityTokenAddress, msg.sender, now, msg.sender, false, launchFee); + emit NewSecurityToken(ticker, _name, newSecurityTokenAddress, msg.sender, now, msg.sender, false, _usdFee, _polyFee); } /** @@ -535,7 +550,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { set(Encoder.getKey("tickerToSecurityToken", ticker), _securityToken); _modifyTicker(_owner, ticker, _name, registrationTime, expiryTime, true); _storeSecurityTokenData(_securityToken, ticker, _tokenDetails, _deployedAt); - emit NewSecurityToken(ticker, _name, _securityToken, _owner, _deployedAt, msg.sender, true, getUintValue(STLAUNCHFEE)); + emit NewSecurityToken(ticker, _name, _securityToken, _owner, _deployedAt, msg.sender, true, uint256(0), uint256(0)); } /** @@ -594,8 +609,8 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { } /** - * @notice Sets the ticker registration fee in POLY tokens. Only Polymath. - * @param _tickerRegFee is the registration fee in POLY tokens (base 18 decimals) + * @notice Sets the ticker registration fee in USD tokens. Only Polymath. + * @param _tickerRegFee is the registration fee in USD tokens (base 18 decimals) */ function changeTickerRegistrationFee(uint256 _tickerRegFee) external onlyOwner { uint256 fee = getUintValue(TICKERREGFEE); @@ -605,8 +620,8 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { } /** - * @notice Sets the ticker registration fee in POLY tokens. Only Polymath. - * @param _stLaunchFee is the registration fee in POLY tokens (base 18 decimals) + * @notice Sets the ticker registration fee in USD tokens. Only Polymath. + * @param _stLaunchFee is the registration fee in USD tokens (base 18 decimals) */ function changeSecurityLaunchFee(uint256 _stLaunchFee) external onlyOwner { uint256 fee = getUintValue(STLAUNCHFEE); diff --git a/contracts/interfaces/IModuleFactory.sol b/contracts/interfaces/IModuleFactory.sol index d0a35355d..9af977287 100644 --- a/contracts/interfaces/IModuleFactory.sol +++ b/contracts/interfaces/IModuleFactory.sol @@ -4,15 +4,15 @@ pragma solidity ^0.5.0; * @title Interface that every module factory contract should implement */ interface IModuleFactory { - event ChangeFactorySetupFee(uint256 _oldSetupCost, uint256 _newSetupCost, address _moduleFactory); - event ChangeFactoryUsageFee(uint256 _oldUsageCost, uint256 _newUsageCost, address _moduleFactory); - event ChangeFactorySubscriptionFee(uint256 _oldSubscriptionCost, uint256 _newMonthlySubscriptionCost, address _moduleFactory); + event ChangeSetupCost(uint256 _oldSetupCost, uint256 _newSetupCost); + event ChangeUsageCost(uint256 _oldUsageCost, uint256 _newUsageCost); event GenerateModuleFromFactory( address _module, bytes32 indexed _moduleName, address indexed _moduleFactory, address _creator, uint256 _setupCost, + uint256 _setupCostInPoly, uint256 _timestamp ); event ChangeSTVersionBound(string _boundType, uint8 _major, uint8 _minor, uint8 _patch); @@ -44,19 +44,13 @@ interface IModuleFactory { * @notice Used to change the setup fee * @param _newSetupCost New setup fee */ - function changeFactorySetupFee(uint256 _newSetupCost) external; + function changeSetupCost(uint256 _newSetupCost) external; /** * @notice Used to change the usage fee * @param _newUsageCost New usage fee */ - function changeFactoryUsageFee(uint256 _newUsageCost) external; - - /** - * @notice Used to change the subscription fee - * @param _newSubscriptionCost New subscription fee - */ - function changeFactorySubscriptionFee(uint256 _newSubscriptionCost) external; + function changeUsageCost(uint256 _newUsageCost) external; /** * @notice Function use to change the lower and upper bound of the compatible version st @@ -66,10 +60,15 @@ interface IModuleFactory { function changeSTVersionBounds(string calldata _boundType, uint8[] calldata _newVersion) external; /** - * @notice Get the setup cost of the module + * @notice Get the setup cost of the module in USD */ function getSetupCost() external view returns(uint256); + /** + * @notice Get the setup cost of the module + */ + function getSetupCostInPoly() external view returns (uint256); + /** * @notice Used to get the lower bound * @return Lower bound diff --git a/contracts/mocks/MockBurnFactory.sol b/contracts/mocks/MockBurnFactory.sol index 720c480f7..edb84d26d 100644 --- a/contracts/mocks/MockBurnFactory.sol +++ b/contracts/mocks/MockBurnFactory.sol @@ -8,19 +8,20 @@ import "../modules/Experimental/Burn/TrackedRedemptionFactory.sol"; */ contract MockBurnFactory is TrackedRedemptionFactory { + /** * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module + * @param _polymathRegistry Address of the Polymath Registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost - ) - public - TrackedRedemptionFactory(_setupCost, _usageCost, _subscriptionCost) + address _polymathRegistry + ) + public + TrackedRedemptionFactory(_setupCost, _usageCost, _polymathRegistry) { } @@ -31,15 +32,15 @@ contract MockBurnFactory is TrackedRedemptionFactory { */ function deploy( bytes calldata /*_data*/ - ) - external - returns(address) + ) + external + returns(address) { address polyToken = _takeFee(); //Check valid bytes - can only call module init function MockRedemptionManager mockRedemptionManager = new MockRedemptionManager(msg.sender, polyToken); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(address(mockRedemptionManager), getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(address(mockRedemptionManager), getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return address(mockRedemptionManager); } diff --git a/contracts/mocks/MockFactory.sol b/contracts/mocks/MockFactory.sol index 558323584..a9a8d5695 100644 --- a/contracts/mocks/MockFactory.sol +++ b/contracts/mocks/MockFactory.sol @@ -13,17 +13,17 @@ contract MockFactory is DummySTOFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` + * @param _polymathRegistry Address of the Polymath Registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost, - address _logicContract - ) - public - DummySTOFactory(_setupCost, _usageCost, _subscriptionCost, _logicContract) + address _logicContract, + address _polymathRegistry + ) + public + DummySTOFactory(_setupCost, _usageCost, _logicContract, _polymathRegistry) { } diff --git a/contracts/mocks/MockWrongTypeFactory.sol b/contracts/mocks/MockWrongTypeFactory.sol index a5d2b74ec..27f256023 100644 --- a/contracts/mocks/MockWrongTypeFactory.sol +++ b/contracts/mocks/MockWrongTypeFactory.sol @@ -13,15 +13,15 @@ contract MockWrongTypeFactory is MockBurnFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module + * @param _polymathRegistry Address of the Polymath Registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost - ) - public - MockBurnFactory(_setupCost, _usageCost, _subscriptionCost) + address _polymathRegistry + ) + public + MockBurnFactory(_setupCost, _usageCost, _polymathRegistry) { } diff --git a/contracts/mocks/TestSTOFactory.sol b/contracts/mocks/TestSTOFactory.sol index 47c7cd280..2117f3796 100644 --- a/contracts/mocks/TestSTOFactory.sol +++ b/contracts/mocks/TestSTOFactory.sol @@ -7,17 +7,17 @@ contract TestSTOFactory is DummySTOFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` + * @param _polymathRegistry Address of the Polymath Registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost, - address _logicContract - ) - public - DummySTOFactory(_setupCost, _usageCost, _subscriptionCost, _logicContract) + address _logicContract, + address _polymathRegistry + ) + public + DummySTOFactory(_setupCost, _usageCost, _logicContract, _polymathRegistry) { version = "1.0.0"; name = "TestSTO"; diff --git a/contracts/modules/Checkpoint/ERC20DividendCheckpointFactory.sol b/contracts/modules/Checkpoint/ERC20DividendCheckpointFactory.sol index 041c8222a..3410e2f36 100644 --- a/contracts/modules/Checkpoint/ERC20DividendCheckpointFactory.sol +++ b/contracts/modules/Checkpoint/ERC20DividendCheckpointFactory.sol @@ -15,17 +15,17 @@ contract ERC20DividendCheckpointFactory is ModuleFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` + * @param _polymathRegistry Address of the Polymath registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost, - address _logicContract + address _logicContract, + address _polymathRegistry ) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { require(_logicContract != address(0), "Invalid logic contract"); version = "2.1.0"; @@ -51,7 +51,7 @@ contract ERC20DividendCheckpointFactory is ModuleFactory { (success, ) = erc20DividendCheckpoint.call(_data); require(success, "Unsuccessful call"); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(erc20DividendCheckpoint, getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(erc20DividendCheckpoint, getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return erc20DividendCheckpoint; } diff --git a/contracts/modules/Checkpoint/EtherDividendCheckpointFactory.sol b/contracts/modules/Checkpoint/EtherDividendCheckpointFactory.sol index 9802af2ee..38f1b16b4 100644 --- a/contracts/modules/Checkpoint/EtherDividendCheckpointFactory.sol +++ b/contracts/modules/Checkpoint/EtherDividendCheckpointFactory.sol @@ -15,17 +15,17 @@ contract EtherDividendCheckpointFactory is ModuleFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` + * @param _polymathRegistry Address of the Polymath registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost, - address _logicContract + address _logicContract, + address _polymathRegistry ) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { require(_logicContract != address(0), "Invalid logic contract"); version = "2.1.0"; @@ -51,7 +51,7 @@ contract EtherDividendCheckpointFactory is ModuleFactory { (success, ) = ethDividendCheckpoint.call(_data); require(success, "Unsuccessful call"); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(ethDividendCheckpoint, getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(ethDividendCheckpoint, getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return ethDividendCheckpoint; } diff --git a/contracts/modules/Experimental/Burn/TrackedRedemptionFactory.sol b/contracts/modules/Experimental/Burn/TrackedRedemptionFactory.sol index 729bfe854..603d65600 100644 --- a/contracts/modules/Experimental/Burn/TrackedRedemptionFactory.sol +++ b/contracts/modules/Experimental/Burn/TrackedRedemptionFactory.sol @@ -11,15 +11,15 @@ contract TrackedRedemptionFactory is ModuleFactory { * @notice Constructor * @param _setupCost Setup cost of module * @param _usageCost Usage cost of module - * @param _subscriptionCost Monthly cost of module + * @param _polymathRegistry Address of the Polymath registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost - ) - public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + address _polymathRegistry + ) + public + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { version = "1.0.0"; name = "TrackedRedemption"; @@ -35,15 +35,15 @@ contract TrackedRedemptionFactory is ModuleFactory { */ function deploy( bytes calldata /* _data */ - ) - external - returns(address) + ) + external + returns(address) { address polyToken = _takeFee(); address trackedRedemption = address(new TrackedRedemption(msg.sender, polyToken)); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(address(trackedRedemption), getName(), address(this), msg.sender, setupCost, now); - return address(trackedRedemption); + emit GenerateModuleFromFactory(trackedRedemption, getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); + return trackedRedemption; } /** diff --git a/contracts/modules/Experimental/Mixed/ScheduledCheckpointFactory.sol b/contracts/modules/Experimental/Mixed/ScheduledCheckpointFactory.sol index e2b9e57c4..86f4687a7 100644 --- a/contracts/modules/Experimental/Mixed/ScheduledCheckpointFactory.sol +++ b/contracts/modules/Experimental/Mixed/ScheduledCheckpointFactory.sol @@ -11,15 +11,15 @@ contract ScheduledCheckpointFactory is ModuleFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module + * @param _polymathRegistry Address of the Polymath registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost - ) - public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + address _polymathRegistry + ) + public + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { version = "1.0.0"; name = "ScheduledCheckpoint"; @@ -35,13 +35,13 @@ contract ScheduledCheckpointFactory is ModuleFactory { */ function deploy( bytes calldata /* _data */ - ) - external - returns(address) + ) + external + returns(address) { address polyToken = _takeFee(); address scheduledCheckpoint = address(new ScheduledCheckpoint(msg.sender, polyToken)); - emit GenerateModuleFromFactory(scheduledCheckpoint, getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(scheduledCheckpoint, getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return scheduledCheckpoint; } @@ -55,41 +55,6 @@ contract ScheduledCheckpointFactory is ModuleFactory { return res; } - /** - * @notice Get the name of the Module - */ - function getName() public view returns(bytes32) { - return name; - } - - /** - * @notice Get the description of the Module - */ - function getDescription() external view returns(string memory) { - return description; - } - - /** - * @notice Get the title of the Module - */ - function getTitle() external view returns(string memory) { - return title; - } - - /** - * @notice Get the version of the Module - */ - function getVersion() external view returns(string memory) { - return version; - } - - /** - * @notice Get the setup cost of the module - */ - function getSetupCost() external view returns(uint256) { - return setupCost; - } - /** * @notice Get the Instructions that helped to used the module */ diff --git a/contracts/modules/Experimental/TransferManager/BlacklistTransferManagerFactory.sol b/contracts/modules/Experimental/TransferManager/BlacklistTransferManagerFactory.sol index d193864b9..2c01246ff 100644 --- a/contracts/modules/Experimental/TransferManager/BlacklistTransferManagerFactory.sol +++ b/contracts/modules/Experimental/TransferManager/BlacklistTransferManagerFactory.sol @@ -13,10 +13,10 @@ contract BlacklistTransferManagerFactory is ModuleFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module + * @param _polymathRegistry Address of the Polymath registry */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor (uint256 _setupCost, uint256 _usageCost, address _polymathRegistry) public + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { version = "2.1.0"; name = "BlacklistTransferManager"; @@ -34,7 +34,7 @@ contract BlacklistTransferManagerFactory is ModuleFactory { address polyToken = _takeFee(); address blacklistTransferManager = address(new BlacklistTransferManager(msg.sender, address(polyToken))); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(blacklistTransferManager, getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(blacklistTransferManager, getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return blacklistTransferManager; } diff --git a/contracts/modules/Experimental/TransferManager/KYCTransferManagerFactory.sol b/contracts/modules/Experimental/TransferManager/KYCTransferManagerFactory.sol index 8a5d8f23c..f8de5dbef 100644 --- a/contracts/modules/Experimental/TransferManager/KYCTransferManagerFactory.sol +++ b/contracts/modules/Experimental/TransferManager/KYCTransferManagerFactory.sol @@ -9,8 +9,8 @@ contract KYCTransferManagerFactory is ModuleFactory { /** * @notice Constructor */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor (uint256 _setupCost, uint256 _usageCost, address _polymathRegistry) public + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { version = "1.0.0"; name = "KYCTransferManager"; @@ -27,10 +27,10 @@ contract KYCTransferManagerFactory is ModuleFactory { */ function deploy(bytes calldata /* _data */) external returns(address) { address polyToken = _takeFee(); - KYCTransferManager kycTransferManager = new KYCTransferManager(msg.sender, polyToken); + address kycTransferManager = address(new KYCTransferManager(msg.sender, polyToken)); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(address(kycTransferManager), getName(), address(this), msg.sender, setupCost, now); - return address(kycTransferManager); + emit GenerateModuleFromFactory(kycTransferManager, getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); + return kycTransferManager; } diff --git a/contracts/modules/Experimental/TransferManager/LockUpTransferManagerFactory.sol b/contracts/modules/Experimental/TransferManager/LockUpTransferManagerFactory.sol index 846133da6..6b47972f1 100644 --- a/contracts/modules/Experimental/TransferManager/LockUpTransferManagerFactory.sol +++ b/contracts/modules/Experimental/TransferManager/LockUpTransferManagerFactory.sol @@ -12,15 +12,15 @@ contract LockUpTransferManagerFactory is ModuleFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module + * @param _polymathRegistry Address of the Polymath registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost + address _polymathRegistry ) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { version = "1.0.0"; name = "LockUpTransferManager"; @@ -43,7 +43,7 @@ contract LockUpTransferManagerFactory is ModuleFactory { address polyToken = _takeFee(); LockUpTransferManager lockUpTransferManager = new LockUpTransferManager(msg.sender, polyToken); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(address(lockUpTransferManager), getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(address(lockUpTransferManager), getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return address(lockUpTransferManager); } diff --git a/contracts/modules/Experimental/TransferManager/SignedTransferManagerFactory.sol b/contracts/modules/Experimental/TransferManager/SignedTransferManagerFactory.sol index bf23eedf8..8f3f90ced 100644 --- a/contracts/modules/Experimental/TransferManager/SignedTransferManagerFactory.sol +++ b/contracts/modules/Experimental/TransferManager/SignedTransferManagerFactory.sol @@ -11,8 +11,8 @@ contract SignedTransferManagerFactory is ModuleFactory { /** * @notice Constructor */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor (uint256 _setupCost, uint256 _usageCost, address _polymathRegistry) public + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { version = "1.0.0"; name = "SignedTransferManager"; @@ -38,7 +38,7 @@ contract SignedTransferManagerFactory is ModuleFactory { function deploy(bytes calldata /* _data */) external returns(address) { address polyToken = _takeFee(); SignedTransferManager signedTransferManager = new SignedTransferManager(msg.sender, polyToken); - emit GenerateModuleFromFactory(address(signedTransferManager), getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(address(signedTransferManager), getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return address(signedTransferManager); } @@ -53,41 +53,6 @@ contract SignedTransferManagerFactory is ModuleFactory { return res; } - /** - * @notice Get the name of the Module - */ - function getName() public view returns(bytes32) { - return name; - } - - /** - * @notice Get the description of the Module - */ - function getDescription() external view returns(string memory) { - return description; - } - - /** - * @notice Get the version of the Module - */ - function getVersion() external view returns(string memory) { - return version; - } - - /** - * @notice Get the title of the Module - */ - function getTitle() external view returns(string memory) { - return title; - } - - /** - * @notice Get the setup cost of the module - */ - function getSetupCost() external view returns (uint256) { - return setupCost; - } - /** * @notice Get the Instructions that helped to used the module */ diff --git a/contracts/modules/Experimental/Wallet/VestingEscrowWalletFactory.sol b/contracts/modules/Experimental/Wallet/VestingEscrowWalletFactory.sol index 0ddf7123d..da0be5eb5 100644 --- a/contracts/modules/Experimental/Wallet/VestingEscrowWalletFactory.sol +++ b/contracts/modules/Experimental/Wallet/VestingEscrowWalletFactory.sol @@ -14,8 +14,8 @@ contract VestingEscrowWalletFactory is ModuleFactory { /** * @notice Constructor */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor (uint256 _setupCost, uint256 _usageCost, address _logicContract, address _polymathRegistry) public + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { require(_logicContract != address(0), "Invalid address"); version = "1.0.0"; @@ -42,7 +42,7 @@ contract VestingEscrowWalletFactory is ModuleFactory { (success, ) = vestingEscrowWallet.call(_data); require(success, "Unsuccessfull call"); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(vestingEscrowWallet, getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(vestingEscrowWallet, getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return vestingEscrowWallet; } diff --git a/contracts/modules/ModuleFactory.sol b/contracts/modules/ModuleFactory.sol index 28abaa38a..bc053e355 100644 --- a/contracts/modules/ModuleFactory.sol +++ b/contracts/modules/ModuleFactory.sol @@ -3,23 +3,28 @@ pragma solidity ^0.5.0; import "../RegistryUpdater.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; import "../interfaces/IModuleFactory.sol"; +import "../interfaces/IOracle.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "../libraries/VersionUtils.sol"; +import "../interfaces/IPolymathRegistry.sol"; +import "../libraries/DecimalMath.sol"; /** * @title Interface that any module factory contract should implement * @notice Contract is abstract */ contract ModuleFactory is IModuleFactory, Ownable { - uint256 public usageCost; - uint256 public monthlySubscriptionCost; - + // Fee to create underlying module in USD uint256 public setupCost; + uint256 public usageCost; + address public polymathRegistry; string public description; string public version; bytes32 public name; string public title; + string constant POLY_ORACLE = "PolyUsdOracle"; + // @notice Allow only two variables to be stored // 1. lowerBound // 2. upperBound @@ -30,40 +35,30 @@ contract ModuleFactory is IModuleFactory, Ownable { /** * @notice Constructor */ - constructor(uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public { + constructor(uint256 _setupCost, uint256 _usageCost, address _polymathRegistry) public { setupCost = _setupCost; usageCost = _usageCost; - monthlySubscriptionCost = _subscriptionCost; + polymathRegistry = _polymathRegistry; } /** * @notice Used to change the fee of the setup cost - * @param _newSetupCost new setup cost + * @param _newSetupCost new setup cost in USD */ - function changeFactorySetupFee(uint256 _newSetupCost) public onlyOwner { - emit ChangeFactorySetupFee(setupCost, _newSetupCost, address(this)); + function changeSetupCost(uint256 _newSetupCost) public onlyOwner { + emit ChangeSetupCost(setupCost, _newSetupCost); setupCost = _newSetupCost; } /** * @notice Used to change the fee of the usage cost - * @param _newUsageCost new usage cost + * @param _newUsageCost new usage cost in USD */ - function changeFactoryUsageFee(uint256 _newUsageCost) public onlyOwner { - emit ChangeFactoryUsageFee(usageCost, _newUsageCost, address(this)); + function changeUsageCost(uint256 _newUsageCost) public onlyOwner { + emit ChangeUsageCost(usageCost, _newUsageCost); usageCost = _newUsageCost; } - /** - * @notice Used to change the fee of the subscription cost - * @param _newSubscriptionCost new subscription cost - */ - function changeFactorySubscriptionFee(uint256 _newSubscriptionCost) public onlyOwner { - emit ChangeFactorySubscriptionFee(monthlySubscriptionCost, _newSubscriptionCost, address(this)); - monthlySubscriptionCost = _newSubscriptionCost; - - } - /** * @notice Updates the title of the ModuleFactory * @param _newTitle New Title that will replace the old one. @@ -140,22 +135,34 @@ contract ModuleFactory is IModuleFactory, Ownable { /** * @notice Get the setup cost of the module */ - function getSetupCost() external view returns(uint256) { + function getSetupCost() public view returns (uint256) { return setupCost; } /** - * @notice Get the name of the Module - */ + * @notice Get the setup cost of the module + */ + function getSetupCostInPoly() public view returns (uint256) { + uint256 polyRate = IOracle(IPolymathRegistry(polymathRegistry).getAddress(POLY_ORACLE)).getPrice(); + return DecimalMath.div(setupCost, polyRate); + } + + /** + * @notice Get the name of the Module + */ function getName() public view returns(bytes32) { return name; } + + /** + * @notice Calculates fee in POLY + */ function _takeFee() internal returns(address) { - address polyToken = RegistryUpdater(msg.sender).polyToken(); - require(polyToken != address(0), "Invalid POLY token"); - if (setupCost > 0) { - require(IERC20(polyToken).transferFrom(msg.sender, owner(), setupCost), "Insufficient allowance for module fee"); + uint256 setupCostInPoly = getSetupCostInPoly(); + address polyToken = IPolymathRegistry(polymathRegistry).getAddress("PolyToken"); + if (setupCostInPoly > 0) { + require(IERC20(polyToken).transferFrom(msg.sender, owner(), setupCostInPoly), "Insufficient allowance for module fee"); } return polyToken; } diff --git a/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol b/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol index f1b52dd9f..646c739c8 100644 --- a/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol +++ b/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol @@ -14,17 +14,17 @@ contract GeneralPermissionManagerFactory is ModuleFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` + * @param _polymathRegistry Address of the Polymath registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost, - address _logicContract - ) - public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + address _logicContract, + address _polymathRegistry + ) + public + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { require(_logicContract != address(0), "Invalid address"); version = "1.0.0"; @@ -42,14 +42,14 @@ contract GeneralPermissionManagerFactory is ModuleFactory { */ function deploy( bytes calldata /* _data */ - ) - external - returns(address) + ) + external + returns(address) { address polyToken = _takeFee(); address permissionManager = address(new GeneralPermissionManagerProxy(msg.sender, polyToken, logicContract)); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(address(permissionManager), getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(permissionManager, getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return permissionManager; } diff --git a/contracts/modules/STO/CappedSTOFactory.sol b/contracts/modules/STO/CappedSTOFactory.sol index abb32f9d5..1f6a63311 100644 --- a/contracts/modules/STO/CappedSTOFactory.sol +++ b/contracts/modules/STO/CappedSTOFactory.sol @@ -16,17 +16,17 @@ contract CappedSTOFactory is ModuleFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` + * @param _polymathRegistry Address of the Polymath registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost, - address _logicContract - ) - public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + address _logicContract, + address _polymathRegistry + ) + public + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { require(_logicContract != address(0), "Invalid address"); version = "2.1.0"; @@ -54,8 +54,8 @@ contract CappedSTOFactory is ModuleFactory { (success, ) = cappedSTO.call(_data); require(success, "Unsuccessfull call"); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(cappedSTO, getName(), address(this), msg.sender, setupCost, now); - return cappedSTO; + emit GenerateModuleFromFactory(address(cappedSTO), getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); + return address(cappedSTO); } /** diff --git a/contracts/modules/STO/DummySTOFactory.sol b/contracts/modules/STO/DummySTOFactory.sol index ee84a4251..57cd7eea6 100644 --- a/contracts/modules/STO/DummySTOFactory.sol +++ b/contracts/modules/STO/DummySTOFactory.sol @@ -16,17 +16,17 @@ contract DummySTOFactory is ModuleFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` + * @param _polymathRegistry Address of the Polymath registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost, - address _logicContract - ) - public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + address _logicContract, + address _polymathRegistry + ) + public + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { version = "1.0.0"; name = "DummySTO"; @@ -53,7 +53,7 @@ contract DummySTOFactory is ModuleFactory { (success, ) = dummySTO.call(_data); require(success, "Unsuccessfull call"); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(dummySTO, getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(dummySTO, getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return dummySTO; } diff --git a/contracts/modules/STO/PreSaleSTOFactory.sol b/contracts/modules/STO/PreSaleSTOFactory.sol index e3ae055d1..cfa617faa 100644 --- a/contracts/modules/STO/PreSaleSTOFactory.sol +++ b/contracts/modules/STO/PreSaleSTOFactory.sol @@ -16,17 +16,17 @@ contract PreSaleSTOFactory is ModuleFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` + * @param _polymathRegistry Address of the Polymath registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost, - address _logicContract - ) - public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + address _logicContract, + address _polymathRegistry + ) + public + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { require(_logicContract != address(0), "Invalid address"); version = "1.0.0"; @@ -54,7 +54,7 @@ contract PreSaleSTOFactory is ModuleFactory { (success, ) = preSaleSTO.call(_data); require(success, "Unsuccessfull call"); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(preSaleSTO, getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(preSaleSTO, getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return preSaleSTO; } diff --git a/contracts/modules/STO/USDTieredSTOFactory.sol b/contracts/modules/STO/USDTieredSTOFactory.sol index e691bce09..cec5420c0 100644 --- a/contracts/modules/STO/USDTieredSTOFactory.sol +++ b/contracts/modules/STO/USDTieredSTOFactory.sol @@ -15,16 +15,17 @@ contract USDTieredSTOFactory is ModuleFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module + * @param _logicContract Contract address that contains the logic related to `description` + * @param _polymathRegistry Address of the Polymath registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost, - address _logicContract + address _logicContract, + address _polymathRegistry ) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { require(_logicContract != address(0), "0x address is not allowed"); logicContract = _logicContract; @@ -51,7 +52,7 @@ contract USDTieredSTOFactory is ModuleFactory { (success, ) = usdTieredSTO.call(_data); require(success, "Unsuccessfull call"); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(usdTieredSTO, getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(usdTieredSTO, getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return usdTieredSTO; } diff --git a/contracts/modules/TransferManager/CountTransferManagerFactory.sol b/contracts/modules/TransferManager/CountTransferManagerFactory.sol index f045fabc5..06873ac5a 100644 --- a/contracts/modules/TransferManager/CountTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/CountTransferManagerFactory.sol @@ -16,16 +16,16 @@ contract CountTransferManagerFactory is ModuleFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` + * @param _polymathRegistry Address of the Polymath registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost, - address _logicContract - ) - public ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + address _logicContract, + address _polymathRegistry + ) + public ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { require(_logicContract != address(0), "Invalid address"); version = "2.1.0"; @@ -51,9 +51,8 @@ contract CountTransferManagerFactory is ModuleFactory { (success, ) = countTransferManager.call(_data); require(success, "Unsuccessful call"); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(countTransferManager, getName(), address(this), msg.sender, setupCost, now); - return countTransferManager; - + emit GenerateModuleFromFactory(address(countTransferManager), getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); + return address(countTransferManager); } /** diff --git a/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol b/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol index 4c6d4a130..5718ffbbc 100644 --- a/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol @@ -13,17 +13,17 @@ contract GeneralTransferManagerFactory is ModuleFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` + * @param _polymathRegistry Address of the Polymath registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost, - address _logicContract - ) - public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + address _logicContract, + address _polymathRegistry + ) + public + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { require(_logicContract != address(0), "Invalid logic contract"); version = "2.1.0"; @@ -41,14 +41,14 @@ contract GeneralTransferManagerFactory is ModuleFactory { */ function deploy( bytes calldata /* _data */ - ) - external - returns(address) + ) + external + returns(address) { address polyToken = _takeFee(); GeneralTransferManagerProxy generalTransferManager = new GeneralTransferManagerProxy(msg.sender, polyToken, logicContract); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(address(generalTransferManager), getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(address(generalTransferManager), getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return address(generalTransferManager); } diff --git a/contracts/modules/TransferManager/ManualApprovalTransferManagerFactory.sol b/contracts/modules/TransferManager/ManualApprovalTransferManagerFactory.sol index 6d50e9e2f..9a1f2e7df 100644 --- a/contracts/modules/TransferManager/ManualApprovalTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/ManualApprovalTransferManagerFactory.sol @@ -14,17 +14,17 @@ contract ManualApprovalTransferManagerFactory is ModuleFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` + * @param _polymathRegistry Address of the Polymath registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost, - address _logicContract + address _logicContract, + address _polymathRegistry ) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { require(_logicContract != address(0), "Invalid address"); version = "2.1.0"; @@ -49,7 +49,7 @@ contract ManualApprovalTransferManagerFactory is ModuleFactory { address polyToken = _takeFee(); ManualApprovalTransferManagerProxy manualTransferManager = new ManualApprovalTransferManagerProxy(msg.sender, polyToken, logicContract); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(address(manualTransferManager), getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(address(manualTransferManager), getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return address(manualTransferManager); } diff --git a/contracts/modules/TransferManager/PercentageTransferManagerFactory.sol b/contracts/modules/TransferManager/PercentageTransferManagerFactory.sol index 4bed16c4d..3154022e3 100644 --- a/contracts/modules/TransferManager/PercentageTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/PercentageTransferManagerFactory.sol @@ -16,17 +16,17 @@ contract PercentageTransferManagerFactory is ModuleFactory { * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module - * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` + * @param _polymathRegistry Address of the Polymath registry */ constructor( uint256 _setupCost, uint256 _usageCost, - uint256 _subscriptionCost, - address _logicContract - ) - public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + address _logicContract, + address _polymathRegistry + ) + public + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { require(_logicContract != address(0), "Invalid address"); version = "1.0.0"; @@ -52,9 +52,8 @@ contract PercentageTransferManagerFactory is ModuleFactory { (success, ) = percentageTransferManager.call(_data); require(success, "Unsuccessful call"); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(percentageTransferManager, getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(percentageTransferManager, getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return percentageTransferManager; - } /** diff --git a/contracts/modules/TransferManager/VolumeRestrictionTMFactory.sol b/contracts/modules/TransferManager/VolumeRestrictionTMFactory.sol index b105dba6f..77ed2c7bd 100644 --- a/contracts/modules/TransferManager/VolumeRestrictionTMFactory.sol +++ b/contracts/modules/TransferManager/VolumeRestrictionTMFactory.sol @@ -12,9 +12,13 @@ contract VolumeRestrictionTMFactory is ModuleFactory { /** * @notice Constructor + * @param _setupCost Setup cost of the module + * @param _usageCost Usage cost of the module + * @param _logicContract Contract address that contains the logic related to `description` + * @param _polymathRegistry Address of the Polymath registry */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor (uint256 _setupCost, uint256 _usageCost, address _logicContract, address _polymathRegistry) public + ModuleFactory(_setupCost, _usageCost, _polymathRegistry) { require(_logicContract != address(0), "Invalid address"); version = "1.0.0"; @@ -35,7 +39,7 @@ contract VolumeRestrictionTMFactory is ModuleFactory { address polyToken = _takeFee(); address volumeRestrictionTransferManager = address(new VolumeRestrictionTMProxy(msg.sender, address(polyToken), logicContract)); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(volumeRestrictionTransferManager, getName(), address(this), msg.sender, setupCost, now); + emit GenerateModuleFromFactory(volumeRestrictionTransferManager, getName(), address(this), msg.sender, getSetupCost(), getSetupCostInPoly(), now); return volumeRestrictionTransferManager; } diff --git a/contracts/tokens/SecurityToken.sol b/contracts/tokens/SecurityToken.sol index 381209b7a..1bb6c9534 100644 --- a/contracts/tokens/SecurityToken.sol +++ b/contracts/tokens/SecurityToken.sol @@ -235,7 +235,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater IModuleRegistry(moduleRegistry).useModule(_moduleFactory); IModuleFactory moduleFactory = IModuleFactory(_moduleFactory); uint8[] memory moduleTypes = moduleFactory.getTypes(); - uint256 moduleCost = moduleFactory.getSetupCost(); + uint256 moduleCost = moduleFactory.getSetupCostInPoly(); require(moduleCost <= _maxCost, "Invalid cost"); //Approve fee for module ERC20(polyToken).approve(_moduleFactory, moduleCost); diff --git a/migrations/2_deploy_contracts.js b/migrations/2_deploy_contracts.js index d6bd8efcd..dae22700d 100644 --- a/migrations/2_deploy_contracts.js +++ b/migrations/2_deploy_contracts.js @@ -270,54 +270,54 @@ module.exports = function(deployer, network, accounts) { .then(() => { // B) Deploy the GeneralTransferManagerFactory Contract (Factory used to generate the GeneralTransferManager contract and this // manager attach with the securityToken contract at the time of deployment) - return deployer.deploy(GeneralTransferManagerFactory, new BN(0), new BN(0), new BN(0), GeneralTransferManagerLogic.address, { + return deployer.deploy(GeneralTransferManagerFactory, new BN(0), new BN(0), GeneralTransferManagerLogic.address, polymathRegistry.address, { from: PolymathAccount }); }) .then(() => { // C) Deploy the GeneralPermissionManagerFactory Contract (Factory used to generate the GeneralPermissionManager contract and // this manager attach with the securityToken contract at the time of deployment) - return deployer.deploy(GeneralPermissionManagerFactory, new BN(0), new BN(0), new BN(0), GeneralPermissionManagerLogic.address, { + return deployer.deploy(GeneralPermissionManagerFactory, new BN(0), new BN(0), GeneralPermissionManagerLogic.address, polymathRegistry.address, { from: PolymathAccount }); }) .then(() => { // D) Deploy the CountTransferManagerFactory Contract (Factory used to generate the CountTransferManager contract use // to track the counts of the investors of the security token) - return deployer.deploy(CountTransferManagerFactory, new BN(0), new BN(0), new BN(0), CountTransferManagerLogic.address, { + return deployer.deploy(CountTransferManagerFactory, new BN(0), new BN(0), CountTransferManagerLogic.address, polymathRegistry.address, { from: PolymathAccount }); }) .then(() => { // D) Deploy the PercentageTransferManagerFactory Contract (Factory used to generate the PercentageTransferManager contract use // to track the percentage of investment the investors could do for a particular security token) - return deployer.deploy(PercentageTransferManagerFactory, new BN(0), new BN(0), new BN(0), PercentageTransferManagerLogic.address, { + return deployer.deploy(PercentageTransferManagerFactory, new BN(0), new BN(0), PercentageTransferManagerLogic.address, polymathRegistry.address, { from: PolymathAccount }); }) .then(() => { // D) Deploy the EtherDividendCheckpointFactory Contract (Factory used to generate the EtherDividendCheckpoint contract use // to provide the functionality of the dividend in terms of ETH) - return deployer.deploy(EtherDividendCheckpointFactory, new BN(0), new BN(0), new BN(0), EtherDividendCheckpointLogic.address, { + return deployer.deploy(EtherDividendCheckpointFactory, new BN(0), new BN(0), EtherDividendCheckpointLogic.address, polymathRegistry.address, { from: PolymathAccount }); }) .then(() => { // D) Deploy the ERC20DividendCheckpointFactory Contract (Factory used to generate the ERC20DividendCheckpoint contract use // to provide the functionality of the dividend in terms of ERC20 token) - return deployer.deploy(ERC20DividendCheckpointFactory, new BN(0), new BN(0), new BN(0), ERC20DividendCheckpointLogic.address, { + return deployer.deploy(ERC20DividendCheckpointFactory, new BN(0), new BN(0), ERC20DividendCheckpointLogic.address, polymathRegistry.address, { from: PolymathAccount }); }) .then(() => { // D) Deploy the VolumeRestrictionTMFactory Contract (Factory used to generate the VolumeRestrictionTM contract use // to provide the functionality of restricting the token volume) - return deployer.deploy(VolumeRestrictionTMFactory, new BN(0), new BN(0), new BN(0), VolumeRestrictionTMLogic.address, { from: PolymathAccount }); + return deployer.deploy(VolumeRestrictionTMFactory, new BN(0), new BN(0), VolumeRestrictionTMLogic.address, polymathRegistry.address, { from: PolymathAccount }); }) .then(() => { // D) Deploy the ManualApprovalTransferManagerFactory Contract (Factory used to generate the ManualApprovalTransferManager contract use // to manual approve the transfer that will overcome the other transfer restrictions) - return deployer.deploy(ManualApprovalTransferManagerFactory, new BN(0), new BN(0), new BN(0), ManualApprovalTransferManagerLogic.address, { + return deployer.deploy(ManualApprovalTransferManagerFactory, new BN(0), new BN(0), ManualApprovalTransferManagerLogic.address, polymathRegistry.address, { from: PolymathAccount }); }) @@ -457,7 +457,7 @@ module.exports = function(deployer, network, accounts) { }) .then(() => { // M) Deploy the CappedSTOFactory (Use to generate the CappedSTO contract which will used to collect the funds ). - return deployer.deploy(CappedSTOFactory, cappedSTOSetupCost, new BN(0), new BN(0), CappedSTOLogic.address, { from: PolymathAccount }); + return deployer.deploy(CappedSTOFactory, cappedSTOSetupCost, new BN(0), CappedSTOLogic.address, polymathRegistry.address, { from: PolymathAccount }); }) .then(() => { // N) Register the CappedSTOFactory in the ModuleRegistry to make the factory available at the protocol level. @@ -472,7 +472,7 @@ module.exports = function(deployer, network, accounts) { }) .then(() => { // H) Deploy the USDTieredSTOFactory (Use to generate the USDTieredSTOFactory contract which will used to collect the funds ). - return deployer.deploy(USDTieredSTOFactory, usdTieredSTOSetupCost, new BN(0), new BN(0), USDTieredSTOLogic.address, { from: PolymathAccount }); + return deployer.deploy(USDTieredSTOFactory, usdTieredSTOSetupCost, new BN(0), USDTieredSTOLogic.address, polymathRegistry.address, { from: PolymathAccount }); }) .then(() => { // I) Register the USDTieredSTOFactory in the ModuleRegistry to make the factory available at the protocol level. diff --git a/test/b_capped_sto.js b/test/b_capped_sto.js index d98271c7e..f0b7cb24d 100644 --- a/test/b_capped_sto.js +++ b/test/b_capped_sto.js @@ -80,7 +80,7 @@ contract("CappedSTO", async (accounts) => { const budget = 0; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); // Capped STO details let startTime_ETH1; @@ -101,7 +101,8 @@ contract("CappedSTO", async (accounts) => { const P_fundRaiseType = 1; const P_rate = new BN(web3.utils.toWei("5")); const cappedSTOSetupCost = new BN(web3.utils.toWei("20000", "ether")); - const maxCost = cappedSTOSetupCost; + const cappedSTOSetupCostPOLY = new BN(web3.utils.toWei("80000", "ether")); + const maxCost = cappedSTOSetupCostPOLY; const STOParameters = ["uint256", "uint256", "uint256", "uint256", "uint8[]", "address"]; let currentTime; @@ -193,7 +194,7 @@ contract("CappedSTO", async (accounts) => { it("Should fail to launch the STO due to security token doesn't have the sufficient POLY", async () => { let startTime = await latestTime() + duration.days(1); let endTime = startTime + duration.days(30); - await I_PolyToken.getTokens(cappedSTOSetupCost, token_owner); + await I_PolyToken.getTokens(cappedSTOSetupCostPOLY, token_owner); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, new BN(0), [E_fundRaiseType], account_fundsReceiver]); @@ -203,7 +204,7 @@ contract("CappedSTO", async (accounts) => { it("Should fail to launch the STO due to rate is 0", async () => { let startTime = await latestTime() + duration.days(1); let endTime = startTime + duration.days(30); - await I_PolyToken.transfer(I_SecurityToken_ETH.address, cappedSTOSetupCost, { from: token_owner }); + await I_PolyToken.transfer(I_SecurityToken_ETH.address, cappedSTOSetupCostPOLY, { from: token_owner }); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, new BN(0), [E_fundRaiseType], account_fundsReceiver]); @@ -497,8 +498,8 @@ contract("CappedSTO", async (accounts) => { startTime_ETH2 = await latestTime() + duration.days(1); endTime_ETH2 = startTime_ETH2 + duration.days(30); - await I_PolyToken.getTokens(cappedSTOSetupCost, token_owner); - await I_PolyToken.transfer(I_SecurityToken_ETH.address, cappedSTOSetupCost, { from: token_owner }); + await I_PolyToken.getTokens(cappedSTOSetupCostPOLY, token_owner); + await I_PolyToken.transfer(I_SecurityToken_ETH.address, cappedSTOSetupCostPOLY, { from: token_owner }); let bytesSTO = encodeModuleCall(STOParameters, [ startTime_ETH2, endTime_ETH2, @@ -574,9 +575,10 @@ contract("CappedSTO", async (accounts) => { const MAX_MODULES = 10; let startTime = await latestTime() + duration.days(1); let endTime = startTime + duration.days(30); - - await I_PolyToken.getTokens(new BN(cappedSTOSetupCost.mul(new BN(19))), token_owner); - await I_PolyToken.transfer(I_SecurityToken_ETH.address, new BN(cappedSTOSetupCost.mul(new BN(19))), { from: token_owner }); + for (var i = 0; i < MAX_MODULES; i++) { + await I_PolyToken.getTokens(new BN(cappedSTOSetupCostPOLY), token_owner); + }; + await I_PolyToken.transfer(I_SecurityToken_ETH.address, new BN(cappedSTOSetupCostPOLY.mul(new BN(MAX_MODULES))), { from: token_owner }); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, [E_fundRaiseType], account_fundsReceiver]); for (var STOIndex = 2; STOIndex < MAX_MODULES; STOIndex++) { @@ -639,8 +641,8 @@ contract("CappedSTO", async (accounts) => { startTime_POLY1 = await latestTime() + duration.days(2); endTime_POLY1 = startTime_POLY1 + duration.days(30); - await I_PolyToken.getTokens(cappedSTOSetupCost, token_owner); - await I_PolyToken.transfer(I_SecurityToken_POLY.address, cappedSTOSetupCost, { from: token_owner }); + await I_PolyToken.getTokens(cappedSTOSetupCostPOLY, token_owner); + await I_PolyToken.transfer(I_SecurityToken_POLY.address, cappedSTOSetupCostPOLY, { from: token_owner }); let bytesSTO = encodeModuleCall(STOParameters, [ startTime_POLY1, @@ -715,6 +717,7 @@ contract("CappedSTO", async (accounts) => { (await I_SecurityToken_POLY.balanceOf(account_investor1)).div(new BN(10).pow(new BN(18))).toNumber(), 5000 ); + }); it("Verification of the event Token Purchase", async () => { @@ -821,6 +824,7 @@ contract("CappedSTO", async (accounts) => { describe("Test cases for the CappedSTOFactory", async () => { it("should get the exact details of the factory", async () => { assert.equal((await I_CappedSTOFactory.getSetupCost.call()).toString(), cappedSTOSetupCost.toString()); + assert.equal((await I_CappedSTOFactory.getSetupCostInPoly.call()).toString(), cappedSTOSetupCostPOLY.toString()); assert.equal((await I_CappedSTOFactory.getTypes.call())[0], 3); assert.equal(web3.utils.hexToString(await I_CappedSTOFactory.getName.call()), "CappedSTO", "Wrong Module added"); assert.equal( @@ -918,8 +922,8 @@ contract("CappedSTO", async (accounts) => { startTime_POLY2 = await latestTime() + duration.days(1); endTime_POLY2 = startTime_POLY2 + duration.days(30); - await I_PolyToken.getTokens(cappedSTOSetupCost, token_owner); - await I_PolyToken.transfer(I_SecurityToken_POLY.address, cappedSTOSetupCost, { from: token_owner }); + await I_PolyToken.getTokens(cappedSTOSetupCostPOLY, token_owner); + await I_PolyToken.transfer(I_SecurityToken_POLY.address, cappedSTOSetupCostPOLY, { from: token_owner }); let bytesSTO = encodeModuleCall(STOParameters, [ startTime_POLY2, diff --git a/test/c_checkpoints.js b/test/c_checkpoints.js index d50620db6..f115d9c1c 100644 --- a/test/c_checkpoints.js +++ b/test/c_checkpoints.js @@ -59,7 +59,7 @@ contract("Checkpoints", async function(accounts) { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); before(async () => { fromTime = await latestTime(); diff --git a/test/d_count_transfer_manager.js b/test/d_count_transfer_manager.js index d6de7c581..a742f8990 100644 --- a/test/d_count_transfer_manager.js +++ b/test/d_count_transfer_manager.js @@ -65,7 +65,7 @@ contract("CountTransferManager", async (accounts) => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); // CountTransferManager details const holderCount = 2; // Maximum number of token holders @@ -156,9 +156,9 @@ contract("CountTransferManager", async (accounts) => { }); it("Should successfully attach the CountTransferManager factory with the security token", async () => { - await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000", "ether")), token_owner); await catchRevert( - I_SecurityToken.addModule(P_CountTransferManagerFactory.address, bytesSTO, new BN(web3.utils.toWei("500", "ether")), new BN(0), { + I_SecurityToken.addModule(P_CountTransferManagerFactory.address, bytesSTO, new BN(web3.utils.toWei("2000", "ether")), new BN(0), { from: token_owner }) ); @@ -166,11 +166,11 @@ contract("CountTransferManager", async (accounts) => { it("Should successfully attach the CountTransferManager factory with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("500", "ether")), { from: token_owner }); + await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("2000", "ether")), { from: token_owner }); const tx = await I_SecurityToken.addModule( P_CountTransferManagerFactory.address, bytesSTO, - new BN(web3.utils.toWei("500", "ether")), + new BN(web3.utils.toWei("2000", "ether")), new BN(0), { from: token_owner } ); @@ -434,9 +434,9 @@ contract("CountTransferManager", async (accounts) => { }); it("Should successfully attach the CountTransferManager factory with the security token", async () => { - await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000", "ether")), token_owner); await catchRevert( - I_SecurityToken2.addModule(P_CountTransferManagerFactory.address, bytesSTO, new BN(web3.utils.toWei("500", "ether")), new BN(0), { + I_SecurityToken2.addModule(P_CountTransferManagerFactory.address, bytesSTO, new BN(web3.utils.toWei("2000", "ether")), new BN(0), { from: token_owner }) ); @@ -496,37 +496,26 @@ contract("CountTransferManager", async (accounts) => { describe("Test cases for the ModuleFactory", async () => { it("Should successfully change the SetupCost -- fail beacuse of bad owner", async () => { await catchRevert( - I_CountTransferManagerFactory.changeFactorySetupFee(new BN(web3.utils.toWei("500")), { from: account_investor3 }) + I_CountTransferManagerFactory.changeSetupCost(new BN(web3.utils.toWei("500")), { from: account_investor3 }) ); }); it("Should successfully change the setupCost", async () => { - await I_CountTransferManagerFactory.changeFactorySetupFee(new BN(web3.utils.toWei("800")), { from: account_polymath }); + await I_CountTransferManagerFactory.changeSetupCost(new BN(web3.utils.toWei("800")), { from: account_polymath }); assert.equal((await I_CountTransferManagerFactory.getSetupCost.call()).toString(), new BN(web3.utils.toWei("800")).toString()); }); it("Should successfully change the usage fee -- fail beacuse of bad owner", async () => { await catchRevert( - I_CountTransferManagerFactory.changeFactoryUsageFee(new BN(web3.utils.toWei("500")), { from: account_investor3 }) + I_CountTransferManagerFactory.changeUsageCost(new BN(web3.utils.toWei("500")), { from: account_investor3 }) ); }); it("Should successfully change the usage fee", async () => { - await I_CountTransferManagerFactory.changeFactoryUsageFee(new BN(web3.utils.toWei("800")), { from: account_polymath }); + await I_CountTransferManagerFactory.changeUsageCost(new BN(web3.utils.toWei("800")), { from: account_polymath }); assert.equal((await I_CountTransferManagerFactory.usageCost.call()).toString(), new BN(web3.utils.toWei("800")).toString()); }); - it("Should successfully change the subscription fee -- fail beacuse of bad owner", async () => { - await catchRevert( - I_CountTransferManagerFactory.changeFactorySubscriptionFee(new BN(web3.utils.toWei("500")), { from: account_investor3 }) - ); - }); - - it("Should successfully change the subscription fee", async () => { - await I_CountTransferManagerFactory.changeFactorySubscriptionFee(new BN(web3.utils.toWei("800")), { from: account_polymath }); - assert.equal((await I_CountTransferManagerFactory.monthlySubscriptionCost.call()), new BN(web3.utils.toWei("800")).toString()); - }); - it("Should successfully change the version of the factory -- failed because of bad owner", async () => { await catchRevert(I_CountTransferManagerFactory.changeVersion("5.0.0", { from: account_investor3 })); }); diff --git a/test/e_erc20_dividends.js b/test/e_erc20_dividends.js index f17bd200a..cc1f8f891 100644 --- a/test/e_erc20_dividends.js +++ b/test/e_erc20_dividends.js @@ -70,7 +70,7 @@ contract("ERC20DividendCheckpoint", async (accounts) => { const managerDetails = web3.utils.fromAscii("Hello"); // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); const one_address = "0x0000000000000000000000000000000000000001"; const address_zero = "0x0000000000000000000000000000000000000000"; @@ -168,7 +168,7 @@ contract("ERC20DividendCheckpoint", async (accounts) => { it("Should successfully attach the ERC20DividendCheckpoint with the security token - fail insufficient payment", async () => { let bytesDividend = encodeModuleCall(DividendParameters, [wallet]); await catchRevert( - I_SecurityToken.addModule(P_ERC20DividendCheckpointFactory.address, bytesDividend, new BN(web3.utils.toWei("500", "ether")), new BN(0), { + I_SecurityToken.addModule(P_ERC20DividendCheckpointFactory.address, bytesDividend, new BN(web3.utils.toWei("2000", "ether")), new BN(0), { from: token_owner }) ); @@ -176,10 +176,10 @@ contract("ERC20DividendCheckpoint", async (accounts) => { it("Should successfully attach the ERC20DividendCheckpoint with the security token with budget", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); - await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("500", "ether")), { from: token_owner }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000", "ether")), token_owner); + await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("2000", "ether")), { from: token_owner }); let bytesDividend = encodeModuleCall(DividendParameters, [wallet]); - const tx = await I_SecurityToken.addModule(P_ERC20DividendCheckpointFactory.address, bytesDividend, new BN(web3.utils.toWei("500", "ether")), new BN(0), { + const tx = await I_SecurityToken.addModule(P_ERC20DividendCheckpointFactory.address, bytesDividend, new BN(web3.utils.toWei("2000", "ether")), new BN(0), { from: token_owner }); assert.equal(tx.logs[3].args._types[0].toNumber(), checkpointKey, "ERC20DividendCheckpoint doesn't get deployed"); diff --git a/test/f_ether_dividends.js b/test/f_ether_dividends.js index dae87c572..a6ace6440 100644 --- a/test/f_ether_dividends.js +++ b/test/f_ether_dividends.js @@ -71,7 +71,7 @@ contract("EtherDividendCheckpoint", async (accounts) => { const DividendParameters = ["address"]; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); let currentTime; @@ -160,10 +160,10 @@ contract("EtherDividendCheckpoint", async (accounts) => { }); it("Should successfully attach the ERC20DividendCheckpoint with the security token", async () => { - await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000", "ether")), token_owner); let bytesDividend = encodeModuleCall(DividendParameters, [wallet]); await catchRevert( - I_SecurityToken.addModule(P_EtherDividendCheckpointFactory.address, bytesDividend, new BN(web3.utils.toWei("500", "ether")), new BN(0), { + I_SecurityToken.addModule(P_EtherDividendCheckpointFactory.address, bytesDividend, new BN(web3.utils.toWei("2000", "ether")), new BN(0), { from: token_owner }) ); @@ -171,9 +171,9 @@ contract("EtherDividendCheckpoint", async (accounts) => { it("Should successfully attach the EtherDividendCheckpoint with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("500", "ether")), { from: token_owner }); + await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("2000", "ether")), { from: token_owner }); let bytesDividend = encodeModuleCall(DividendParameters, [wallet]); - const tx = await I_SecurityToken.addModule(P_EtherDividendCheckpointFactory.address, bytesDividend, new BN(web3.utils.toWei("500", "ether")), new BN(0), { + const tx = await I_SecurityToken.addModule(P_EtherDividendCheckpointFactory.address, bytesDividend, new BN(web3.utils.toWei("2000", "ether")), new BN(0), { from: token_owner }); assert.equal(tx.logs[3].args._types[0].toNumber(), checkpointKey, "EtherDividendCheckpoint doesn't get deployed"); diff --git a/test/g_general_permission_manager.js b/test/g_general_permission_manager.js index 6792d6d17..b339376f2 100644 --- a/test/g_general_permission_manager.js +++ b/test/g_general_permission_manager.js @@ -66,7 +66,7 @@ contract("GeneralPermissionManager", async (accounts) => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); let currentTime; const address_zero = "0x0000000000000000000000000000000000000000"; @@ -136,7 +136,7 @@ contract("GeneralPermissionManager", async (accounts) => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token @@ -158,9 +158,9 @@ contract("GeneralPermissionManager", async (accounts) => { it("Should successfully attach the General permission manager factory with the security token -- failed because Token is not paid", async () => { let errorThrown = false; - await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000", "ether")), token_owner); await catchRevert( - I_SecurityToken.addModule(P_GeneralPermissionManagerFactory.address, "0x", new BN(web3.utils.toWei("500", "ether")), new BN(0), { + I_SecurityToken.addModule(P_GeneralPermissionManagerFactory.address, "0x", new BN(web3.utils.toWei("2000", "ether")), new BN(0), { from: token_owner }) ); @@ -168,11 +168,11 @@ contract("GeneralPermissionManager", async (accounts) => { it("Should successfully attach the General permission manager factory with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("500", "ether")), { from: token_owner }); + await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("2000", "ether")), { from: token_owner }); const tx = await I_SecurityToken.addModule( P_GeneralPermissionManagerFactory.address, "0x", - new BN(web3.utils.toWei("500", "ether")), + new BN(web3.utils.toWei("2000", "ether")), new BN(0), { from: token_owner } ); diff --git a/test/h_general_transfer_manager.js b/test/h_general_transfer_manager.js index 03c22b23f..3feae6422 100644 --- a/test/h_general_transfer_manager.js +++ b/test/h_general_transfer_manager.js @@ -72,7 +72,7 @@ contract("GeneralTransferManager", async (accounts) => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); // Dummy STO details let startTime; @@ -189,14 +189,14 @@ contract("GeneralTransferManager", async (accounts) => { it("Should attach the paid GTM -- failed because of no tokens", async () => { await catchRevert( - I_SecurityToken.addModule(P_GeneralTransferManagerFactory.address, "0x0", new BN(web3.utils.toWei("500")), new BN(0), { from: account_issuer }) + I_SecurityToken.addModule(P_GeneralTransferManagerFactory.address, "0x0", new BN(web3.utils.toWei("2000")), new BN(0), { from: account_issuer }) ); }); it("Should attach the paid GTM", async () => { let snap_id = await takeSnapshot(); - await I_PolyToken.getTokens(new BN(web3.utils.toWei("500")), I_SecurityToken.address); - await I_SecurityToken.addModule(P_GeneralTransferManagerFactory.address, "0x0", new BN(web3.utils.toWei("500")), new BN(0), { + await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000")), I_SecurityToken.address); + await I_SecurityToken.addModule(P_GeneralTransferManagerFactory.address, "0x0", new BN(web3.utils.toWei("2000")), new BN(0), { from: account_issuer }); await revertToSnapshot(snap_id); @@ -257,7 +257,7 @@ contract("GeneralTransferManager", async (accounts) => { someString ]); await catchRevert( - I_SecurityToken.addModule(P_DummySTOFactory.address, bytesSTO, new BN(web3.utils.toWei("500")), new BN(0), { from: token_owner }) + I_SecurityToken.addModule(P_DummySTOFactory.address, bytesSTO, new BN(web3.utils.toWei("2000")), new BN(0), { from: token_owner }) ); }); @@ -269,8 +269,8 @@ contract("GeneralTransferManager", async (accounts) => { cap, someString ]); - await I_PolyToken.getTokens(new BN(web3.utils.toWei("500")), I_SecurityToken.address); - const tx = await I_SecurityToken.addModule(P_DummySTOFactory.address, bytesSTO, new BN(web3.utils.toWei("500")), new BN(0), { + await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000")), I_SecurityToken.address); + const tx = await I_SecurityToken.addModule(P_DummySTOFactory.address, bytesSTO, new BN(web3.utils.toWei("2000")), new BN(0), { from: token_owner }); assert.equal(tx.logs[3].args._types[0].toNumber(), stoKey, "DummySTO doesn't get deployed"); @@ -306,7 +306,7 @@ contract("GeneralTransferManager", async (accounts) => { }); it("Should successfully attach the permission manager factory with the security token", async () => { - const tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, new BN(0), new BN(0), new BN(0), { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "0x0", new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), delegateManagerKey, "GeneralPermissionManager doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), diff --git a/test/helpers/createInstances.js b/test/helpers/createInstances.js index f9d0ab10c..1c3a0fe6b 100644 --- a/test/helpers/createInstances.js +++ b/test/helpers/createInstances.js @@ -1,6 +1,7 @@ import { encodeProxyCall, encodeModuleCall } from "./encodeCall"; const PolymathRegistry = artifacts.require("./PolymathRegistry.sol"); +const MockOracle = artifacts.require("./MockOracle.sol"); const ModuleRegistry = artifacts.require("./ModuleRegistry.sol"); const ModuleRegistryProxy = artifacts.require("./ModuleRegistryProxy.sol"); const SecurityToken = artifacts.require("./SecurityToken.sol"); @@ -100,6 +101,8 @@ let I_STRProxied; let I_MRProxied; let I_STRGetter; let I_SignedTransferManagerFactory; +let I_USDOracle; +let I_POLYOracle; // Initial fee for ticker registry and security token registry const initRegFee = new BN(web3.utils.toWei("250")); @@ -129,6 +132,9 @@ export async function setUpPolymathNetwork(account_polymath, token_owner) { await setInPolymathRegistry(account_polymath); // STEP 9: Register the Modules with the ModuleRegistry contract await registerGTM(account_polymath); + // STEP 10: Add dummy oracles + await addOracles(account_polymath); + let tempArray = new Array( I_PolymathRegistry, I_PolyToken, @@ -146,6 +152,15 @@ export async function setUpPolymathNetwork(account_polymath, token_owner) { return Promise.all(tempArray); } +export async function addOracles(account_polymath) { + let USDETH = new BN(500).mul(new BN(10).pow(new BN(18))); // 500 USD/ETH + let USDPOLY = new BN(25).mul(new BN(10).pow(new BN(16))); // 0.25 USD/POLY + I_USDOracle = await MockOracle.new("0x0000000000000000000000000000000000000000", web3.utils.fromAscii("ETH"), web3.utils.fromAscii("USD"), USDETH, { from: account_polymath }); // 500 dollars per POLY + I_POLYOracle = await MockOracle.new(I_PolyToken.address, web3.utils.fromAscii("POLY"), web3.utils.fromAscii("USD"), USDPOLY, { from: account_polymath }); // 25 cents per POLY + await I_PolymathRegistry.changeAddress("EthUsdOracle", I_USDOracle.address, { from: account_polymath }); + await I_PolymathRegistry.changeAddress("PolyUsdOracle", I_POLYOracle.address, { from: account_polymath }); +} + export async function deployPolyRegistryAndPolyToken(account_polymath, token_owner) { // Step 0: Deploy the PolymathRegistry I_PolymathRegistry = await PolymathRegistry.new({ from: account_polymath }); @@ -195,7 +210,7 @@ async function deployGTMLogic(account_polymath) { } async function deployGTM(account_polymath) { - I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(new BN(0), new BN(0), new BN(0), I_GeneralTransferManagerLogic.address, { + I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(new BN(0), new BN(0), I_GeneralTransferManagerLogic.address, I_PolymathRegistry.address, { from: account_polymath }); @@ -266,7 +281,7 @@ async function registerAndVerifyByMR(factoryAdrress, owner, mr) { /// Deploy the TransferManagers export async function deployGTMAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { - I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(setupCost, new BN(0), new BN(0), I_GeneralTransferManagerLogic.address, { + I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(setupCost, new BN(0), I_GeneralTransferManagerLogic.address, I_PolymathRegistry.address, { from: accountPolymath }); @@ -284,7 +299,7 @@ export async function deployGTMAndVerifyed(accountPolymath, MRProxyInstance, set export async function deployVRTMAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { I_VolumeRestrictionTMLogic = await VolumeRestrictionTM.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_VolumeRestrictionTMFactory = await VolumeRestrictionTMFactory.new(setupCost, new BN(0), new BN(0), I_VolumeRestrictionTMLogic.address, { from: accountPolymath }); + I_VolumeRestrictionTMFactory = await VolumeRestrictionTMFactory.new(setupCost, new BN(0), I_VolumeRestrictionTMLogic.address, I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_VolumeRestrictionTMFactory.address.valueOf(), @@ -299,7 +314,7 @@ export async function deployVRTMAndVerifyed(accountPolymath, MRProxyInstance, se export async function deployCountTMAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { I_CountTransferManagerLogic = await CountTransferManager.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_CountTransferManagerFactory = await CountTransferManagerFactory.new(setupCost, new BN(0), new BN(0), I_CountTransferManagerLogic.address, { from: accountPolymath }); + I_CountTransferManagerFactory = await CountTransferManagerFactory.new(setupCost, new BN(0), I_CountTransferManagerLogic.address, I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_CountTransferManagerFactory.address.valueOf(), @@ -313,7 +328,7 @@ export async function deployCountTMAndVerifyed(accountPolymath, MRProxyInstance, export async function deployManualApprovalTMAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { I_ManualApprovalTransferManagerLogic = await ManualApprovalTransferManager.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_ManualApprovalTransferManagerFactory = await ManualApprovalTransferManagerFactory.new(setupCost, new BN(0), new BN(0), ManualApprovalTransferManager.address, { from: accountPolymath }); + I_ManualApprovalTransferManagerFactory = await ManualApprovalTransferManagerFactory.new(setupCost, new BN(0), ManualApprovalTransferManager.address, I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_ManualApprovalTransferManagerFactory.address.valueOf(), "0x0000000000000000000000000000000000000000", @@ -326,7 +341,7 @@ export async function deployManualApprovalTMAndVerifyed(accountPolymath, MRProxy export async function deployPercentageTMAndVerified(accountPolymath, MRProxyInstance, setupCost) { I_PercentageTransferManagerLogic = await PercentageTransferManager.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_PercentageTransferManagerFactory = await PercentageTransferManagerFactory.new(setupCost, new BN(0), new BN(0), I_PercentageTransferManagerLogic.address, { from: accountPolymath }); + I_PercentageTransferManagerFactory = await PercentageTransferManagerFactory.new(setupCost, new BN(0), I_PercentageTransferManagerLogic.address, I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_PercentageTransferManagerFactory.address.valueOf(), "0x0000000000000000000000000000000000000000", @@ -339,7 +354,7 @@ export async function deployPercentageTMAndVerified(accountPolymath, MRProxyInst export async function deployBlacklistTMAndVerified(accountPolymath, MRProxyInstance, setupCost) { - I_BlacklistTransferManagerFactory = await BlacklistTransferManagerFactory.new(setupCost, new BN(0), new BN(0), { from: accountPolymath }); + I_BlacklistTransferManagerFactory = await BlacklistTransferManagerFactory.new(setupCost, new BN(0), I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_BlacklistTransferManagerFactory.address.valueOf(), "0x0000000000000000000000000000000000000000", @@ -351,7 +366,7 @@ export async function deployBlacklistTMAndVerified(accountPolymath, MRProxyInsta } export async function deployLockupVolumeRTMAndVerified(accountPolymath, MRProxyInstance, setupCost) { - I_VolumeRestrictionTransferManagerFactory = await LockUpTransferManagerFactory.new(setupCost, new BN(0), new BN(0), { + I_VolumeRestrictionTransferManagerFactory = await LockUpTransferManagerFactory.new(setupCost, new BN(0), I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( @@ -365,7 +380,7 @@ export async function deployLockupVolumeRTMAndVerified(accountPolymath, MRProxyI } export async function deployScheduleCheckpointAndVerified(accountPolymath, MRProxyInstance, setupCost) { - I_ScheduledCheckpointFactory = await ScheduledCheckpointFactory.new(setupCost, new BN(0), new BN(0), { from: accountPolymath }); + I_ScheduledCheckpointFactory = await ScheduledCheckpointFactory.new(setupCost, new BN(0), I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_ScheduledCheckpointFactory.address.valueOf(), "0x0000000000000000000000000000000000000000", @@ -380,7 +395,7 @@ export async function deployScheduleCheckpointAndVerified(accountPolymath, MRPro export async function deployGPMAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { I_GeneralPermissionManagerLogic = await GeneralPermissionManager.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(setupCost, new BN(0), new BN(0), I_GeneralPermissionManagerLogic.address, { from: accountPolymath }); + I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(setupCost, new BN(0), I_GeneralPermissionManagerLogic.address, I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_GeneralPermissionManagerFactory.address.valueOf(), @@ -397,7 +412,7 @@ export async function deployGPMAndVerifyed(accountPolymath, MRProxyInstance, set export async function deployDummySTOAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { I_DummySTOLogic = await DummySTO.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_DummySTOFactory = await DummySTOFactory.new(setupCost, new BN(0), new BN(0), I_DummySTOLogic.address,{ from: accountPolymath }); + I_DummySTOFactory = await DummySTOFactory.new(setupCost, new BN(0), I_DummySTOLogic.address, I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_DummySTOFactory.address.valueOf(), @@ -410,7 +425,7 @@ export async function deployDummySTOAndVerifyed(accountPolymath, MRProxyInstance export async function deployCappedSTOAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { I_CappedSTOLogic = await CappedSTO.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_CappedSTOFactory = await CappedSTOFactory.new(setupCost, new BN(0), new BN(0), I_CappedSTOLogic.address, { from: accountPolymath }); + I_CappedSTOFactory = await CappedSTOFactory.new(setupCost, new BN(0), I_CappedSTOLogic.address, I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_CappedSTOFactory.address.valueOf(), "0x0000000000000000000000000000000000000000", @@ -423,7 +438,7 @@ export async function deployCappedSTOAndVerifyed(accountPolymath, MRProxyInstanc export async function deployPresaleSTOAndVerified(accountPolymath, MRProxyInstance, setupCost) { I_PreSaleSTOLogic = await PreSaleSTO.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_PreSaleSTOFactory = await PreSaleSTOFactory.new(setupCost, new BN(0), new BN(0), I_PreSaleSTOLogic.address, { from: accountPolymath }); + I_PreSaleSTOFactory = await PreSaleSTOFactory.new(setupCost, new BN(0), I_PreSaleSTOLogic.address, I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_PreSaleSTOFactory.address.valueOf(), @@ -442,7 +457,7 @@ export async function deployUSDTieredSTOAndVerified(accountPolymath, MRProxyInst { from: accountPolymath } ); - I_USDTieredSTOFactory = await USDTieredSTOFactory.new(setupCost, new BN(0), new BN(0), I_USDTieredSTOLogic.address, { from: accountPolymath }); + I_USDTieredSTOFactory = await USDTieredSTOFactory.new(setupCost, new BN(0), I_USDTieredSTOLogic.address, I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_USDTieredSTOFactory.address.valueOf(), @@ -462,7 +477,7 @@ export async function deployERC20DividendAndVerifyed(accountPolymath, MRProxyIns "0x0000000000000000000000000000000000000000", { from: accountPolymath } ); - I_ERC20DividendCheckpointFactory = await ERC20DividendCheckpointFactory.new(setupCost, new BN(0), new BN(0), I_ERC20DividendCheckpointLogic.address, { + I_ERC20DividendCheckpointFactory = await ERC20DividendCheckpointFactory.new(setupCost, new BN(0), I_ERC20DividendCheckpointLogic.address, I_PolymathRegistry.address, { from: accountPolymath }); @@ -481,7 +496,7 @@ export async function deployEtherDividendAndVerifyed(accountPolymath, MRProxyIns "0x0000000000000000000000000000000000000000", { from: accountPolymath } ); - I_EtherDividendCheckpointFactory = await EtherDividendCheckpointFactory.new(setupCost, new BN(0), new BN(0), I_EtherDividendCheckpointLogic.address, { + I_EtherDividendCheckpointFactory = await EtherDividendCheckpointFactory.new(setupCost, new BN(0), I_EtherDividendCheckpointLogic.address, I_PolymathRegistry.address, { from: accountPolymath }); @@ -498,7 +513,7 @@ export async function deployEtherDividendAndVerifyed(accountPolymath, MRProxyIns /// Deploy the Burn Module export async function deployRedemptionAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { - I_TrackedRedemptionFactory = await TrackedRedemptionFactory.new(setupCost, new BN(0), new BN(0), { from: accountPolymath }); + I_TrackedRedemptionFactory = await TrackedRedemptionFactory.new(setupCost, new BN(0), I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_TrackedRedemptionFactory.address.valueOf(), @@ -512,7 +527,7 @@ export async function deployRedemptionAndVerifyed(accountPolymath, MRProxyInstan export async function deployVestingEscrowWalletAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { I_VestingEscrowWalletLogic = await VestingEscrowWallet.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_VestingEscrowWalletFactory = await VestingEscrowWalletFactory.new(setupCost, new BN(0), new BN(0), I_VestingEscrowWalletLogic.address, { from: accountPolymath }); + I_VestingEscrowWalletFactory = await VestingEscrowWalletFactory.new(setupCost, new BN(0), I_VestingEscrowWalletLogic.address, I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_VestingEscrowWalletFactory.address.valueOf(), @@ -525,7 +540,7 @@ export async function deployVestingEscrowWalletAndVerifyed(accountPolymath, MRPr } export async function deployMockRedemptionAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { - I_MockBurnFactory = await MockBurnFactory.new(setupCost, new BN(0), new BN(0), { from: accountPolymath }); + I_MockBurnFactory = await MockBurnFactory.new(setupCost, new BN(0), I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_MockBurnFactory.address.valueOf(), @@ -538,7 +553,7 @@ export async function deployMockRedemptionAndVerifyed(accountPolymath, MRProxyIn } export async function deployMockWrongTypeRedemptionAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { - I_MockWrongTypeBurnFactory = await MockWrongTypeFactory.new(setupCost, new BN(0), new BN(0), { from: accountPolymath }); + I_MockWrongTypeBurnFactory = await MockWrongTypeFactory.new(setupCost, new BN(0), I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_MockWrongTypeBurnFactory.address.valueOf(), @@ -551,7 +566,7 @@ export async function deployMockWrongTypeRedemptionAndVerifyed(accountPolymath, } export async function deploySignedTMAndVerifyed(accountPolymath, MRProxyInstance, polyToken, setupCost) { - I_SignedTransferManagerFactory = await SignedTransferManagerFactory.new(setupCost, 0, 0, { from: accountPolymath }); + I_SignedTransferManagerFactory = await SignedTransferManagerFactory.new(setupCost, new BN(0), I_PolymathRegistry.address, { from: accountPolymath }); assert.notEqual( I_SignedTransferManagerFactory.address.valueOf(), "0x0000000000000000000000000000000000000000", @@ -560,4 +575,4 @@ export async function deploySignedTMAndVerifyed(accountPolymath, MRProxyInstance await registerAndVerifyByMR(I_SignedTransferManagerFactory.address, accountPolymath, MRProxyInstance); return new Array(I_SignedTransferManagerFactory); -} \ No newline at end of file +} diff --git a/test/i_Issuance.js b/test/i_Issuance.js index 7b62336bd..15f68fc2a 100644 --- a/test/i_Issuance.js +++ b/test/i_Issuance.js @@ -68,7 +68,7 @@ contract("Issuance", async (accounts) => { const one_address = "0x0000000000000000000000000000000000000001"; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); // Capped STO details //let startTime; // Start time will be 5000 seconds more than the latest time @@ -77,7 +77,8 @@ contract("Issuance", async (accounts) => { const rate = new BN(web3.utils.toWei("1000")); const fundRaiseType = [0]; const cappedSTOSetupCost = new BN(web3.utils.toWei("20000", "ether")); - const maxCost = cappedSTOSetupCost; + const cappedSTOSetupCostPOLY = new BN(web3.utils.toWei("80000", "ether")); + const maxCost = cappedSTOSetupCostPOLY; const STOParameters = ["uint256", "uint256", "uint256", "uint256", "uint8[]", "address"]; const STRProxyParameters = ["address", "address", "uint256", "uint256", "address", "address"]; const MRProxyParameters = ["address", "address"]; @@ -149,7 +150,7 @@ contract("Issuance", async (accounts) => { it("POLYMATH: Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: account_polymath }); - + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: account_polymath }); // Verify the successful generation of the security token @@ -183,8 +184,8 @@ contract("Issuance", async (accounts) => { account_fundsReceiver ]); - await I_PolyToken.getTokens(cappedSTOSetupCost, account_polymath); - await I_PolyToken.transfer(I_SecurityToken.address, cappedSTOSetupCost, { from: account_polymath }); + await I_PolyToken.getTokens(cappedSTOSetupCostPOLY, account_polymath); + await I_PolyToken.transfer(I_SecurityToken.address, cappedSTOSetupCostPOLY, { from: account_polymath }); const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: account_polymath }); diff --git a/test/j_manual_approval_transfer_manager.js b/test/j_manual_approval_transfer_manager.js index 26580b093..b46239995 100644 --- a/test/j_manual_approval_transfer_manager.js +++ b/test/j_manual_approval_transfer_manager.js @@ -72,7 +72,7 @@ contract("ManualApprovalTransferManager", accounts => { let approvalTime; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = web3.utils.toWei("1000"); const STOParameters = ["uint256", "uint256", "uint256", "uint256", "uint8[]", "address"]; let currentTime; @@ -225,9 +225,9 @@ contract("ManualApprovalTransferManager", accounts => { }); it("Should successfully attach the ManualApprovalTransferManager with the security token", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("500", "ether"), token_owner); + await I_PolyToken.getTokens(web3.utils.toWei("2000", "ether"), token_owner); await catchRevert( - I_SecurityToken.addModule(P_ManualApprovalTransferManagerFactory.address, "0x0", web3.utils.toWei("500", "ether"), 0, { + I_SecurityToken.addModule(P_ManualApprovalTransferManagerFactory.address, "0x0", web3.utils.toWei("2000", "ether"), 0, { from: token_owner }) ); @@ -235,11 +235,11 @@ contract("ManualApprovalTransferManager", accounts => { it("Should successfully attach the General permission manager factory with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, web3.utils.toWei("500", "ether"), { from: token_owner }); + await I_PolyToken.transfer(I_SecurityToken.address, web3.utils.toWei("2000", "ether"), { from: token_owner }); const tx = await I_SecurityToken.addModule( P_ManualApprovalTransferManagerFactory.address, "0x0", - web3.utils.toWei("500", "ether"), + web3.utils.toWei("2000", "ether"), 0, { from: token_owner } ); diff --git a/test/k_module_registry.js b/test/k_module_registry.js index efba2e2f2..036949f9a 100644 --- a/test/k_module_registry.js +++ b/test/k_module_registry.js @@ -80,7 +80,7 @@ contract("ModuleRegistry", async (accounts) => { const one_address = "0x0000000000000000000000000000000000000001"; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); // delagate details const delegateDetails = "I am delegate .."; @@ -253,14 +253,14 @@ contract("ModuleRegistry", async (accounts) => { }); it("Should fail in registering the module-- type = 0", async () => { - I_MockFactory = await MockFactory.new(new BN(0), new BN(0), new BN(0), address_zero, { from: account_polymath }); + I_MockFactory = await MockFactory.new(new BN(0), new BN(0), address_zero, I_PolymathRegistry.address, { from: account_polymath }); catchRevert(I_MRProxied.registerModule(I_MockFactory.address, { from: account_polymath })); }); it("Should fail to register the new module because msg.sender is not the owner of the module", async() => { I_CappedSTOLogic = await CappedSTO.new(address_zero, address_zero, { from: account_polymath }); - I_CappedSTOFactory3 = await CappedSTOFactory.new(new BN(0), new BN(0), new BN(0), I_CappedSTOLogic.address, { from: account_temp }); + I_CappedSTOFactory3 = await CappedSTOFactory.new(new BN(0), new BN(0), I_CappedSTOLogic.address, I_PolymathRegistry.address, { from: account_temp }); catchRevert(I_MRProxied.registerModule(I_CappedSTOFactory3.address, { from: token_owner })); }); @@ -282,7 +282,7 @@ contract("ModuleRegistry", async (accounts) => { }); it("Should successfully verify the module -- false", async () => { - I_CappedSTOFactory1 = await CappedSTOFactory.new(new BN(0), new BN(0), new BN(0), I_CappedSTOLogic.address, { from: account_polymath }); + I_CappedSTOFactory1 = await CappedSTOFactory.new(new BN(0), new BN(0), I_CappedSTOLogic.address, I_PolymathRegistry.address, { from: account_polymath }); await I_MRProxied.registerModule(I_CappedSTOFactory1.address, { from: account_polymath }); let tx = await I_MRProxied.verifyModule(I_CappedSTOFactory1.address, false, { from: account_polymath }); assert.equal(tx.logs[0].args._moduleFactory, I_CappedSTOFactory1.address, "Failed in verifying the module"); @@ -296,8 +296,8 @@ contract("ModuleRegistry", async (accounts) => { describe("Test cases for the useModule function of the module registry", async () => { it("Deploy the securityToken", async () => { - await I_PolyToken.getTokens(new BN(web3.utils.toWei("500")), account_issuer); - await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("500")), { from: account_issuer }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000")), account_issuer); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("2000")), { from: account_issuer }); await I_STRProxied.registerTicker(account_issuer, symbol, name, { from: account_issuer }); let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, true, { from: account_issuer }); assert.equal(tx.logs[2].args._ticker, symbol.toUpperCase()); @@ -313,7 +313,7 @@ contract("ModuleRegistry", async (accounts) => { }); it("Should fail to register module because custom modules not allowed", async () => { - I_CappedSTOFactory2 = await CappedSTOFactory.new(0, new BN(0), new BN(0), I_CappedSTOLogic.address, { from: token_owner }); + I_CappedSTOFactory2 = await CappedSTOFactory.new(new BN(0), new BN(0), I_CappedSTOLogic.address, I_PolymathRegistry.address, { from: token_owner }); assert.notEqual(I_CappedSTOFactory2.address.valueOf(), address_zero, "CappedSTOFactory contract was not deployed"); @@ -361,7 +361,7 @@ contract("ModuleRegistry", async (accounts) => { it("Should successfully add verified module", async () => { I_GeneralPermissionManagerLogic = await GeneralPermissionManager.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: account_polymath }); - I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(0, new BN(0), new BN(0), I_GeneralPermissionManagerLogic.address, { + I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(new BN(0), new BN(0), I_GeneralPermissionManagerLogic.address, I_PolymathRegistry.address, { from: account_polymath }); await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); @@ -371,7 +371,7 @@ contract("ModuleRegistry", async (accounts) => { }); it("Should failed in adding the TestSTOFactory module because not compatible with the current protocol version --lower", async () => { - I_TestSTOFactory = await TestSTOFactory.new(new BN(0), new BN(0), new BN(0), address_zero, { from: account_polymath }); + I_TestSTOFactory = await TestSTOFactory.new(new BN(0), new BN(0), address_zero, I_PolymathRegistry.address, { from: account_polymath }); await I_MRProxied.registerModule(I_TestSTOFactory.address, { from: account_polymath }); await I_MRProxied.verifyModule(I_TestSTOFactory.address, true, { from: account_polymath }); // Taking the snapshot the revert the changes from here @@ -398,8 +398,8 @@ contract("ModuleRegistry", async (accounts) => { // Generate the new securityToken let newSymbol = "toro"; - await I_PolyToken.getTokens(new BN(web3.utils.toWei("500")), account_issuer); - await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("500")), { from: account_issuer }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000")), account_issuer); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("2000")), { from: account_issuer }); await I_STRProxied.registerTicker(account_issuer, newSymbol, name, { from: account_issuer }); let tx = await I_STRProxied.generateSecurityToken(name, newSymbol, tokenDetails, true, { from: account_issuer }); assert.equal(tx.logs[2].args._ticker, newSymbol.toUpperCase()); diff --git a/test/l_percentage_transfer_manager.js b/test/l_percentage_transfer_manager.js index b27f34427..428f35b41 100644 --- a/test/l_percentage_transfer_manager.js +++ b/test/l_percentage_transfer_manager.js @@ -63,7 +63,7 @@ contract("PercentageTransferManager", async (accounts) => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); // PercentageTransferManager details const holderPercentage = 70 * 10 ** 16; // Maximum number of token holders @@ -252,9 +252,9 @@ contract("PercentageTransferManager", async (accounts) => { }); it("Should successfully attach the PercentageTransferManager factory with the security token - failed payment", async () => { - await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000", "ether")), token_owner); await catchRevert( - I_SecurityToken.addModule(P_PercentageTransferManagerFactory.address, bytesSTO, new BN(web3.utils.toWei("500", "ether")), new BN(0), { + I_SecurityToken.addModule(P_PercentageTransferManagerFactory.address, bytesSTO, new BN(web3.utils.toWei("2000", "ether")), new BN(0), { from: token_owner }) ); @@ -262,11 +262,11 @@ contract("PercentageTransferManager", async (accounts) => { it("Should successfully attach the PercentageTransferManager factory with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("500", "ether")), { from: token_owner }); + await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("2000", "ether")), { from: token_owner }); const tx = await I_SecurityToken.addModule( P_PercentageTransferManagerFactory.address, bytesSTO, - new BN(web3.utils.toWei("500", "ether")), + new BN(web3.utils.toWei("2000", "ether")), new BN(0), { from: token_owner } ); diff --git a/test/m_presale_sto.js b/test/m_presale_sto.js index daa982397..86259560c 100644 --- a/test/m_presale_sto.js +++ b/test/m_presale_sto.js @@ -69,7 +69,7 @@ contract("PreSaleSTO", async (accounts) => { const budget = 0; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); let endTime; const address_zero = "0x0000000000000000000000000000000000000000"; const one_address = "0x0000000000000000000000000000000000000001"; diff --git a/test/n_security_token_registry.js b/test/n_security_token_registry.js index d723f4e45..a7d19c13c 100644 --- a/test/n_security_token_registry.js +++ b/test/n_security_token_registry.js @@ -83,7 +83,7 @@ contract("SecurityTokenRegistry", async (accounts) => { // Initial fee for ticker registry and security token registry const initRegFee = new BN(web3.utils.toWei("250")); - const newRegFee = new BN(web3.utils.toWei("300")); + const initRegFeePOLY = new BN(web3.utils.toWei("1000")); const STRProxyParameters = ["address", "address", "uint256", "uint256", "address", "address"]; const STOParameters = ["uint256", "uint256", "uint256", "string"]; @@ -324,8 +324,8 @@ contract("SecurityTokenRegistry", async (accounts) => { }); it("Should fail to register ticker if owner is 0x", async () => { - await I_PolyToken.getTokens(initRegFee, account_temp); - await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: account_temp }); + await I_PolyToken.getTokens(initRegFeePOLY, account_temp); + await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: account_temp }); await catchRevert( I_STRProxied.registerTicker(address_zero, symbol, name, { from: account_temp }), @@ -368,8 +368,8 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should fail to register same symbol again", async () => { // Give POLY to token issuer - await I_PolyToken.getTokens(initRegFee, token_owner); - await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); + await I_PolyToken.getTokens(initRegFeePOLY, token_owner); + await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); // Call registration function await catchRevert( I_STRProxied.registerTicker(token_owner, symbol, name, { from: token_owner }), @@ -379,7 +379,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should successfully register pre registerd ticker if expiry is reached", async () => { await increaseTime(5184000 + 100); // 60(5184000) days of expiry + 100 sec for buffer - await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); let tx = await I_STRProxied.registerTicker(token_owner, symbol, name, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner, `Owner should be the ${token_owner}`); assert.equal(tx.logs[0].args._ticker, symbol, `Symbol should be ${symbol}`); @@ -387,7 +387,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should fail to register ticker if registration is paused", async () => { await I_STRProxied.pause({ from: account_polymath }); - await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); await catchRevert( I_STRProxied.registerTicker(token_owner, "AAA", name, { from: token_owner }), @@ -401,7 +401,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should successfully register ticker if registration is unpaused", async () => { await I_STRProxied.unpause({ from: account_polymath }); - await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); let tx = await I_STRProxied.registerTicker(token_owner, "AAA", name, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner, `Owner should be the ${token_owner}`); assert.equal(tx.logs[0].args._ticker, "AAA", `Symbol should be AAA`); @@ -472,7 +472,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should fail to generate token if registration is paused", async () => { await I_STRProxied.pause({ from: account_polymath }); - await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); await catchRevert( I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }), @@ -528,7 +528,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should fail to generate the SecurityToken because ticker gets expired", async () => { let snap_Id = await takeSnapshot(); - await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("500")), { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("2000")), { from: token_owner }); let tx = await I_STRProxied.registerTicker(token_owner, "CCC", name, { from: token_owner }); await increaseTime(duration.days(65)); await catchRevert( @@ -541,7 +541,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should generate the SecurityToken when launch fee is 0", async () => { let snap_Id = await takeSnapshot(); await I_STRProxied.changeSecurityLaunchFee(0, { from: account_polymath }); - await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("500")), { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("2000")), { from: token_owner }); let tx = await I_STRProxied.registerTicker(token_owner, "CCC", name, { from: token_owner }); await I_STRProxied.generateSecurityToken(name, "CCC", tokenDetails, false, { from: token_owner }), await revertToSnapshot(snap_Id); @@ -549,8 +549,8 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should get all created security tokens", async() => { let snap_Id = await takeSnapshot(); - await I_PolyToken.getTokens(web3.utils.toWei("500"), account_temp); - await I_PolyToken.approve(I_STRProxied.address, web3.utils.toWei("500"), { from: account_temp }); + await I_PolyToken.getTokens(web3.utils.toWei("2000"), account_temp); + await I_PolyToken.approve(I_STRProxied.address, web3.utils.toWei("2000"), { from: account_temp }); await I_STRProxied.registerTicker(account_temp, "TMP", name, { from: account_temp }); let tx = await I_STRProxied.generateSecurityToken(name, "TMP", tokenDetails, false, { from: account_temp }); @@ -593,14 +593,14 @@ contract("SecurityTokenRegistry", async (accounts) => { }); it("Should register the ticker before the generation of the security token", async () => { - await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); let tx = await I_STRProxied.registerTicker(token_owner, symbol2, name2, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner, `Token owner should be ${token_owner}`); assert.equal(tx.logs[0].args._ticker, symbol2, `Symbol should be ${symbol2}`); }); it("Should generate the new security token with version 2", async () => { - await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); let tx = await I_STRProxied.generateSecurityToken(name2, symbol2, tokenDetails, false, { from: token_owner }); @@ -705,7 +705,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should successfully generate custom token", async () => { // Register the new ticker -- Fulfiling the TickerStatus.ON condition await I_PolyToken.getTokens(new BN(web3.utils.toWei("1000")), account_temp); - await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: account_temp }); + await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: account_temp }); let tickersListArray = await I_Getter.getTickersByOwner.call(account_temp); console.log(tickersListArray); await I_STRProxied.registerTicker(account_temp, "LOG", "LOGAN", { from: account_temp }); @@ -951,7 +951,7 @@ contract("SecurityTokenRegistry", async (accounts) => { }); it("Should fail to register the ticker with the old fee", async () => { - await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); await catchRevert( I_STRProxied.registerTicker(token_owner, "POLY", "Polymath", { from: token_owner }), "tx revert -> failed because of ticker registeration fee gets change" @@ -959,15 +959,15 @@ contract("SecurityTokenRegistry", async (accounts) => { }); it("Should register the ticker with the new fee", async () => { - await I_PolyToken.getTokens(new BN(web3.utils.toWei("1000")), token_owner); - await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("500")), { from: token_owner }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("1600")), token_owner); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("2000")), { from: token_owner }); let tx = await I_STRProxied.registerTicker(token_owner, "POLY", "Polymath", { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner, `Token owner should be ${token_owner}`); assert.equal(tx.logs[0].args._ticker, "POLY", `Symbol should be POLY`); }); it("Should fail to launch the securityToken with the old launch fee", async () => { - await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); await catchRevert( I_STRProxied.generateSecurityToken("Polymath", "POLY", tokenDetails, false, { from: token_owner }), "tx revert -> failed because of old launch fee" @@ -975,7 +975,7 @@ contract("SecurityTokenRegistry", async (accounts) => { }); it("Should launch the the securityToken", async () => { - await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("500")), { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("2000")), { from: token_owner }); let tx = await I_STRProxied.generateSecurityToken("Polymath", "POLY", tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token @@ -1051,8 +1051,8 @@ contract("SecurityTokenRegistry", async (accounts) => { describe(" Test cases of the registerTicker", async () => { it("Should register the ticker 1", async () => { - await I_PolyToken.getTokens(new BN(web3.utils.toWei("1000")), account_temp); - await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("1000")), { from: account_temp }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("1600")), account_temp); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("1600")), { from: account_temp }); let tx = await I_STRProxied.registerTicker(account_temp, "TOK1", "0x0", { from: account_temp }); assert.equal(tx.logs[0].args._owner, account_temp, `Owner should be the ${account_temp}`); assert.equal(tx.logs[0].args._ticker, "TOK1", `Symbol should be TOK1`); @@ -1060,8 +1060,8 @@ contract("SecurityTokenRegistry", async (accounts) => { }); it("Should register the ticker 2", async () => { - await I_PolyToken.getTokens(new BN(web3.utils.toWei("1000")), account_temp); - await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("1000")), { from: account_temp }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("1600")), account_temp); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("1600")), { from: account_temp }); let tx = await I_STRProxied.registerTicker(account_temp, "TOK2", "0x0", { from: account_temp }); assert.equal(tx.logs[0].args._owner, account_temp, `Owner should be the ${account_temp}`); assert.equal(tx.logs[0].args._ticker, "TOK2", `Symbol should be TOK2`); @@ -1069,8 +1069,8 @@ contract("SecurityTokenRegistry", async (accounts) => { }); it("Should register the ticker 3", async () => { - await I_PolyToken.getTokens(new BN(web3.utils.toWei("1000")), account_temp); - await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("1000")), { from: account_temp }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("1600")), account_temp); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("1600")), { from: account_temp }); let tx = await I_STRProxied.registerTicker(account_temp, "TOK3", "0x0", { from: account_temp }); assert.equal(tx.logs[0].args._owner, account_temp, `Owner should be the ${account_temp}`); assert.equal(tx.logs[0].args._ticker, "TOK3", `Symbol should be TOK3`); diff --git a/test/o_security_token.js b/test/o_security_token.js index d6adbbc99..680950ccd 100644 --- a/test/o_security_token.js +++ b/test/o_security_token.js @@ -84,7 +84,7 @@ contract("SecurityToken", async (accounts) => { const budget = 0; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); // delagate details const delegateDetails = web3.utils.fromAscii("I am delegate .."); @@ -98,7 +98,8 @@ contract("SecurityToken", async (accounts) => { const rate = new BN(web3.utils.toWei("1000")); const fundRaiseType = [0]; const cappedSTOSetupCost = new BN(web3.utils.toWei("20000", "ether")); - const maxCost = cappedSTOSetupCost; + const cappedSTOSetupCostPOLY = new BN(web3.utils.toWei("80000", "ether")); + const maxCost = cappedSTOSetupCostPOLY; const STOParameters = ["uint256", "uint256", "uint256", "uint256", "uint8[]", "address"]; let currentTime; @@ -292,8 +293,8 @@ contract("SecurityToken", async (accounts) => { startTime = await latestTime() + duration.seconds(5000); endTime = startTime + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, fundRaiseType, account_fundsReceiver]); - await I_PolyToken.getTokens(cappedSTOSetupCost, token_owner); - await I_PolyToken.transfer(I_SecurityToken.address, cappedSTOSetupCost, { from: token_owner }); + await I_PolyToken.getTokens(cappedSTOSetupCostPOLY, token_owner); + await I_PolyToken.transfer(I_SecurityToken.address, cappedSTOSetupCostPOLY, { from: token_owner }); await catchRevert( I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, new BN(web3.utils.toWei("1000", "ether")), new BN(0), { from: token_owner }) @@ -306,8 +307,8 @@ contract("SecurityToken", async (accounts) => { endTime = startTime + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, fundRaiseType, account_fundsReceiver]); - await I_PolyToken.getTokens(cappedSTOSetupCost, token_owner); - await I_PolyToken.transfer(I_SecurityToken.address, cappedSTOSetupCost, { from: token_owner }); + await I_PolyToken.getTokens(cappedSTOSetupCostPOLY, token_owner); + await I_PolyToken.transfer(I_SecurityToken.address, cappedSTOSetupCostPOLY, { from: token_owner }); console.log("0"); const tx = await I_SecurityToken.addModuleWithLabel(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), web3.utils.fromAscii("stofactory"), { from: token_owner @@ -326,8 +327,8 @@ contract("SecurityToken", async (accounts) => { endTime = startTime + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, fundRaiseType, account_fundsReceiver]); - await I_PolyToken.getTokens(cappedSTOSetupCost, token_owner); - await I_PolyToken.transfer(I_SecurityToken.address, cappedSTOSetupCost, { from: token_owner }); + await I_PolyToken.getTokens(cappedSTOSetupCostPOLY, token_owner); + await I_PolyToken.transfer(I_SecurityToken.address, cappedSTOSetupCostPOLY, { from: token_owner }); const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: token_owner }); @@ -1047,13 +1048,14 @@ contract("SecurityToken", async (accounts) => { it("Should successfully withdraw the poly", async () => { let balanceBefore = await I_PolyToken.balanceOf(token_owner); - await I_SecurityToken.withdrawERC20(I_PolyToken.address, new BN(web3.utils.toWei("20000", "ether")), { from: token_owner }); + let stBalance = await I_PolyToken.balanceOf(I_SecurityToken.address); + await I_SecurityToken.withdrawERC20(I_PolyToken.address, new BN(stBalance), { from: token_owner }); let balanceAfter = await I_PolyToken.balanceOf(token_owner); assert.equal( BN(balanceAfter) .sub(new BN(balanceBefore)) .toString(), - new BN(web3.utils.toWei("20000", "ether").toString()) + stBalance.toString() ); }); diff --git a/test/p_usd_tiered_sto.js b/test/p_usd_tiered_sto.js index 4661fb043..f70d222ed 100644 --- a/test/p_usd_tiered_sto.js +++ b/test/p_usd_tiered_sto.js @@ -203,7 +203,7 @@ contract("USDTieredSTO", async (accounts) => { e18 = new BN(10).pow(new BN(18)); e16 = new BN(10).pow(new BN(16)); currentTime = new BN(await latestTime()); - REGFEE = new BN(web3.utils.toWei("250")); + REGFEE = new BN(web3.utils.toWei("1000")); USDETH = new BN(500).mul(new BN(10).pow(new BN(18))); // 500 USD/ETH USDPOLY = new BN(25).mul(new BN(10).pow(new BN(16))); // 0.25 USD/POLY POLYMATH = accounts[0]; @@ -406,7 +406,7 @@ contract("USDTieredSTO", async (accounts) => { let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); await catchRevert( - I_SecurityToken.addModule(P_USDTieredSTOFactory.address, bytesSTO, new BN(web3.utils.toWei("500")), new BN(0), { + I_SecurityToken.addModule(P_USDTieredSTOFactory.address, bytesSTO, new BN(web3.utils.toWei("2000")), new BN(0), { from: ISSUER, gasPrice: GAS_PRICE }) @@ -432,8 +432,8 @@ contract("USDTieredSTO", async (accounts) => { ]; let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); - await I_PolyToken.getTokens(new BN(web3.utils.toWei("500")), I_SecurityToken.address); - let tx = await I_SecurityToken.addModule(P_USDTieredSTOFactory.address, bytesSTO, new BN(web3.utils.toWei("500")), new BN(0), { + await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000")), I_SecurityToken.address); + let tx = await I_SecurityToken.addModule(P_USDTieredSTOFactory.address, bytesSTO, new BN(web3.utils.toWei("2000")), new BN(0), { from: ISSUER, gasPrice: GAS_PRICE }); diff --git a/test/q_usd_tiered_sto_sim.js b/test/q_usd_tiered_sto_sim.js index e4f9db8e1..c0f62f589 100644 --- a/test/q_usd_tiered_sto_sim.js +++ b/test/q_usd_tiered_sto_sim.js @@ -70,7 +70,7 @@ contract("USDTieredSTO Sim", async (accounts) => { const STOKEY = 3; // Initial fee for ticker registry and security token registry - const REGFEE = new BN(web3.utils.toWei("250")); + const REGFEE = new BN(web3.utils.toWei("1000")); const STOSetupCost = 0; // MockOracle USD prices @@ -783,4 +783,4 @@ function assertIsNear(a, b, reason) { } else { assert.isBelow(b.sub(a).toNumber(), 4, reason); } -} \ No newline at end of file +} diff --git a/test/r_concurrent_STO.js b/test/r_concurrent_STO.js index 129116c26..513f8c8a7 100644 --- a/test/r_concurrent_STO.js +++ b/test/r_concurrent_STO.js @@ -56,8 +56,9 @@ contract("Concurrent STO", async (accounts) => { let message = "Transaction Should Fail!"; // Initial fees - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); const STOSetupCost = web3.utils.toHex(200 * Math.pow(10, 18)); + const STOSetupCostPOLY = web3.utils.toHex(800 * Math.pow(10, 18)); // Module keys const transferManagerKey = 2; @@ -142,7 +143,7 @@ contract("Concurrent STO", async (accounts) => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.getTokens(initRegFee, account_issuer); await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: account_issuer }); - + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: account_issuer }); assert.equal(tx.logs[2].args._ticker, symbol, "SecurityToken doesn't get deployed"); @@ -184,7 +185,7 @@ contract("Concurrent STO", async (accounts) => { const rate = new BN(web3.utils.toWei("1000")); const fundRaiseType = [0]; const budget = 0; - const maxCost = STOSetupCost; + const maxCost = STOSetupCostPOLY; const cappedBytesSig = encodeModuleCall(CappedSTOParameters, [ startTime, endTime, @@ -197,8 +198,8 @@ contract("Concurrent STO", async (accounts) => { const presaleBytesSig = encodeModuleCall(PresaleSTOParameters, [endTime]); for (var STOIndex = 0; STOIndex < MAX_MODULES; STOIndex++) { - await I_PolyToken.getTokens(STOSetupCost, account_issuer); - await I_PolyToken.transfer(I_SecurityToken.address, STOSetupCost, { from: account_issuer }); + await I_PolyToken.getTokens(STOSetupCostPOLY, account_issuer); + await I_PolyToken.transfer(I_SecurityToken.address, STOSetupCostPOLY, { from: account_issuer }); switch (STOIndex % 3) { case 0: // Capped STO diff --git a/test/t_security_token_registry_proxy.js b/test/t_security_token_registry_proxy.js index 0854d94e1..d2767dedd 100644 --- a/test/t_security_token_registry_proxy.js +++ b/test/t_security_token_registry_proxy.js @@ -39,6 +39,7 @@ contract("SecurityTokenRegistryProxy", async (accounts) => { // Initial fee for ticker registry and security token registry const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFeePOLY = new BN(web3.utils.toWei("1000")); const version = "1.0.0"; const message = "Transaction Should Fail!"; @@ -147,15 +148,15 @@ contract("SecurityTokenRegistryProxy", async (accounts) => { describe("Feed some data in storage", async () => { it("Register the ticker", async () => { - await I_PolyToken.getTokens(new BN(web3.utils.toWei("1000")), token_owner); - await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("8000")), token_owner); + await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); let tx = await I_STRProxied.registerTicker(token_owner, symbol, name, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner, "Owner should be the same as registered with the ticker"); assert.equal(tx.logs[0].args._ticker, symbol, "Same as the symbol registered in the registerTicker function call"); }); it("Should generate the new security token with the same symbol as registered above", async () => { - await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); diff --git a/test/u_module_registry_proxy.js b/test/u_module_registry_proxy.js index 624217939..c4d3c2d98 100644 --- a/test/u_module_registry_proxy.js +++ b/test/u_module_registry_proxy.js @@ -44,7 +44,6 @@ contract("ModuleRegistryProxy", async (accounts) => { let account_polymath_new; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); const version = "1.0.0"; const message = "Transaction Should Fail!"; const address_zero = "0x0000000000000000000000000000000000000000"; @@ -136,7 +135,7 @@ contract("ModuleRegistryProxy", async (accounts) => { { from: account_polymath } ); - I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(new BN(0), new BN(0), new BN(0), I_GeneralTransferManagerLogic.address, { + I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(new BN(0), new BN(0), I_GeneralTransferManagerLogic.address, I_PolymathRegistry.address, { from: account_polymath }); @@ -173,7 +172,7 @@ contract("ModuleRegistryProxy", async (accounts) => { describe("Feed some data in storage", async () => { it("Register and verify the new module", async () => { I_GeneralPermissionManagerLogic = await GeneralPermissionManager.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: account_polymath }); - I_GeneralPermissionManagerfactory = await GeneralPermissionManagerFactory.new(0, new BN(0), new BN(0), I_GeneralPermissionManagerLogic.address, { + I_GeneralPermissionManagerfactory = await GeneralPermissionManagerFactory.new(new BN(0), new BN(0), I_GeneralPermissionManagerLogic.address, I_PolymathRegistry.address, { from: account_polymath }); diff --git a/test/v_tracked_redemptions.js b/test/v_tracked_redemptions.js index 28ccaded7..a0b3ba36f 100644 --- a/test/v_tracked_redemptions.js +++ b/test/v_tracked_redemptions.js @@ -63,7 +63,7 @@ contract("TrackedRedemption", async (accounts) => { const burnKey = 5; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); let currentTime; const address_zero = "0x0000000000000000000000000000000000000000"; @@ -135,7 +135,7 @@ contract("TrackedRedemption", async (accounts) => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token @@ -157,8 +157,8 @@ contract("TrackedRedemption", async (accounts) => { it("Should successfully attach the paid TrackedRedemption with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.getTokens(new BN(web3.utils.toWei("500")), I_SecurityToken.address); - const tx = await I_SecurityToken.addModule(P_TrackedRedemptionFactory.address, "0x0", new BN(web3.utils.toWei("500")), new BN(0), { + await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000")), I_SecurityToken.address); + const tx = await I_SecurityToken.addModule(P_TrackedRedemptionFactory.address, "0x0", new BN(web3.utils.toWei("2000")), new BN(0), { from: token_owner }); assert.equal(tx.logs[3].args._types[0].toNumber(), burnKey, "TrackedRedemption doesn't get deployed"); diff --git a/test/w_lockup_transfer_manager.js b/test/w_lockup_transfer_manager.js index 0be2bfe04..254ae384f 100644 --- a/test/w_lockup_transfer_manager.js +++ b/test/w_lockup_transfer_manager.js @@ -68,7 +68,7 @@ contract('LockUpTransferManager', accounts => { let temp; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); let currentTime; before(async() => { @@ -246,17 +246,17 @@ contract('LockUpTransferManager', accounts => { }); it("Should unsuccessfully attach the LockUpTransferManager factory with the security token -- failed because Token is not paid", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("500", "ether"), token_owner); + await I_PolyToken.getTokens(web3.utils.toWei("2000", "ether"), token_owner); await catchRevert( - I_SecurityToken.addModule(P_LockUpTransferManagerFactory.address, "0x", new BN(web3.utils.toWei("500", "ether")), 0, { from: token_owner }) + I_SecurityToken.addModule(P_LockUpTransferManagerFactory.address, "0x", new BN(web3.utils.toWei("2000", "ether")), 0, { from: token_owner }) ) }); it("Should successfully attach the LockUpTransferManager factory with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("500", "ether")), {from: token_owner}); + await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("2000", "ether")), {from: token_owner}); console.log((await P_LockUpTransferManagerFactory.getSetupCost.call()).toString()); - const tx = await I_SecurityToken.addModule(P_LockUpTransferManagerFactory.address, "0x", new BN(web3.utils.toWei("500", "ether")), new BN(0), { from: token_owner }); + const tx = await I_SecurityToken.addModule(P_LockUpTransferManagerFactory.address, "0x", new BN(web3.utils.toWei("2000", "ether")), new BN(0), { from: token_owner }); assert.equal(tx.logs[3].args._types[0].toString(), transferManagerKey, "LockUpVolumeRestrictionTMFactory doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[3].args._name) diff --git a/test/x_scheduled_checkpoints.js b/test/x_scheduled_checkpoints.js index aa490f32e..dd23a8f9e 100644 --- a/test/x_scheduled_checkpoints.js +++ b/test/x_scheduled_checkpoints.js @@ -56,7 +56,7 @@ contract("ScheduledCheckpoint", async (accounts) => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); let currentTime; const address_zero = "0x0000000000000000000000000000000000000000"; @@ -122,7 +122,7 @@ contract("ScheduledCheckpoint", async (accounts) => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token diff --git a/test/y_volume_restriction_tm.js b/test/y_volume_restriction_tm.js index 0b5456a0d..e855673dd 100644 --- a/test/y_volume_restriction_tm.js +++ b/test/y_volume_restriction_tm.js @@ -74,7 +74,7 @@ contract('VolumeRestrictionTransferManager', accounts => { let tempArrayGlobal = new Array(); // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); const address_zero = "0x0000000000000000000000000000000000000000"; diff --git a/test/z_blacklist_transfer_manager.js b/test/z_blacklist_transfer_manager.js index 54e249a1f..2c4a5cef3 100644 --- a/test/z_blacklist_transfer_manager.js +++ b/test/z_blacklist_transfer_manager.js @@ -67,7 +67,7 @@ contract('BlacklistTransferManager', accounts => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = web3.utils.toWei("1000"); // BlacklistTransferManager details const holderCount = 2; // Maximum number of token holders @@ -171,9 +171,9 @@ contract('BlacklistTransferManager', accounts => { }); it("Should successfully attach the BlacklistTransferManager factory with the security token", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("500", "ether"), token_owner); + await I_PolyToken.getTokens(web3.utils.toWei("2000", "ether"), token_owner); await catchRevert ( - I_SecurityToken.addModule(P_BlacklistTransferManagerFactory.address, bytesSTO, web3.utils.toWei("500", "ether"), 0, { + I_SecurityToken.addModule(P_BlacklistTransferManagerFactory.address, bytesSTO, web3.utils.toWei("2000", "ether"), 0, { from: token_owner }) ); @@ -181,8 +181,8 @@ contract('BlacklistTransferManager', accounts => { it("Should successfully attach the BlacklistTransferManager factory with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, web3.utils.toWei("500", "ether"), {from: token_owner}); - const tx = await I_SecurityToken.addModule(P_BlacklistTransferManagerFactory.address, bytesSTO, web3.utils.toWei("500", "ether"), 0, { from: token_owner }); + await I_PolyToken.transfer(I_SecurityToken.address, web3.utils.toWei("2000", "ether"), {from: token_owner}); + const tx = await I_SecurityToken.addModule(P_BlacklistTransferManagerFactory.address, bytesSTO, web3.utils.toWei("2000", "ether"), 0, { from: token_owner }); assert.equal(tx.logs[3].args._types[0].toString(), transferManagerKey, "BlacklistTransferManager doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[3].args._name) diff --git a/test/z_fuzz_test_adding_removing_modules_ST.js b/test/z_fuzz_test_adding_removing_modules_ST.js index 194287801..fbec6e51b 100644 --- a/test/z_fuzz_test_adding_removing_modules_ST.js +++ b/test/z_fuzz_test_adding_removing_modules_ST.js @@ -98,7 +98,7 @@ contract('GeneralPermissionManager', accounts => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = web3.utils.toWei("1000"); let _details = "details holding for test"; let testRepeat = 20; @@ -210,19 +210,19 @@ contract('GeneralPermissionManager', accounts => { it("Should successfully attach the General permission manager factory with the security token -- failed because Token is not paid", async () => { let errorThrown = false; - await I_PolyToken.getTokens(web3.utils.toWei("500", "ether"), token_owner); + await I_PolyToken.getTokens(web3.utils.toWei("2000", "ether"), token_owner); await catchRevert( - I_SecurityToken.addModule(P_GeneralPermissionManagerFactory.address, "0x0", web3.utils.toWei("500", "ether"), 0, { from: token_owner }) + I_SecurityToken.addModule(P_GeneralPermissionManagerFactory.address, "0x0", web3.utils.toWei("2000", "ether"), 0, { from: token_owner }) ); }); it("Should successfully attach the General permission manager factory with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, web3.utils.toWei("500", "ether"), { from: token_owner }); + await I_PolyToken.transfer(I_SecurityToken.address, web3.utils.toWei("2000", "ether"), { from: token_owner }); const tx = await I_SecurityToken.addModule( P_GeneralPermissionManagerFactory.address, "0x0", - web3.utils.toWei("500", "ether"), + web3.utils.toWei("2000", "ether"), 0, { from: token_owner } ); diff --git a/test/z_fuzzer_volumn_restriction_transfer_manager.js b/test/z_fuzzer_volumn_restriction_transfer_manager.js index 0cf2fc02f..5aac12df8 100644 --- a/test/z_fuzzer_volumn_restriction_transfer_manager.js +++ b/test/z_fuzzer_volumn_restriction_transfer_manager.js @@ -74,7 +74,7 @@ contract('VolumeRestrictionTransferManager', accounts => { let tempArrayGlobal = new Array(); // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = web3.utils.toWei("1000"); async function print(data, account) { console.log(` diff --git a/test/z_general_permission_manager_fuzzer.js b/test/z_general_permission_manager_fuzzer.js index 7f7933801..98f2ecbe3 100644 --- a/test/z_general_permission_manager_fuzzer.js +++ b/test/z_general_permission_manager_fuzzer.js @@ -90,7 +90,7 @@ contract("GeneralPermissionManager Fuzz", async (accounts) => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); // CountTransferManager details const holderCount = 2; // Maximum number of token holders @@ -204,9 +204,9 @@ contract("GeneralPermissionManager Fuzz", async (accounts) => { it("Should successfully attach the General permission manager factory with the security token -- failed because Token is not paid", async () => { let errorThrown = false; - await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000", "ether")), token_owner); await catchRevert( - I_SecurityToken.addModule(P_GeneralPermissionManagerFactory.address, "0x", new BN(web3.utils.toWei("500", "ether")), new BN(0), { + I_SecurityToken.addModule(P_GeneralPermissionManagerFactory.address, "0x", new BN(web3.utils.toWei("2000", "ether")), new BN(0), { from: token_owner }) ); @@ -214,11 +214,11 @@ contract("GeneralPermissionManager Fuzz", async (accounts) => { it("Should successfully attach the General permission manager factory with the security token - paid module", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("500", "ether")), { from: token_owner }); + await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("2000", "ether")), { from: token_owner }); const tx = await I_SecurityToken.addModule( P_GeneralPermissionManagerFactory.address, "0x", - new BN(web3.utils.toWei("500", "ether")), + new BN(web3.utils.toWei("2000", "ether")), new BN(0), { from: token_owner } ); diff --git a/test/z_vesting_escrow_wallet.js b/test/z_vesting_escrow_wallet.js index b5aba3441..52252a62c 100644 --- a/test/z_vesting_escrow_wallet.js +++ b/test/z_vesting_escrow_wallet.js @@ -65,7 +65,7 @@ contract('VestingEscrowWallet', accounts => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); let currentTime; const address_zero = "0x0000000000000000000000000000000000000000"; @@ -123,7 +123,7 @@ contract('VestingEscrowWallet', accounts => { STFactory: ${I_STFactory.address} GeneralTransferManagerFactory: ${I_GeneralTransferManagerFactory.address} GeneralPermissionManagerFactory: ${I_GeneralPermissionManagerFactory.address} - + I_VestingEscrowWalletFactory: ${I_VestingEscrowWalletFactory.address} ----------------------------------------------------------------------------- `); diff --git a/test/za_datastore.js b/test/za_datastore.js index b89646bac..aa3860151 100644 --- a/test/za_datastore.js +++ b/test/za_datastore.js @@ -41,7 +41,7 @@ contract("Data store", async (accounts) => { const bytes32data2 = "0x4400000000000000000000000000000000000000000000000000000000000000"; // Initial fee for ticker registry and security token registry - const initRegFee = new BN(web3.utils.toWei("250")); + const initRegFee = new BN(web3.utils.toWei("1000")); const address_zero = "0x0000000000000000000000000000000000000000"; const address_one = "0x0000000000000000000000000000000000000001"; @@ -422,7 +422,7 @@ contract("Data store", async (accounts) => { }); it("Should not allow unauthorized addresses to delete bytes32 from Array", async () => { - await catchRevert(I_DataStore.deleteBytes32(key, 0, { from: account_polymath })); + await catchRevert(I_DataStore.deleteBytes32(key, 0, { from: account_polymath })); }); it("Should not allow unauthorized addresses to delete address from Array", async () => { @@ -465,4 +465,4 @@ contract("Data store", async (accounts) => { await catchRevert(I_DataStore.insertBoolMulti([key, key2], [true, true], { from: account_polymath })); }); }); -}); \ No newline at end of file +}); diff --git a/test/zb_signed_transfer_manager.js b/test/zb_signed_transfer_manager.js index a35baba07..88b8a7428 100644 --- a/test/zb_signed_transfer_manager.js +++ b/test/zb_signed_transfer_manager.js @@ -64,7 +64,7 @@ contract("SignedTransferManager", accounts => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = web3.utils.toWei("1000"); let currentTime; @@ -188,7 +188,7 @@ contract("SignedTransferManager", accounts => { it("Should successfully attach the SignedTransferManager with the security token", async () => { - const tx = await I_SecurityToken.addModule(I_SignedTransferManagerFactory.address, new BN(0),new BN(0),new BN(0), { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_SignedTransferManagerFactory.address, "0x0",new BN(0),new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), transferManagerKey, "SignedTransferManager doesn't get deployed"); assert.equal( web3.utils.toUtf8(tx.logs[2].args._name),