Skip to content

Commit

Permalink
permission fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SatyamSB committed Jun 13, 2019
1 parent 0138971 commit 16d568f
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion contracts/modules/STO/Capped/CappedSTO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard {
* @notice Return the permissions flag that are associated with STO
*/
function getPermissions() public view returns(bytes32[] memory) {
bytes32[] memory allPermissions = new bytes32[](0);
bytes32[] memory allPermissions = new bytes32[](1);
allPermissions[0] = OPERATOR;
return allPermissions;
}

Expand Down
1 change: 0 additions & 1 deletion contracts/modules/STO/Capped/CappedSTOStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pragma solidity ^0.5.0;
*/
contract CappedSTOStorage {

bytes32 constant OPERATOR = "OPERATOR";
// 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
3 changes: 3 additions & 0 deletions contracts/modules/STO/USDTiered/USDTieredSTO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,9 @@ contract USDTieredSTO is USDTieredSTOStorage, STO {
* @notice Return the permissions flag that are associated with STO
*/
function getPermissions() public view returns(bytes32[] memory allPermissions) {
bytes32[] memory allPermissions = new bytes32[](2);
allPermissions[0] = OPERATOR;
allPermissions[1] = ADMIN;
return allPermissions;
}

Expand Down
2 changes: 0 additions & 2 deletions contracts/modules/STO/USDTiered/USDTieredSTOStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ pragma solidity ^0.5.0;
contract USDTieredSTOStorage {

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

/////////////
// Storage //
Expand Down
2 changes: 1 addition & 1 deletion test/b_capped_sto.js
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ contract("CappedSTO", async (accounts) => {

it("Should get the listed permissions", async () => {
let tx = await I_CappedSTO_Array_POLY[0].getPermissions.call();
assert.equal(tx.length, 0);
assert.equal(tx.length, 1);
});

it("Should get the metrics of the STO", async () => {
Expand Down
4 changes: 2 additions & 2 deletions test/p_usd_tiered_sto.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ contract("USDTieredSTO", async (accounts) => {
_tokensPerTierTotal[stoId].length,
"Incorrect number of tiers"
);
assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, new BN(0), "Incorrect number of permissions");
assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, new BN(2), "Incorrect number of permissions");
});

it("Should attach the paid STO factory -- failed because of no tokens", async () => {
Expand Down Expand Up @@ -579,7 +579,7 @@ contract("USDTieredSTO", async (accounts) => {
_tokensPerTierTotal[stoId].length,
"Incorrect number of tiers"
);
assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, new BN(0), "Incorrect number of permissions");
assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, new BN(2), "Incorrect number of permissions");
});

it("Should successfully attach the third STO module to the security token", async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/q_usd_tiered_sto_sim.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ contract("USDTieredSTO Sim", async (accounts) => {
_tokensPerTierTotal[stoId].length,
"Incorrect number of tiers"
);
assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, new BN(0), "Incorrect number of permissions");
assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, new BN(2), "Incorrect number of permissions");
});

it("Should successfully prepare the STO", async () => {
Expand Down

0 comments on commit 16d568f

Please sign in to comment.