Code
HordETHStakingManager.sol
Address
HordETHStakingManager
is deployed at on the Ethereum mainnet.
Overview
HordETHStakingManager(HETH)
is upgradeable contract where users can deposit ETH in order to stake and earn validator rewards, redeeming of deposit is not possible yet, but it will be after the Shanghai Hard Fork.
Events
Deposit
Copy event Deposit(address account, uint256 amountDeposited);
Emitted each time when someone deposits.
LaunchNewValidator
Copy event LaunchNewValidator(address account, uint256 amountWithdrawn);
Emitted each time when a new validator is launched.
HETHMinted
Copy event HETHMinted(address account, uint256 amountHETH);
Emitted each time when new HETH tokens are minted.
EtherReceived
Copy event EtherReceived(address account, uint256 amountETH);
Emitted each time when contract receives the execution layer rewards.
FeeCollected
Copy event FeeCollected(address account, uint256 amountHETH, uint256 amountETHForMintingCalc, uint256 diffExecLayerRewardsForFeelCalc);
Emitted each time when reward fees are collected.
StakingStatsUpdated
Copy event StakingStatsUpdated(uint256 newRewardsAmount, uint256 newTotalETHBalanceInValidators, uint256 newTotalExecutionLayerRewards);
Emitted each time when the staking stats are updated.
NewTokensFarmSDKSet
Copy event NewTokensFarmSDKSet(address newAddress);
Emitted each time when the TokensFarmSDK
address changes.
Transfer
Copy event Transfer(address indexed from, address indexed to, uint256 value);
Emitted each time when the someone transfers HETH
tokens.
Approval
Copy event Approval(address indexed owner, address indexed spender, uint256 value);
Emitted each time when the someone approves HETH
tokens.
Burn
Copy event Burn(address indexed account, uint256 value);
Emitted each time when HordETHStakingManager calls burn function.
Mint
Copy event Mint(address indexed beneficiary, uint256 value);
Emitted each time when HordETHStakingManager calls mint function.
Core functions
userDepositETH
Copy function userDepositETH()
payable
isDirectCall
isCorrectAmount
external
whenNotPaused;
UserDepositETH
function allowing user to deposit ETH on contract.
launchNewValidator
Copy function launchNewValidator(
bytes calldata pubkey,
bytes calldata withdrawal_credentials,
bytes calldata signature,
bytes32 deposit_data_root
)
nonReentrant
external
whenNotPaused
onlyMaintainer;
LaunchNewValidator
Withdraws funds for launching new validator, callable only by maintainer.
transfer
Copy function transfer(address recipient, uint256 amount) public virtual returns (bool);
Transfer HETH from msg.sender to recipient
address.
approve
Copy function approve(address spender, uint256 amount) public virtual returns (bool);
Msg.sender approves spender
to manage his HETH tokens.
transferFrom
Copy function transferFrom(address sender, address recipient, uint256 amount) public virtual returns (bool);
Transfer this amount
of HETH from sender
to recipient
address.
Read-Only functions
totalETHDeposited
Copy function totalETHDeposited() external view returns(uint256);
TotalETHDeposited
represents total ETH deposited by user.
totalBalanceETHInValidators
Copy function totalBalanceETHInValidators() external view returns(uint256);
TotalBalanceETHInValidators
represents total balance ETH in validators includes amount required to launch the validator plus validator rewards.
totalRewardsCollected
Copy function totalRewardsCollected() external view returns(uint256);
TotalRewardsCollected
represents total rewards collected validator plus execution layer rewards.
totalHETHMinted
Copy function totalHETHMinted() external view returns(uint256);
TotalHETHMinted
represents total HETH minted.
numberOfUsers
Copy function numberOfUsers() external view returns(uint256);
NumberOfUsers
represents total number of users who stake.
lastRewardsForFeeCalc
Copy function lastRewardsForFeeCalc() external view returns(uint256);
LastRewardsForFeeCalc
represents the last amount of total rewards from which fees was taken.
totalFeesAccountedInETH
Copy function totalFeesAccountedInETH() external view returns(uint256);
TotalFeesAccountedInETH
represents total fees accounted in ETH.
totalFeesMintedInHETH
Copy function totalFeesMintedInHETH() external view returns(uint256);
TotalFeesMintedInHETH
represents total fees minted in HETH.
lastExecLayerRewardsForFeeCalc
Copy function lastExecLayerRewardsForFeeCalc() external view returns(uint256);
LastExecLayerRewardsForFeeCalc
represents the last amount of execution layer rewards from which fees was taken.
totalExecLayerRewards
Copy function totalExecLayerRewards() external view returns(uint256);
TotalExecLayerRewards
represents total total amount of execution layer rewards.
hordCongressMembersRegistry
Copy function hordCongressMembersRegistry() external view returns(address);
HordCongressMembersRegistry
represents instance of HordCongressMembersRegistry contract.
beaconDeposit
Copy function beaconDeposit() external view returns(address);
BeaconDeposit
represents instance of BeaconDeposit contract.
stakingConfiguration
Copy function stakingConfiguration() external view returns(address);
StakingConfiguration
represents instance of StakingConfiguration contract.
users
Copy function users() external view returns(User);
struct User {
uint256 amountDeposited;
uint256 rewardsEarned;
}
Users
map user address to his informations.
getAmountOfHETHforETH
Copy function getAmountOfHETHforETH(uint256 amountETH, bool isContractCall, uint256 diffExecLayerRewardsForFeeCalc) external view returns(uint256);
GetAmountOfHETHforETH
calculates how much HETH will be minted for certain amount of ETH.
decimals
Copy function decimals(uint256 amountETH, bool isContractCall, uint256 diffExecLayerRewardsForFeeCalc) external view returns(uint256);
decimals
returns the number of decimals used to get its user representation.
totalSupply
Copy function totalSupply(uint256 amountETH, bool isContractCall, uint256 diffExecLayerRewardsForFeeCalc) external view returns(uint256);
totalSuplly
returns total supply of HETH token.
balanceOf
Copy function balanceOf(address account) public view virtual returns (uint256)
balanceOf
balance of HETH tokens for sepcific account
.
allowance
Copy function allowance(address owner, address spender) public view virtual returns (uint256);
allowance
returns amount of HETH which owner
has approved spender
to use.
name
Copy function name(uint256 amountETH, bool isContractCall, uint256 diffExecLayerRewardsForFeeCalc) external view returns(uint256);
name
returns name of HETH token.
symbol
Copy function symbol(uint256 amountETH, bool isContractCall, uint256 diffExecLayerRewardsForFeeCalc) external view returns(uint256);
symbol
returns symbol of HETH token.
State-Changing Functions
pause
Copy function pause() external onlyHordCongressOrMaintainer;
Pause
function allowing HordCongress or maintainer to pause contract.
unpause
Copy function unpause() external onlyHordConngressMember;
Unpause
function allowing HordCongress member to unpause contract.
setTokensfarmSDK
Copy function setTokensFarmSDK(address _tokensFarmSDK) external onlyHordCongress;
SetTokensFarmSDK
sets address of TokensFarmSDK contract.
setValidatorStats
Copy function setValidatorStats(uint256 newRewardsAmount, uint256 newTotalETHBalanceInValidators, uint256 newTotalExecutionLayerRewards) external onlyMaintainer;
SetValidatorStats
sets total amount of collected rewards, total balance ETH in validators and total amount of execution layer rewards.