Hord ETH Staking Manager (HETH)

Core contract for Ethereum Staking Platform.

Code

HordETHStakingManager.sol

Address

HordETHStakingManager is deployed at 0x5bBe36152d3CD3eB7183A82470b39b29EedF068B 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

event Deposit(address account, uint256 amountDeposited);
  • Emitted each time when someone deposits.

LaunchNewValidator

event LaunchNewValidator(address account, uint256 amountWithdrawn);
  • Emitted each time when a new validator is launched.

HETHMinted

event HETHMinted(address account, uint256 amountHETH);
  • Emitted each time when new HETH tokens are minted.

EtherReceived

event EtherReceived(address account, uint256 amountETH);
  • Emitted each time when contract receives the execution layer rewards.

FeeCollected

event FeeCollected(address account, uint256 amountHETH, uint256 amountETHForMintingCalc, uint256 diffExecLayerRewardsForFeelCalc);
  • Emitted each time when reward fees are collected.

StakingStatsUpdated

event StakingStatsUpdated(uint256 newRewardsAmount, uint256 newTotalETHBalanceInValidators, uint256 newTotalExecutionLayerRewards);
  • Emitted each time when the staking stats are updated.

NewTokensFarmSDKSet

event NewTokensFarmSDKSet(address newAddress);
  • Emitted each time when the TokensFarmSDK address changes.

Transfer

event Transfer(address indexed from, address indexed to, uint256 value);
  • Emitted each time when the someone transfers HETH tokens.

Approval

event Approval(address indexed owner, address indexed spender, uint256 value);
  • Emitted each time when the someone approves HETH tokens.

Burn

event Burn(address indexed account, uint256 value);
  • Emitted each time when HordETHStakingManager calls burn function.

Mint

event Mint(address indexed beneficiary, uint256 value);
  • Emitted each time when HordETHStakingManager calls mint function.

Core functions

userDepositETH

function userDepositETH() 
payable
isDirectCall
isCorrectAmount
external 
whenNotPaused;
  • UserDepositETH function allowing user to deposit ETH on contract.

  • Emits Deposit event.

launchNewValidator

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.

  • Emits LaunchNewValidator event.

transfer

function transfer(address recipient, uint256 amount) public virtual returns (bool);
  • Transfer HETH from msg.sender to recipient address.

  • Emits Transfer event.

approve

function approve(address spender, uint256 amount) public virtual returns (bool);
  • Msg.sender approves spender to manage his HETH tokens.

  • Emits Approval event.

transferFrom

function transferFrom(address sender, address recipient, uint256 amount) public virtual returns (bool);
  • Transfer this amount of HETH from sender to recipient address.

  • Emits Transfer event.

Read-Only functions

totalETHDeposited

function totalETHDeposited() external view returns(uint256);
  • TotalETHDeposited represents total ETH deposited by user.

totalBalanceETHInValidators

function totalBalanceETHInValidators() external view returns(uint256);
  • TotalBalanceETHInValidators represents total balance ETH in validators includes amount required to launch the validator plus validator rewards.

totalRewardsCollected

function totalRewardsCollected() external view returns(uint256);
  • TotalRewardsCollected represents total rewards collected validator plus execution layer rewards.

totalHETHMinted

function totalHETHMinted() external view returns(uint256);
  • TotalHETHMinted represents total HETH minted.

numberOfUsers

function numberOfUsers() external view returns(uint256);
  • NumberOfUsers represents total number of users who stake.

lastRewardsForFeeCalc

function lastRewardsForFeeCalc() external view returns(uint256);
  • LastRewardsForFeeCalc represents the last amount of total rewards from which fees was taken.

totalFeesAccountedInETH

function totalFeesAccountedInETH() external view returns(uint256);
  • TotalFeesAccountedInETH represents total fees accounted in ETH.

totalFeesMintedInHETH

function totalFeesMintedInHETH() external view returns(uint256);
  • TotalFeesMintedInHETH represents total fees minted in HETH.

lastExecLayerRewardsForFeeCalc

function lastExecLayerRewardsForFeeCalc() external view returns(uint256);
  • LastExecLayerRewardsForFeeCalc represents the last amount of execution layer rewards from which fees was taken.

totalExecLayerRewards

function totalExecLayerRewards() external view returns(uint256);
  • TotalExecLayerRewards represents total total amount of execution layer rewards.

hordCongressMembersRegistry

function hordCongressMembersRegistry() external view returns(address);
  • HordCongressMembersRegistry represents instance of HordCongressMembersRegistry contract.

beaconDeposit

function beaconDeposit() external view returns(address);
  • BeaconDeposit represents instance of BeaconDeposit contract.

stakingConfiguration

function stakingConfiguration() external view returns(address);
  • StakingConfiguration represents instance of StakingConfiguration contract.

users

function users() external view returns(User);

struct User {
	uint256 amountDeposited;
	uint256 rewardsEarned;
}
  • Users map user address to his informations.

getAmountOfHETHforETH

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

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

function totalSupply(uint256 amountETH, bool isContractCall, uint256 diffExecLayerRewardsForFeeCalc) external view returns(uint256);
  • totalSuplly returns total supply of HETH token.

balanceOf

function balanceOf(address account) public view virtual returns (uint256)
  • balanceOf balance of HETH tokens for sepcific account.

allowance

function allowance(address owner, address spender) public view virtual returns (uint256);
  • allowance returns amount of HETH which owner has approved spender to use.

name

function name(uint256 amountETH, bool isContractCall, uint256 diffExecLayerRewardsForFeeCalc) external view returns(uint256);
  • name returns name of HETH token.

symbol

function symbol(uint256 amountETH, bool isContractCall, uint256 diffExecLayerRewardsForFeeCalc) external view returns(uint256);
  • symbol returns symbol of HETH token.

State-Changing Functions

pause

function pause() external onlyHordCongressOrMaintainer;
  • Pause function allowing HordCongress or maintainer to pause contract.

  • Emits Paused event.

unpause

function unpause() external onlyHordConngressMember;
  • Unpause function allowing HordCongress member to unpause contract.

  • Emits Unpaused event.

setTokensfarmSDK

function setTokensFarmSDK(address _tokensFarmSDK) external onlyHordCongress;

setValidatorStats

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.

  • Emits a StakingStatsUpdated event.

Last updated