From fc0b5fdb02b88f3f6206a3290a367be15cf9360c Mon Sep 17 00:00:00 2001 From: kartojal Date: Tue, 16 Nov 2021 10:14:39 +0100 Subject: [PATCH] feat: fix tests, remove unused initialize parameter --- contracts/incentives/StakedTokenIncentivesController.sol | 3 +-- .../claim-rewards-to-self.spec.ts | 2 +- test/PullRewardsIncentivesController/claim-rewards.spec.ts | 2 +- test/PullRewardsIncentivesController/misc.spec.ts | 2 +- test/StakedIncentivesController/claim-rewards-to-self.spec.ts | 2 +- test/StakedIncentivesController/claim-rewards.spec.ts | 2 +- test/StakedIncentivesController/initialize.spec.ts | 2 +- test/StakedIncentivesController/misc.spec.ts | 2 +- test/helpers/deploy.ts | 4 +--- 9 files changed, 9 insertions(+), 12 deletions(-) diff --git a/contracts/incentives/StakedTokenIncentivesController.sol b/contracts/incentives/StakedTokenIncentivesController.sol index 7c1e76e..148da4b 100644 --- a/contracts/incentives/StakedTokenIncentivesController.sol +++ b/contracts/incentives/StakedTokenIncentivesController.sol @@ -27,9 +27,8 @@ contract StakedTokenIncentivesController is BaseIncentivesController { /** * @dev Initialize IStakedTokenIncentivesController - * @param addressesProvider the address of the corresponding addresses provider **/ - function initialize(address addressesProvider) external initializer { + function initialize() external initializer { //approves the safety module to allow staking IERC20(STAKE_TOKEN.STAKED_TOKEN()).safeApprove(address(STAKE_TOKEN), type(uint256).max); } diff --git a/test/PullRewardsIncentivesController/claim-rewards-to-self.spec.ts b/test/PullRewardsIncentivesController/claim-rewards-to-self.spec.ts index 3049102..2b0e213 100644 --- a/test/PullRewardsIncentivesController/claim-rewards-to-self.spec.ts +++ b/test/PullRewardsIncentivesController/claim-rewards-to-self.spec.ts @@ -32,7 +32,7 @@ const getRewardsBalanceScenarios: ScenarioAction[] = [ { caseName: 'Accrued rewards are not 0', emissionPerSecond: '2432424', - amountToClaim: '10', + amountToClaim: MAX_UINT_AMOUNT, }, { caseName: 'Should allow -1', diff --git a/test/PullRewardsIncentivesController/claim-rewards.spec.ts b/test/PullRewardsIncentivesController/claim-rewards.spec.ts index 719e03f..c154084 100644 --- a/test/PullRewardsIncentivesController/claim-rewards.spec.ts +++ b/test/PullRewardsIncentivesController/claim-rewards.spec.ts @@ -34,7 +34,7 @@ const getRewardsBalanceScenarios: ScenarioAction[] = [ { caseName: 'Accrued rewards are not 0', emissionPerSecond: '2432424', - amountToClaim: '10', + amountToClaim: MAX_UINT_AMOUNT, }, { caseName: 'Should allow -1', diff --git a/test/PullRewardsIncentivesController/misc.spec.ts b/test/PullRewardsIncentivesController/misc.spec.ts index b210d2b..505669c 100644 --- a/test/PullRewardsIncentivesController/misc.spec.ts +++ b/test/PullRewardsIncentivesController/misc.spec.ts @@ -54,7 +54,7 @@ makeSuite('pullRewardsIncentivesController misc tests', (testEnv) => { await expect( pullRewardsIncentivesController.configureAssets([aDaiBaseMock.address], [MAX_UINT_AMOUNT]) - ).to.be.revertedWith('INVALID_CONFIGURATION'); + ).to.be.revertedWith('Index overflow at emissionsPerSecond'); }); it('Should REWARD_TOKEN getter returns the stake token address to keep old interface compatibility', async () => { diff --git a/test/StakedIncentivesController/claim-rewards-to-self.spec.ts b/test/StakedIncentivesController/claim-rewards-to-self.spec.ts index cee3b43..41c3275 100644 --- a/test/StakedIncentivesController/claim-rewards-to-self.spec.ts +++ b/test/StakedIncentivesController/claim-rewards-to-self.spec.ts @@ -32,7 +32,7 @@ const getRewardsBalanceScenarios: ScenarioAction[] = [ { caseName: 'Accrued rewards are not 0', emissionPerSecond: '2432424', - amountToClaim: '10', + amountToClaim: MAX_UINT_AMOUNT, }, { caseName: 'Should allow -1', diff --git a/test/StakedIncentivesController/claim-rewards.spec.ts b/test/StakedIncentivesController/claim-rewards.spec.ts index 3bee11c..5d8493e 100644 --- a/test/StakedIncentivesController/claim-rewards.spec.ts +++ b/test/StakedIncentivesController/claim-rewards.spec.ts @@ -34,7 +34,7 @@ const getRewardsBalanceScenarios: ScenarioAction[] = [ { caseName: 'Accrued rewards are not 0', emissionPerSecond: '2432424', - amountToClaim: '10', + amountToClaim: MAX_UINT_AMOUNT, }, { caseName: 'Should allow -1', diff --git a/test/StakedIncentivesController/initialize.spec.ts b/test/StakedIncentivesController/initialize.spec.ts index 6abef9f..894c189 100644 --- a/test/StakedIncentivesController/initialize.spec.ts +++ b/test/StakedIncentivesController/initialize.spec.ts @@ -7,7 +7,7 @@ makeSuite('AaveIncentivesController initialize', (testEnv: TestEnv) => { // TODO: useless or not? it('Tries to call initialize second time, should be reverted', async () => { const { aaveIncentivesController } = testEnv; - await expect(aaveIncentivesController.initialize(ZERO_ADDRESS)).to.be.reverted; + await expect(aaveIncentivesController.initialize()).to.be.reverted; }); it('allowance on aave token should be granted to psm contract for pei', async () => { const { aaveIncentivesController, stakedAave, aaveToken } = testEnv; diff --git a/test/StakedIncentivesController/misc.spec.ts b/test/StakedIncentivesController/misc.spec.ts index 7663cbf..f6f9480 100644 --- a/test/StakedIncentivesController/misc.spec.ts +++ b/test/StakedIncentivesController/misc.spec.ts @@ -52,7 +52,7 @@ makeSuite('AaveIncentivesController misc tests', (testEnv) => { await expect( aaveIncentivesController.configureAssets([aDaiMock.address], [MAX_UINT_AMOUNT]) - ).to.be.revertedWith('INVALID_CONFIGURATION'); + ).to.be.revertedWith('Index overflow at emissionsPerSecond'); }); it('Should REWARD_TOKEN getter returns the stake token address to keep old interface compatibility', async () => { diff --git a/test/helpers/deploy.ts b/test/helpers/deploy.ts index 4e90e39..5b944c5 100644 --- a/test/helpers/deploy.ts +++ b/test/helpers/deploy.ts @@ -53,9 +53,7 @@ export const testDeployIncentivesController = async ( '18', ] ); - const incentivesInit = incentivesImplementation.interface.encodeFunctionData('initialize', [ - ZERO_ADDRESS, - ]); + const incentivesInit = incentivesImplementation.interface.encodeFunctionData('initialize'); await ( await stakeProxy['initialize(address,address,bytes)'](