Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow payouts over 90% [do not merge to dev/v3] #559

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions contracts/HATClaimsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ contract HATClaimsManager is IHATClaimsManager, OwnableUpgradeable, ReentrancyGu
address public constant NULL_ADDRESS = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF;
uint256 public constant HUNDRED_PERCENT = 1e4;
uint256 public constant HUNDRED_PERCENT_SQRD = 1e8;
uint256 public constant MAX_BOUNTY_LIMIT = 90e2; // Max bounty, can be up to 90%
uint256 public constant DESTROY_VAULT_AFTER_LARGER_PAYOUT = 90e2; // Max bounty above which vault deposits will be disabled forever, set to anything over 90%
uint256 public constant MAX_COMMITTEE_BOUNTY = 10e2; // Max committee bounty can be up to 10%

IHATVaultsRegistry public registry;
Expand Down Expand Up @@ -120,8 +120,6 @@ contract HATClaimsManager is IHATClaimsManager, OwnableUpgradeable, ReentrancyGu

/** @notice See {IHATClaimsManager-initialize}. */
function initialize(IHATVault _vault, IHATClaimsManager.ClaimsManagerInitParams calldata _params) external initializer {
if (_params.maxBounty > MAX_BOUNTY_LIMIT && _params.maxBounty != HUNDRED_PERCENT)
revert MaxBountyCannotBeMoreThanMaxBountyLimit();
_validateSplit(_params.bountySplit);
_setVestingParams(_params.vestingDuration, _params.vestingPeriods);
HATVaultsRegistry _registry = HATVaultsRegistry(msg.sender);
Expand Down Expand Up @@ -163,9 +161,6 @@ contract HATClaimsManager is IHATClaimsManager, OwnableUpgradeable, ReentrancyGu
if (_bountyPercentage > maxBounty)
revert BountyPercentageHigherThanMaxBounty();

if (maxBounty == HUNDRED_PERCENT && _bountyPercentage != HUNDRED_PERCENT && _bountyPercentage > MAX_BOUNTY_LIMIT)
revert PayoutMustBeUpToMaxBountyLimitOrHundredPercent();

claimId = keccak256(abi.encodePacked(address(this), ++nonce));
activeClaim = Claim({
claimId: claimId,
Expand Down Expand Up @@ -248,7 +243,7 @@ contract HATClaimsManager is IHATClaimsManager, OwnableUpgradeable, ReentrancyGu

vault.setWithdrawPaused(false);

if (_claim.bountyPercentage == HUNDRED_PERCENT) {
if (_claim.bountyPercentage > DESTROY_VAULT_AFTER_LARGER_PAYOUT) {
vault.destroyVault();
}

Expand Down Expand Up @@ -376,8 +371,6 @@ contract HATClaimsManager is IHATClaimsManager, OwnableUpgradeable, ReentrancyGu

/** @notice See {IHATClaimsManager-setPendingMaxBounty}. */
function setPendingMaxBounty(uint16 _maxBounty) external onlyOwner noActiveClaim {
if (_maxBounty > MAX_BOUNTY_LIMIT && _maxBounty != HUNDRED_PERCENT)
revert MaxBountyCannotBeMoreThanMaxBountyLimit();
pendingMaxBounty.maxBounty = _maxBounty;
// solhint-disable-next-line not-rely-on-time
pendingMaxBounty.timestamp = uint32(block.timestamp);
Expand Down Expand Up @@ -549,8 +542,6 @@ contract HATClaimsManager is IHATClaimsManager, OwnableUpgradeable, ReentrancyGu
}
if (_bountyPercentage > maxBounty)
revert BountyPercentageHigherThanMaxBounty();
if (maxBounty == HUNDRED_PERCENT && _bountyPercentage != HUNDRED_PERCENT && _bountyPercentage > MAX_BOUNTY_LIMIT)
revert PayoutMustBeUpToMaxBountyLimitOrHundredPercent();

uint256 _totalBountyAmount = _totalAssets * _bountyPercentage;

Expand Down
4 changes: 0 additions & 4 deletions contracts/interfaces/IHATClaimsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@
error VestingPeriodsCannotBeZero();
// Vesting duration smaller than periods
error VestingDurationSmallerThanPeriods();
// Max bounty cannot be more than `MAX_BOUNTY_LIMIT` (unless if it is 100%)
error MaxBountyCannotBeMoreThanMaxBountyLimit();
// Committee bounty split cannot be more than `MAX_COMMITTEE_BOUNTY`
error CommitteeBountyCannotBeMoreThanMax();
// Only registry owner
Expand All @@ -196,8 +194,6 @@
error SystemInEmergencyPause();
// Cannot set a reward controller that was already used in the past
error CannotSetToPerviousRewardController();
// Payout must either be 100%, or up to the MAX_BOUNTY_LIMIT
error PayoutMustBeUpToMaxBountyLimitOrHundredPercent();


event SubmitClaim(
Expand Down Expand Up @@ -492,5 +488,5 @@
* @notice Returns the claims manager's version
* @return The claims manager's version
*/
function VERSION() external view returns(string calldata);

Check warning on line 491 in contracts/interfaces/IHATClaimsManager.sol

View workflow job for this annotation

GitHub Actions / build (14.x)

Function name must be in mixedCase
}
34 changes: 6 additions & 28 deletions docs/dodoc/HATClaimsManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ The HATClaimsManager manages the bounty payouts from the HATVault of a project.

## Methods

### HUNDRED_PERCENT
### DESTROY_VAULT_AFTER_LARGER_PAYOUT

```solidity
function HUNDRED_PERCENT() external view returns (uint256)
function DESTROY_VAULT_AFTER_LARGER_PAYOUT() external view returns (uint256)
```


Expand All @@ -27,10 +27,10 @@ function HUNDRED_PERCENT() external view returns (uint256)
|---|---|---|
| _0 | uint256 | undefined |

### HUNDRED_PERCENT_SQRD
### HUNDRED_PERCENT

```solidity
function HUNDRED_PERCENT_SQRD() external view returns (uint256)
function HUNDRED_PERCENT() external view returns (uint256)
```


Expand All @@ -44,10 +44,10 @@ function HUNDRED_PERCENT_SQRD() external view returns (uint256)
|---|---|---|
| _0 | uint256 | undefined |

### MAX_BOUNTY_LIMIT
### HUNDRED_PERCENT_SQRD

```solidity
function MAX_BOUNTY_LIMIT() external view returns (uint256)
function HUNDRED_PERCENT_SQRD() external view returns (uint256)
```


Expand Down Expand Up @@ -1235,17 +1235,6 @@ error DelayPeriodForSettingMaxBountyHadNotPassed()



### MaxBountyCannotBeMoreThanMaxBountyLimit

```solidity
error MaxBountyCannotBeMoreThanMaxBountyLimit()
```






### NoActiveClaimExists

```solidity
Expand Down Expand Up @@ -1356,17 +1345,6 @@ error OnlyRegistryOwner()



### PayoutMustBeUpToMaxBountyLimitOrHundredPercent

```solidity
error PayoutMustBeUpToMaxBountyLimitOrHundredPercent()
```






### SafetyPeriod

```solidity
Expand Down
22 changes: 0 additions & 22 deletions docs/dodoc/interfaces/IHATClaimsManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -820,17 +820,6 @@ error DelayPeriodForSettingMaxBountyHadNotPassed()



### MaxBountyCannotBeMoreThanMaxBountyLimit

```solidity
error MaxBountyCannotBeMoreThanMaxBountyLimit()
```






### NoActiveClaimExists

```solidity
Expand Down Expand Up @@ -941,17 +930,6 @@ error OnlyRegistryOwner()



### PayoutMustBeUpToMaxBountyLimitOrHundredPercent

```solidity
error PayoutMustBeUpToMaxBountyLimitOrHundredPercent()
```






### SafetyPeriod

```solidity
Expand Down
34 changes: 6 additions & 28 deletions docs/dodoc/mocks/HATClaimsManagerV2Mock.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

## Methods

### HUNDRED_PERCENT
### DESTROY_VAULT_AFTER_LARGER_PAYOUT

```solidity
function HUNDRED_PERCENT() external view returns (uint256)
function DESTROY_VAULT_AFTER_LARGER_PAYOUT() external view returns (uint256)
```


Expand All @@ -27,10 +27,10 @@ function HUNDRED_PERCENT() external view returns (uint256)
|---|---|---|
| _0 | uint256 | undefined |

### HUNDRED_PERCENT_SQRD
### HUNDRED_PERCENT

```solidity
function HUNDRED_PERCENT_SQRD() external view returns (uint256)
function HUNDRED_PERCENT() external view returns (uint256)
```


Expand All @@ -44,10 +44,10 @@ function HUNDRED_PERCENT_SQRD() external view returns (uint256)
|---|---|---|
| _0 | uint256 | undefined |

### MAX_BOUNTY_LIMIT
### HUNDRED_PERCENT_SQRD

```solidity
function MAX_BOUNTY_LIMIT() external view returns (uint256)
function HUNDRED_PERCENT_SQRD() external view returns (uint256)
```


Expand Down Expand Up @@ -1252,17 +1252,6 @@ error DelayPeriodForSettingMaxBountyHadNotPassed()



### MaxBountyCannotBeMoreThanMaxBountyLimit

```solidity
error MaxBountyCannotBeMoreThanMaxBountyLimit()
```






### NoActiveClaimExists

```solidity
Expand Down Expand Up @@ -1373,17 +1362,6 @@ error OnlyRegistryOwner()



### PayoutMustBeUpToMaxBountyLimitOrHundredPercent

```solidity
error PayoutMustBeUpToMaxBountyLimitOrHundredPercent()
```






### SafetyPeriod

```solidity
Expand Down
2 changes: 1 addition & 1 deletion docs/dodoc/tge/HATAirdrop.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Initialize a HATAirdrop instance
| _root | bytes32 | new merkle tree root to use for verifying airdrop data. |
| _startTime | uint256 | start of the redeem period and of the token lock (if exists) |
| _deadline | uint256 | end time to redeem from the contract |
| _lockEndTime | uint256 | end time for the token lock contract (if exists) |
| _lockEndTime | uint256 | end time for the token lock contract. If this date is in the past, the tokens will be transferred directly to the user and no token lock will be created |
| _periods | uint256 | number of periods of the token lock contract (if exists) |
| _token | contract IERC20Upgradeable | the token to be airdropped |
| _tokenLockFactory | contract ITokenLockFactory | the token lock factory to use to deploy the token locks |
Expand Down
Loading
Loading