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;
@@ -301,7 +301,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
301301 * @param _investors Array of investor addresses to modify
302302 * @param _accredited Array of bools specifying accreditation status
303303 */
304- function changeAccredited (address [] _investors , bool [] _accredited ) public onlyOwner {
304+ function changeAccredited (address [] _investors , bool [] _accredited ) external onlyOwner {
305305 require (_investors.length == _accredited.length , "Array length mismatch " );
306306 for (uint256 i = 0 ; i < _investors.length ; i++ ) {
307307 if (_accredited[i]) {
@@ -319,7 +319,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
319319 * @param _investors Array of investor addresses to modify
320320 * @param _nonAccreditedLimit Array of uints specifying non-accredited limits
321321 */
322- function changeNonAccreditedLimit (address [] _investors , uint256 [] _nonAccreditedLimit ) public onlyOwner {
322+ function changeNonAccreditedLimit (address [] _investors , uint256 [] _nonAccreditedLimit ) external onlyOwner {
323323 //nonAccreditedLimitUSDOverride
324324 require (_investors.length == _nonAccreditedLimit.length , "Array length mismatch " );
325325 for (uint256 i = 0 ; i < _investors.length ; i++ ) {
@@ -357,7 +357,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
357357 * @notice Function to set allowBeneficialInvestments (allow beneficiary to be different to funder)
358358 * @param _allowBeneficialInvestments Boolean to allow or disallow beneficial investments
359359 */
360- function changeAllowBeneficialInvestments (bool _allowBeneficialInvestments ) public onlyOwner {
360+ function changeAllowBeneficialInvestments (bool _allowBeneficialInvestments ) external onlyOwner {
361361 require (_allowBeneficialInvestments != allowBeneficialInvestments, "Value unchanged " );
362362 allowBeneficialInvestments = _allowBeneficialInvestments;
363363 emit SetAllowBeneficialInvestments (allowBeneficialInvestments);
@@ -508,7 +508,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
508508 uint256 _investmentValue ,
509509 FundRaiseType _fundRaiseType
510510 )
511- public
511+ external
512512 view
513513 returns (uint256 spentUSD , uint256 spentValue , uint256 tokensMinted )
514514 {
@@ -732,7 +732,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
732732 * @param _amount Value to convert to USD
733733 * @return uint256 Value in USD
734734 */
735- function convertToUSD (FundRaiseType _fundRaiseType , uint256 _amount ) public view returns (uint256 ) {
735+ function convertToUSD (FundRaiseType _fundRaiseType , uint256 _amount ) external view returns (uint256 ) {
736736 uint256 rate = getRate (_fundRaiseType);
737737 return DecimalMath.mul (_amount, rate);
738738 }
@@ -743,7 +743,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
743743 * @param _amount Value to convert from USD
744744 * @return uint256 Value in ETH or POLY
745745 */
746- function convertFromUSD (FundRaiseType _fundRaiseType , uint256 _amount ) public view returns (uint256 ) {
746+ function convertFromUSD (FundRaiseType _fundRaiseType , uint256 _amount ) external view returns (uint256 ) {
747747 uint256 rate = getRate (_fundRaiseType);
748748 return DecimalMath.div (_amount, rate);
749749 }
@@ -776,7 +776,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
776776 * param _fundRaiseType The fund raising currency (e.g. ETH, POLY, SC) to calculate sold tokens for
777777 * @return uint256 Total number of tokens sold for ETH
778778 */
779- function getTokensSoldFor (FundRaiseType _fundRaiseType ) public view returns (uint256 ) {
779+ function getTokensSoldFor (FundRaiseType _fundRaiseType ) external view returns (uint256 ) {
780780 uint256 tokensSold;
781781 for (uint256 i = 0 ; i < tiers.length ; i++ ) {
782782 tokensSold = tokensSold.add (tiers[i].minted[uint8 (_fundRaiseType)]);
@@ -789,7 +789,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
789789 * param _tier The tier to return minted tokens for
790790 * @return uint256[] array of minted tokens in each fund raise type
791791 */
792- function getTokensMintedByTier (uint256 _tier ) public view returns (uint256 []) {
792+ function getTokensMintedByTier (uint256 _tier ) external view returns (uint256 []) {
793793 require (_tier < tiers.length , "Invalid tier " );
794794 uint256 [] memory tokensMinted = new uint256 [](3 );
795795 tokensMinted[0 ] = tiers[_tier].minted[uint8 (FundRaiseType.ETH)];
@@ -803,7 +803,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
803803 * param _tier The tier to calculate sold tokens for
804804 * @return uint256 Total number of tokens sold in the tier
805805 */
806- function getTokensSoldByTier (uint256 _tier ) public view returns (uint256 ) {
806+ function getTokensSoldByTier (uint256 _tier ) external view returns (uint256 ) {
807807 require (_tier < tiers.length , "Incorrect tier " );
808808 uint256 tokensSold;
809809 tokensSold = tokensSold.add (tiers[_tier].minted[uint8 (FundRaiseType.ETH)]);
@@ -816,15 +816,15 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
816816 * @notice Return the total no. of tiers
817817 * @return uint256 Total number of tiers
818818 */
819- function getNumberOfTiers () public view returns (uint256 ) {
819+ function getNumberOfTiers () external view returns (uint256 ) {
820820 return tiers.length ;
821821 }
822822
823823 /**
824824 * @notice Return the usd tokens accepted by the STO
825825 * @return address[] usd tokens
826826 */
827- function getUsdTokens () public view returns (address []) {
827+ function getUsdTokens () external view returns (address []) {
828828 return usdTokens;
829829 }
830830
@@ -848,7 +848,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
848848 * @return Amount of tokens sold.
849849 * @return Array of bools to show if funding is allowed in ETH, POLY, SC respectively
850850 */
851- function getSTODetails () public view returns (uint256 , uint256 , uint256 , uint256 [], uint256 [], uint256 , uint256 , uint256 , bool []) {
851+ function getSTODetails () external view returns (uint256 , uint256 , uint256 , uint256 [], uint256 [], uint256 , uint256 , uint256 , bool []) {
852852 uint256 [] memory cap = new uint256 [](tiers.length );
853853 uint256 [] memory rate = new uint256 [](tiers.length );
854854 for (uint256 i = 0 ; i < tiers.length ; i++ ) {
0 commit comments