Skip to content

Commit

Permalink
The Secondary's primary is now private.
Browse files Browse the repository at this point in the history
  • Loading branch information
nventuro committed Aug 30, 2018
1 parent 622df07 commit 5ca4023
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion contracts/ownership/Secondary.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pragma solidity ^0.4.24;
* @dev A Secondary contract can only be used by its primary account (the one that created it)
*/
contract Secondary {
address public primary;
address private primary;

/**
* @dev Sets the primary account to the one that is creating the Secondary contract.
Expand Down
11 changes: 1 addition & 10 deletions test/ownership/Secondary.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ contract('Secondary', function ([_, primary, newPrimary, anyone]) {
this.secondary = await SecondaryMock.new({ from: primary });
});

it('stores the primary\'s address', async function () {
(await this.secondary.primary()).should.equal(primary);
});

describe('onlyPrimary', function () {
it('allows the primary account to call onlyPrimary functions', async function () {
await this.secondary.onlyPrimaryMock({ from: primary });
Expand All @@ -27,11 +23,6 @@ contract('Secondary', function ([_, primary, newPrimary, anyone]) {
});

describe('transferPrimary', function () {
it('makes the recipient the new primary', async function () {
await this.secondary.transferPrimary(newPrimary, { from: primary });
(await this.secondary.primary()).should.equal(newPrimary);
});

it('reverts when transfering to the null address', async function () {
await assertRevert(this.secondary.transferPrimary(ZERO_ADDRESS, { from: primary }));
});
Expand All @@ -40,7 +31,7 @@ contract('Secondary', function ([_, primary, newPrimary, anyone]) {
await assertRevert(this.secondary.transferPrimary(newPrimary, { from: anyone }));
});

context('with new primary', function () {
context('after transferring to new primary account', function () {
beforeEach(async function () {
await this.secondary.transferPrimary(newPrimary, { from: primary });
});
Expand Down

0 comments on commit 5ca4023

Please sign in to comment.