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

coverage(PrizePool): increase coverage percentage #128

Merged
merged 10 commits into from
Sep 30, 2021

Conversation

kamescg
Copy link
Contributor

@kamescg kamescg commented Sep 28, 2021

Added getters for public variables.

@asselstine Should we update he public access for ticket, prizeStrategy, balance and liquidityCap, so they're only accessible through the get functions?

image

@linear
Copy link

linear bot commented Sep 28, 2021

@kamescg kamescg marked this pull request as ready for review September 29, 2021 21:36
@PierrickGT PierrickGT self-assigned this Sep 29, 2021
/**
* @notice Read internal Ticket accounted balance.
*/
function getAccountedBalance() external view returns (uint256);
Copy link
Contributor

Choose a reason for hiding this comment

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

You can specify the returned value in the natspec doc for all these getters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Affirmative.

@@ -83,7 +78,10 @@ abstract contract PrizePool is IPrizePool, Ownable, ReentrancyGuard, IERC721Rece
function awardBalance() external override view returns (uint256) {
return _currentAwardBalance;
}

/// @inheritdoc IPrizePool
function accountedBalance() external override view returns (uint256) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why keep accountedBalance it we replace it by getAccountedBalance?

Copy link
Contributor Author

@kamescg kamescg Sep 29, 2021

Choose a reason for hiding this comment

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

Wasn't sure which one we wanted to keep. Removed accountedBalance.

@@ -264,7 +278,7 @@ abstract contract PrizePool is IPrizePool, Ownable, ReentrancyGuard, IERC721Rece
}

/// @inheritdoc IERC721Receiver
function onERC721Received(address,address,uint256,bytes calldata) external pure override returns (bytes4) {
function onERC721Received(address,address,uint256,bytes calldata) public pure override returns (bytes4) {
Copy link
Contributor

@PierrickGT PierrickGT Sep 29, 2021

Choose a reason for hiding this comment

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

Not sure you would need to add public if you were only calling onERC721Received in the harness contract.
Why call it with super?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Chuuu right @PierrickGT - removed public and just call directly.

const NFT_TOKEN_ID = 1;

describe('PrizePool', function () {
let contractsOwner: SignerWithAddress;
let wallet1: SignerWithAddress;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why replace by wallet1? Makes more sense to me when it's called contractsOwner.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We use wallet1 in all the other tests.

@asselstine
Copy link
Contributor

@kamescg

@asselstine Should we update he public access for ticket, prizeStrategy, balance and liquidityCap, so they're only accessible through the get functions?

Yes!

Comment on lines 81 to 84
// /// @inheritdoc IPrizePool
// function accountedBalance() external override view returns (uint256) {
// return _ticketTotalSupply();
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this comment.

Comment on lines 63 to 65
// function mockOnERC721Received(bytes calldata sig) external pure returns (bytes4) {
// return super.onERC721Received(address(0), address(0), 0, sig);
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this comment.

test/prize-pool/PrizePool.test.ts Outdated Show resolved Hide resolved
test/prize-pool/PrizePool.test.ts Outdated Show resolved Hide resolved
@PierrickGT PierrickGT merged commit 7663fb8 into master Sep 30, 2021
@PierrickGT PierrickGT deleted the pool-1585-coverage-prizepool branch September 30, 2021 20:52
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.

3 participants