diff --git a/contracts/StakingRewardsNotifier.sol b/contracts/StakingRewardsNotifier.sol index a09d213f4..ed4a09b39 100644 --- a/contracts/StakingRewardsNotifier.sol +++ b/contracts/StakingRewardsNotifier.sol @@ -43,8 +43,10 @@ contract StakingRewardsNotifier is Ownable2Step, IStakingRewardsNotifier { /// @param _usdc: address of the USDC contract /// @param _supplySchedule: address of the SupplySchedule contract constructor(address _contractOwner, address _kwenta, address _usdc, address _supplySchedule) { - if (_contractOwner == address(0) || _kwenta == address(0) || _usdc == address(0) || _supplySchedule == address(0)) - { + if ( + _contractOwner == address(0) || _kwenta == address(0) || _usdc == address(0) + || _supplySchedule == address(0) + ) { revert ZeroAddress(); } kwenta = IKwenta(_kwenta); diff --git a/contracts/interfaces/IStakingRewardsV2.sol b/contracts/interfaces/IStakingRewardsV2.sol index 7265a0ff2..79f3bb1df 100644 --- a/contracts/interfaces/IStakingRewardsV2.sol +++ b/contracts/interfaces/IStakingRewardsV2.sol @@ -112,7 +112,7 @@ interface IStakingRewardsV2 { /// @param _timestamp: timestamp to check /// @return balance at given timestamp /// @dev if called with a timestamp that equals the current block timestamp, then the function might return inconsistent - /// values as further transactions changing the balances can still occur within the same block. + /// values as further transactions changing the balances can still occur within the same block. function balanceAtTime(address _account, uint256 _timestamp) external view returns (uint256); /// @notice get a users escrowed balance at a given timestamp @@ -120,7 +120,7 @@ interface IStakingRewardsV2 { /// @param _timestamp: timestamp to check /// @return escrowed balance at given timestamp /// @dev if called with a timestamp that equals the current block timestamp, then the function might return inconsistent - /// values as further transactions changing the balances can still occur within the same block. + /// values as further transactions changing the balances can still occur within the same block. function escrowedBalanceAtTime(address _account, uint256 _timestamp) external view @@ -130,7 +130,7 @@ interface IStakingRewardsV2 { /// @param _timestamp: timestamp to check /// @return total supply at given timestamp /// @dev if called with a timestamp that equals the current block timestamp, then the function might return inconsistent - /// values as further transactions changing the balances can still occur within the same block. + /// values as further transactions changing the balances can still occur within the same block. function totalSupplyAtTime(uint256 _timestamp) external view returns (uint256); /*////////////////////////////////////////////////////////////// diff --git a/test/foundry/integration/stakingV2.migration.fork.t.sol b/test/foundry/integration/stakingV2.migration.fork.t.sol index 548133c1f..4a829d74b 100644 --- a/test/foundry/integration/stakingV2.migration.fork.t.sol +++ b/test/foundry/integration/stakingV2.migration.fork.t.sol @@ -35,9 +35,8 @@ contract StakingV2MigrationForkTests is StakingTestHelpers { // set owners address code to trick the test into allowing onlyOwner functions to be called via script vm.etch(owner, address(new Migrate()).code); - (rewardEscrowV2, stakingRewardsV2, escrowMigrator, rewardsNotifier) = Migrate( - owner - ).runCompleteMigrationProcess({ + (rewardEscrowV2, stakingRewardsV2, escrowMigrator, rewardsNotifier) = Migrate(owner) + .runCompleteMigrationProcess({ _owner: owner, _kwenta: address(kwenta), _usdc: address(usdc), diff --git a/test/foundry/integration/stakingV2.upgrade.fork.t.sol b/test/foundry/integration/stakingV2.upgrade.fork.t.sol index f0b2ba5c4..8e0881e26 100644 --- a/test/foundry/integration/stakingV2.upgrade.fork.t.sol +++ b/test/foundry/integration/stakingV2.upgrade.fork.t.sol @@ -14,7 +14,6 @@ import {StakingRewardsV2} from "../../../contracts/StakingRewardsV2.sol"; import "../utils/Constants.t.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; - contract StakingV2MigrationForkTests is StakingTestHelpers { /*////////////////////////////////////////////////////////////// SETUP @@ -115,6 +114,6 @@ contract StakingV2MigrationForkTests is StakingTestHelpers { // check some stake has been earned assertGt(newV2Impl.earned(address(this)), earnedKwenta); - assertGt(newV2Impl.earnedUSDC(address(this)) , 0); + assertGt(newV2Impl.earnedUSDC(address(this)), 0); } } diff --git a/test/foundry/integration/stakingV2.upgrade.t.sol b/test/foundry/integration/stakingV2.upgrade.t.sol index 951ee0680..e80a9599b 100644 --- a/test/foundry/integration/stakingV2.upgrade.t.sol +++ b/test/foundry/integration/stakingV2.upgrade.t.sol @@ -196,10 +196,7 @@ contract StakingV2UpgradeTests is DefaultStakingV2Setup { { stakingRewardsV3Implementation = address( new MockStakingRewardsV3( - address(kwenta), - address(usdc), - address(rewardEscrowV2), - address(rewardsNotifier) + address(kwenta), address(usdc), address(rewardEscrowV2), address(rewardsNotifier) ) ); } diff --git a/test/foundry/unit/StakingRewardsNotifier/StakingRewardsNotifier.t.sol b/test/foundry/unit/StakingRewardsNotifier/StakingRewardsNotifier.t.sol index c2e955bfe..4c7375c1a 100644 --- a/test/foundry/unit/StakingRewardsNotifier/StakingRewardsNotifier.t.sol +++ b/test/foundry/unit/StakingRewardsNotifier/StakingRewardsNotifier.t.sol @@ -20,17 +20,23 @@ contract StakingRewardsNotifierTest is DefaultStakingV2Setup { function testCannotDeployWithZeroOwnerAddress() public { vm.expectRevert(IStakingRewardsNotifier.ZeroAddress.selector); - new StakingRewardsNotifier(address(0), address(kwenta), address(usdc), address(supplySchedule)); + new StakingRewardsNotifier( + address(0), address(kwenta), address(usdc), address(supplySchedule) + ); } function testCannotDeployWithZeroKwentaAddress() public { vm.expectRevert(IStakingRewardsNotifier.ZeroAddress.selector); - new StakingRewardsNotifier(address(this), address(0), address(usdc), address(supplySchedule)); + new StakingRewardsNotifier( + address(this), address(0), address(usdc), address(supplySchedule) + ); } function testCannotDeployWithZeroUsdcAddress() public { vm.expectRevert(IStakingRewardsNotifier.ZeroAddress.selector); - new StakingRewardsNotifier(address(this), address(kwenta), address(0), address(supplySchedule)); + new StakingRewardsNotifier( + address(this), address(kwenta), address(0), address(supplySchedule) + ); } function testCannotDeployWithZeroSupplyScheduleAddress() public { @@ -159,12 +165,11 @@ contract StakingRewardsNotifierTest is DefaultStakingV2Setup { assertEq(kwenta.balanceOf(address(rewardEscrowV2)), 0); // Mint and the RewardsNotifier should transfer amounts to the staking contract - uint256 mintAmount = 176268972686291953380981; + uint256 mintAmount = 176_268_972_686_291_953_380_981; uint256 balanceBefore = kwenta.balanceOf(address(stakingRewardsV2)); supplySchedule.mint(); uint256 balanceAfter = kwenta.balanceOf(address(stakingRewardsV2)); assertGt(balanceAfter, balanceBefore); assertEq(balanceAfter - balanceBefore, 225 ether + mintAmount); - } } diff --git a/test/foundry/unit/StakingV2SetupTests.t.sol b/test/foundry/unit/StakingV2SetupTests.t.sol index 70cb6a420..7395b7aee 100644 --- a/test/foundry/unit/StakingV2SetupTests.t.sol +++ b/test/foundry/unit/StakingV2SetupTests.t.sol @@ -26,8 +26,7 @@ contract StakingV2SetupTests is StakingV1Setup { function setUp() public virtual override { super.setUp(); - rewardEscrowV2Implementation = - address(new RewardEscrowV2(address(kwenta), address(0x1))); + rewardEscrowV2Implementation = address(new RewardEscrowV2(address(kwenta), address(0x1))); } /*////////////////////////////////////////////////////////////// @@ -38,7 +37,9 @@ contract StakingV2SetupTests is StakingV1Setup { (address rewardEscrowV2, address stakingRewardsV2) = deployRewardEscrowV2AndStakingRewardsV2(address(this)); - new EscrowMigrator(address(kwenta), address(rewardEscrowV1), rewardEscrowV2, stakingRewardsV2); + new EscrowMigrator( + address(kwenta), address(rewardEscrowV1), rewardEscrowV2, stakingRewardsV2 + ); } function test_Cannot_Setup_EscrowMigrator_With_Kwenta_Zero_Address() public { @@ -76,18 +77,16 @@ contract StakingV2SetupTests is StakingV1Setup { deployRewardEscrowV2AndStakingRewardsV2(address(this)); escrowMigratorImplementation = address( - new EscrowMigrator(address(kwenta), address(rewardEscrowV1), rewardEscrowV2, stakingRewardsV2) + new EscrowMigrator( + address(kwenta), address(rewardEscrowV1), rewardEscrowV2, stakingRewardsV2 + ) ); vm.expectRevert(IEscrowMigrator.ZeroAddress.selector); new ERC1967Proxy( - escrowMigratorImplementation, - abi.encodeWithSignature( - "initialize(address,address)", - address(0), - treasury - ) - ); + escrowMigratorImplementation, + abi.encodeWithSignature("initialize(address,address)", address(0), treasury) + ); } function test_Cannot_Initialize_EscrowMigrator_Proxy_With_Treasury_Zero_Address() public { @@ -95,18 +94,16 @@ contract StakingV2SetupTests is StakingV1Setup { deployRewardEscrowV2AndStakingRewardsV2(address(this)); escrowMigratorImplementation = address( - new EscrowMigrator(address(kwenta), address(rewardEscrowV1), rewardEscrowV2, stakingRewardsV2) + new EscrowMigrator( + address(kwenta), address(rewardEscrowV1), rewardEscrowV2, stakingRewardsV2 + ) ); vm.expectRevert(IEscrowMigrator.ZeroAddress.selector); new ERC1967Proxy( - escrowMigratorImplementation, - abi.encodeWithSignature( - "initialize(address,address)", - address(0x1), - address(0) - ) - ); + escrowMigratorImplementation, + abi.encodeWithSignature("initialize(address,address)", address(0x1), address(0)) + ); } /*////////////////////////////////////////////////////////////// @@ -136,12 +133,7 @@ contract StakingV2SetupTests is StakingV1Setup { address rewardEscrowV2 = deployRewardEscrowV2(address(this)); vm.expectRevert(IStakingRewardsV2.ZeroAddress.selector); stakingRewardsV2Implementation = address( - new StakingRewardsV2( - address(0), - address(usdc), - rewardEscrowV2, - address(supplySchedule) - ) + new StakingRewardsV2(address(0), address(usdc), rewardEscrowV2, address(supplySchedule)) ); } @@ -150,10 +142,7 @@ contract StakingV2SetupTests is StakingV1Setup { vm.expectRevert(IStakingRewardsV2.ZeroAddress.selector); stakingRewardsV2Implementation = address( new StakingRewardsV2( - address(kwenta), - address(0), - rewardEscrowV2, - address(supplySchedule) + address(kwenta), address(0), rewardEscrowV2, address(supplySchedule) ) ); } @@ -162,10 +151,7 @@ contract StakingV2SetupTests is StakingV1Setup { vm.expectRevert(IStakingRewardsV2.ZeroAddress.selector); stakingRewardsV2Implementation = address( new StakingRewardsV2( - address(kwenta), - address(usdc), - address(0), - address(supplySchedule) + address(kwenta), address(usdc), address(0), address(supplySchedule) ) ); } @@ -174,12 +160,7 @@ contract StakingV2SetupTests is StakingV1Setup { address rewardEscrowV2 = deployRewardEscrowV2(address(this)); vm.expectRevert(IStakingRewardsV2.ZeroAddress.selector); stakingRewardsV2Implementation = address( - new StakingRewardsV2( - address(kwenta), - address(usdc), - rewardEscrowV2, - address(0) - ) + new StakingRewardsV2(address(kwenta), address(usdc), rewardEscrowV2, address(0)) ); } @@ -187,10 +168,7 @@ contract StakingV2SetupTests is StakingV1Setup { address rewardEscrowV2 = deployRewardEscrowV2(address(this)); stakingRewardsV2Implementation = address( new StakingRewardsV2( - address(kwenta), - address(usdc), - rewardEscrowV2, - address(supplySchedule) + address(kwenta), address(usdc), rewardEscrowV2, address(supplySchedule) ) ); vm.expectRevert(IStakingRewardsV2.ZeroAddress.selector); @@ -209,10 +187,7 @@ contract StakingV2SetupTests is StakingV1Setup { stakingRewardsV2Implementation = address( new StakingRewardsV2( - address(kwenta), - address(usdc), - rewardEscrowV2, - address(supplySchedule) + address(kwenta), address(usdc), rewardEscrowV2, address(supplySchedule) ) ); @@ -224,24 +199,17 @@ contract StakingV2SetupTests is StakingV1Setup { function deployRewardEscrowV2(address _owner) internal returns (address) { return address( new ERC1967Proxy( - rewardEscrowV2Implementation, - abi.encodeWithSignature( - "initialize(address)", - _owner - ) - ) + rewardEscrowV2Implementation, abi.encodeWithSignature("initialize(address)", _owner) + ) ); } function deployStakingRewardsV2(address _owner) internal returns (address) { return address( new ERC1967Proxy( - stakingRewardsV2Implementation, - abi.encodeWithSignature( - "initialize(address)", - _owner - ) - ) + stakingRewardsV2Implementation, + abi.encodeWithSignature("initialize(address)", _owner) + ) ); } } diff --git a/test/foundry/utils/mocks/MockERC20.sol b/test/foundry/utils/mocks/MockERC20.sol index f0da0821b..1e45d4fe8 100644 --- a/test/foundry/utils/mocks/MockERC20.sol +++ b/test/foundry/utils/mocks/MockERC20.sol @@ -4,7 +4,12 @@ pragma solidity 0.8.19; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract MockERC20 is ERC20 { - constructor(string memory name, string memory symbol, uint256 _initialSupply, address _initialHolder) ERC20(name, symbol) { + constructor( + string memory name, + string memory symbol, + uint256 _initialSupply, + address _initialHolder + ) ERC20(name, symbol) { _mint(_initialHolder, _initialSupply); } @@ -15,4 +20,4 @@ contract MockERC20 is ERC20 { function burn(address from, uint256 amount) external { _burn(from, amount); } -} \ No newline at end of file +} diff --git a/test/foundry/utils/mocks/MockStakingRewardsV3.t.sol b/test/foundry/utils/mocks/MockStakingRewardsV3.t.sol index 4227c18bf..996f7d48e 100644 --- a/test/foundry/utils/mocks/MockStakingRewardsV3.t.sol +++ b/test/foundry/utils/mocks/MockStakingRewardsV3.t.sol @@ -6,12 +6,9 @@ import {StakingRewardsV2} from "../../../../contracts/StakingRewardsV2.sol"; contract MockStakingRewardsV3 is StakingRewardsV2 { uint256 public newNum; - constructor( - address _kwenta, - address _usdc, - address _rewardEscrow, - address _rewardNotifier - ) StakingRewardsV2(_kwenta, _usdc, _rewardEscrow, _rewardNotifier) {} + constructor(address _kwenta, address _usdc, address _rewardEscrow, address _rewardNotifier) + StakingRewardsV2(_kwenta, _usdc, _rewardEscrow, _rewardNotifier) + {} function setNewNum(uint256 _newNum) external { newNum = _newNum;