Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions contracts/modules/Checkpoint/DividendCheckpoint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module {
* @notice Creates a checkpoint on the security token
* @return Checkpoint ID
*/
function createCheckpoint() public withPerm(CHECKPOINT) returns(uint256) {
function createCheckpoint() public withPerm(OPERATOR) returns(uint256) {
return ISecurityToken(securityToken).createCheckpoint();
}

/**
* @notice Function to clear and set list of excluded addresses used for future dividends
* @param _excluded Addresses of investors
*/
function setDefaultExcluded(address[] memory _excluded) public withPerm(MANAGE) {
function setDefaultExcluded(address[] memory _excluded) public withPerm(ADMIN) {
require(_excluded.length <= EXCLUDED_ADDRESS_LIMIT, "Too many excluded addresses");
for (uint256 j = 0; j < _excluded.length; j++) {
require(_excluded[j] != address(0), "Invalid address");
Expand All @@ -105,7 +105,7 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module {
* @param _investors Addresses of investors
* @param _withholding Withholding tax for individual investors (multiplied by 10**16)
*/
function setWithholding(address[] memory _investors, uint256[] memory _withholding) public withPerm(MANAGE) {
function setWithholding(address[] memory _investors, uint256[] memory _withholding) public withPerm(ADMIN) {
require(_investors.length == _withholding.length, "Mismatched input lengths");
/*solium-disable-next-line security/no-block-members*/
emit SetWithholding(_investors, _withholding);
Expand All @@ -120,7 +120,7 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module {
* @param _investors Addresses of investor
* @param _withholding Withholding tax for all investors (multiplied by 10**16)
*/
function setWithholdingFixed(address[] memory _investors, uint256 _withholding) public withPerm(MANAGE) {
function setWithholdingFixed(address[] memory _investors, uint256 _withholding) public withPerm(ADMIN) {
require(_withholding <= 10 ** 18, "Incorrect withholding tax");
/*solium-disable-next-line security/no-block-members*/
emit SetWithholdingFixed(_investors, _withholding);
Expand All @@ -139,7 +139,7 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module {
address payable[] memory _payees
)
public
withPerm(DISTRIBUTE)
withPerm(OPERATOR)
validDividendIndex(_dividendIndex)
{
Dividend storage dividend = dividends[_dividendIndex];
Expand All @@ -161,7 +161,7 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module {
uint256 _start,
uint256 _iterations
) public
withPerm(DISTRIBUTE)
withPerm(OPERATOR)
validDividendIndex(_dividendIndex)
{
Dividend storage dividend = dividends[_dividendIndex];
Expand Down Expand Up @@ -391,8 +391,8 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module {
*/
function getPermissions() public view returns(bytes32[] memory) {
bytes32[] memory allPermissions = new bytes32[](2);
allPermissions[0] = DISTRIBUTE;
allPermissions[1] = MANAGE;
allPermissions[0] = ADMIN;
allPermissions[1] = OPERATOR;
return allPermissions;
}

Expand Down
12 changes: 6 additions & 6 deletions contracts/modules/Checkpoint/ERC20DividendCheckpoint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec
bytes32 _name
)
external
withPerm(MANAGE)
withPerm(ADMIN)
{
createDividendWithExclusions(_maturity, _expiry, _token, _amount, excluded, _name);
}
Expand All @@ -79,7 +79,7 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec
bytes32 _name
)
external
withPerm(MANAGE)
withPerm(ADMIN)
{
_createDividendWithCheckpointAndExclusions(_maturity, _expiry, _token, _amount, _checkpointId, excluded, _name);
}
Expand All @@ -102,7 +102,7 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec
bytes32 _name
)
public
withPerm(MANAGE)
withPerm(ADMIN)
{
uint256 checkpointId = ISecurityToken(securityToken).createCheckpoint();
_createDividendWithCheckpointAndExclusions(_maturity, _expiry, _token, _amount, checkpointId, _excluded, _name);
Expand All @@ -128,7 +128,7 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec
bytes32 _name
)
public
withPerm(MANAGE)
withPerm(ADMIN)
{
_createDividendWithCheckpointAndExclusions(_maturity, _expiry, _token, _amount, _checkpointId, _excluded, _name);
}
Expand Down Expand Up @@ -251,7 +251,7 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec
* @notice Issuer can reclaim remaining unclaimed dividend amounts, for expired dividends
* @param _dividendIndex Dividend to reclaim
*/
function reclaimDividend(uint256 _dividendIndex) external withPerm(MANAGE) {
function reclaimDividend(uint256 _dividendIndex) external withPerm(OPERATOR) {
require(_dividendIndex < dividends.length, "Invalid dividend");
/*solium-disable-next-line security/no-block-members*/
require(now >= dividends[_dividendIndex].expiry, "Dividend expiry in future");
Expand All @@ -267,7 +267,7 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec
* @notice Allows issuer to withdraw withheld tax
* @param _dividendIndex Dividend to withdraw from
*/
function withdrawWithholding(uint256 _dividendIndex) external withPerm(MANAGE) {
function withdrawWithholding(uint256 _dividendIndex) external withPerm(OPERATOR) {
require(_dividendIndex < dividends.length, "Invalid dividend");
Dividend storage dividend = dividends[_dividendIndex];
uint256 remainingWithheld = dividend.totalWithheld.sub(dividend.totalWithheldWithdrawn);
Expand Down
12 changes: 6 additions & 6 deletions contracts/modules/Checkpoint/EtherDividendCheckpoint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ contract EtherDividendCheckpoint is DividendCheckpoint {
* @param _expiry Time until dividend can no longer be paid, and can be reclaimed by issuer
* @param _name Name/title for identification
*/
function createDividend(uint256 _maturity, uint256 _expiry, bytes32 _name) external payable withPerm(MANAGE) {
function createDividend(uint256 _maturity, uint256 _expiry, bytes32 _name) external payable withPerm(ADMIN) {
createDividendWithExclusions(_maturity, _expiry, excluded, _name);
}

Expand All @@ -58,7 +58,7 @@ contract EtherDividendCheckpoint is DividendCheckpoint {
)
external
payable
withPerm(MANAGE)
withPerm(ADMIN)
{
_createDividendWithCheckpointAndExclusions(_maturity, _expiry, _checkpointId, excluded, _name);
}
Expand All @@ -78,7 +78,7 @@ contract EtherDividendCheckpoint is DividendCheckpoint {
)
public
payable
withPerm(MANAGE)
withPerm(ADMIN)
{
uint256 checkpointId = ISecurityToken(securityToken).createCheckpoint();
_createDividendWithCheckpointAndExclusions(_maturity, _expiry, checkpointId, _excluded, _name);
Expand All @@ -101,7 +101,7 @@ contract EtherDividendCheckpoint is DividendCheckpoint {
)
public
payable
withPerm(MANAGE)
withPerm(ADMIN)
{
_createDividendWithCheckpointAndExclusions(_maturity, _expiry, _checkpointId, _excluded, _name);
}
Expand Down Expand Up @@ -190,7 +190,7 @@ contract EtherDividendCheckpoint is DividendCheckpoint {
* @notice Issuer can reclaim remaining unclaimed dividend amounts, for expired dividends
* @param _dividendIndex Dividend to reclaim
*/
function reclaimDividend(uint256 _dividendIndex) external withPerm(MANAGE) {
function reclaimDividend(uint256 _dividendIndex) external withPerm(OPERATOR) {
require(_dividendIndex < dividends.length, "Incorrect dividend index");
/*solium-disable-next-line security/no-block-members*/
require(now >= dividends[_dividendIndex].expiry, "Dividend expiry is in the future");
Expand All @@ -206,7 +206,7 @@ contract EtherDividendCheckpoint is DividendCheckpoint {
* @notice Allows issuer to withdraw withheld tax
* @param _dividendIndex Dividend to withdraw from
*/
function withdrawWithholding(uint256 _dividendIndex) external withPerm(MANAGE) {
function withdrawWithholding(uint256 _dividendIndex) external withPerm(OPERATOR) {
require(_dividendIndex < dividends.length, "Incorrect dividend index");
Dividend storage dividend = dividends[_dividendIndex];
uint256 remainingWithheld = dividend.totalWithheld.sub(dividend.totalWithheldWithdrawn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import "openzeppelin-solidity/contracts/math/SafeMath.sol";
contract BlacklistTransferManager is TransferManager {
using SafeMath for uint256;

bytes32 public constant ADMIN = "ADMIN";

struct BlacklistsDetails {
uint256 startTime;
uint256 endTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ contract KYCTransferManager is TransferManager {

bytes32 public constant KYC_NUMBER = "KYC_NUMBER"; //We will standardize what key to use for what.

bytes32 public constant KYC_PROVIDER = "KYC_PROVIDER";

bytes32 public constant KYC_ARRAY = "KYC_ARRAY";

/**
Expand Down Expand Up @@ -50,7 +48,7 @@ contract KYCTransferManager is TransferManager {
return (Result.NA, bytes32(0));
}

function modifyKYC( address _investor, bool _kycStatus) public withPerm(KYC_PROVIDER) {
function modifyKYC( address _investor, bool _kycStatus) public withPerm(ADMIN) {
_modifyKYC(_investor, _kycStatus);
}

Expand All @@ -75,15 +73,6 @@ contract KYCTransferManager is TransferManager {
//I am maintaining the array to showcase how it can be done in cases where it might be needed.
}

/**
* @notice Return the permissions flag that are associated with general trnasfer manager
*/
function getPermissions() public view returns(bytes32[] memory) {
bytes32[] memory allPermissions = new bytes32[](1);
allPermissions[0] = KYC_PROVIDER;
return allPermissions;
}

function getKYCAddresses() public view returns(address[] memory) {
IDataStore dataStore = IDataStore(ISecurityToken(securityToken).dataStore());
return dataStore.getAddressArray(KYC_ARRAY);
Expand All @@ -100,6 +89,16 @@ contract KYCTransferManager is TransferManager {
return bytes32(keccak256(abi.encodePacked(KYC_NUMBER, _identity)));
}

/**
* @notice Return the permissions flag that are associated with this module
* @return bytes32 array
*/
function getPermissions() public view returns(bytes32[] memory) {
bytes32[] memory allPermissions = new bytes32[](1);
allPermissions[0] = ADMIN;
return allPermissions;
}

/**
* @notice return the amount of tokens for a given user as per the partition
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ contract LockUpTransferManager is TransferManager {

using SafeMath for uint256;

// permission definition
bytes32 public constant ADMIN = "ADMIN";

// a per-user lockup
struct LockUp {
uint256 lockupAmount; // Amount to be locked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ contract SignedTransferManager is TransferManager {
using SafeMath for uint256;
using ECDSA for bytes32;

bytes32 constant public ADMIN = "ADMIN";

//Keeps track of if the signature has been used or invalidated
//mapping(bytes => bool) invalidSignatures;
bytes32 constant public INVALID_SIG = "INVALIDSIG";
Expand Down
11 changes: 5 additions & 6 deletions contracts/modules/Experimental/Wallet/VestingEscrowWallet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import "./IWallet.sol";
contract VestingEscrowWallet is VestingEscrowWalletStorage, IWallet {
using SafeMath for uint256;

bytes32 public constant ADMIN = "ADMIN";

// States used to represent the status of the schedule
enum State {CREATED, STARTED, COMPLETED}

Expand Down Expand Up @@ -103,7 +101,7 @@ contract VestingEscrowWallet is VestingEscrowWalletStorage, IWallet {
* @notice Sends unassigned tokens to the treasury wallet
* @param _amount Amount of tokens that should be send to the treasury wallet
*/
function sendToTreasury(uint256 _amount) external withPerm(ADMIN) {
function sendToTreasury(uint256 _amount) external withPerm(OPERATOR) {
require(_amount > 0, "Amount cannot be zero");
require(_amount <= unassignedTokens, "Amount is greater than unassigned tokens");
uint256 amount = unassignedTokens;
Expand All @@ -116,7 +114,7 @@ contract VestingEscrowWallet is VestingEscrowWalletStorage, IWallet {
* @notice Pushes available tokens to the beneficiary's address
* @param _beneficiary Address of the beneficiary who will receive tokens
*/
function pushAvailableTokens(address _beneficiary) public withPerm(ADMIN) {
function pushAvailableTokens(address _beneficiary) public withPerm(OPERATOR) {
_sendTokens(_beneficiary);
}

Expand Down Expand Up @@ -420,7 +418,7 @@ contract VestingEscrowWallet is VestingEscrowWalletStorage, IWallet {
* @param _fromIndex Start index of array of beneficiary's addresses
* @param _toIndex End index of array of beneficiary's addresses
*/
function pushAvailableTokensMulti(uint256 _fromIndex, uint256 _toIndex) external withPerm(ADMIN) {
function pushAvailableTokensMulti(uint256 _fromIndex, uint256 _toIndex) external withPerm(OPERATOR) {
require(_toIndex <= beneficiaries.length - 1, "Array out of bound");
for (uint256 i = _fromIndex; i <= _toIndex; i++) {
if (schedules[beneficiaries[i]].length !=0)
Expand Down Expand Up @@ -557,8 +555,9 @@ contract VestingEscrowWallet is VestingEscrowWalletStorage, IWallet {
* @notice Return the permissions flag that are associated with VestingEscrowWallet
*/
function getPermissions() public view returns(bytes32[] memory) {
bytes32[] memory allPermissions = new bytes32[](1);
bytes32[] memory allPermissions = new bytes32[](2);
allPermissions[0] = ADMIN;
allPermissions[1] = OPERATOR;
return allPermissions;
}

Expand Down
5 changes: 4 additions & 1 deletion contracts/modules/Module.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ contract Module is IModule, ModuleStorage {
ModuleStorage(_securityToken, _polyAddress)
{
}

//Allows owner, factory or permissioned delegate
modifier withPerm(bytes32 _perm) {
bool isOwner = msg.sender == Ownable(securityToken).owner();
Expand Down Expand Up @@ -61,6 +61,9 @@ contract Module is IModule, ModuleStorage {
return true;
}

/**
* @notice used to return the data store address of securityToken
*/
function getDataStore() public view returns(address) {
return ISecurityToken(securityToken).dataStore();
}
Expand Down
10 changes: 5 additions & 5 deletions contracts/modules/PermissionManager/GeneralPermissionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio
* @param _delegate Ethereum address of the delegate
* @param _details Details about the delegate i.e `Belongs to financial firm`
*/
function addDelegate(address _delegate, bytes32 _details) external withPerm(CHANGE_PERMISSION) {
function addDelegate(address _delegate, bytes32 _details) external withPerm(ADMIN) {
require(_delegate != address(0), "Invalid address");
require(_details != bytes32(0), "0 value not allowed");
require(delegateDetails[_delegate] == bytes32(0), "Already present");
Expand All @@ -60,7 +60,7 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio
* @notice Used to delete a delegate
* @param _delegate Ethereum address of the delegate
*/
function deleteDelegate(address _delegate) external withPerm(CHANGE_PERMISSION) {
function deleteDelegate(address _delegate) external withPerm(ADMIN) {
require(delegateDetails[_delegate] != bytes32(0), "delegate does not exist");
for (uint256 i = 0; i < allDelegates.length; i++) {
if (allDelegates[i] == _delegate) {
Expand Down Expand Up @@ -92,7 +92,7 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio
* @param _valid Bool flag use to switch on/off the permission
* @return bool
*/
function changePermission(address _delegate, address _module, bytes32 _perm, bool _valid) public withPerm(CHANGE_PERMISSION) {
function changePermission(address _delegate, address _module, bytes32 _perm, bool _valid) public withPerm(ADMIN) {
require(_delegate != address(0), "invalid address");
_changePermission(_delegate, _module, _perm, _valid);
}
Expand All @@ -112,7 +112,7 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio
bool[] calldata _valids
)
external
withPerm(CHANGE_PERMISSION)
withPerm(ADMIN)
{
require(_delegate != address(0), "invalid address");
require(_modules.length > 0, "0 length is not allowed");
Expand Down Expand Up @@ -225,7 +225,7 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio
*/
function getPermissions() public view returns(bytes32[] memory) {
bytes32[] memory allPermissions = new bytes32[](1);
allPermissions[0] = CHANGE_PERMISSION;
allPermissions[0] = ADMIN;
return allPermissions;
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/modules/STO/CappedSTO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard {
* @notice This function returns the signature of configure function
*/
function getInitFunction() public pure returns(bytes4) {
return bytes4(keccak256("configure(uint256,uint256,uint256,uint256,uint8[],address)"));
return this.configure.selector;
}

/**
Expand Down
Loading