From 28844ce0438350ec8e98897d9ff3a07404680fb5 Mon Sep 17 00:00:00 2001 From: JulesCrown Date: Tue, 27 Feb 2024 17:41:22 +0100 Subject: [PATCH] wip --- src/Harb.sol | 2 +- src/Stake.sol | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Harb.sol b/src/Harb.sol index b10e1b5..dd04968 100644 --- a/src/Harb.sol +++ b/src/Harb.sol @@ -22,7 +22,7 @@ contract Harb is ERC20, ERC20Permit { /// @notice Address of the TwabController used to keep track of balances. TwabController public immutable twabController; - /// @notice Address of the LiquidityManager that mints and burns supply + /// @notice Address of the LiquidityManager contract that mints and burns supply address public immutable liquidityManager; /* ============ Errors ============ */ diff --git a/src/Stake.sol b/src/Stake.sol index 032a34e..516fcef 100644 --- a/src/Stake.sol +++ b/src/Stake.sol @@ -8,7 +8,7 @@ import "./interfaces/IHarb.sol"; contract Stake is IStake { uint256 internal constant MAX_STAKE = 20; // 20% of HARB supply - uint256 internal constant MAX_TAX = 1000; // max 1000% tax + uint256 internal constant MAX_TAX = 1000; // max 1000% tax per year uint256 internal constant TAX_RATE_BASE = 100; uint256 internal constant TAX_FLOOR_DURATION = 60 * 60 * 24 * 3; //this duration is the minimum basis for fee calculation, regardless of actual holding time. /** @@ -18,6 +18,7 @@ contract Stake is IStake { error TaxTooLow(address receiver, uint64 taxRateWanted, uint64 taxRateMet, uint256 positionId); error SharesTooLow(address receiver, uint256 assets, uint256 sharesWanted, uint256 minStake); error NoPermission(address requester, address owner); + error PossitionNotFound struct StakingPosition { @@ -69,6 +70,10 @@ contract Stake is IStake { // run through all suggested positions for (uint i = 0; i < positions.length; i++) { StakingPosition pos = positions[i]; + if (pos.creationTime == 0) { + //TODO: + revert PossitionNotFound(); + } // check that tax lower if (taxRate <= pos.perSecondTaxRate) { revert TaxTooLow(receiver, taxRate, pos.perSecondTaxRate, i);