added more gov params

This commit is contained in:
JulesCrown 2024-07-17 14:08:53 +02:00
parent 9f03bd9f5d
commit dbc23802d2
4 changed files with 32 additions and 16 deletions

View file

@ -36,7 +36,6 @@ contract Stake {
// only 20% of the total HARB supply can be staked.
uint256 internal constant MAX_STAKE = 20; // 20% of HARB supply
uint256 internal constant TAX_FLOOR_DURATION = 60 * 60 * 24 * 3; //this duration is the minimum basis for fee calculation, regardless of actual holding time.
uint256 internal constant MIN_SUPPLY_FRACTION = 3000;
// the tax rates are discrete to prevent users from snatching by micro incroments of tax
uint256[] public TAX_RATES = [1, 3, 5, 8, 12, 18, 24, 30, 40, 50, 60, 80, 100, 130, 180, 250, 320, 420, 540, 700, 920, 1200, 1600, 2000, 2600, 3400, 4400, 5700, 7500, 9700];
// this is the base for the values in the array above: e.g. 1/100 = 1%
@ -64,11 +63,13 @@ contract Stake {
uint32 taxRate; // e.g. value of 60 = 60% tax per year
}
uint256 public immutable totalSupply;
Harb private immutable harb;
address private immutable taxPool;
uint256 public immutable totalSupply;
uint256 public outstandingStake;
uint256 public nextPositionId;
mapping(uint256 => StakingPosition) public positions;
/// @notice Initializes the stake contract with references to the Harb contract and sets the initial position ID.
@ -76,9 +77,9 @@ contract Stake {
/// @dev Sets up the total supply based on the decimals of the Harb token plus a fixed offset.
constructor(address _harb) {
harb = Harb(_harb);
totalSupply = 10 ** (harb.decimals() + DECIMAL_OFFSET);
taxPool = Harb(_harb).TAX_POOL();
// start counting somewhere
nextPositionId = 654321;
}
@ -171,7 +172,7 @@ contract Stake {
{
// check that position size is at least minStake
// to prevent excessive fragmentation, increasing snatch cost
uint256 minStake = harb.previousTotalSupply() / MIN_SUPPLY_FRACTION;
uint256 minStake = harb.minStake();
if (assets < minStake) {
revert StakeTooLow(receiver, assets, minStake);
}
@ -340,4 +341,6 @@ contract Stake {
uint256 assetsBefore = sharesToAssets(pos.share);
amountDue = assetsBefore * TAX_RATES[pos.taxRate] * elapsedTime / (365 * 24 * 60 * 60) / TAX_RATE_BASE;
}
}