文件 1 的 15:DepositType.sol
pragma solidity 0.7.6;
enum DepositType {
None,
FOUR,
EIGHT,
TWELVE,
SIXTEEN,
Empty
}
文件 2 的 15:IRETHToken.sol
pragma solidity 0.7.6;
interface IRETHToken {
function getEthValue(uint256 _rethAmount) external view returns (uint256);
function getRethValue(uint256 _ethAmount) external view returns (uint256);
function getExchangeRate() external view returns (uint256);
function getTotalCollateral() external view returns (uint256);
function getCollateralRate() external view returns (uint256);
function depositRewards() external payable;
function depositExcess() external payable;
function userMint(uint256 _ethAmount, address _to) external;
function userBurn(uint256 _rethAmount) external;
}
文件 3 的 15:IStafiEther.sol
pragma solidity 0.7.6;
interface IStafiEther {
function balanceOf(address _contractAddress) external view returns (uint256);
function depositEther() external payable;
function withdrawEther(uint256 _amount) external;
}
文件 4 的 15:IStafiEtherWithdrawer.sol
pragma solidity 0.7.6;
interface IStafiEtherWithdrawer {
function receiveEtherWithdrawal() external payable;
}
文件 5 的 15:IStafiLightNode.sol
pragma solidity 0.7.6;
pragma abicoder v2;
interface IStafiLightNode {
function depositEth() external payable;
function deposit(bytes[] calldata _validatorPubkeys, bytes[] calldata _validatorSignatures, bytes32[] calldata _depositDataRoots) external payable;
function stake(bytes[] calldata _validatorPubkeys, bytes[] calldata _validatorSignatures, bytes32[] calldata _depositDataRoots) external;
function offBoard(bytes calldata _validatorPubkey) external;
function provideNodeDepositToken(bytes calldata _validatorPubkey) external payable;
function withdrawNodeDepositToken(bytes calldata _validatorPubkey) external;
function getLightNodePubkeyCount(address _nodeAddress) external view returns (uint256);
function getLightNodePubkeyAt(address _nodeAddress, uint256 _index) external view returns (bytes memory);
function getLightNodePubkeyStatus(bytes calldata _validatorPubkey) external view returns (uint256);
function voteWithdrawCredentials(bytes[] calldata _pubkey, bool[] calldata _match) external;
}
文件 6 的 15:IStafiStakingPool.sol
pragma solidity 0.7.6;
import "../../types/DepositType.sol";
import "../../types/StakingPoolStatus.sol";
interface IStafiStakingPool {
function initialise(address _nodeAddress, DepositType _depositType) external;
function getStatus() external view returns (StakingPoolStatus);
function getStatusBlock() external view returns (uint256);
function getStatusTime() external view returns (uint256);
function getWithdrawalCredentialsMatch() external view returns (bool);
function getDepositType() external view returns (DepositType);
function getNodeAddress() external view returns (address);
function getNodeFee() external view returns (uint256);
function getNodeDepositBalance() external view returns (uint256);
function getNodeRefundBalance() external view returns (uint256);
function getNodeDepositAssigned() external view returns (bool);
function getNodeCommonlyRefunded() external view returns (bool);
function getNodeTrustedRefunded() external view returns (bool);
function getUserDepositBalance() external view returns (uint256);
function getUserDepositAssigned() external view returns (bool);
function getUserDepositAssignedTime() external view returns (uint256);
function getPlatformDepositBalance() external view returns (uint256);
function nodeDeposit(bytes calldata _validatorPubkey, bytes calldata _validatorSignature, bytes32 _depositDataRoot) external payable;
function userDeposit() external payable;
function stake(bytes calldata _validatorSignature, bytes32 _depositDataRoot) external;
function refund() external;
function dissolve() external;
function close() external;
function voteWithdrawCredentials() external;
}
文件 7 的 15:IStafiStakingPoolQueue.sol
pragma solidity 0.7.6;
import "../../types/DepositType.sol";
interface IStafiStakingPoolQueue {
function getTotalLength() external view returns (uint256);
function getLength(DepositType _depositType) external view returns (uint256);
function getTotalCapacity() external view returns (uint256);
function getEffectiveCapacity() external view returns (uint256);
function getNextCapacity() external view returns (uint256);
function enqueueStakingPool(DepositType _depositType, address _stakingPool) external;
function dequeueStakingPool() external returns (address);
function removeStakingPool() external;
}
文件 8 的 15:IStafiStorage.sol
pragma solidity 0.7.6;
interface IStafiStorage {
function getAddress(bytes32 _key) external view returns (address);
function getUint(bytes32 _key) external view returns (uint);
function getString(bytes32 _key) external view returns (string memory);
function getBytes(bytes32 _key) external view returns (bytes memory);
function getBool(bytes32 _key) external view returns (bool);
function getInt(bytes32 _key) external view returns (int);
function getBytes32(bytes32 _key) external view returns (bytes32);
function setAddress(bytes32 _key, address _value) external;
function setUint(bytes32 _key, uint _value) external;
function setString(bytes32 _key, string calldata _value) external;
function setBytes(bytes32 _key, bytes calldata _value) external;
function setBool(bytes32 _key, bool _value) external;
function setInt(bytes32 _key, int _value) external;
function setBytes32(bytes32 _key, bytes32 _value) external;
function deleteAddress(bytes32 _key) external;
function deleteUint(bytes32 _key) external;
function deleteString(bytes32 _key) external;
function deleteBytes(bytes32 _key) external;
function deleteBool(bytes32 _key) external;
function deleteInt(bytes32 _key) external;
function deleteBytes32(bytes32 _key) external;
}
文件 9 的 15:IStafiSuperNode.sol
pragma solidity 0.7.6;
pragma abicoder v2;
interface IStafiSuperNode {
function depositEth() external payable;
function deposit(bytes[] calldata _validatorPubkeys, bytes[] calldata _validatorSignatures, bytes32[] calldata _depositDataRoots) external;
function stake(bytes[] calldata _validatorPubkeys, bytes[] calldata _validatorSignatures, bytes32[] calldata _depositDataRoots) external;
function getSuperNodePubkeyCount(address _nodeAddress) external view returns (uint256);
function getSuperNodePubkeyAt(address _nodeAddress, uint256 _index) external view returns (bytes memory);
function getSuperNodePubkeyStatus(bytes calldata _validatorPubkey) external view returns (uint256);
function voteWithdrawCredentials(bytes[] calldata _pubkey, bool[] calldata _match) external;
}
文件 10 的 15:IStafiUserDeposit.sol
pragma solidity 0.7.6;
interface IStafiUserDeposit {
function getBalance() external view returns (uint256);
function getExcessBalance() external view returns (uint256);
function deposit() external payable;
function recycleDissolvedDeposit() external payable;
function recycleWithdrawDeposit() external payable;
function recycleDistributorDeposit() external payable;
function assignDeposits() external;
function withdrawExcessBalance(uint256 _amount) external;
function withdrawExcessBalanceForSuperNode(uint256 _amount) external;
function withdrawExcessBalanceForLightNode(uint256 _amount) external;
function withdrawExcessBalanceForWithdraw(uint256 _amount) external;
}
文件 11 的 15:IStafiWithdraw.sol
pragma solidity 0.7.6;
interface IStafiWithdraw {
function unstake(uint256 _rEthAmount) external;
function withdraw(uint256[] calldata _withdrawIndexList) external;
function notifyValidatorExit(
uint256 _withdrawCycle,
uint256 _ejectedStartWithdrawCycle,
uint256[] calldata _validatorIndex
) external;
function distributeWithdrawals(
uint256 _dealedHeight,
uint256 _userAmount,
uint256 _nodeAmount,
uint256 _platformAmount,
uint256 _maxClaimableWithdrawIndex
) external;
function reserveEthForWithdraw(uint256 _withdrawCycle) external;
function depositEth() external payable;
function getUnclaimedWithdrawalsOfUser(address user) external view returns (uint256[] memory);
function getEjectedValidatorsAtCycle(uint256 cycle) external view returns (uint256[] memory);
}
文件 12 的 15:SafeMath.sol
pragma solidity ^0.7.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}
文件 13 的 15:StafiBase.sol
pragma solidity 0.7.6;
import "./interfaces/storage/IStafiStorage.sol";
abstract contract StafiBase {
uint8 public version;
IStafiStorage stafiStorage = IStafiStorage(0);
modifier onlyLatestNetworkContract() {
require(getBool(keccak256(abi.encodePacked("contract.exists", msg.sender))), "Invalid or outdated network contract");
_;
}
modifier onlyLatestContract(string memory _contractName, address _contractAddress) {
require(_contractAddress == getAddress(keccak256(abi.encodePacked("contract.address", _contractName))), "Invalid or outdated contract");
_;
}
modifier onlyTrustedNode(address _nodeAddress) {
require(getBool(keccak256(abi.encodePacked("node.trusted", _nodeAddress))), "Invalid trusted node");
_;
}
modifier onlySuperNode(address _nodeAddress) {
require(getBool(keccak256(abi.encodePacked("node.super", _nodeAddress))), "Invalid super node");
_;
}
modifier onlyRegisteredStakingPool(address _stakingPoolAddress) {
require(getBool(keccak256(abi.encodePacked("stakingpool.exists", _stakingPoolAddress))), "Invalid staking pool");
_;
}
modifier onlyOwner() {
require(roleHas("owner", msg.sender), "Account is not the owner");
_;
}
modifier onlyAdmin() {
require(roleHas("admin", msg.sender), "Account is not an admin");
_;
}
modifier onlySuperUser() {
require(roleHas("owner", msg.sender) || roleHas("admin", msg.sender), "Account is not a super user");
_;
}
modifier onlyRole(string memory _role) {
require(roleHas(_role, msg.sender), "Account does not match the specified role");
_;
}
constructor(address _stafiStorageAddress) {
stafiStorage = IStafiStorage(_stafiStorageAddress);
}
function getContractAddress(string memory _contractName) internal view returns (address) {
address contractAddress = getAddress(keccak256(abi.encodePacked("contract.address", _contractName)));
require(contractAddress != address(0x0), "Contract not found");
return contractAddress;
}
function getContractName(address _contractAddress) internal view returns (string memory) {
string memory contractName = getString(keccak256(abi.encodePacked("contract.name", _contractAddress)));
require(keccak256(abi.encodePacked(contractName)) != keccak256(abi.encodePacked("")), "Contract not found");
return contractName;
}
function getAddress(bytes32 _key) internal view returns (address) { return stafiStorage.getAddress(_key); }
function getUint(bytes32 _key) internal view returns (uint256) { return stafiStorage.getUint(_key); }
function getString(bytes32 _key) internal view returns (string memory) { return stafiStorage.getString(_key); }
function getBytes(bytes32 _key) internal view returns (bytes memory) { return stafiStorage.getBytes(_key); }
function getBool(bytes32 _key) internal view returns (bool) { return stafiStorage.getBool(_key); }
function getInt(bytes32 _key) internal view returns (int256) { return stafiStorage.getInt(_key); }
function getBytes32(bytes32 _key) internal view returns (bytes32) { return stafiStorage.getBytes32(_key); }
function getAddressS(string memory _key) internal view returns (address) { return stafiStorage.getAddress(keccak256(abi.encodePacked(_key))); }
function getUintS(string memory _key) internal view returns (uint256) { return stafiStorage.getUint(keccak256(abi.encodePacked(_key))); }
function getStringS(string memory _key) internal view returns (string memory) { return stafiStorage.getString(keccak256(abi.encodePacked(_key))); }
function getBytesS(string memory _key) internal view returns (bytes memory) { return stafiStorage.getBytes(keccak256(abi.encodePacked(_key))); }
function getBoolS(string memory _key) internal view returns (bool) { return stafiStorage.getBool(keccak256(abi.encodePacked(_key))); }
function getIntS(string memory _key) internal view returns (int256) { return stafiStorage.getInt(keccak256(abi.encodePacked(_key))); }
function getBytes32S(string memory _key) internal view returns (bytes32) { return stafiStorage.getBytes32(keccak256(abi.encodePacked(_key))); }
function setAddress(bytes32 _key, address _value) internal { stafiStorage.setAddress(_key, _value); }
function setUint(bytes32 _key, uint256 _value) internal { stafiStorage.setUint(_key, _value); }
function setString(bytes32 _key, string memory _value) internal { stafiStorage.setString(_key, _value); }
function setBytes(bytes32 _key, bytes memory _value) internal { stafiStorage.setBytes(_key, _value); }
function setBool(bytes32 _key, bool _value) internal { stafiStorage.setBool(_key, _value); }
function setInt(bytes32 _key, int256 _value) internal { stafiStorage.setInt(_key, _value); }
function setBytes32(bytes32 _key, bytes32 _value) internal { stafiStorage.setBytes32(_key, _value); }
function setAddressS(string memory _key, address _value) internal { stafiStorage.setAddress(keccak256(abi.encodePacked(_key)), _value); }
function setUintS(string memory _key, uint256 _value) internal { stafiStorage.setUint(keccak256(abi.encodePacked(_key)), _value); }
function setStringS(string memory _key, string memory _value) internal { stafiStorage.setString(keccak256(abi.encodePacked(_key)), _value); }
function setBytesS(string memory _key, bytes memory _value) internal { stafiStorage.setBytes(keccak256(abi.encodePacked(_key)), _value); }
function setBoolS(string memory _key, bool _value) internal { stafiStorage.setBool(keccak256(abi.encodePacked(_key)), _value); }
function setIntS(string memory _key, int256 _value) internal { stafiStorage.setInt(keccak256(abi.encodePacked(_key)), _value); }
function setBytes32S(string memory _key, bytes32 _value) internal { stafiStorage.setBytes32(keccak256(abi.encodePacked(_key)), _value); }
function deleteAddress(bytes32 _key) internal { stafiStorage.deleteAddress(_key); }
function deleteUint(bytes32 _key) internal { stafiStorage.deleteUint(_key); }
function deleteString(bytes32 _key) internal { stafiStorage.deleteString(_key); }
function deleteBytes(bytes32 _key) internal { stafiStorage.deleteBytes(_key); }
function deleteBool(bytes32 _key) internal { stafiStorage.deleteBool(_key); }
function deleteInt(bytes32 _key) internal { stafiStorage.deleteInt(_key); }
function deleteBytes32(bytes32 _key) internal { stafiStorage.deleteBytes32(_key); }
function deleteAddressS(string memory _key) internal { stafiStorage.deleteAddress(keccak256(abi.encodePacked(_key))); }
function deleteUintS(string memory _key) internal { stafiStorage.deleteUint(keccak256(abi.encodePacked(_key))); }
function deleteStringS(string memory _key) internal { stafiStorage.deleteString(keccak256(abi.encodePacked(_key))); }
function deleteBytesS(string memory _key) internal { stafiStorage.deleteBytes(keccak256(abi.encodePacked(_key))); }
function deleteBoolS(string memory _key) internal { stafiStorage.deleteBool(keccak256(abi.encodePacked(_key))); }
function deleteIntS(string memory _key) internal { stafiStorage.deleteInt(keccak256(abi.encodePacked(_key))); }
function deleteBytes32S(string memory _key) internal { stafiStorage.deleteBytes32(keccak256(abi.encodePacked(_key))); }
function roleHas(string memory _role, address _address) internal view returns (bool) {
return getBool(keccak256(abi.encodePacked("access.role", _role, _address)));
}
}
文件 14 的 15:StafiUserDeposit.sol
pragma solidity 0.7.6;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../StafiBase.sol";
import "../interfaces/IStafiEther.sol";
import "../interfaces/IStafiEtherWithdrawer.sol";
import "../interfaces/deposit/IStafiUserDeposit.sol";
import "../interfaces/pool/IStafiStakingPool.sol";
import "../interfaces/pool/IStafiStakingPoolQueue.sol";
import "../interfaces/token/IRETHToken.sol";
import "../interfaces/node/IStafiSuperNode.sol";
import "../interfaces/node/IStafiLightNode.sol";
import "../interfaces/withdraw/IStafiWithdraw.sol";
contract StafiUserDeposit is StafiBase, IStafiUserDeposit, IStafiEtherWithdrawer {
using SafeMath for uint256;
event DepositReceived(address indexed from, uint256 amount, uint256 time);
event DepositRecycled(address indexed from, uint256 amount, uint256 time);
event DepositAssigned(address indexed stakingPool, uint256 amount, uint256 time);
event ExcessWithdrawn(address indexed to, uint256 amount, uint256 time);
constructor(address _stafiStorageAddress) StafiBase(_stafiStorageAddress) {
version = 1;
if (!getBoolS("settings.user.deposit.init")) {
setDepositEnabled(true);
setAssignDepositsEnabled(true);
setMinimumDeposit(0.01 ether);
setMaximumDepositAssignments(2);
setBoolS("settings.user.deposit.init", true);
}
}
function getBalance() override public view returns (uint256) {
IStafiEther stafiEther = IStafiEther(getContractAddress("stafiEther"));
return stafiEther.balanceOf(address(this));
}
function getExcessBalance() override public view returns (uint256) {
IStafiStakingPoolQueue stafiStakingPoolQueue = IStafiStakingPoolQueue(getContractAddress("stafiStakingPoolQueue"));
uint256 stakingPoolCapacity = stafiStakingPoolQueue.getEffectiveCapacity();
uint256 balance = getBalance();
if (stakingPoolCapacity >= balance) { return 0; }
else { return balance.sub(stakingPoolCapacity); }
}
function receiveEtherWithdrawal() override external payable onlyLatestContract("stafiUserDeposit", address(this)) onlyLatestContract("stafiEther", msg.sender) {}
function deposit() override external payable onlyLatestContract("stafiUserDeposit", address(this)) {
require(getDepositEnabled(), "Deposits into Stafi are currently disabled");
require(msg.value >= getMinimumDeposit(), "The deposited amount is less than the minimum deposit size");
IRETHToken rETHToken = IRETHToken(getContractAddress("rETHToken"));
rETHToken.userMint(msg.value, msg.sender);
emit DepositReceived(msg.sender, msg.value, block.timestamp);
processDeposit();
}
function recycleDissolvedDeposit() override external payable onlyLatestContract("stafiUserDeposit", address(this)) onlyRegisteredStakingPool(msg.sender) {
emit DepositRecycled(msg.sender, msg.value, block.timestamp);
processDeposit();
}
function recycleDistributorDeposit() override external payable onlyLatestContract("stafiUserDeposit", address(this)) onlyLatestContract("stafiDistributor", msg.sender) {
emit DepositRecycled(msg.sender, msg.value, block.timestamp);
processDeposit();
}
function recycleWithdrawDeposit() override external payable onlyLatestContract("stafiUserDeposit", address(this)) onlyLatestContract("stafiWithdraw", msg.sender) {
emit DepositRecycled(msg.sender, msg.value, block.timestamp);
processDeposit();
}
function processDeposit() private {
IStafiEther stafiEther = IStafiEther(getContractAddress("stafiEther"));
stafiEther.depositEther{value: msg.value}();
assignDeposits();
}
function assignDeposits() override public onlyLatestContract("stafiUserDeposit", address(this)) {
if (!getAssignDepositsEnabled()) {
return;
}
IStafiStakingPoolQueue stafiStakingPoolQueue = IStafiStakingPoolQueue(getContractAddress("stafiStakingPoolQueue"));
IStafiEther stafiEther = IStafiEther(getContractAddress("stafiEther"));
uint256 maximumDepositAssignments = getMaximumDepositAssignments();
for (uint256 i = 0; i < maximumDepositAssignments; ++i) {
uint256 stakingPoolCapacity = stafiStakingPoolQueue.getNextCapacity();
if (stakingPoolCapacity == 0 || getBalance() < stakingPoolCapacity) { break; }
address stakingPoolAddress = stafiStakingPoolQueue.dequeueStakingPool();
IStafiStakingPool stakingPool = IStafiStakingPool(stakingPoolAddress);
stafiEther.withdrawEther(stakingPoolCapacity);
stakingPool.userDeposit{value: stakingPoolCapacity}();
emit DepositAssigned(stakingPoolAddress, stakingPoolCapacity, block.timestamp);
}
}
function withdrawExcessBalance(uint256 _amount) override external onlyLatestContract("stafiUserDeposit", address(this)) onlyLatestContract("rETHToken", msg.sender) {
IRETHToken rETHToken = IRETHToken(getContractAddress("rETHToken"));
IStafiEther stafiEther = IStafiEther(getContractAddress("stafiEther"));
require(_amount <= getBalance(), "Insufficient balance for withdrawal");
stafiEther.withdrawEther(_amount);
rETHToken.depositExcess{value: _amount}();
emit ExcessWithdrawn(msg.sender, _amount, block.timestamp);
}
function withdrawExcessBalanceForSuperNode(uint256 _amount) override external onlyLatestContract("stafiUserDeposit", address(this)) onlyLatestContract("stafiSuperNode", msg.sender) {
IStafiSuperNode superNode = IStafiSuperNode(getContractAddress("stafiSuperNode"));
IStafiEther stafiEther = IStafiEther(getContractAddress("stafiEther"));
require(_amount <= getBalance(), "Insufficient balance for withdrawal");
stafiEther.withdrawEther(_amount);
superNode.depositEth{value: _amount}();
emit ExcessWithdrawn(msg.sender, _amount, block.timestamp);
}
function withdrawExcessBalanceForLightNode(uint256 _amount) override external onlyLatestContract("stafiUserDeposit", address(this)) onlyLatestContract("stafiLightNode", msg.sender) {
IStafiLightNode lightNode = IStafiLightNode(getContractAddress("stafiLightNode"));
IStafiEther stafiEther = IStafiEther(getContractAddress("stafiEther"));
require(_amount <= getBalance(), "Insufficient balance for withdrawal");
stafiEther.withdrawEther(_amount);
lightNode.depositEth{value: _amount}();
emit ExcessWithdrawn(msg.sender, _amount, block.timestamp);
}
function withdrawExcessBalanceForWithdraw(uint256 _amount) override external onlyLatestContract("stafiUserDeposit", address(this)) onlyLatestContract("stafiWithdraw", msg.sender) {
IStafiWithdraw stafiWithdraw = IStafiWithdraw(getContractAddress("stafiWithdraw"));
IStafiEther stafiEther = IStafiEther(getContractAddress("stafiEther"));
require(_amount <= getBalance(), "Insufficient balance for withdrawal");
stafiEther.withdrawEther(_amount);
stafiWithdraw.depositEth{value: _amount}();
emit ExcessWithdrawn(msg.sender, _amount, block.timestamp);
}
function getDepositEnabled() public view returns (bool) {
return getBoolS("settings.deposit.enabled");
}
function setDepositEnabled(bool _value) public onlySuperUser {
setBoolS("settings.deposit.enabled", _value);
}
function getAssignDepositsEnabled() public view returns (bool) {
return getBoolS("settings.deposit.assign.enabled");
}
function setAssignDepositsEnabled(bool _value) public onlySuperUser {
setBoolS("settings.deposit.assign.enabled", _value);
}
function getMinimumDeposit() public view returns (uint256) {
return getUintS("settings.deposit.minimum");
}
function setMinimumDeposit(uint256 _value) public onlySuperUser {
setUintS("settings.deposit.minimum", _value);
}
function getMaximumDepositAssignments() public view returns (uint256) {
return getUintS("settings.deposit.assign.maximum");
}
function setMaximumDepositAssignments(uint256 _value) public onlySuperUser {
setUintS("settings.deposit.assign.maximum", _value);
}
}
文件 15 的 15:StakingPoolStatus.sol
pragma solidity 0.7.6;
enum StakingPoolStatus {
Initialized,
Prelaunch,
Staking,
Withdrawn,
Dissolved
}
{
"compilationTarget": {
"contracts/deposit/StafiUserDeposit.sol": "StafiUserDeposit"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_stafiStorageAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"stakingPool","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"DepositAssigned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"DepositReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"DepositRecycled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"ExcessWithdrawn","type":"event"},{"inputs":[],"name":"assignDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getAssignDepositsEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDepositEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getExcessBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaximumDepositAssignments","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMinimumDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"receiveEtherWithdrawal","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"recycleDissolvedDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"recycleDistributorDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"recycleWithdrawDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bool","name":"_value","type":"bool"}],"name":"setAssignDepositsEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_value","type":"bool"}],"name":"setDepositEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"setMaximumDepositAssignments","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"setMinimumDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawExcessBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawExcessBalanceForLightNode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawExcessBalanceForSuperNode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawExcessBalanceForWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]