Skip to content

Commit

Permalink
Merge pull request #4 from DistributedCollective/test-improvement
Browse files Browse the repository at this point in the history
Test Improvements
  • Loading branch information
Franklin Richards committed Jul 26, 2021
2 parents ddf3112 + 0bcb940 commit d1421f9
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 106 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -132,3 +132,4 @@ Please make sure to read the README mentioned in the scripts folder before runni
- Total unique wallets participated in all tiers. Currently only unique wallets participated in a each tier is counted, which is not the same as unique wallets participated in all tiers combined. New storage structure will be required.
- Tests related to other type of sales to be added.
- Reduce the reason string text size, or use a numbering system with errors in mainly LockedFund and OriginsBase.
- `saleEndDurationOrTS` in OriginsBase has little upside for storing and might be removable in the future.
1 change: 1 addition & 0 deletions contracts/LockedFund.sol
Expand Up @@ -324,6 +324,7 @@ contract LockedFund is ILockedFund {
*/
function withdrawAndStakeTokens(address _receiverAddress) external {
_withdrawWaitedUnlockedBalance(msg.sender, _receiverAddress);
// TODO: Withdraw Unlocked Balances as well.
_createVestingAndStake(msg.sender);
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "origins-launchpad",
"version": "1.2.8",
"version": "1.2.9",
"description": "The smart contracts for the Origins Platform",
"keywords": [
"Origins",
Expand Down
8 changes: 2 additions & 6 deletions tests/LockedFund/admin.test.js
Expand Up @@ -6,9 +6,9 @@ const {
randomValue,
currentTimestamp,
createStakeAndVest,
createLockedFund,
// Contract Artifacts
Token,
LockedFund,
VestingRegistry,
} = require("../utils");

Expand All @@ -32,11 +32,9 @@ contract("LockedFund (Admin Functions)", (accounts) => {

// Creating the Staking and Vesting
[staking, vestingLogic, vestingRegistry] = await createStakeAndVest(creator, token);
});

beforeEach("Creating New Locked Fund Contract Instance.", async () => {
// Creating the instance of LockedFund Contract.
lockedFund = await LockedFund.new(waitedTS, token.address, vestingRegistry.address, [admin], { from: creator });
lockedFund = await createLockedFund(waitedTS, token, vestingRegistry, [admin], creator);

// Adding lockedFund as an admin in the Vesting Registry.
await vestingRegistry.addAdmin(lockedFund.address, { from: creator });
Expand All @@ -51,12 +49,10 @@ contract("LockedFund (Admin Functions)", (accounts) => {
});

it("Admin should not be able to add another admin more than once.", async () => {
await lockedFund.addAdmin(newAdmin, { from: admin });
await expectRevert(lockedFund.addAdmin(newAdmin, { from: admin }), "LockedFund: Address is already admin.");
});

it("Admin should be able to remove an admin.", async () => {
await lockedFund.addAdmin(newAdmin, { from: admin });
await lockedFund.removeAdmin(newAdmin, { from: admin });
});

Expand Down
5 changes: 2 additions & 3 deletions tests/LockedFund/creator.test.js
Expand Up @@ -6,6 +6,7 @@ const {
randomValue,
currentTimestamp,
createStakeAndVest,
createLockedFund,
// Contract Artifacts
Token,
LockedFund,
Expand All @@ -32,11 +33,9 @@ contract("LockedFund (Creator Functions)", (accounts) => {

// Creating the Staking and Vesting
[staking, vestingLogic, vestingRegistry] = await createStakeAndVest(creator, token);
});

beforeEach("Creating New Locked Fund Contract Instance.", async () => {
// Creating the instance of LockedFund Contract.
lockedFund = await LockedFund.new(waitedTS, token.address, vestingRegistry.address, [admin], { from: creator });
lockedFund = await createLockedFund(waitedTS, token, vestingRegistry, [admin], creator);

// Adding lockedFund as an admin in the Vesting Registry.
await vestingRegistry.addAdmin(lockedFund.address, { from: creator });
Expand Down

0 comments on commit d1421f9

Please sign in to comment.