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
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ contract ManualApprovalTransferManager is ITransferManager {
* @param _expiryTime is the time until which the transfer is allowed
*/
function addManualApproval(address _from, address _to, uint256 _allowance, uint256 _expiryTime) public withPerm(TRANSFER_APPROVAL) {
require(_from != address(0), "Invalid from address");
require(_to != address(0), "Invalid to address");
/*solium-disable-next-line security/no-block-members*/
require(_expiryTime > now, "Invalid expiry time");
Expand All @@ -129,7 +128,6 @@ contract ManualApprovalTransferManager is ITransferManager {
* @param _expiryTime is the time until which the transfer is blocked
*/
function addManualBlocking(address _from, address _to, uint256 _expiryTime) public withPerm(TRANSFER_APPROVAL) {
require(_from != address(0), "Invalid from address");
require(_to != address(0), "Invalid to address");
/*solium-disable-next-line security/no-block-members*/
require(_expiryTime > now, "Invalid expiry time");
Expand All @@ -144,7 +142,6 @@ contract ManualApprovalTransferManager is ITransferManager {
* @param _to is the address to which transfers are approved
*/
function revokeManualApproval(address _from, address _to) public withPerm(TRANSFER_APPROVAL) {
require(_from != address(0), "Invalid from address");
require(_to != address(0), "Invalid to address");
delete manualApprovals[_from][_to];
emit RevokeManualApproval(_from, _to, msg.sender);
Expand All @@ -156,7 +153,6 @@ contract ManualApprovalTransferManager is ITransferManager {
* @param _to is the address to which transfers are approved
*/
function revokeManualBlocking(address _from, address _to) public withPerm(TRANSFER_APPROVAL) {
require(_from != address(0), "Invalid from address");
require(_to != address(0), "Invalid to address");
delete manualBlockings[_from][_to];
emit RevokeManualBlocking(_from, _to, msg.sender);
Expand Down
47 changes: 19 additions & 28 deletions test/j_manual_approval_transfer_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,6 @@ contract("ManualApprovalTransferManager", accounts => {
assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("5", "ether"));
});

it("Should fail to add a manual approval because invalid _from address", async () => {
await catchRevert(
I_ManualApprovalTransferManager.addManualApproval(
"",
account_investor4,
web3.utils.toWei("2", "ether"),
latestTime() + duration.days(1),
{ from: token_owner }
)
);
});

it("Should fail to add a manual approval because invalid _to address", async () => {
await catchRevert(
I_ManualApprovalTransferManager.addManualApproval(
Expand Down Expand Up @@ -367,6 +355,16 @@ contract("ManualApprovalTransferManager", accounts => {
);
});

it("Add a manual approval for a 5th investor from issuance", async () => {
await I_ManualApprovalTransferManager.addManualApproval(
"",
account_investor5,
web3.utils.toWei("2", "ether"),
latestTime() + duration.days(1),
{ from: token_owner }
);
});

it("Should fail to add a manual approval because allowance is laready exists", async () => {
await catchRevert(
I_ManualApprovalTransferManager.addManualApproval(
Expand All @@ -379,10 +377,6 @@ contract("ManualApprovalTransferManager", accounts => {
);
});

it("Should fail to revoke manual approval because invalid _from address", async () => {
await catchRevert(I_ManualApprovalTransferManager.revokeManualApproval("", account_investor4, { from: token_owner }));
});

it("Should fail to revoke manual approval because invalid _to address", async () => {
await catchRevert(I_ManualApprovalTransferManager.revokeManualApproval(account_investor1, "", { from: token_owner }));
});
Expand All @@ -409,6 +403,15 @@ contract("ManualApprovalTransferManager", accounts => {
assert.equal((await I_SecurityToken.balanceOf(account_investor4)).toNumber(), web3.utils.toWei("1", "ether"));
});

it("Approval fails with wrong from to address", async () => {
await catchRevert(I_SecurityToken.transfer(account_investor5, web3.utils.toWei("1", "ether"), { from: account_investor1 }));
});

it("Use 100% of issuance approval", async () => {
await I_SecurityToken.mint(account_investor5, web3.utils.toWei("2", "ether"), { from: token_owner });
assert.equal((await I_SecurityToken.balanceOf(account_investor5)).toNumber(), web3.utils.toWei("2", "ether"));
});

it("Check verifyTransfer without actually transferring", async () => {
let verified = await I_SecurityToken.verifyTransfer.call(
account_investor1,
Expand Down Expand Up @@ -439,14 +442,6 @@ contract("ManualApprovalTransferManager", accounts => {
await I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), { from: account_investor1 });
});

it("Should fail to add a manual block because invalid _from address", async () => {
await catchRevert(
I_ManualApprovalTransferManager.addManualBlocking("", account_investor2, latestTime() + duration.days(1), {
from: token_owner
})
);
});

it("Should fail to add a manual block because invalid _to address", async () => {
await catchRevert(
I_ManualApprovalTransferManager.addManualBlocking(account_investor1, "", latestTime() + duration.days(1), {
Expand Down Expand Up @@ -477,10 +472,6 @@ contract("ManualApprovalTransferManager", accounts => {
await catchRevert(I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), { from: account_investor1 }));
});

it("Should fail to revoke manual block because invalid _from address", async () => {
await catchRevert(I_ManualApprovalTransferManager.revokeManualBlocking("0x0", account_investor2, { from: token_owner }));
});

it("Should fail to revoke manual block because invalid _to address", async () => {
await catchRevert(I_ManualApprovalTransferManager.revokeManualBlocking(account_investor1, "0x0", { from: token_owner }));
});
Expand Down