This commit is contained in:
JulesCrown 2024-02-27 17:41:22 +01:00
parent 94c4ff05d4
commit 28844ce043
2 changed files with 7 additions and 2 deletions

View file

@ -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 ============ */

View file

@ -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);