Skip to content

Commit

Permalink
Merge pull request #103 from PolymathNetwork/coverage
Browse files Browse the repository at this point in the history
Coverage
  • Loading branch information
satyamakgec committed May 15, 2018
2 parents e9efd58 + d4185ce commit 89b376f
Show file tree
Hide file tree
Showing 28 changed files with 10,818 additions and 671 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
.npm-debug.log
*.DS_Store
privKey
coverage/
coverage.json
23 changes: 23 additions & 0 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
norpc: true,
port: 8545,
copyPackages: ['openzeppelin-solidity'],
skipFiles: ['tokens/STVersionProxy001.sol',
'tokens/STVersionProxy002.sol',
'tokens/SecurityTokenV2.sol',
'interfaces/IModule.sol',
'interfaces/IModuleFactory.sol',
'interfaces/IModuleRegistry.sol',
'interfaces/ISecurityToken.sol',
'interfaces/ISecurityTokenRegistry.sol',
'interfaces/IST20.sol',
'interfaces/ISTProxy.sol',
'interfaces/ITickerRegistry.sol',
'helpers/Util.sol',
'helpers/TokenBurner.sol',
'helpers/PolyToken.sol',
'Migrations.sol',
'mocks/PolyTokenFaucet.sol',
'mocks/TestSTOFactory.sol',
'mocks/MockFactory.sol']
};
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Build Status](https://travis-ci.org/PolymathNetwork/polymath-core.svg?branch=master)](https://travis-ci.org/PolymathNetwork/polymath-core)
[![Coverage Status](https://coveralls.io/repos/github/PolymathNetwork/polymath-core/badge.svg?branch=master)](https://coveralls.io/github/PolymathNetwork/polymath-core?branch=master)
<a href="https://t.me/polymathnetwork"><img src="https://img.shields.io/badge/50k+-telegram-blue.svg" target="_blank"></a>

![Polymath logo](Polymath.png)
Expand Down
4 changes: 2 additions & 2 deletions contracts/helpers/TokenBurner.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ contract TokenBurner {

address public securityToken;

constructor (address _securityToken) {
constructor (address _securityToken) public {
securityToken = _securityToken;
}

function burn(address _burner, uint256 _value) public returns(bool) {
function burn(address /*_burner*/, uint256 /*_value*/) public returns(bool) {
require(msg.sender == securityToken);
// Add the schematics for the burner( token holder) that backing the burning of the securities
return true;
Expand Down
57 changes: 57 additions & 0 deletions contracts/mocks/MockFactory.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
pragma solidity ^0.4.23;

import "../modules/STO/DummySTO.sol";
import "../interfaces/IModuleFactory.sol";
import "../interfaces/IModule.sol";


contract MockFactory is IModuleFactory {

constructor (address _polyAddress) public
IModuleFactory(_polyAddress)
{

}

function deploy(bytes _data) external returns(address) {
if(getCost() > 0)
require(polyToken.transferFrom(msg.sender, owner, getCost()), "Failed transferFrom because of sufficent Allowance is not provided");
//Check valid bytes - can only call module init function
DummySTO dummySTO = new DummySTO(msg.sender, address(polyToken));
//Checks that _data is valid (not calling anything it shouldn't)
require(getSig(_data) == dummySTO.getInitFunction(), "Provided data is not valid");
require(address(dummySTO).call(_data), "Un-successfull call");
return address(dummySTO);
}

function getCost() public view returns(uint256) {
return uint256(1000 * 10 ** 18);
}

function getType() public view returns(uint8) {
return 0;
}

function getName() public view returns(bytes32) {
return "Mock";
}

function getDescription() public view returns(string) {
return "MockManager";
}

function getTitle() public view returns(string) {
return "Mock Manager";
}

function getInstructions() public view returns(string) {
return "Mock Manager - This is mock in nature";
}

function getTags() public view returns(bytes32[]) {
bytes32[] memory availableTags = new bytes32[](4);
availableTags[0] = "Mock";
return availableTags;
}

}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pragma solidity ^0.4.23;

import "../../../contracts/modules/STO/DummySTO.sol";
import "../../../contracts/interfaces/IModuleFactory.sol";
import "../../../contracts/interfaces/IModule.sol";
import "../modules/STO/DummySTO.sol";
import "../interfaces/IModuleFactory.sol";
import "../interfaces/IModule.sol";


contract TestSTOFactory is IModuleFactory {
Expand Down
13 changes: 13 additions & 0 deletions contracts/modules/STO/CappedSTO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,19 @@ contract CappedSTO is ISTO {
return allPermissions;
}

function getSTODetails() public view returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, bool) {
return (
startTime,
endTime,
cap,
rate,
fundsRaised,
investorCount,
tokensSold,
(fundraiseType == FundraiseType.POLY)
);
}

// -----------------------------------------
// Internal interface (extensible)
// -----------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion contracts/modules/STO/PreSaleSTO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ contract PreSaleSTO is ISTO {
}

function getPermissions() public view returns(bytes32[]) {
bytes32[] memory allPermissions = new bytes32[](0);
bytes32[] memory allPermissions = new bytes32[](1);
allPermissions[0] = PRE_SALE_ADMIN;
return allPermissions;
}

Expand Down
4 changes: 4 additions & 0 deletions migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ module.exports = function (deployer, network, accounts) {
} else if (network === 'mainnet') {
web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/g5xfoQ0jFSE9S5LwM1Ei'))
PolyToken = '0x9992eC3cF6A55b00978cdDF2b27BC6882d88D1eC' // Mainnet PolyToken Address
}if (network === 'coverage') {
web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'))
PolymathAccount = accounts[0]
PolyToken = DevPolyToken.address // Development network polytoken address
}

// POLYMATH NETWORK Configuration :: DO THIS ONLY ONCE
Expand Down
Loading

0 comments on commit 89b376f

Please sign in to comment.