|
| 1 | +import { keccak256, toHex } from 'viem/utils'; |
| 2 | +import { Hex } from 'viem'; |
| 3 | + |
| 4 | +/** |
| 5 | + * @notice Permission for funding the StakingVault. |
| 6 | + */ |
| 7 | +export const FUND_ROLE = keccak256(toHex('vaults.Permissions.Fund')); |
| 8 | + |
| 9 | +/** |
| 10 | + * @notice Permission for withdrawing funds from the StakingVault. |
| 11 | + */ |
| 12 | +export const WITHDRAW_ROLE = keccak256(toHex('vaults.Permissions.Withdraw')); |
| 13 | + |
| 14 | +/** |
| 15 | + * @notice Permission for locking ether on StakingVault. |
| 16 | + */ |
| 17 | +export const LOCK_ROLE = keccak256(toHex('vaults.Permissions.Lock')); |
| 18 | + |
| 19 | +/** |
| 20 | + * @notice Permission for minting stETH shares backed by the StakingVault. |
| 21 | + */ |
| 22 | +export const MINT_ROLE = keccak256(toHex('vaults.Permissions.Mint')); |
| 23 | + |
| 24 | +/** |
| 25 | + * @notice Permission for burning stETH shares backed by the StakingVault. |
| 26 | + */ |
| 27 | +export const BURN_ROLE = keccak256(toHex('vaults.Permissions.Burn')); |
| 28 | + |
| 29 | +/** |
| 30 | + * @notice Permission for rebalancing the StakingVault. |
| 31 | + */ |
| 32 | +export const REBALANCE_ROLE = keccak256(toHex('vaults.Permissions.Rebalance')); |
| 33 | + |
| 34 | +/** |
| 35 | + * @notice Permission for pausing beacon chain deposits on the StakingVault. |
| 36 | + */ |
| 37 | +export const PAUSE_BEACON_CHAIN_DEPOSITS_ROLE = keccak256( |
| 38 | + toHex('vaults.Permissions.PauseDeposits'), |
| 39 | +); |
| 40 | + |
| 41 | +/** |
| 42 | + * @notice Permission for resuming beacon chain deposits on the StakingVault. |
| 43 | + */ |
| 44 | +export const RESUME_BEACON_CHAIN_DEPOSITS_ROLE = keccak256( |
| 45 | + toHex('vaults.Permissions.ResumeDeposits'), |
| 46 | +); |
| 47 | + |
| 48 | +/** |
| 49 | + * @notice Permission for requesting validator exit from the StakingVault. |
| 50 | + */ |
| 51 | +export const REQUEST_VALIDATOR_EXIT_ROLE = keccak256( |
| 52 | + toHex('vaults.Permissions.RequestValidatorExit'), |
| 53 | +); |
| 54 | + |
| 55 | +/** |
| 56 | + * @notice Permission for triggering validator withdrawal from the StakingVault using EIP-7002 triggerable exit. |
| 57 | + */ |
| 58 | +export const TRIGGER_VALIDATOR_WITHDRAWAL_ROLE = keccak256( |
| 59 | + toHex('vaults.Permissions.TriggerValidatorWithdrawal'), |
| 60 | +); |
| 61 | + |
| 62 | +/** |
| 63 | + * @notice Permission for voluntary disconnecting the StakingVault. |
| 64 | + */ |
| 65 | +export const VOLUNTARY_DISCONNECT_ROLE = keccak256( |
| 66 | + toHex('vaults.Permissions.VoluntaryDisconnect'), |
| 67 | +); |
| 68 | + |
| 69 | +/** |
| 70 | + * @notice Node operator manager role: |
| 71 | + * - confirms confirm expiry; |
| 72 | + * - confirms ownership transfer; |
| 73 | + * - assigns NODE_OPERATOR_FEE_CONFIRM_ROLE; |
| 74 | + * - assigns NODE_OPERATOR_FEE_CLAIM_ROLE. |
| 75 | + */ |
| 76 | +export const NODE_OPERATOR_MANAGER_ROLE = keccak256( |
| 77 | + toHex('vaults.Delegation.NodeOperatorManagerRole'), |
| 78 | +); |
| 79 | + |
| 80 | +/** |
| 81 | + * @notice Claims node operator fee. |
| 82 | + */ |
| 83 | +export const NODE_OPERATOR_FEE_CLAIM_ROLE = keccak256( |
| 84 | + toHex('vaults.Delegation.NodeOperatorFeeClaimRole'), |
| 85 | +); |
| 86 | + |
| 87 | +export const RECOVER_ASSETS_ROLE = keccak256( |
| 88 | + toHex('vaults.Dashboard.RecoverAssets'), |
| 89 | +); |
| 90 | + |
| 91 | +/** |
| 92 | + * @notice Adjusts rewards to allow fee correction during side deposits or consolidations |
| 93 | + */ |
| 94 | +export const NODE_OPERATOR_REWARDS_ADJUST_ROLE = keccak256( |
| 95 | + toHex('vaults.NodeOperatorFee.RewardsAdjustRole'), |
| 96 | +); |
| 97 | + |
| 98 | +/** |
| 99 | + * @notice Permission for getting compensation for disproven validator predeposit from PDG |
| 100 | + */ |
| 101 | +export const PDG_COMPENSATE_PREDEPOSIT_ROLE = keccak256( |
| 102 | + toHex('vaults.Permissions.PDGCompensatePredeposit'), |
| 103 | +); |
| 104 | + |
| 105 | +/** |
| 106 | + * @notice Permission for proving valid vault validators unknown to the PDG |
| 107 | + */ |
| 108 | +export const PDG_PROVE_VALIDATOR_ROLE = keccak256( |
| 109 | + toHex('vaults.Permissions.PDGProveValidator'), |
| 110 | +); |
| 111 | + |
| 112 | +/** |
| 113 | + * @notice Permission for unguarnateed deposit to trusted validators |
| 114 | + */ |
| 115 | +export const UNGUARANTEED_BEACON_CHAIN_DEPOSIT_ROLE = keccak256( |
| 116 | + toHex('vaults.Permissions.UnguaranteedBeaconChainDeposit'), |
| 117 | +); |
| 118 | + |
| 119 | +/** |
| 120 | + * @dev Permission for deauthorizing Lido VaultHub from the StakingVault. |
| 121 | + */ |
| 122 | +export const LIDO_VAULTHUB_DEAUTHORIZATION_ROLE = keccak256( |
| 123 | + toHex('vaults.Permissions.LidoVaultHubDeauthorization'), |
| 124 | +); |
| 125 | + |
| 126 | +/** |
| 127 | + * @dev Permission for granting authorization to Lido VaultHub on the StakingVault. |
| 128 | + */ |
| 129 | +export const LIDO_VAULTHUB_AUTHORIZATION_ROLE = keccak256( |
| 130 | + toHex('vaults.Permissions.LidoVaultHubAuthorization'), |
| 131 | +); |
| 132 | + |
| 133 | +/** |
| 134 | + * @dev Permission for ossifying the StakingVault. |
| 135 | + */ |
| 136 | +export const OSSIFY_ROLE = keccak256(toHex('vaults.Permissions.Ossify')); |
| 137 | + |
| 138 | +/** |
| 139 | + * @dev Permission for setting depositor on the StakingVault. |
| 140 | + */ |
| 141 | +export const SET_DEPOSITOR_ROLE = keccak256( |
| 142 | + toHex('vaults.Permissions.SetDepositor'), |
| 143 | +); |
| 144 | + |
| 145 | +/** |
| 146 | + * @dev Permission for resetting locked amount on the disconnected StakingVault. |
| 147 | + */ |
| 148 | +export const RESET_LOCKED_ROLE = keccak256( |
| 149 | + toHex('vaults.Permissions.ResetLocked'), |
| 150 | +); |
| 151 | + |
| 152 | +/** |
| 153 | + * @dev Permission for requesting change of tier on the OperatorGrid. |
| 154 | + */ |
| 155 | +export const REQUEST_TIER_CHANGE_ROLE = keccak256( |
| 156 | + toHex('vaults.Permissions.RequestTierChange'), |
| 157 | +); |
| 158 | + |
| 159 | +/** |
| 160 | + * @notice default vault admin role. |
| 161 | + */ |
| 162 | +export const DEFAULT_ADMIN_ROLE = |
| 163 | + '0x0000000000000000000000000000000000000000000000000000000000000000' as Hex; |
| 164 | + |
| 165 | +export const permissions = { |
| 166 | + FUND_ROLE, |
| 167 | + WITHDRAW_ROLE, |
| 168 | + LOCK_ROLE, |
| 169 | + MINT_ROLE, |
| 170 | + BURN_ROLE, |
| 171 | + REBALANCE_ROLE, |
| 172 | + PAUSE_BEACON_CHAIN_DEPOSITS_ROLE, |
| 173 | + RESUME_BEACON_CHAIN_DEPOSITS_ROLE, |
| 174 | + REQUEST_VALIDATOR_EXIT_ROLE, |
| 175 | + TRIGGER_VALIDATOR_WITHDRAWAL_ROLE, |
| 176 | + VOLUNTARY_DISCONNECT_ROLE, |
| 177 | + RECOVER_ASSETS_ROLE, |
| 178 | + NODE_OPERATOR_FEE_CLAIM_ROLE, |
| 179 | + NODE_OPERATOR_REWARDS_ADJUST_ROLE, |
| 180 | + PDG_COMPENSATE_PREDEPOSIT_ROLE, |
| 181 | + PDG_PROVE_VALIDATOR_ROLE, |
| 182 | + UNGUARANTEED_BEACON_CHAIN_DEPOSIT_ROLE, |
| 183 | + LIDO_VAULTHUB_DEAUTHORIZATION_ROLE, |
| 184 | + LIDO_VAULTHUB_AUTHORIZATION_ROLE, |
| 185 | + OSSIFY_ROLE, |
| 186 | + SET_DEPOSITOR_ROLE, |
| 187 | + RESET_LOCKED_ROLE, |
| 188 | + REQUEST_TIER_CHANGE_ROLE, |
| 189 | +}; |
| 190 | + |
| 191 | +export const permissionsKeys = Object.keys(permissions) as PERMISSION[]; |
| 192 | +export type EntirePermissionsType = typeof permissions; |
| 193 | +export type PERMISSION = keyof EntirePermissionsType; |
0 commit comments