11pragma solidity ^ 0.4.24 ;
22
3- import "./ISTO .sol " ;
3+ import "./STO .sol " ;
44import "../../interfaces/ISecurityToken.sol " ;
55import "../../interfaces/IOracle.sol " ;
66import "../../RegistryUpdater.sol " ;
@@ -12,7 +12,7 @@ import "../../storage/USDTieredSTOStorage.sol";
1212/**
1313 * @title STO module for standard capped crowdsale
1414 */
15- contract USDTieredSTO is USDTieredSTOStorage , ISTO , ReentrancyGuard {
15+ contract USDTieredSTO is USDTieredSTOStorage , STO , ReentrancyGuard {
1616 using SafeMath for uint256 ;
1717
1818 string public constant POLY_ORACLE = "PolyUsdOracle " ;
@@ -262,7 +262,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
262262 }
263263 usdTokens = _usdTokens;
264264 for (i = 0 ; i < _usdTokens.length ; i++ ) {
265- require (_usdTokens[i] != address (0 ), "Invalid USD token " );
265+ require (_usdTokens[i] != address (0 ) && _usdTokens[i] != address (polyToken) , "Invalid USD token " );
266266 usdTokenEnabled[_usdTokens[i]] = true ;
267267 }
268268 emit SetAddresses (wallet, reserveWallet, _usdTokens);
@@ -276,7 +276,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
276276 * @notice Finalizes the STO and mint remaining tokens to reserve address
277277 * @notice Reserve address must be whitelisted to successfully finalize
278278 */
279- function finalize () public onlyOwner {
279+ function finalize () external onlyOwner {
280280 require (! isFinalized, "STO is already finalized " );
281281 isFinalized = true ;
282282 uint256 tempReturned;
@@ -304,7 +304,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
304304 * @param _investors Array of investor addresses to modify
305305 * @param _accredited Array of bools specifying accreditation status
306306 */
307- function changeAccredited (address [] _investors , bool [] _accredited ) public onlyOwner {
307+ function changeAccredited (address [] _investors , bool [] _accredited ) external onlyOwner {
308308 require (_investors.length == _accredited.length , "Array length mismatch " );
309309 for (uint256 i = 0 ; i < _investors.length ; i++ ) {
310310 if (_accredited[i]) {
@@ -322,7 +322,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
322322 * @param _investors Array of investor addresses to modify
323323 * @param _nonAccreditedLimit Array of uints specifying non-accredited limits
324324 */
325- function changeNonAccreditedLimit (address [] _investors , uint256 [] _nonAccreditedLimit ) public onlyOwner {
325+ function changeNonAccreditedLimit (address [] _investors , uint256 [] _nonAccreditedLimit ) external onlyOwner {
326326 //nonAccreditedLimitUSDOverride
327327 require (_investors.length == _nonAccreditedLimit.length , "Array length mismatch " );
328328 for (uint256 i = 0 ; i < _investors.length ; i++ ) {
@@ -360,7 +360,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
360360 * @notice Function to set allowBeneficialInvestments (allow beneficiary to be different to funder)
361361 * @param _allowBeneficialInvestments Boolean to allow or disallow beneficial investments
362362 */
363- function changeAllowBeneficialInvestments (bool _allowBeneficialInvestments ) public onlyOwner {
363+ function changeAllowBeneficialInvestments (bool _allowBeneficialInvestments ) external onlyOwner {
364364 require (_allowBeneficialInvestments != allowBeneficialInvestments, "Value unchanged " );
365365 allowBeneficialInvestments = _allowBeneficialInvestments;
366366 emit SetAllowBeneficialInvestments (allowBeneficialInvestments);
@@ -511,7 +511,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
511511 uint256 _investmentValue ,
512512 FundRaiseType _fundRaiseType
513513 )
514- public
514+ external
515515 view
516516 returns (uint256 spentUSD , uint256 spentValue , uint256 tokensMinted )
517517 {
@@ -735,7 +735,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
735735 * @param _amount Value to convert to USD
736736 * @return uint256 Value in USD
737737 */
738- function convertToUSD (FundRaiseType _fundRaiseType , uint256 _amount ) public view returns (uint256 ) {
738+ function convertToUSD (FundRaiseType _fundRaiseType , uint256 _amount ) external view returns (uint256 ) {
739739 uint256 rate = getRate (_fundRaiseType);
740740 return DecimalMath.mul (_amount, rate);
741741 }
@@ -746,7 +746,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
746746 * @param _amount Value to convert from USD
747747 * @return uint256 Value in ETH or POLY
748748 */
749- function convertFromUSD (FundRaiseType _fundRaiseType , uint256 _amount ) public view returns (uint256 ) {
749+ function convertFromUSD (FundRaiseType _fundRaiseType , uint256 _amount ) external view returns (uint256 ) {
750750 uint256 rate = getRate (_fundRaiseType);
751751 return DecimalMath.div (_amount, rate);
752752 }
@@ -779,7 +779,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
779779 * param _fundRaiseType The fund raising currency (e.g. ETH, POLY, SC) to calculate sold tokens for
780780 * @return uint256 Total number of tokens sold for ETH
781781 */
782- function getTokensSoldFor (FundRaiseType _fundRaiseType ) public view returns (uint256 ) {
782+ function getTokensSoldFor (FundRaiseType _fundRaiseType ) external view returns (uint256 ) {
783783 uint256 tokensSold;
784784 for (uint256 i = 0 ; i < tiers.length ; i++ ) {
785785 tokensSold = tokensSold.add (tiers[i].minted[uint8 (_fundRaiseType)]);
@@ -792,7 +792,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
792792 * param _tier The tier to return minted tokens for
793793 * @return uint256[] array of minted tokens in each fund raise type
794794 */
795- function getTokensMintedByTier (uint256 _tier ) public view returns (uint256 []) {
795+ function getTokensMintedByTier (uint256 _tier ) external view returns (uint256 []) {
796796 require (_tier < tiers.length , "Invalid tier " );
797797 uint256 [] memory tokensMinted = new uint256 [](3 );
798798 tokensMinted[0 ] = tiers[_tier].minted[uint8 (FundRaiseType.ETH)];
@@ -806,7 +806,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
806806 * param _tier The tier to calculate sold tokens for
807807 * @return uint256 Total number of tokens sold in the tier
808808 */
809- function getTokensSoldByTier (uint256 _tier ) public view returns (uint256 ) {
809+ function getTokensSoldByTier (uint256 _tier ) external view returns (uint256 ) {
810810 require (_tier < tiers.length , "Incorrect tier " );
811811 uint256 tokensSold;
812812 tokensSold = tokensSold.add (tiers[_tier].minted[uint8 (FundRaiseType.ETH)]);
@@ -819,15 +819,15 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
819819 * @notice Return the total no. of tiers
820820 * @return uint256 Total number of tiers
821821 */
822- function getNumberOfTiers () public view returns (uint256 ) {
822+ function getNumberOfTiers () external view returns (uint256 ) {
823823 return tiers.length ;
824824 }
825825
826826 /**
827827 * @notice Return the usd tokens accepted by the STO
828828 * @return address[] usd tokens
829829 */
830- function getUsdTokens () public view returns (address []) {
830+ function getUsdTokens () external view returns (address []) {
831831 return usdTokens;
832832 }
833833
@@ -851,7 +851,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
851851 * @return Amount of tokens sold.
852852 * @return Array of bools to show if funding is allowed in ETH, POLY, SC respectively
853853 */
854- function getSTODetails () public view returns (uint256 , uint256 , uint256 , uint256 [], uint256 [], uint256 , uint256 , uint256 , bool []) {
854+ function getSTODetails () external view returns (uint256 , uint256 , uint256 , uint256 [], uint256 [], uint256 , uint256 , uint256 , bool []) {
855855 uint256 [] memory cap = new uint256 [](tiers.length );
856856 uint256 [] memory rate = new uint256 [](tiers.length );
857857 for (uint256 i = 0 ; i < tiers.length ; i++ ) {
0 commit comments