Skip to content

Commit

Permalink
Merge pull request #168 from The-Poolz/cleaned
Browse files Browse the repository at this point in the history
Cleaned
  • Loading branch information
PoolzAdmin committed Jun 25, 2021
2 parents 41a92fe + 3ec405f commit 82f9bbe
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 65 deletions.
7 changes: 0 additions & 7 deletions contracts/ILockedDeal.sol

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/Invest.sol
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.6.0;
import "./PoolsData.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "poolz-helper/contracts/IPozBenefit.sol";
import "./ILockedDeal.sol";
import "poolz-helper/contracts/ILockedDeal.sol";

contract Invest is PoolsData {
event NewInvestorEvent(uint256 Investor_ID, address Investor_Address, uint256 LockedDeal_ID);
Expand Down
8 changes: 8 additions & 0 deletions contracts/Manageable.sol
Expand Up @@ -125,5 +125,13 @@ contract Manageable is ETHHelper, ERC20Helper, PozBenefit, Pausable {
function isUsingLockedDeal() public view returns(bool) {
return UseLockedDealForTlp && LockedDealAddress != address(0x0);
}

function pause() public onlyOwnerOrGov {
_pause();
}

function unpause() public onlyOwnerOrGov {
_unpause();
}

}
19 changes: 0 additions & 19 deletions contracts/Migrations.sol

This file was deleted.

28 changes: 1 addition & 27 deletions contracts/Token.sol
@@ -1,30 +1,4 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

// import "openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
// import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";

import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/access/Ownable.sol";

/**
* @title TestToken is a basic ERC20 Token
*/
contract Token is ERC20, Ownable{

/**
* @dev assign totalSupply to account creating this contract
*/

constructor(string memory _TokenName, string memory _TokenSymbol) ERC20(_TokenName, _TokenSymbol) public {
_setupDecimals(5);
_mint(msg.sender, 5000000000000);

}

function FreeTest () public {
_mint(msg.sender, 5000000);
}
}

import "poolz-helper/contracts/Token.sol";
8 changes: 0 additions & 8 deletions migrations/1_initial_migration.js

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -10,7 +10,7 @@
"ganache-time-traveler": "^1.0.15",
"moonbeam-truffle-plugin": "^1.1.6",
"node-fetch": ">=2.6.1",
"poolz-helper": "^1.0.5",
"poolz-helper": "^1.0.8",
"truffle-assertions": "^0.9.2",
"truffle-flattener": "^1.5.0",
"truffle-privatekey-provider": "^1.5.0",
Expand All @@ -28,7 +28,7 @@
"truffle-plugin-verify": "^0.5.7"
},
"name": "poolz-back",
"version": "1.0.8",
"version": "1.0.10",
"main": "truffle-config.js",
"directories": {
"test": "test"
Expand Down
8 changes: 8 additions & 0 deletions test/General/5_CreatePoolFail.js
Expand Up @@ -57,4 +57,12 @@ contract("Create Pool Fails", async accounts => {
it("fail get pool status", async () => {
await truffleAssert.reverts(instance.GetPoolStatus(99));
});
it('cannot create new pool when paused', async () => {
await instance.pause({from: accounts[0]})
await Token.approve(instance.address, amount, { from: accounts[0] });
let date = new Date();
date.setDate(date.getDate() + 1); // add a day
const tx = instance.CreatePool(Token.address, Math.floor(date.getTime() / 1000) + 60, rate, rate, amount, 0, zero_address,true,0,0, { from: accounts[0] })
await truffleAssert.reverts(tx, 'Pausable: paused')
})
});
13 changes: 12 additions & 1 deletion test/General/6_Admin.js
@@ -1,6 +1,7 @@
const ThePoolz = artifacts.require("ThePoolz");
const { assert } = require('chai');
const truffleAssert = require('truffle-assertions');
const TestToken = artifacts.require("Token");
//const timeMachine = require('ganache-time-traveler');
const zero_address = "0x0000000000000000000000000000000000000000";

Expand All @@ -17,6 +18,7 @@ contract("Thepoolz Admin", accounts => {

beforeEach(async () => {
instance = await ThePoolz.deployed();
Token = await TestToken.new('TestToken', 'TEST');
})

it('set/get the Governer Contract Address', async () => {
Expand Down Expand Up @@ -116,5 +118,14 @@ contract("Thepoolz Admin", accounts => {
const after = await instance.UseLockedDealForTlp()
assert.equal(before, !after)
})

it('should pause', async () => {
await instance.pause({from: ownerAddress})
const result = await instance.paused()
assert.equal(result, true)
})
it('should unpause', async () => {
await instance.unpause({from: ownerAddress})
const result = await instance.paused()
assert.equal(result, false)
})
});
4 changes: 4 additions & 0 deletions test/General/8_FailInvest.js
Expand Up @@ -62,4 +62,8 @@ contract('Fail Invest', accounts => {
it('Fail to invest when pool does not have enough tokens', async () => {
await truffleAssert.reverts(instance.InvestETH(ethPoolId, {from: fromAddress, value: invest*50}), "Not enough tokens in the pool")
})
it('Fail to invest when Paused', async () => {
await instance.pause({from: fromAddress})
await truffleAssert.reverts(instance.InvestETH(ethPoolId,{ value: invest, from: fromAddress }), 'Pausable: paused')
})
})

0 comments on commit 82f9bbe

Please sign in to comment.