Skip to content
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
868d48a
explicit revert reason checks for CappedSTO
ross-rosario Jul 16, 2019
cbe6ba0
Merge remote-tracking branch 'origin/dev-3.1.0' into chore/reason-str…
ross-rosario Jul 17, 2019
c4dab92
chore: explicit revert checks for the CTM
ross-rosario Jul 17, 2019
2750595
chore: explicit revert checks for ERC20 Dividends
ross-rosario Jul 17, 2019
266587f
chore: explicit revert reason check for ETH dividends
ross-rosario Jul 17, 2019
f8aadfe
chore: explicit revert reason checks for GPM
ross-rosario Jul 17, 2019
b594c4b
chore: explicit revert reason check for GTM
ross-rosario Jul 17, 2019
b520ebd
fix: capped STO tests
ross-rosario Jul 18, 2019
9374295
chore: explicit revert reason checks for MATM
ross-rosario Jul 18, 2019
9dd1f4b
chore: explicit revert checks for MR
ross-rosario Jul 18, 2019
3a6ab75
chore: reverts of PTM
ross-rosario Jul 18, 2019
c46ccb5
chore: presale STO reverts
ross-rosario Jul 18, 2019
9359d47
chore: STR reverts
ross-rosario Jul 18, 2019
fe650c1
chore: USDTieredSTO reverts
ross-rosario Jul 18, 2019
279fa57
chore: STR proxy reverts
ross-rosario Jul 18, 2019
d68fe43
chore: MR proxy reverts
ross-rosario Jul 18, 2019
cdc74e6
chore: reverts of LTM
ross-rosario Jul 18, 2019
e613ea4
chore: VRTM reverts
ross-rosario Jul 18, 2019
ff460e7
chore: reverts of BTM
ross-rosario Jul 18, 2019
5dbe786
chore: reverts of BTM (cont)
ross-rosario Jul 18, 2019
d8e0b8b
chore: ST module test reverts
ross-rosario Jul 19, 2019
fa3694f
chore: two more fuzzing tests
ross-rosario Jul 19, 2019
ad5e3b1
chore: Vesting Escrow Wallet reverts
ross-rosario Jul 19, 2019
80fc058
fix: an attempt to fix VRTM test
ross-rosario Jul 19, 2019
d678799
chore: explicit reverts for remaining tests
ross-rosario Jul 19, 2019
33384ed
Fixed some tests
maxsam4 Jul 22, 2019
7061438
Fixed bad ticker test case
maxsam4 Jul 22, 2019
5c6eaf6
Updated some test descriptions
maxsam4 Jul 22, 2019
886ab59
Fixed usd tiered sto tests
maxsam4 Jul 22, 2019
3628f1b
Fixed more tests
maxsam4 Jul 22, 2019
303c017
Fixed vesting tests
maxsam4 Jul 22, 2019
cf08035
Removed a fixme
maxsam4 Jul 22, 2019
a683165
Remove remaining @FIXME comments
ross-rosario Jul 22, 2019
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
107 changes: 68 additions & 39 deletions test/b_capped_sto.js

Large diffs are not rendered by default.

73 changes: 46 additions & 27 deletions test/d_count_transfer_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,13 @@ contract("CountTransferManager", async (accounts) => {
I_GeneralTransferManager = await GeneralTransferManager.at(moduleData);
});

it("Should successfully attach the CountTransferManager factory with the security token", async () => {
it("Should FAIL to attach a CountTransferManager without sufficient tokens", async () => {
await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000", "ether")), token_owner);
await catchRevert(
I_SecurityToken.addModule(P_CountTransferManagerFactory.address, bytesSTO, new BN(web3.utils.toWei("2000", "ether")), new BN(0), false, {
from: token_owner
})
}),
"Insufficient tokens transferable"
);
});

Expand Down Expand Up @@ -310,8 +311,8 @@ contract("CountTransferManager", async (accounts) => {
"Failed in adding the investor in whitelist"
);

await catchRevert(I_SecurityToken.issue(account_investor3, new BN(web3.utils.toWei("3", "ether")), "0x0", { from: token_owner }));
await catchRevert(I_SecurityToken.transfer(account_investor3, new BN(web3.utils.toWei("1", "ether")), { from: account_investor2 }));
await catchRevert(I_SecurityToken.issue(account_investor3, new BN(web3.utils.toWei("3", "ether")), "0x0", { from: token_owner }), "Transfer Invalid");
await catchRevert(I_SecurityToken.transfer(account_investor3, new BN(web3.utils.toWei("1", "ether")), { from: account_investor2 }), "Transfer Invalid");
let canTransfer = await I_SecurityToken.canTransfer(account_investor3, new BN(web3.utils.toWei("1", "ether")), "0x0", { from: account_investor2 });
assert.equal(canTransfer[0], "0x50"); //Transfer failure.
});
Expand All @@ -333,7 +334,7 @@ contract("CountTransferManager", async (accounts) => {
});

it("Should fail in modifying the holder count", async () => {
await catchRevert(I_CountTransferManager.changeHolderCount(1, { from: account_investor1 }));
await catchRevert(I_CountTransferManager.changeHolderCount(1, { from: account_investor1 }), "Invalid permission");
});

it("Modify holder count to 1", async () => {
Expand All @@ -354,7 +355,7 @@ contract("CountTransferManager", async (accounts) => {

it("Should not be able to transfer to a new token holder", async () => {
// await I_CountTransferManager.unpause({from: token_owner});
await catchRevert(I_SecurityToken.transfer(account_investor3, new BN(web3.utils.toWei("2", "ether")), { from: account_investor2 }));
await catchRevert(I_SecurityToken.transfer(account_investor3, new BN(web3.utils.toWei("2", "ether")), { from: account_investor2 }), "Transfer Invalid");
});

it("Should be able to consolidate balances", async () => {
Expand Down Expand Up @@ -457,16 +458,17 @@ contract("CountTransferManager", async (accounts) => {
I_GeneralTransferManager2 = await GeneralTransferManager.at(moduleData);
});

it("Should successfully attach the CountTransferManager factory with the security token", async () => {
it("Should fail to attach a CountTransferManager because of insufficient tokens", async () => {
await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000", "ether")), token_owner);
await catchRevert(
I_SecurityToken2.addModule(P_CountTransferManagerFactory.address, bytesSTO, new BN(web3.utils.toWei("2000", "ether")), new BN(0), false, {
from: token_owner
})
}),
"Insufficient tokens"
);
});

it("Should successfully attach the CountTransferManager with the security token and set max holder to 2", async () => {
it("Token 2: Should successfully attach the CountTransferManager with the security token and set max holder to 2", async () => {
const tx = await I_SecurityToken2.addModule(I_CountTransferManagerFactory.address, bytesSTO, new BN(0), new BN(0), false, { from: token_owner });
assert.equal(tx.logs[2].args._types[0].toNumber(), transferManagerKey, "CountTransferManager doesn't get deployed");
assert.equal(
Expand All @@ -479,7 +481,7 @@ contract("CountTransferManager", async (accounts) => {
console.log("current max holder number is " + (await I_CountTransferManager2.maxHolderCount({ from: token_owner })));
});

it("Should successfully attach the CountTransferManager with the third security token and set max holder to 2", async () => {
it("Token 3: Should successfully attach the CountTransferManager with the third security token and set max holder to 2", async () => {
const tx = await I_SecurityToken3.addModule(I_CountTransferManagerFactory.address, bytesSTO, new BN(0), new BN(0), false, { from: token_owner });
assert.equal(tx.logs[2].args._types[0].toNumber(), transferManagerKey, "CountTransferManager doesn't get deployed");
assert.equal(
Expand All @@ -492,29 +494,35 @@ contract("CountTransferManager", async (accounts) => {
console.log("current max holder number is " + (await I_CountTransferManager3.maxHolderCount({ from: token_owner })));
});

// @FIXME
it("Should upgrade the CTM", async () => {
I_MockCountTransferManagerLogic = await MockCountTransferManager.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: account_polymath });
let bytesCM = encodeProxyCall(["uint256"], [11]);
await catchRevert(
// Fails as no upgrade available
I_SecurityToken2.upgradeModule(I_CountTransferManager2.address, { from: token_owner })
I_SecurityToken2.upgradeModule(I_CountTransferManager2.address, { from: token_owner }),
"Incorrect version"
);
await catchRevert(
// Fails due to the same version being used
I_CountTransferManagerFactory.setLogicContract("3.0.0", I_MockCountTransferManagerLogic.address, bytesCM, { from: account_polymath })
I_CountTransferManagerFactory.setLogicContract("3.0.0", I_MockCountTransferManagerLogic.address, bytesCM, { from: account_polymath }),
"Same version"
);
await catchRevert(
// Fails due to the wrong contract being used
I_CountTransferManagerFactory.setLogicContract("4.0.0", "0x0000000000000000000000000000000000000000", bytesCM, { from: account_polymath })
I_CountTransferManagerFactory.setLogicContract("4.0.0", "0x0000000000000000000000000000000000000000", bytesCM, { from: account_polymath }),
"Invalid address"
);
await catchRevert(
// Fails due to the wrong owner being used
I_CountTransferManagerFactory.setLogicContract("4.0.0", "0x0000000000000000000000000000000000000000", bytesCM, { from: token_owner })
I_CountTransferManagerFactory.setLogicContract("4.0.0", "0x0000000000000000000000000000000000000000", bytesCM, { from: token_owner }),
"revert"
);
await I_CountTransferManagerFactory.setLogicContract("4.0.0", I_MockCountTransferManagerLogic.address, bytesCM, { from: account_polymath });
await catchRevert(
// Fails as upgraded module has been unverified
I_SecurityToken2.upgradeModule(I_CountTransferManager2.address, { from: token_owner })
I_SecurityToken2.upgradeModule(I_CountTransferManager2.address, { from: token_owner }),
"ModuleFactory must be verified"
);
let tx = await I_MRProxied.verifyModule(I_CountTransferManagerFactory.address, { from: account_polymath });
await I_SecurityToken2.upgradeModule(I_CountTransferManager2.address, { from: token_owner });
Expand All @@ -528,20 +536,24 @@ contract("CountTransferManager", async (accounts) => {
let bytesCM = encodeProxyCall(["uint256"], [12]);
await catchRevert(
// Fails due to the same version being used
I_CountTransferManagerFactory.updateLogicContract(1, "3.0.0", I_MockCountTransferManagerLogic.address, bytesCM, { from: account_polymath })
I_CountTransferManagerFactory.updateLogicContract(1, "3.0.0", I_MockCountTransferManagerLogic.address, bytesCM, { from: account_polymath }),
"Same version"
);
await catchRevert(
// Fails due to the wrong contract being used
I_CountTransferManagerFactory.updateLogicContract(1, "4.0.0", "0x0000000000000000000000000000000000000000", bytesCM, { from: account_polymath })
I_CountTransferManagerFactory.updateLogicContract(1, "4.0.0", "0x0000000000000000000000000000000000000000", bytesCM, { from: account_polymath }),
"Invalid address"
);
await catchRevert(
// Fails due to the wrong owner being used
I_CountTransferManagerFactory.updateLogicContract(1, "4.0.0", "0x0000000000000000000000000000000000000000", bytesCM, { from: token_owner })
I_CountTransferManagerFactory.updateLogicContract(1, "4.0.0", "0x0000000000000000000000000000000000000000", bytesCM, { from: token_owner }),
"revert"
);
await I_CountTransferManagerFactory.updateLogicContract(1, "4.0.0", I_MockCountTransferManagerLogic.address, bytesCM, { from: account_polymath });
await catchRevert(
// Fails as upgraded module has been unverified
I_SecurityToken3.upgradeModule(I_CountTransferManager3.address, { from: token_owner })
I_SecurityToken3.upgradeModule(I_CountTransferManager3.address, { from: token_owner }),
"ModuleFactory must be verified"
);
let tx = await I_MRProxied.verifyModule(I_CountTransferManagerFactory.address, { from: account_polymath });
await I_SecurityToken3.upgradeModule(I_CountTransferManager3.address, { from: token_owner });
Expand All @@ -557,16 +569,21 @@ contract("CountTransferManager", async (accounts) => {
let bytesCM = encodeProxyCall(["uint256"], [11]);
await catchRevert(
// Fails as no upgrade available
I_SecurityToken2.upgradeModule(I_CountTransferManager2.address, { from: token_owner })
I_SecurityToken2.upgradeModule(I_CountTransferManager2.address, { from: token_owner }),
"Incorrect version"
);
await catchRevert(
// Fails due to the same version being used
I_CountTransferManagerFactory.setLogicContract("4.0.0", I_MockCountTransferManagerLogic.address, bytesCM, { from: account_polymath })
I_CountTransferManagerFactory.setLogicContract("4.0.0", I_MockCountTransferManagerLogic.address, bytesCM, { from: account_polymath }),
"Same version"
);
await I_CountTransferManagerFactory.setLogicContract("5.0.0", I_MockCountTransferManagerLogic.address, bytesCM, { from: account_polymath });

// @FIXME how is this the same version?
await catchRevert(
// Fails due to the same contract being used
I_CountTransferManagerFactory.setLogicContract("6.0.0", I_MockCountTransferManagerLogic.address, bytesCM, { from: account_polymath })
I_CountTransferManagerFactory.setLogicContract("6.0.0", I_MockCountTransferManagerLogic.address, bytesCM, { from: account_polymath }),
"Same version"
);
I_MockCountTransferManagerLogic = await MockCountTransferManager.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: account_polymath });
await I_CountTransferManagerFactory.setLogicContract("6.0.0", I_MockCountTransferManagerLogic.address, bytesCM, { from: account_polymath });
Expand Down Expand Up @@ -611,7 +628,8 @@ contract("CountTransferManager", async (accounts) => {
describe("Test cases for the ModuleFactory", async () => {
it("Should successfully change the SetupCost -- fail beacuse of bad owner", async () => {
await catchRevert(
I_CountTransferManagerFactory.changeSetupCost(new BN(web3.utils.toWei("500")), { from: account_investor3 })
I_CountTransferManagerFactory.changeSetupCost(new BN(web3.utils.toWei("500")), { from: account_investor3 }),
"revert"
);
});

Expand All @@ -622,7 +640,8 @@ contract("CountTransferManager", async (accounts) => {

it("Should successfully change the cost type -- fail beacuse of bad owner", async () => {
await catchRevert(
I_CountTransferManagerFactory.changeCostAndType(new BN(web3.utils.toWei("500")), true, { from: account_investor3 })
I_CountTransferManagerFactory.changeCostAndType(new BN(web3.utils.toWei("500")), true, { from: account_investor3 }),
"revert"
);
});

Expand All @@ -640,17 +659,17 @@ contract("CountTransferManager", async (accounts) => {

describe("Test case for the changeSTVersionBounds", async () => {
it("Should successfully change the version bounds -- failed because of the non permitted bound type", async () => {
await catchRevert(I_CountTransferManagerFactory.changeSTVersionBounds("middleType", [1, 2, 3], { from: account_polymath }));
await catchRevert(I_CountTransferManagerFactory.changeSTVersionBounds("middleType", [1, 2, 3], { from: account_polymath }), "Invalid bound type");
});

it("Should successfully change the version bound --failed because the new version length < 3", async () => {
await catchRevert(I_CountTransferManagerFactory.changeSTVersionBounds("lowerBound", [1, 2], { from: account_polymath }));
await catchRevert(I_CountTransferManagerFactory.changeSTVersionBounds("lowerBound", [1, 2], { from: account_polymath }), "Invalid version");
});

it("Should successfully change the version bound", async () => {
await I_CountTransferManagerFactory.changeSTVersionBounds("lowerBound", [1, 2, 1], { from: account_polymath });
await I_CountTransferManagerFactory.changeSTVersionBounds("lowerBound", [1, 0, 9], { from: account_polymath });
await catchRevert(I_CountTransferManagerFactory.changeSTVersionBounds("lowerBound", [1, 1, 0], { from: account_polymath }));
await catchRevert(I_CountTransferManagerFactory.changeSTVersionBounds("lowerBound", [1, 1, 0], { from: account_polymath }), "Invalid version");
});
});
});
Expand Down
Loading