fix: update foundry.toml line_lenght to 110 to fix conflict with prettier

This commit is contained in:
Ricardo Guilherme Schmidt 2024-08-27 13:34:54 -03:00
parent 12f16e300c
commit 5af8d35e97
3 changed files with 69 additions and 18 deletions

View File

@ -175,11 +175,20 @@ contract StakeManager is Ownable {
/**
* Increases balance of msg.sender;
* @param _amount Amount of balance to be decreased.
* @param _timeToIncrease Seconds to increase in locked time. If stake is unlocked, increases from block.timestamp.
* @param _timeToIncrease Seconds to increase in locked time. If stake is unlocked, increases from
* block.timestamp.
*
* @dev Reverts when resulting locked time is not in range of [MIN_LOCKUP_PERIOD, MAX_LOCKUP_PERIOD]
*/
function stake(uint256 _amount, uint256 _timeToIncrease) external onlyVault noPendingMigration finalizeEpoch {
function stake(
uint256 _amount,
uint256 _timeToIncrease
)
external
onlyVault
noPendingMigration
finalizeEpoch
{
Account storage account = accounts[msg.sender];
if (account.balance > 0) {
revert StakeManager__AlreadyStaked();
@ -258,7 +267,8 @@ contract StakeManager is Ownable {
//mp estimation
uint256 mpPerEpoch = _getMPToMint(account.balance, EPOCH_SIZE);
stakeRewardEstimate.decrementExpiredMP(account.mpMaxBoostLimitEpoch, mpPerEpoch); // some staked amount from the
stakeRewardEstimate.decrementExpiredMP(account.mpMaxBoostLimitEpoch, mpPerEpoch); // some staked
// amount from the
// past
if (account.mpMaxBoostLimitEpoch < currentEpoch) {
totalMPPerEpoch -= mpPerEpoch;
@ -274,7 +284,8 @@ contract StakeManager is Ownable {
/**
* @notice Locks entire balance for more amount of time.
* @param _timeToIncrease Seconds to increase in locked time. If stake is unlocked, increases from block.timestamp.
* @param _timeToIncrease Seconds to increase in locked time. If stake is unlocked, increases from
* block.timestamp.
*
* @dev Reverts when resulting locked time is not in range of [MIN_LOCKUP_PERIOD, MAX_LOCKUP_PERIOD]
*/
@ -428,7 +439,14 @@ contract StakeManager is Ownable {
* @param _account Account data
* @param _acceptMigration If account should be stored or its MP/balance supply reduced
*/
function migrateFrom(address _vault, bool _acceptMigration, Account memory _account) external onlyPreviousManager {
function migrateFrom(
address _vault,
bool _acceptMigration,
Account memory _account
)
external
onlyPreviousManager
{
if (_acceptMigration) {
accounts[_vault] = _account;
} else {

View File

@ -35,7 +35,7 @@
[fmt]
bracket_spacing = true
int_types = "long"
line_length = 120
line_length = 110
multiline_func_header = "all"
number_underscore = "thousands"
quote_style = "double"

View File

@ -545,8 +545,15 @@ contract ExecuteAccountTest is StakeManagerTest {
console.log("# PND_REWARDS", stakeManager.pendingReward());
for (uint256 j = 0; j < userVaults.length; j++) {
(address rewardAddress,,, uint256 totalMPBefore, uint256 lastMintBefore,, uint256 epochBefore,) =
stakeManager.accounts(address(userVaults[j]));
(
address rewardAddress,
,
,
uint256 totalMPBefore,
uint256 lastMintBefore,
,
uint256 epochBefore,
) = stakeManager.accounts(address(userVaults[j]));
uint256 rewardsBefore = ERC20(stakeToken).balanceOf(rewardAddress);
console.log("-Vault number", j);
console.log("--=====BEFORE=====");
@ -613,16 +620,25 @@ contract ExecuteAccountTest is StakeManagerTest {
vm.warp(stakeManager.epochEnd() - 1);
userVaults.push(_createStakingAccount(makeAddr("testUser8"), stakeAmount, 0));
//userVaults.push(_createStakingAccount(makeAddr("testUser4"), stakeAmount, stakeManager.MAX_LOCKUP_PERIOD()));
//userVaults.push(_createStakingAccount(makeAddr("testUser5"), stakeAmount, stakeManager.MIN_LOCKUP_PERIOD()));
//userVaults.push(_createStakingAccount(makeAddr("testUser4"), stakeAmount,
// stakeManager.MAX_LOCKUP_PERIOD()));
//userVaults.push(_createStakingAccount(makeAddr("testUser5"), stakeAmount,
// stakeManager.MIN_LOCKUP_PERIOD()));
for (uint256 i = 0; i <= epochsAmountToReachCap; i++) {
deal(stakeToken, address(stakeManager), 100 ether);
vm.warp(stakeManager.epochEnd());
stakeManager.executeEpoch();
for (uint256 j = 0; j < userVaults.length; j++) {
(address rewardAddress,,, uint256 totalMPBefore, uint256 lastMintBefore,, uint256 epochBefore,) =
stakeManager.accounts(address(userVaults[j]));
(
address rewardAddress,
,
,
uint256 totalMPBefore,
uint256 lastMintBefore,
,
uint256 epochBefore,
) = stakeManager.accounts(address(userVaults[j]));
uint256 rewardsBefore = ERC20(stakeToken).balanceOf(rewardAddress);
stakeManager.executeAccount(address(userVaults[j]), epochBefore + 1);
@ -644,8 +660,15 @@ contract ExecuteAccountTest is StakeManagerTest {
vm.warp(stakeManager.epochEnd());
stakeManager.executeEpoch();
for (uint256 j = 0; j < userVaults.length; j++) {
(address rewardAddress,,, uint256 totalMPBefore, uint256 lastMintBefore,, uint256 epochBefore,) =
stakeManager.accounts(address(userVaults[j]));
(
address rewardAddress,
,
,
uint256 totalMPBefore,
uint256 lastMintBefore,
,
uint256 epochBefore,
) = stakeManager.accounts(address(userVaults[j]));
uint256 rewardsBefore = ERC20(stakeToken).balanceOf(rewardAddress);
stakeManager.executeAccount(address(userVaults[j]), epochBefore + 1);
@ -721,7 +744,9 @@ contract UserFlowsTest is StakeManagerTest {
for (uint256 i = 0; i <= accountNum; i++) {
// deal(stakeToken, testUser, stakeAmount);
userVaults.push(
_createStakingAccount(makeAddr(string(abi.encode(keccak256(abi.encode(accountNum))))), stakeAmount, 0)
_createStakingAccount(
makeAddr(string(abi.encode(keccak256(abi.encode(accountNum))))), stakeAmount, 0
)
);
}
@ -733,8 +758,15 @@ contract UserFlowsTest is StakeManagerTest {
uint256 pendingMPToBeMintedBefore = stakeManager.pendingMPToBeMinted();
uint256 totalSupplyMP = stakeManager.totalSupplyMP();
for (uint256 j = 0; j < userVaults.length; j++) {
(address rewardAddress,,, uint256 totalMPBefore, uint256 lastMintBefore,, uint256 epochBefore,) =
stakeManager.accounts(address(userVaults[j]));
(
address rewardAddress,
,
,
uint256 totalMPBefore,
uint256 lastMintBefore,
,
uint256 epochBefore,
) = stakeManager.accounts(address(userVaults[j]));
stakeManager.executeAccount(address(userVaults[j]), epochBefore + 1);
}
@ -751,7 +783,8 @@ contract MigrationStakeManagerTest is StakeManagerTest {
function setUp() public virtual override {
super.setUp();
DeployMigrationStakeManager deployment = new DeployMigrationStakeManager(address(stakeManager), stakeToken);
DeployMigrationStakeManager deployment =
new DeployMigrationStakeManager(address(stakeManager), stakeToken);
newStakeManager = deployment.run();
}