Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra Items #702

Merged
merged 2 commits into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions contracts/SecurityTokenRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy {
// Attempt to charge the reg fee if it is > 0 USD
(, uint256 _polyFee) = _takeFee(TICKERREGFEE);
string memory ticker = Util.upper(_ticker);
require(_tickerAvailable(ticker), "Ticker reserved");
require(tickerAvailable(ticker), "Ticker reserved");
// Check whether ticker was previously registered (and expired)
address previousOwner = _tickerOwner(ticker);
if (previousOwner != address(0)) {
Expand Down Expand Up @@ -421,11 +421,11 @@ contract SecurityTokenRegistry is EternalStorage, Proxy {
}

/**
* @notice Internal - Checks if the entered ticker is registered and has not expired
* @notice Checks if the entered ticker is registered and has not expired
* @param _ticker is the token ticker
* @return bool
*/
function _tickerAvailable(string memory _ticker) internal view returns(bool) {
function tickerAvailable(string memory _ticker) public view returns(bool) {
if (_tickerOwner(_ticker) != address(0)) {
/*solium-disable-next-line security/no-block-members*/
if ((now > getUintValue(Encoder.getKey("registeredTickers_expiryDate", _ticker))) && !_tickerStatus(_ticker)) {
Expand Down
7 changes: 7 additions & 0 deletions contracts/interfaces/ISecurityTokenRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,11 @@ interface ISecurityTokenRegistry {
*/
function owner() external view returns(address);

/**
* @notice Checks if the entered ticker is registered and has not expired
* @param _ticker is the token ticker
* @return bool
*/
function tickerAvailable(string calldata _ticker) external view returns(bool);

}
24 changes: 12 additions & 12 deletions contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpoint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ contract PLCRVotingCheckpoint is PLCRVotingCheckpointStorage, VotingCheckpoint {
uint256 _proposedQuorum
);
event BallotStatusChanged(uint256 indexed _ballotId, bool _newStatus);
event ChangedBallotExemptedVotersList(uint256 indexed _ballotId, address indexed _voter, bool _change);
event ChangedBallotExemptedVotersList(uint256 indexed _ballotId, address indexed _voter, bool _exempt);

constructor(address _securityToken, address _polyAddress)
public
Expand Down Expand Up @@ -172,31 +172,31 @@ contract PLCRVotingCheckpoint is PLCRVotingCheckpointStorage, VotingCheckpoint {
* Change the given ballot exempted list
* @param _ballotId Given ballot Id
* @param _voter Address of the voter
* @param _change Whether it is exempted or not
* @param _exempt Whether it is exempted or not
*/
function changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _change) external withPerm(ADMIN) {
_changeBallotExemptedVotersList(_ballotId, _voter, _change);
function changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _exempt) external withPerm(ADMIN) {
_changeBallotExemptedVotersList(_ballotId, _voter, _exempt);
}

/**
* Change the given ballot exempted list (Multi)
* @param _ballotId Given ballot Id
* @param _voters Address of the voter
* @param _changes Whether it is exempted or not
* @param _exempts Whether it is exempted or not
*/
function changeBallotExemptedVotersListMulti(uint256 _ballotId, address[] calldata _voters, bool[] calldata _changes) external withPerm(ADMIN) {
require(_voters.length == _changes.length, "Array length mismatch");
function changeBallotExemptedVotersListMulti(uint256 _ballotId, address[] calldata _voters, bool[] calldata _exempts) external withPerm(ADMIN) {
require(_voters.length == _exempts.length, "Array length mismatch");
for (uint256 i = 0; i < _voters.length; i++) {
_changeBallotExemptedVotersList(_ballotId, _voters[i], _changes[i]);
_changeBallotExemptedVotersList(_ballotId, _voters[i], _exempts[i]);
}
}

function _changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _change) internal {
function _changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _exempt) internal {
require(_voter != address(0), "Invalid address");
_validBallotId(_ballotId);
require(ballots[_ballotId].exemptedVoters[_voter] != _change, "No change");
ballots[_ballotId].exemptedVoters[_voter] = _change;
emit ChangedBallotExemptedVotersList(_ballotId, _voter, _change);
require(ballots[_ballotId].exemptedVoters[_voter] != _exempt, "No change");
ballots[_ballotId].exemptedVoters[_voter] = _exempt;
emit ChangedBallotExemptedVotersList(_ballotId, _voter, _exempt);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ contract WeightedVoteCheckpoint is WeightedVoteCheckpointStorage, VotingCheckpoi
);
event VoteCast(address indexed _voter, uint256 _weight, uint256 indexed _ballotId, uint256 indexed _proposalId);
event BallotStatusChanged(uint256 indexed _ballotId, bool _isActive);
event ChangedBallotExemptedVotersList(uint256 indexed _ballotId, address indexed _voter, bool _change);
event ChangedBallotExemptedVotersList(uint256 indexed _ballotId, address indexed _voter, bool _exempt);

/**
* @notice Constructor
Expand Down Expand Up @@ -124,31 +124,31 @@ contract WeightedVoteCheckpoint is WeightedVoteCheckpointStorage, VotingCheckpoi
* Change the given ballot exempted list
* @param _ballotId Given ballot Id
* @param _voter Address of the voter
* @param _change Whether it is exempted or not
* @param _exempt Whether it is exempted or not
*/
function changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _change) external withPerm(ADMIN) {
_changeBallotExemptedVotersList(_ballotId, _voter, _change);
function changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _exempt) external withPerm(ADMIN) {
_changeBallotExemptedVotersList(_ballotId, _voter, _exempt);
}

/**
* Change the given ballot exempted list (Multi)
* @param _ballotId Given ballot Id
* @param _voters Address of the voter
* @param _changes Whether it is exempted or not
* @param _exempts Whether it is exempted or not
*/
function changeBallotExemptedVotersListMulti(uint256 _ballotId, address[] calldata _voters, bool[] calldata _changes) external withPerm(ADMIN) {
require(_voters.length == _changes.length, "Array length mismatch");
function changeBallotExemptedVotersListMulti(uint256 _ballotId, address[] calldata _voters, bool[] calldata _exempts) external withPerm(ADMIN) {
require(_voters.length == _exempts.length, "Array length mismatch");
for (uint256 i = 0; i < _voters.length; i++) {
_changeBallotExemptedVotersList(_ballotId, _voters[i], _changes[i]);
_changeBallotExemptedVotersList(_ballotId, _voters[i], _exempts[i]);
}
}

function _changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _change) internal {
function _changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _exempt) internal {
require(_voter != address(0), "Invalid address");
_validBallotId(_ballotId);
require(ballots[_ballotId].exemptedVoters[_voter] != _change, "No change");
ballots[_ballotId].exemptedVoters[_voter] = _change;
emit ChangedBallotExemptedVotersList(_ballotId, _voter, _change);
require(ballots[_ballotId].exemptedVoters[_voter] != _exempt, "No change");
ballots[_ballotId].exemptedVoters[_voter] = _exempt;
emit ChangedBallotExemptedVotersList(_ballotId, _voter, _exempt);
}

/**
Expand Down
24 changes: 12 additions & 12 deletions contracts/modules/Checkpoint/Voting/VotingCheckpoint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@ import "../../../storage/modules/Checkpoint/Voting/VotingCheckpointStorage.sol";

contract VotingCheckpoint is VotingCheckpointStorage, ICheckpoint, IVoting, Module {

event ChangedDefaultExemptedVotersList(address indexed _voter, bool _change);
event ChangedDefaultExemptedVotersList(address indexed _voter, bool _exempt);

/**
* Change the global exempted voters list
* @param _voter Address of the voter
* @param _change Whether it is exempted or not
* @param _exempt Whether it is exempted or not
*/
function changeDefaultExemptedVotersList(address _voter, bool _change) external withPerm(ADMIN) {
_changeDefaultExemptedVotersList(_voter, _change);
function changeDefaultExemptedVotersList(address _voter, bool _exempt) external withPerm(ADMIN) {
_changeDefaultExemptedVotersList(_voter, _exempt);
}

/**
* Change the global exempted voters list
* @param _voters Address of the voter
* @param _changes Whether it is exempted or not
* @param _exempts Whether it is exempted or not
*/
function changeDefaultExemptedVotersListMulti(address[] calldata _voters, bool[] calldata _changes) external withPerm(ADMIN) {
require(_voters.length == _changes.length, "Array length mismatch");
function changeDefaultExemptedVotersListMulti(address[] calldata _voters, bool[] calldata _exempts) external withPerm(ADMIN) {
require(_voters.length == _exempts.length, "Array length mismatch");
for (uint256 i = 0; i < _voters.length; i++) {
_changeDefaultExemptedVotersList(_voters[i], _changes[i]);
_changeDefaultExemptedVotersList(_voters[i], _exempts[i]);
}
}

function _changeDefaultExemptedVotersList(address _voter, bool _change) internal {
function _changeDefaultExemptedVotersList(address _voter, bool _exempt) internal {
require(_voter != address(0), "Invalid address");
require((defaultExemptIndex[_voter] == 0) == _change);
if (_change) {
require((defaultExemptIndex[_voter] == 0) == _exempt);
if (_exempt) {
defaultExemptedVoters.push(_voter);
defaultExemptIndex[_voter] = defaultExemptedVoters.length;
} else {
Expand All @@ -44,7 +44,7 @@ contract VotingCheckpoint is VotingCheckpointStorage, ICheckpoint, IVoting, Modu
delete defaultExemptIndex[_voter];
defaultExemptedVoters.length --;
}
emit ChangedDefaultExemptedVotersList(_voter, _change);
emit ChangedDefaultExemptedVotersList(_voter, _exempt);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions contracts/modules/STO/Capped/CappedSTO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard {
* @notice Function to set allowBeneficialInvestments (allow beneficiary to be different to funder)
* @param _allowBeneficialInvestments Boolean to allow or disallow beneficial investments
*/
function changeAllowBeneficialInvestments(bool _allowBeneficialInvestments) public {
_onlySecurityTokenOwner();
function changeAllowBeneficialInvestments(bool _allowBeneficialInvestments) public withPerm(OPERATOR) {
satyamakgec marked this conversation as resolved.
Show resolved Hide resolved
require(_allowBeneficialInvestments != allowBeneficialInvestments, "Does not change value");
allowBeneficialInvestments = _allowBeneficialInvestments;
emit SetAllowBeneficialInvestments(allowBeneficialInvestments);
Expand Down
1 change: 1 addition & 0 deletions contracts/modules/STO/Capped/CappedSTOStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pragma solidity ^0.5.0;
*/
contract CappedSTOStorage {

bytes32 constant OPERATOR = "OPERATOR";
satyamakgec marked this conversation as resolved.
Show resolved Hide resolved
// Determine whether users can invest on behalf of a beneficiary
bool public allowBeneficialInvestments = false;
// How many token units a buyer gets (multiplied by 10^18) per wei / base unit of POLY
Expand Down
21 changes: 7 additions & 14 deletions contracts/modules/STO/USDTiered/USDTieredSTO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ contract USDTieredSTO is USDTieredSTOStorage, STO {

event SetAllowBeneficialInvestments(bool _allowed);
event SetNonAccreditedLimit(address _investor, uint256 _limit);
event SetAccredited(address _investor, bool _accredited);
event TokenPurchase(
address indexed _purchaser,
address indexed _beneficiary,
Expand Down Expand Up @@ -126,8 +125,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO {
* @dev Modifies fund raise types
* @param _fundRaiseTypes Array of fund raise types to allow
*/
function modifyFunding(FundRaiseType[] calldata _fundRaiseTypes) external {
_onlySecurityTokenOwner();
function modifyFunding(FundRaiseType[] calldata _fundRaiseTypes) external withPerm(OPERATOR) {
_isSTOStarted();
_setFundRaiseType(_fundRaiseTypes);
}
Expand All @@ -137,8 +135,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO {
* @param _nonAccreditedLimitUSD max non accredited invets limit
* @param _minimumInvestmentUSD overall minimum investment limit
*/
function modifyLimits(uint256 _nonAccreditedLimitUSD, uint256 _minimumInvestmentUSD) external {
_onlySecurityTokenOwner();
function modifyLimits(uint256 _nonAccreditedLimitUSD, uint256 _minimumInvestmentUSD) external withPerm(OPERATOR) {
_isSTOStarted();
_modifyLimits(_nonAccreditedLimitUSD, _minimumInvestmentUSD);
}
Expand All @@ -157,8 +154,8 @@ contract USDTieredSTO is USDTieredSTOStorage, STO {
uint256[] calldata _tokensPerTierDiscountPoly
)
external
withPerm(OPERATOR)
{
_onlySecurityTokenOwner();
_isSTOStarted();
_modifyTiers(_ratePerTier, _ratePerTierDiscountPoly, _tokensPerTierTotal, _tokensPerTierDiscountPoly);
}
Expand All @@ -168,8 +165,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO {
* @param _startTime start time of sto
* @param _endTime end time of sto
*/
function modifyTimes(uint256 _startTime, uint256 _endTime) external {
_onlySecurityTokenOwner();
function modifyTimes(uint256 _startTime, uint256 _endTime) external withPerm(OPERATOR) {
_isSTOStarted();
_modifyTimes(_startTime, _endTime);
}
Expand Down Expand Up @@ -258,8 +254,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO {
* @notice Finalizes the STO and mint remaining tokens to treasury address
* @notice Treasury wallet address must be whitelisted to successfully finalize
*/
function finalize() external {
_onlySecurityTokenOwner();
function finalize() external withPerm(ADMIN) {
require(!isFinalized, "STO is finalized");
isFinalized = true;
uint256 tempReturned;
Expand Down Expand Up @@ -289,8 +284,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO {
* @param _investors Array of investor addresses to modify
* @param _nonAccreditedLimit Array of uints specifying non-accredited limits
*/
function changeNonAccreditedLimit(address[] calldata _investors, uint256[] calldata _nonAccreditedLimit) external {
_onlySecurityTokenOwner();
function changeNonAccreditedLimit(address[] calldata _investors, uint256[] calldata _nonAccreditedLimit) external withPerm(OPERATOR) {
//nonAccreditedLimitUSDOverride
require(_investors.length == _nonAccreditedLimit.length, "Length mismatch");
for (uint256 i = 0; i < _investors.length; i++) {
Expand Down Expand Up @@ -320,8 +314,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO {
* @notice Function to set allowBeneficialInvestments (allow beneficiary to be different to funder)
* @param _allowBeneficialInvestments Boolean to allow or disallow beneficial investments
*/
function changeAllowBeneficialInvestments(bool _allowBeneficialInvestments) external {
_onlySecurityTokenOwner();
function changeAllowBeneficialInvestments(bool _allowBeneficialInvestments) external withPerm(OPERATOR) {
require(_allowBeneficialInvestments != allowBeneficialInvestments);
allowBeneficialInvestments = _allowBeneficialInvestments;
emit SetAllowBeneficialInvestments(allowBeneficialInvestments);
Expand Down
4 changes: 3 additions & 1 deletion contracts/modules/STO/USDTiered/USDTieredSTOStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ pragma solidity ^0.5.0;
contract USDTieredSTOStorage {

bytes32 internal constant INVESTORSKEY = 0xdf3a8dd24acdd05addfc6aeffef7574d2de3f844535ec91e8e0f3e45dba96731; //keccak256(abi.encodePacked("INVESTORS"))

bytes32 constant ADMIN = "ADMIN";
bytes32 constant OPERATOR = "OPERATOR";
satyamakgec marked this conversation as resolved.
Show resolved Hide resolved

/////////////
// Storage //
/////////////
Expand Down
12 changes: 6 additions & 6 deletions contracts/modules/TransferManager/VRTM/VolumeRestrictionTM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ contract VolumeRestrictionTM is VolumeRestrictionTMStorage, TransferManager {
using SafeMath for uint256;

// Emit when the token holder is added/removed from the exemption list
event ChangedExemptWalletList(address indexed _wallet, bool _change);
event ChangedExemptWalletList(address indexed _wallet, bool _exempted);
// Emit when the new individual restriction is added corresponds to new token holders
event AddIndividualRestriction(
address indexed _holder,
Expand Down Expand Up @@ -186,12 +186,12 @@ contract VolumeRestrictionTM is VolumeRestrictionTMStorage, TransferManager {
/**
* @notice Add/Remove wallet address from the exempt list
* @param _wallet Ethereum wallet/contract address that need to be exempted
* @param _change Boolean value used to add (i.e true) or remove (i.e false) from the list
* @param _exempted Boolean value used to add (i.e true) or remove (i.e false) from the list
*/
function changeExemptWalletList(address _wallet, bool _change) public withPerm(ADMIN) {
function changeExemptWalletList(address _wallet, bool _exempted) public withPerm(ADMIN) {
require(_wallet != address(0));
require((exemptions.exemptIndex[_wallet] == 0) == _change);
if (_change) {
require((exemptions.exemptIndex[_wallet] == 0) == _exempted);
if (_exempted) {
exemptions.exemptAddresses.push(_wallet);
exemptions.exemptIndex[_wallet] = exemptions.exemptAddresses.length;
} else {
Expand All @@ -200,7 +200,7 @@ contract VolumeRestrictionTM is VolumeRestrictionTMStorage, TransferManager {
delete exemptions.exemptIndex[_wallet];
exemptions.exemptAddresses.length--;
}
emit ChangedExemptWalletList(_wallet, _change);
emit ChangedExemptWalletList(_wallet, _exempted);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion contracts/tokens/SecurityToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ contract SecurityToken is ERC20, ReentrancyGuard, SecurityTokenStorage, IERC1594
bytes32 _label,
bool _archived
);

// Emit when Module get upgraded from the securityToken
event ModuleUpgraded(uint8[] _types, address _module);
// Emit when the token details get updated
event UpdateTokenDetails(string _oldDetails, string _newDetails);
// Emit when the token name get updated
Expand Down
4 changes: 2 additions & 2 deletions test/zc_plcr_voting_checkpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ contract("PLCRVotingCheckpoint", async (accounts) => {
let tx = await I_PLCRVotingCheckpoint.changeBallotExemptedVotersList(new BN(0), account_investor1, true, {from: token_owner});
assert.equal((tx.logs[0].args._ballotId).toString(), 0);
assert.equal(tx.logs[0].args._voter, account_investor1);
assert.equal(tx.logs[0].args._change, true);
assert.equal(tx.logs[0].args._exempt, true);
});

it("\t\t Should fail to add voter in ballot exemption list -- doing the same change again", async() => {
Expand Down Expand Up @@ -426,7 +426,7 @@ contract("PLCRVotingCheckpoint", async (accounts) => {
it("\t\t Should add the voter in to the default exemption list", async() => {
let tx = await I_PLCRVotingCheckpoint.changeDefaultExemptedVotersList(account_investor3, true, {from: token_owner});
assert.equal(tx.logs[0].args._voter, account_investor3);
assert.equal(tx.logs[0].args._change, true);
assert.equal(tx.logs[0].args._exempt, true);
});

it("\t\t Should fail to add voter in default exemption list -- doing the same change again", async() => {
Expand Down
Loading