Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase coverage #342

Merged
merged 7 commits into from
Oct 16, 2018
Merged

Increase coverage #342

merged 7 commits into from
Oct 16, 2018

Conversation

satyamakgec
Copy link
Contributor

Fixes during increasing the tests

  • Wrong mapping used in the addManualBlocking() of MATM
  • Return statement is missing from the implementation() of OwnerUpgradeability.sol
  • change the withdrawPoly function with withdrawERC20.

@@ -669,6 +669,7 @@ contract SecurityTokenRegistry is ISecurityTokenRegistry, EternalStorage {
* @param _patch Patch version of the proxy
*/
function setProtocolVersion(address _STFactoryAddress, uint8 _major, uint8 _minor, uint8 _patch) external onlyOwner {
require(_STFactoryAddress != address(0));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing reason string

function withdrawERC20(address _tokenContract, uint256 _value) external onlyOwner {
require(_tokenContract != address(0));
IERC20 token = IERC20(_tokenContract);
require(token.transfer(owner, _value));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing reason strings

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is intentional to reduce the size of the contract

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add at least 1 character reason so that we can know if our require statement is reverting or if it's something generic.
I'll have a deep look at the security token contract and to see if I can save some bits at some other places.

describe("Test the initialize the function", async () => {
it("Should successfully update the implementation address -- fail because polymathRegistry address is 0x", async () => {
let bytesProxy = encodeProxyCall(MRProxyParameters, [
"0x0000000000000000000000000000000000000000",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For cleaner code, maybe let's define const nullAddress = "0x0000000000000000000000000000000000000000" and use it everywhere. It is used a lot in all the test cases.

* @title Mock Contract Not fit for production environment
*/

contract MockBurnFactory is ModuleFactory {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should inherit the main contract in the mock contract and overwrite the functions we need to. This will help the reader understand what exactly we are mocking and why.
contract MockBurnFactory is ModuleFactory
can be
contract MockBurnFactory is BurnFactory

Same goes for all mock contracts.

@pabloruiz55 pabloruiz55 merged commit df996a1 into development-1.5.0 Oct 16, 2018
@satyamakgec satyamakgec deleted the increase-coverage branch October 30, 2019 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants