Skip to content

Commit 061e38a

Browse files
satyamakgecadamdossa
authored andcommitted
MATM to master (#435)
* Allow 0x transfers for MATM * Fix typo * changelog updated and MATM version changed * Update CHANGELOG.md * fixed MATM test w/ version change
1 parent 47bc200 commit 061e38a

4 files changed

Lines changed: 31 additions & 36 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
# v2.1.0 - Release Candidate
5+
6+
[__2.1.0__](https://www.npmjs.com/package/polymath-core?activeTab=readme) __13-089-18__
7+
8+
## Manual Approval TransferManager
9+
* Removed `0x0` check for the `_from` address to `ManualApprovalTransferManager`. This allows for the Issuer/Transfer Agent to approve a one-off mint of tokens that otherwise would not be possible.
10+
* Changed the version of `ManualApprovalTransferManagerFactory` from `1.0.0` to `2.0.1`.
11+
412
# v1.5.0 - Release Candidate
513

614
[__1.5.0__](https://www.npmjs.com/package/polymath-core?activeTab=readme) __15-08-18__
@@ -39,13 +47,13 @@ All notable changes to this project will be documented in this file.
3947
* All permissions are denied if no permission manager is active.
4048
* Generalize the STO varaible names and added them in `ISTO.sol` to use the common standard in all STOs.
4149
* Generalize the event when any new token get registered with the polymath ecosystem. `LogNewSecurityToken` should emit _ticker, _name, _securityTokenAddress, _owner, _addedAt, _registrant respectively. #230
42-
* Change the function name of `withdraPoly` to `withdrawERC20` and make the function generalize to extract tokens from the ST contract. parmeters are contract address and the value need to extract from the securityToken.
50+
* Change the function name of `withdraPoly` to `withdrawERC20` and make the function generalize to extract tokens from the ST contract. parmeters are contract address and the value need to extract from the securityToken.
4351

4452
## Removed
4553
* Removed investors list pruning
4654
* Remove `swarmHash` from the `registerTicker(), addCustomTicker(), generateSecurityToken(), addCustomSecurityToken()` functions of TickerRegistry.sol and SecurityTokenRegistry.sol. #230
4755
* Remove `Log` prefix from all the event present in the ecosystem.
48-
* Removed `addTagByModuleType` & `removeTagsByModuleType` from MR.
56+
* Removed `addTagByModuleType` & `removeTagsByModuleType` from MR.
4957

5058
======
5159

contracts/modules/TransferManager/ManualApprovalTransferManager.sol

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ contract ManualApprovalTransferManager is ITransferManager {
113113
* @param _expiryTime is the time until which the transfer is allowed
114114
*/
115115
function addManualApproval(address _from, address _to, uint256 _allowance, uint256 _expiryTime) public withPerm(TRANSFER_APPROVAL) {
116-
require(_from != address(0), "Invalid from address");
117116
require(_to != address(0), "Invalid to address");
118117
/*solium-disable-next-line security/no-block-members*/
119118
require(_expiryTime > now, "Invalid expiry time");
@@ -129,7 +128,6 @@ contract ManualApprovalTransferManager is ITransferManager {
129128
* @param _expiryTime is the time until which the transfer is blocked
130129
*/
131130
function addManualBlocking(address _from, address _to, uint256 _expiryTime) public withPerm(TRANSFER_APPROVAL) {
132-
require(_from != address(0), "Invalid from address");
133131
require(_to != address(0), "Invalid to address");
134132
/*solium-disable-next-line security/no-block-members*/
135133
require(_expiryTime > now, "Invalid expiry time");
@@ -144,7 +142,6 @@ contract ManualApprovalTransferManager is ITransferManager {
144142
* @param _to is the address to which transfers are approved
145143
*/
146144
function revokeManualApproval(address _from, address _to) public withPerm(TRANSFER_APPROVAL) {
147-
require(_from != address(0), "Invalid from address");
148145
require(_to != address(0), "Invalid to address");
149146
delete manualApprovals[_from][_to];
150147
emit RevokeManualApproval(_from, _to, msg.sender);
@@ -156,7 +153,6 @@ contract ManualApprovalTransferManager is ITransferManager {
156153
* @param _to is the address to which transfers are approved
157154
*/
158155
function revokeManualBlocking(address _from, address _to) public withPerm(TRANSFER_APPROVAL) {
159-
require(_from != address(0), "Invalid from address");
160156
require(_to != address(0), "Invalid to address");
161157
delete manualBlockings[_from][_to];
162158
emit RevokeManualBlocking(_from, _to, msg.sender);

contracts/modules/TransferManager/ManualApprovalTransferManagerFactory.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ contract ManualApprovalTransferManagerFactory is ModuleFactory {
1818
constructor (address _polyAddress, uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
1919
ModuleFactory(_polyAddress, _setupCost, _usageCost, _subscriptionCost)
2020
{
21-
version = "1.0.0";
21+
version = "2.0.1";
2222
name = "ManualApprovalTransferManager";
2323
title = "Manual Approval Transfer Manager";
2424
description = "Manage transfers using single approvals / blocking";

test/j_manual_approval_transfer_manager.js

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -321,18 +321,6 @@ contract("ManualApprovalTransferManager", accounts => {
321321
assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("5", "ether"));
322322
});
323323

324-
it("Should fail to add a manual approval because invalid _from address", async () => {
325-
await catchRevert(
326-
I_ManualApprovalTransferManager.addManualApproval(
327-
"",
328-
account_investor4,
329-
web3.utils.toWei("2", "ether"),
330-
latestTime() + duration.days(1),
331-
{ from: token_owner }
332-
)
333-
);
334-
});
335-
336324
it("Should fail to add a manual approval because invalid _to address", async () => {
337325
await catchRevert(
338326
I_ManualApprovalTransferManager.addManualApproval(
@@ -367,6 +355,16 @@ contract("ManualApprovalTransferManager", accounts => {
367355
);
368356
});
369357

358+
it("Add a manual approval for a 5th investor from issuance", async () => {
359+
await I_ManualApprovalTransferManager.addManualApproval(
360+
"",
361+
account_investor5,
362+
web3.utils.toWei("2", "ether"),
363+
latestTime() + duration.days(1),
364+
{ from: token_owner }
365+
);
366+
});
367+
370368
it("Should fail to add a manual approval because allowance is laready exists", async () => {
371369
await catchRevert(
372370
I_ManualApprovalTransferManager.addManualApproval(
@@ -379,10 +377,6 @@ contract("ManualApprovalTransferManager", accounts => {
379377
);
380378
});
381379

382-
it("Should fail to revoke manual approval because invalid _from address", async () => {
383-
await catchRevert(I_ManualApprovalTransferManager.revokeManualApproval("", account_investor4, { from: token_owner }));
384-
});
385-
386380
it("Should fail to revoke manual approval because invalid _to address", async () => {
387381
await catchRevert(I_ManualApprovalTransferManager.revokeManualApproval(account_investor1, "", { from: token_owner }));
388382
});
@@ -409,6 +403,15 @@ contract("ManualApprovalTransferManager", accounts => {
409403
assert.equal((await I_SecurityToken.balanceOf(account_investor4)).toNumber(), web3.utils.toWei("1", "ether"));
410404
});
411405

406+
it("Approval fails with wrong from to address", async () => {
407+
await catchRevert(I_SecurityToken.transfer(account_investor5, web3.utils.toWei("1", "ether"), { from: account_investor1 }));
408+
});
409+
410+
it("Use 100% of issuance approval", async () => {
411+
await I_SecurityToken.mint(account_investor5, web3.utils.toWei("2", "ether"), { from: token_owner });
412+
assert.equal((await I_SecurityToken.balanceOf(account_investor5)).toNumber(), web3.utils.toWei("2", "ether"));
413+
});
414+
412415
it("Check verifyTransfer without actually transferring", async () => {
413416
let verified = await I_SecurityToken.verifyTransfer.call(
414417
account_investor1,
@@ -439,14 +442,6 @@ contract("ManualApprovalTransferManager", accounts => {
439442
await I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), { from: account_investor1 });
440443
});
441444

442-
it("Should fail to add a manual block because invalid _from address", async () => {
443-
await catchRevert(
444-
I_ManualApprovalTransferManager.addManualBlocking("", account_investor2, latestTime() + duration.days(1), {
445-
from: token_owner
446-
})
447-
);
448-
});
449-
450445
it("Should fail to add a manual block because invalid _to address", async () => {
451446
await catchRevert(
452447
I_ManualApprovalTransferManager.addManualBlocking(account_investor1, "", latestTime() + duration.days(1), {
@@ -477,10 +472,6 @@ contract("ManualApprovalTransferManager", accounts => {
477472
await catchRevert(I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), { from: account_investor1 }));
478473
});
479474

480-
it("Should fail to revoke manual block because invalid _from address", async () => {
481-
await catchRevert(I_ManualApprovalTransferManager.revokeManualBlocking("0x0", account_investor2, { from: token_owner }));
482-
});
483-
484475
it("Should fail to revoke manual block because invalid _to address", async () => {
485476
await catchRevert(I_ManualApprovalTransferManager.revokeManualBlocking(account_investor1, "0x0", { from: token_owner }));
486477
});
@@ -550,7 +541,7 @@ contract("ManualApprovalTransferManager", accounts => {
550541
"Allows an issuer to set manual approvals or blocks for specific pairs of addresses and amounts. Init function takes no parameters.",
551542
"Wrong Module added"
552543
);
553-
assert.equal(await I_ManualApprovalTransferManagerFactory.version.call(), "1.0.0");
544+
assert.equal(await I_ManualApprovalTransferManagerFactory.version.call(), "2.0.1");
554545
});
555546

556547
it("Should get the tags of the factory", async () => {

0 commit comments

Comments
 (0)