Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Read Proxy
Write Contract
Write Proxy
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- EtnyStakingRegistry
- Optimization enabled
- true
- Compiler version
- v0.8.7+commit.e28d00a7
- Optimization runs
- 200
- EVM Version
- istanbul
- Verified at
- 2024-04-26T18:54:37.032559Z
Contract source code
// File: contracts/Initializable.sol
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Modifier to protect an initializer function from being invoked twice.
*/
modifier initializer() {
require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
_initialized = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
}
}
/// @dev Returns true if and only if the function is running in the constructor
function _isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective way to detect if a contract is
// under construction or not.
address self = address(this);
uint256 cs;
// solhint-disable-next-line no-inline-assembly
assembly {cs := extcodesize(self)}
return cs == 0;
}
}
// File: contracts/interfaces/IOwnable.sol
pragma solidity ^0.8.0;
interface IOwnable {
function owner() external view returns (address);
}
// File: contracts/Ownable.sol
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
* @author crypto-pumpkin
*
* By initialization, the owner account will be the one that called initializeOwner. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Initializable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor(){
initializeOwner();
}
/**
* @dev COVER : Initializes the contract setting the deployer as the initial owner.
*/
function initializeOwner() internal initializer {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == msg.sender, "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: contracts/Delegated.sol
pragma solidity ^0.8.0;
/**
* Copyright (C) 2018, 2019, 2020 Ethernity HODL UG
*
* This file is part of ETHERNITY PoX SC.
*
* ETHERNITY PoE SC is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
contract Delegated is Ownable {
address public callerAddress;
event ProxyTransferred(address indexed _from, address indexed _to);
/*constructor() {
callerAddress = msg.sender;
}*/
modifier onlyDelegate {
require(msg.sender == callerAddress);
_;
}
function transferProxy(address _newProxy) public onlyOwner {
callerAddress = _newProxy;
}
}
// File: contracts/CompanyWallet.sol
pragma solidity ^0.8.0;
contract CompanyWallet is Ownable {
mapping(address => bool) companyAddresses;
constructor(){
companyAddresses[msg.sender] = true;
}
function addCompanyWallet(address companyAddress) public onlyOwner {
companyAddresses[companyAddress] = true;
}
function removeCompanyWallet(address oldCompanyAddress) public onlyOwner {
companyAddresses[oldCompanyAddress] = false;
}
/**
* @dev Throws if called by any account other than other of company wallets.
*/
modifier onlyCompanyWallet() {
require(
companyAddresses[msg.sender],
"CompanyWallet: caller is not a wallet from company"
);
_;
}
}
// File: contracts/Enums.sol
pragma solidity ^0.8.0;
library Enums {
enum BaseStakeStatus {
PENDING,
APPROVED,
DECLINED,
CANCELED,
TERMINATED
}
enum ExtendedStakeStatus {
PENDING,
APPROVED,
DECLINED,
CANCELED,
TERMINATED
}
enum StakeContractStatus {
PENDING,
APPROVED,
DECLINED,
CANCELED,
TERMINATED
}
enum EntityType{
STAKER,
NODE_OPERATOR
}
enum StakeType{
BASE_STAKE,
EXTENDED_STAKE
}
}
// File: contracts/Models.sol
pragma solidity ^0.8.0;
library Models {
struct BaseStake {
address stakeHolderAddress;
address rewardAddress;
address nodeAddress;
uint256 timestamp;
uint64 amount;
uint16 period;
Enums.BaseStakeStatus status;
uint256 stakeContractId;
}
struct ExtendedStake {
address stakeHolderAddress;
address rewardAddress;
address nodeAddress;
uint256 timestamp;
uint64 amount;
uint64 amountBooked;
uint64 stakingContracts;
uint16 period; // in months
uint8 operatorRewardPercentage;
bool allowMultipleOp;
bool autoConfirm;
Enums.ExtendedStakeStatus status;
mapping(uint64 => uint256) stakingContractsMapping;
mapping(Enums.StakeContractStatus => uint64) stakingContractsStatuses;
}
struct StakeContract {
address stakeHolder;
address stakeRewardAddress;
address nodeAddress;
address nodeRewardAddress;
uint256 timestamp;
uint64 amount;
uint64 operatorRewardPercentage;
uint16 period; //in months
uint256 canceledOn;
uint256 approvedOn;
uint256 expiresOn;
Enums.StakeContractStatus status;
uint256 stakeId;
Enums.StakeType stakeType;
bool isOperatorPerformingBad;
}
}
// File: contracts/EtnyStakingStorage.sol
pragma solidity ^0.8.0;
/**
* Copyright (C) 2018, 2019, 2020 Ethernity HODL UG
*
* This file is part of ETHERNITY PoX SC.
*
* ETHERNITY PoE SC is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
contract EtnyStakingStorage is Delegated, CompanyWallet {
constructor() {
_owner = msg.sender;
companyAddresses[msg.sender] = true;
}
address public implementation;
address[] internal versions;
address public _owner;
address internal _etnyPartnershipProgramSmartContractAddress;
address internal _etnyTokenSmartContractAddress;
address internal _etnyNFTIntegrationContractAddress;
// contracts and requests lists
Models.BaseStake[] internal _baseStakesList;
Models.ExtendedStake[] internal _extendedStakeList;
Models.StakeContract[] internal _stakingContractsList;
mapping(address => uint256[]) internal _stakerBaseStakeRequests;
mapping(address => uint256[]) internal _stakerExtendedStakeRequests;
mapping(address => uint256[]) internal _nodeBaseStakeRequests;
mapping(address => bool) internal _nodeActiveBaseStake;
mapping(address => uint256[]) internal _nodeExtendedStakeRequests;
mapping(address => uint256[]) internal _nodeExtendedContracts;
mapping(address => uint256) internal _nodeStakingTotal;
mapping(uint256 => uint256) internal _baseStakePenalty;
mapping(address => uint256) internal _tokensLockedInStaking;
mapping(address => bool) internal _canceledBaseStakeNodes;
//technical properties
uint256 maxTokens = 75000;
uint256 maxNFTTokens = 225000;
uint8 apyPercentage = 10;
uint8 minPeriodStakeContractInMonths = 6;
uint64 totalSupply = 15000000;
uint64 minBaseStakeAmount = 1976;
uint64 minBaseStakeNFTAmount = 700;
uint64 minExtendedStakeAmount = 3024;
uint64 maxBaseStakeAmount = 75000;
uint64 nodesStakeMinAmount = 5000;
}
// File: contracts/EtnyStakingRegistry.sol
pragma solidity ^0.8.0;
/**
* Copyright (C) 2018, 2019, 2020 Ethernity HODL UG
*
* This file is part of ETHERNITY PoX SC.
*
* ETHERNITY PoE SC is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
contract EtnyStakingRegistry is EtnyStakingStorage {
constructor() {
versions.push(address(0));
}
/**
* @dev Upgrades the implementation address
* @param _newImplementation address of the new implementation
*/
function upgradeTo(address _newImplementation) public onlyOwner returns (bool success){
require(implementation != _newImplementation,
"EthernityStakingRegistry: new implementation should be different than older one.");
_setImplementation(_newImplementation);
return true;
}
// User interface //
function _delegate(address _implementation) internal virtual {
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, 0, calldatasize())
let result := delegatecall(gas(), _implementation, ptr, calldatasize(), 0, 0)
let size := returndatasize()
returndatacopy(ptr, 0, size)
switch result
case 0 {
revert(ptr, size)
}
default {
return (ptr, size)
}
}
}
function _fallback() private {
address target = implementation;
require(target != address(0));
callerAddress = msg.sender;
_delegate(target);
}
fallback() external payable {
_fallback();
}
receive() external payable {
_fallback();
}
/**
* @dev Sets the address of the current implementation
* @param _newImp address of the new implementation
*/
function _setImplementation(address _newImp) internal onlyOwner {
implementation = _newImp;
versions.push(_newImp);
}
}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ProxyTransferred","inputs":[{"type":"address","name":"_from","internalType":"address","indexed":true},{"type":"address","name":"_to","internalType":"address","indexed":true}],"anonymous":false},{"type":"fallback","stateMutability":"payable"},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"_owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addCompanyWallet","inputs":[{"type":"address","name":"companyAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"callerAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"implementation","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeCompanyWallet","inputs":[{"type":"address","name":"oldCompanyAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferProxy","inputs":[{"type":"address","name":"_newProxy","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"success","internalType":"bool"}],"name":"upgradeTo","inputs":[{"type":"address","name":"_newImplementation","internalType":"address"}]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x6080604052620124f860165562036ee8601755601880546001600160d01b0319167302bc00000000000007b80000000000e4e1c0060a179055601980546001600160c01b03191671138800000000000124f80000000000000bd017905534801561006857600080fd5b506100716100e7565b3360008181526002602052604081208054600160ff1991821681178355600580546001600160a01b03199081169096179055825490911681179091556004805491820181559091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01805490911690556101fe565b600054610100900460ff16806100fc5750303b155b8061010a575060005460ff16155b6101715760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b600054610100900460ff16158015610193576000805461ffff19166101011790555b600080546201000033810262010000600160b01b0319909216919091178083556040519190046001600160a01b031691907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a380156101fb576000805461ff00191690555b50565b6106f08061020d6000396000f3fe6080604052600436106100955760003560e01c80638da5cb5b116100595780638da5cb5b1461016e57806390cadc5a14610192578063b2bdfa7b146101b2578063f2fde38b146101d2578063faa8aab1146101f2576100a4565b80632e14edaa146100ac5780633659cfe6146100cc578063438787d0146101015780635c60da1b14610121578063715018a614610159576100a4565b366100a4576100a2610212565b005b6100a2610212565b3480156100b857600080fd5b506100a26100c7366004610655565b610246565b3480156100d857600080fd5b506100ec6100e7366004610655565b6102a3565b60405190151581526020015b60405180910390f35b34801561010d57600080fd5b506100a261011c366004610655565b610382565b34801561012d57600080fd5b50600354610141906001600160a01b031681565b6040516001600160a01b0390911681526020016100f8565b34801561016557600080fd5b506100a26103d4565b34801561017a57600080fd5b506000546201000090046001600160a01b0316610141565b34801561019e57600080fd5b506100a26101ad366004610655565b610455565b3480156101be57600080fd5b50600554610141906001600160a01b031681565b3480156101de57600080fd5b506100a26101ed366004610655565b6104a6565b3480156101fe57600080fd5b50600154610141906001600160a01b031681565b6003546001600160a01b03168061022857600080fd5b600180546001600160a01b03191633179055610243816105a4565b50565b6000546201000090046001600160a01b0316331461027f5760405162461bcd60e51b815260040161027690610685565b60405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19166001179055565b600080546201000090046001600160a01b031633146102d45760405162461bcd60e51b815260040161027690610685565b6003546001600160a01b03838116911614156103715760405162461bcd60e51b815260206004820152605060248201527f45746865726e6974795374616b696e6752656769737472793a206e657720696d60448201527f706c656d656e746174696f6e2073686f756c6420626520646966666572656e7460648201526f103a3430b71037b63232b91037b7329760811b608482015260a401610276565b61037a826105c9565b506001919050565b6000546201000090046001600160a01b031633146103b25760405162461bcd60e51b815260040161027690610685565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546201000090046001600160a01b031633146104045760405162461bcd60e51b815260040161027690610685565b60008054604051620100009091046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805462010000600160b01b0319169055565b6000546201000090046001600160a01b031633146104855760405162461bcd60e51b815260040161027690610685565b6001600160a01b03166000908152600260205260409020805460ff19169055565b6000546201000090046001600160a01b031633146104d65760405162461bcd60e51b815260040161027690610685565b6001600160a01b03811661053b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610276565b600080546040516001600160a01b03808516936201000090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b60405136600082376000803683855af43d806000843e8180156105c5578184f35b8184fd5b6000546201000090046001600160a01b031633146105f95760405162461bcd60e51b815260040161027690610685565b600380546001600160a01b039092166001600160a01b03199283168117909155600480546001810182556000919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b018054909216179055565b60006020828403121561066757600080fd5b81356001600160a01b038116811461067e57600080fd5b9392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526060019056fea2646970667358221220ed69bee94709c8cc6f5c0043e8929cca737ee245ca82ede9ebf0c5aa9126618a64736f6c63430008070033
Deployed ByteCode
0x6080604052600436106100955760003560e01c80638da5cb5b116100595780638da5cb5b1461016e57806390cadc5a14610192578063b2bdfa7b146101b2578063f2fde38b146101d2578063faa8aab1146101f2576100a4565b80632e14edaa146100ac5780633659cfe6146100cc578063438787d0146101015780635c60da1b14610121578063715018a614610159576100a4565b366100a4576100a2610212565b005b6100a2610212565b3480156100b857600080fd5b506100a26100c7366004610655565b610246565b3480156100d857600080fd5b506100ec6100e7366004610655565b6102a3565b60405190151581526020015b60405180910390f35b34801561010d57600080fd5b506100a261011c366004610655565b610382565b34801561012d57600080fd5b50600354610141906001600160a01b031681565b6040516001600160a01b0390911681526020016100f8565b34801561016557600080fd5b506100a26103d4565b34801561017a57600080fd5b506000546201000090046001600160a01b0316610141565b34801561019e57600080fd5b506100a26101ad366004610655565b610455565b3480156101be57600080fd5b50600554610141906001600160a01b031681565b3480156101de57600080fd5b506100a26101ed366004610655565b6104a6565b3480156101fe57600080fd5b50600154610141906001600160a01b031681565b6003546001600160a01b03168061022857600080fd5b600180546001600160a01b03191633179055610243816105a4565b50565b6000546201000090046001600160a01b0316331461027f5760405162461bcd60e51b815260040161027690610685565b60405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19166001179055565b600080546201000090046001600160a01b031633146102d45760405162461bcd60e51b815260040161027690610685565b6003546001600160a01b03838116911614156103715760405162461bcd60e51b815260206004820152605060248201527f45746865726e6974795374616b696e6752656769737472793a206e657720696d60448201527f706c656d656e746174696f6e2073686f756c6420626520646966666572656e7460648201526f103a3430b71037b63232b91037b7329760811b608482015260a401610276565b61037a826105c9565b506001919050565b6000546201000090046001600160a01b031633146103b25760405162461bcd60e51b815260040161027690610685565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546201000090046001600160a01b031633146104045760405162461bcd60e51b815260040161027690610685565b60008054604051620100009091046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805462010000600160b01b0319169055565b6000546201000090046001600160a01b031633146104855760405162461bcd60e51b815260040161027690610685565b6001600160a01b03166000908152600260205260409020805460ff19169055565b6000546201000090046001600160a01b031633146104d65760405162461bcd60e51b815260040161027690610685565b6001600160a01b03811661053b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610276565b600080546040516001600160a01b03808516936201000090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b60405136600082376000803683855af43d806000843e8180156105c5578184f35b8184fd5b6000546201000090046001600160a01b031633146105f95760405162461bcd60e51b815260040161027690610685565b600380546001600160a01b039092166001600160a01b03199283168117909155600480546001810182556000919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b018054909216179055565b60006020828403121561066757600080fd5b81356001600160a01b038116811461067e57600080fd5b9392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526060019056fea2646970667358221220ed69bee94709c8cc6f5c0043e8929cca737ee245ca82ede9ebf0c5aa9126618a64736f6c63430008070033