Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kamescg committed Mar 18, 2022
1 parent ed4433d commit 4db11e4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 31 deletions.
4 changes: 2 additions & 2 deletions contracts/PrizeTierHistoryV2.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.6;
import "@pooltogether/owner-manager-contracts/contracts/Manageable.sol";
import "./abstract/IdBinarySearchLib.sol";
import "./abstract/IdBinarySearch.sol";

contract PrizeTierHistoryV2 is IdBinarySearchLib, Manageable {
contract PrizeTierHistoryV2 is IdBinarySearch, Manageable {

struct PrizeTier {
uint8 bitRangeSize;
Expand Down
22 changes: 0 additions & 22 deletions contracts/abstract/DrawIDBinarySearch.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
pragma solidity 0.8.6;

/**
* @title PoolTogether V4 IdBinarySearchLib
* @title PoolTogether V4 IdBinarySearch
* @author PoolTogether Inc Team
* @notice IdBinarySearchLib uses binary search to find a parent contract struct with the drawId parameter
* @notice IdBinarySearch uses binary search to find a parent contract struct with the drawId parameter
* @dev The implementing contract must provider access to a struct (i.e. PrizeTier) list with is both
* sorted and indexed by the drawId field for binary search to work.
*/
abstract contract IdBinarySearchLib {
abstract contract IdBinarySearch {
/**
* @notice Get newest index in array
*/
Expand All @@ -28,7 +28,7 @@ abstract contract IdBinarySearchLib {
uint32 oldestDrawId = getIdForIndex(leftSide);
uint32 newestDrawId = getIdForIndex(rightSide);

require(_drawId >= oldestDrawId, "IdBinarySearchLib/draw-id-out-of-range");
require(_drawId >= oldestDrawId, "IdBinarySearch/draw-id-out-of-range");
if (_drawId >= newestDrawId) return rightSide;
if (_drawId == oldestDrawId) return leftSide;

Expand Down
4 changes: 2 additions & 2 deletions contracts/test/DrawIDAndStructMappingBinarySearch.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.6;
import "../abstract/IdBinarySearchLib.sol";
import "../abstract/IdBinarySearch.sol";

contract DrawIDAndStructMappingBinarySearch is IdBinarySearchLib {
contract DrawIDAndStructMappingBinarySearch is IdBinarySearch {
struct Draw {
uint32 drawId;
uint256 randomNumber;
Expand Down
2 changes: 1 addition & 1 deletion test/PrizeTierHistoryV2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe('PrizeTierHistoryV2', () => {
it('should fail to get a PrizeTer after history range', async () => {
await prizeTierHistory.push(prizeTiers[2]);
await expect(prizeTierHistory.getPrizeTier(4)).to.be.revertedWith(
'IdBinarySearchLib/draw-id-out-of-range',
'IdBinarySearch/draw-id-out-of-range',
);
});
});
Expand Down

0 comments on commit 4db11e4

Please sign in to comment.