Skip to content

Commit

Permalink
passing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kamescg committed Sep 30, 2021
1 parent b34fc10 commit 363d92b
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 25 deletions.
2 changes: 1 addition & 1 deletion contracts/PrizeSplitStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ contract PrizeSplitStrategy is PrizeSplit, IStrategy {
* @param _amount Amount of minted tokens.
*/
function _awardPrizeSplitAmount(address _to, uint256 _amount) override internal {
IControlledToken _ticket = prizePool.ticket();
IControlledToken _ticket = prizePool.getTicket();
prizePool.award(_to, _amount);
emit PrizeSplitAwarded(_to, _amount, _ticket);
}
Expand Down
12 changes: 4 additions & 8 deletions contracts/interfaces/IPrizePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ interface IPrizePool {
* @notice Read ticket variable
*/
function getTicket() external view returns (IControlledToken);
/**
* @notice Read token variable
*/
function getToken() external view returns (address);
/**
* @notice Read prizeStrategy variable
*/
Expand Down Expand Up @@ -193,14 +197,6 @@ interface IPrizePool {
/// @return True if ticket has been successfully set.
function setTicket(IControlledToken _ticket) external returns (bool);

/// @dev Returns the address of the prize pool ticket.
/// @return The address of the prize pool ticket.
function ticket() external view returns (IControlledToken);

/// @dev Returns the address of the underlying ERC20 asset
/// @return The address of the asset
function token() external view returns (address);

/// @notice Delegate the votes for a Compound COMP-like token held by the prize pool
/// @param _compLike The COMP-like token held by the prize pool that should be delegated
/// @param _to The address to delegate to
Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/IReserve.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ interface IReserve {

/**
* @notice Emit when checkpoint is created.
* @param destination Address receiving funds
* @param amount Amount of tokens transfered.
* @param reserveAccumulated Total depsosited
* @param withdrawAccumulated Total withdrawn
*/

event Checkpoint(uint256 reserveAccumulated, uint256 withdrawAccumulated);
Expand Down
4 changes: 2 additions & 2 deletions contracts/prize-pool/PrizePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ abstract contract PrizePool is IPrizePool, Ownable, ReentrancyGuard, IERC721Rece
string constant public VERSION = "4.0.0";

/// @notice Prize Pool ticket. Can only be set once by calling `setTicket()`.
IControlledToken internal override ticket;
IControlledToken internal ticket;

/// @notice The Prize Strategy that this Prize Pool is bound to.
address internal prizeStrategy;
Expand Down Expand Up @@ -111,7 +111,7 @@ abstract contract PrizePool is IPrizePool, Ownable, ReentrancyGuard, IERC721Rece
}

/// @inheritdoc IPrizePool
function token() external override view returns (address) {
function getToken() external override view returns (address) {
return address(_token());
}

Expand Down
2 changes: 1 addition & 1 deletion test/PrizeSplitStrategy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('PrizeSplitStrategy', () => {
debug('mocking ticket and prizePool...');
ticket = await erc20MintableFactory.deploy('Ticket', 'TICK');
prizePool = await deployMockContract(wallet1 as Signer, PrizePool.abi);
await prizePool.mock.ticket.returns(ticket.address);
await prizePool.mock.getTicket.returns(ticket.address);

debug('deploy prizeSplitStrategy...');
prizeSplitStrategy = await prizeSplitStrategyFactory.deploy(wallet1.address, prizePool.address);
Expand Down
2 changes: 1 addition & 1 deletion test/Ticket.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Ticket', () => {

prizePool = await deployMockContract(wallet1 as Signer, PrizePool.abi);
ticket = await deployTicketContract(ticketName, ticketSymbol, ticketDecimals, prizePool.address);
prizePool.mock.balanceCap.returns(MaxUint256);
prizePool.mock.getBalanceCap.returns(MaxUint256);
});

describe('constructor()', () => {
Expand Down
8 changes: 4 additions & 4 deletions test/prize-pool/PrizePool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('PrizePool', function () {
});

it('should set all the vars', async () => {
expect(await prizePool.token()).to.equal(depositToken.address);
expect(await prizePool.getToken()).to.equal(depositToken.address);
});

it('should reject invalid params', async () => {
Expand Down Expand Up @@ -339,7 +339,7 @@ describe('PrizePool', function () {
.to.emit(prizePool, 'PrizeStrategySet')
.withArgs(randomWallet.address);

expect(await prizePool.prizeStrategy()).to.equal(randomWallet.address);
expect(await prizePool.getPrizeStrategy()).to.equal(randomWallet.address);
});

it('should not allow anyone else to change the prize strategy', async () => {
Expand All @@ -357,7 +357,7 @@ describe('PrizePool', function () {
.to.emit(prizePool, 'BalanceCapSet')
.withArgs(balanceCap);

expect(await prizePool.balanceCap()).to.equal(balanceCap);
expect(await prizePool.getBalanceCap()).to.equal(balanceCap);
});

it('should not allow anyone else to call', async () => {
Expand All @@ -377,7 +377,7 @@ describe('PrizePool', function () {
.to.emit(prizePool, 'LiquidityCapSet')
.withArgs(liquidityCap);

expect(await prizePool.liquidityCap()).to.equal(liquidityCap);
expect(await prizePool.getLiquidityCap()).to.equal(liquidityCap);
});

it('should not allow anyone else to call', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/prize-pool/StakePrizePool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('StakePrizePool', function () {

describe('_token()', () => {
it('should return the staked token', async () => {
expect(await prizePool.token()).to.equal(stakeToken.address);
expect(await prizePool.getToken()).to.equal(stakeToken.address);
});
});
});
10 changes: 5 additions & 5 deletions test/prize-pool/YieldSourcePrizePool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ describe('YieldSourcePrizePool', function () {
};

const depositTo = async (amount: BigNumber) => {
await yieldSource.mock.supplyTokenTo.withArgs(amount, prizePool.address).returns();
await yieldSource.mock.supplyTokenTo.withArgs(amount, prizePool.address).returns();

await depositToken.approve(prizePool.address, amount);
await depositToken.mint(wallet.address, amount);
await prizePool.depositTo(wallet.address, amount);
await depositToken.approve(prizePool.address, amount);
await depositToken.mint(wallet.address, amount);
await prizePool.depositTo(wallet.address, amount);
}

beforeEach(async () => {
Expand Down Expand Up @@ -136,7 +136,7 @@ describe('YieldSourcePrizePool', function () {

describe('token()', async () => {
it('should return the yield source token', async () => {
expect(await prizePool.token()).to.equal(depositToken.address);
expect(await prizePool.getToken()).to.equal(depositToken.address);
});
});

Expand Down

0 comments on commit 363d92b

Please sign in to comment.