编译器
0.8.14+commit.80d49f37
文件 1 的 12:Address.sol
pragma solidity ^0.8.1;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
文件 2 的 12:BrewlabsStaking.sol
pragma solidity ^0.8.0;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../libs/IUniRouter02.sol";
import "../libs/IWETH.sol";
interface WhiteList {
function whitelisted(address _address) external view returns (bool);
}
contract BrewlabsStaking is Ownable, ReentrancyGuard {
using SafeERC20 for IERC20;
uint256 private constant PERCENT_PRECISION = 10000;
uint256 private constant BLOCKS_PER_DAY = 6426;
bool public isInitialized;
uint256 public duration = 365;
bool public hasUserLimit;
uint256 public poolLimitPerUser;
address public whiteList;
uint256 public startBlock;
uint256 public bonusEndBlock;
uint256 public rewardPerBlock;
uint256 public lastRewardBlock;
uint256 public slippageFactor = 8000;
uint256 public constant slippageFactorUL = 9950;
address public uniRouterAddress;
address[] public reflectionToStakedPath;
address[] public earnedToStakedPath;
uint256 public constant MAX_FEE = 2000;
uint256 public depositFee;
uint256 public withdrawFee;
address public walletA;
address public treasury = 0x64961Ffd0d84b2355eC2B5d35B0d8D8825A774dc;
uint256 public performanceFee = 0.00089 ether;
uint256 public PRECISION_FACTOR;
uint256 public PRECISION_FACTOR_REFLECTION;
IERC20 public stakingToken;
IERC20 public earnedToken;
address public dividendToken;
bool public hasDividend;
bool public autoAdjustableForRewardRate = true;
uint256 public accTokenPerShare;
uint256 public accDividendPerShare;
uint256 public totalStaked;
uint256 private totalEarned;
uint256 private totalReflections;
uint256 private reflections;
uint256 public paidRewards;
uint256 private shouldTotalPaid;
mapping(address => UserInfo) public userInfo;
struct UserInfo {
uint256 amount;
uint256 rewardDebt;
uint256 reflectionDebt;
}
event Deposit(address indexed user, uint256 amount);
event Withdraw(address indexed user, uint256 amount);
event Claim(address indexed user, uint256 amount);
event ClaimDividend(address indexed user, uint256 amount);
event Compound(address indexed user, uint256 amount);
event CompoundDividend(address indexed user, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 amount);
event AdminTokenRecovered(address tokenRecovered, uint256 amount);
event NewStartAndEndBlocks(uint256 startBlock, uint256 endBlock);
event NewRewardPerBlock(uint256 rewardPerBlock);
event RewardsStop(uint256 blockNumber);
event EndBlockUpdated(uint256 blockNumber);
event UpdatePoolLimit(uint256 poolLimitPerUser, bool hasLimit);
event ServiceInfoUpadted(address _addr, uint256 _fee);
event WalletAUpdated(address _addr);
event DurationUpdated(uint256 _duration);
event SetAutoAdjustableForRewardRate(bool status);
event SetWhiteList(address _whitelist);
event SetSettings(
uint256 _depositFee,
uint256 _withdrawFee,
uint256 _slippageFactor,
address _uniRouter,
address[] _path0,
address[] _path1
);
constructor() {}
function initialize(
IERC20 _stakingToken,
IERC20 _earnedToken,
address _dividendToken,
uint256 _rewardPerBlock,
uint256 _depositFee,
uint256 _withdrawFee,
address _uniRouter,
address[] memory _earnedToStakedPath,
address[] memory _reflectionToStakedPath,
address _whiteList,
bool _hasDividend
) external onlyOwner {
require(!isInitialized, "Already initialized");
isInitialized = true;
stakingToken = _stakingToken;
earnedToken = _earnedToken;
dividendToken = _dividendToken;
hasDividend = _hasDividend;
rewardPerBlock = _rewardPerBlock;
require(_depositFee < MAX_FEE, "Invalid deposit fee");
require(_withdrawFee < MAX_FEE, "Invalid withdraw fee");
depositFee = _depositFee;
withdrawFee = _withdrawFee;
walletA = msg.sender;
uint256 decimalsRewardToken = uint256(IERC20Metadata(address(earnedToken)).decimals());
require(decimalsRewardToken < 30, "Must be inferior to 30");
PRECISION_FACTOR = uint256(10 ** (40 - decimalsRewardToken));
uint256 decimalsdividendToken = 18;
if (address(dividendToken) != address(0x0)) {
decimalsdividendToken = uint256(IERC20Metadata(address(dividendToken)).decimals());
require(decimalsdividendToken < 30, "Must be inferior to 30");
}
PRECISION_FACTOR_REFLECTION = uint256(10 ** (40 - decimalsdividendToken));
uniRouterAddress = _uniRouter;
earnedToStakedPath = _earnedToStakedPath;
reflectionToStakedPath = _reflectionToStakedPath;
whiteList = _whiteList;
}
function deposit(uint256 _amount) external payable nonReentrant {
require(startBlock > 0 && startBlock < block.number, "Staking hasn't started yet");
require(_amount > 0, "Amount should be greator than 0");
if (whiteList != address(0x0)) {
require(WhiteList(whiteList).whitelisted(msg.sender), "not whitelisted");
}
UserInfo storage user = userInfo[msg.sender];
if (hasUserLimit) {
require(_amount + user.amount <= poolLimitPerUser, "User amount above limit");
}
_transferPerformanceFee();
_updatePool();
if (user.amount > 0) {
uint256 pending = user.amount * accTokenPerShare / PRECISION_FACTOR - user.rewardDebt;
if (pending > 0) {
require(availableRewardTokens() >= pending, "Insufficient reward tokens");
earnedToken.safeTransfer(address(msg.sender), pending);
if (totalEarned > pending) {
totalEarned = totalEarned - pending;
} else {
totalEarned = 0;
}
paidRewards = paidRewards + pending;
emit Claim(msg.sender, pending);
}
uint256 pendingReflection =
user.amount * accDividendPerShare / PRECISION_FACTOR_REFLECTION - user.reflectionDebt;
if (pendingReflection > 0 && hasDividend) {
uint256 _pendingReflection = estimateDividendAmount(pendingReflection);
totalReflections = totalReflections - pendingReflection;
if (address(dividendToken) == address(0x0)) {
payable(msg.sender).transfer(_pendingReflection);
} else {
IERC20(dividendToken).safeTransfer(address(msg.sender), _pendingReflection);
}
emit ClaimDividend(msg.sender, _pendingReflection);
}
}
uint256 beforeAmount = stakingToken.balanceOf(address(this));
stakingToken.safeTransferFrom(address(msg.sender), address(this), _amount);
uint256 afterAmount = stakingToken.balanceOf(address(this));
uint256 realAmount = afterAmount - beforeAmount;
if (realAmount > _amount) realAmount = _amount;
if (depositFee > 0) {
uint256 fee = realAmount * depositFee / PERCENT_PRECISION;
stakingToken.safeTransfer(walletA, fee);
realAmount = realAmount - fee;
}
user.amount = user.amount + realAmount;
user.rewardDebt = user.amount * accTokenPerShare / PRECISION_FACTOR;
user.reflectionDebt = user.amount * accDividendPerShare / PRECISION_FACTOR_REFLECTION;
totalStaked = totalStaked + realAmount;
emit Deposit(msg.sender, realAmount);
if (autoAdjustableForRewardRate) _updateRewardRate();
}
function withdraw(uint256 _amount) external payable nonReentrant {
require(_amount > 0, "Amount should be greator than 0");
UserInfo storage user = userInfo[msg.sender];
require(user.amount >= _amount, "Amount to withdraw too high");
_transferPerformanceFee();
_updatePool();
if (user.amount > 0) {
uint256 pending = user.amount * accTokenPerShare / PRECISION_FACTOR - user.rewardDebt;
if (pending > 0) {
require(availableRewardTokens() >= pending, "Insufficient reward tokens");
earnedToken.safeTransfer(address(msg.sender), pending);
if (totalEarned > pending) {
totalEarned = totalEarned - pending;
} else {
totalEarned = 0;
}
paidRewards = paidRewards + pending;
emit Claim(msg.sender, pending);
}
uint256 pendingReflection =
user.amount * accDividendPerShare / PRECISION_FACTOR_REFLECTION - user.reflectionDebt;
if (pendingReflection > 0 && hasDividend) {
uint256 _pendingReflection = estimateDividendAmount(pendingReflection);
totalReflections = totalReflections - pendingReflection;
if (address(dividendToken) == address(0x0)) {
payable(msg.sender).transfer(_pendingReflection);
} else {
IERC20(dividendToken).safeTransfer(address(msg.sender), _pendingReflection);
}
emit ClaimDividend(msg.sender, _pendingReflection);
}
}
uint256 realAmount = _amount;
if (user.amount < _amount) {
realAmount = user.amount;
}
user.amount = user.amount - realAmount;
totalStaked = totalStaked - realAmount;
emit Withdraw(msg.sender, realAmount);
if (withdrawFee > 0) {
uint256 fee = realAmount * withdrawFee / PERCENT_PRECISION;
stakingToken.safeTransfer(walletA, fee);
realAmount = realAmount - fee;
}
stakingToken.safeTransfer(address(msg.sender), realAmount);
user.rewardDebt = user.amount * accTokenPerShare / PRECISION_FACTOR;
user.reflectionDebt = user.amount * accDividendPerShare / PRECISION_FACTOR_REFLECTION;
if (autoAdjustableForRewardRate) _updateRewardRate();
}
function claimReward() external payable nonReentrant {
UserInfo storage user = userInfo[msg.sender];
_transferPerformanceFee();
_updatePool();
if (user.amount == 0) return;
uint256 pending = user.amount * accTokenPerShare / PRECISION_FACTOR - user.rewardDebt;
if (pending > 0) {
require(availableRewardTokens() >= pending, "Insufficient reward tokens");
earnedToken.safeTransfer(address(msg.sender), pending);
if (totalEarned > pending) {
totalEarned = totalEarned - pending;
} else {
totalEarned = 0;
}
paidRewards = paidRewards + pending;
emit Claim(msg.sender, pending);
}
user.rewardDebt = user.amount * accTokenPerShare / PRECISION_FACTOR;
}
function claimDividend() external payable nonReentrant {
require(hasDividend == true, "No reflections");
UserInfo storage user = userInfo[msg.sender];
_transferPerformanceFee();
_updatePool();
if (user.amount == 0) return;
uint256 pendingReflection =
user.amount * accDividendPerShare / PRECISION_FACTOR_REFLECTION - user.reflectionDebt;
if (pendingReflection > 0) {
uint256 _pendingReflection = estimateDividendAmount(pendingReflection);
totalReflections = totalReflections - pendingReflection;
if (address(dividendToken) == address(0x0)) {
payable(msg.sender).transfer(_pendingReflection);
} else {
IERC20(dividendToken).safeTransfer(address(msg.sender), _pendingReflection);
}
emit ClaimDividend(msg.sender, _pendingReflection);
}
user.reflectionDebt = user.amount * accDividendPerShare / PRECISION_FACTOR_REFLECTION;
}
function compoundReward() external payable nonReentrant {
UserInfo storage user = userInfo[msg.sender];
_transferPerformanceFee();
_updatePool();
if (user.amount == 0) return;
uint256 pending = user.amount * accTokenPerShare / PRECISION_FACTOR - user.rewardDebt;
if (pending > 0) {
require(availableRewardTokens() >= pending, "Insufficient reward tokens");
if (totalEarned > pending) {
totalEarned = totalEarned - pending;
} else {
totalEarned = 0;
}
paidRewards = paidRewards + pending;
emit Compound(msg.sender, pending);
if (address(stakingToken) != address(earnedToken)) {
uint256 beforeAmount = stakingToken.balanceOf(address(this));
_safeSwap(pending, earnedToStakedPath, address(this));
uint256 afterAmount = stakingToken.balanceOf(address(this));
pending = afterAmount - beforeAmount;
}
if (hasUserLimit) {
require(pending + user.amount <= poolLimitPerUser, "User amount above limit");
}
totalStaked = totalStaked + pending;
user.amount = user.amount + pending;
user.reflectionDebt = user.reflectionDebt + pending * accDividendPerShare / PRECISION_FACTOR_REFLECTION;
emit Deposit(msg.sender, pending);
}
user.rewardDebt = user.amount * accTokenPerShare / PRECISION_FACTOR;
}
function compoundDividend() external payable nonReentrant {
require(hasDividend == true, "No reflections");
UserInfo storage user = userInfo[msg.sender];
_transferPerformanceFee();
_updatePool();
if (user.amount == 0) return;
uint256 _pending = (user.amount * accDividendPerShare) / PRECISION_FACTOR_REFLECTION - user.reflectionDebt;
uint256 pending = estimateDividendAmount(_pending);
totalReflections = totalReflections - _pending;
if (pending > 0) {
emit CompoundDividend(msg.sender, pending);
if (address(stakingToken) != address(dividendToken)) {
if (address(dividendToken) == address(0x0)) {
address wethAddress = IUniRouter02(uniRouterAddress).WETH();
IWETH(wethAddress).deposit{value: pending}();
}
uint256 beforeAmount = stakingToken.balanceOf(address(this));
_safeSwap(pending, reflectionToStakedPath, address(this));
uint256 afterAmount = stakingToken.balanceOf(address(this));
pending = afterAmount - beforeAmount;
}
if (hasUserLimit) {
require(pending + user.amount <= poolLimitPerUser, "User amount above limit");
}
totalStaked = totalStaked + pending;
user.amount = user.amount + pending;
user.rewardDebt = user.rewardDebt + pending * accTokenPerShare / PRECISION_FACTOR;
emit Deposit(msg.sender, pending);
}
user.reflectionDebt = user.amount * accDividendPerShare / PRECISION_FACTOR_REFLECTION;
}
function _transferPerformanceFee() internal {
require(msg.value >= performanceFee, "should pay small gas to compound or harvest");
payable(treasury).transfer(performanceFee);
if (msg.value > performanceFee) {
payable(msg.sender).transfer(msg.value - performanceFee);
}
}
function emergencyWithdraw() external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
uint256 amountToTransfer = user.amount;
user.amount = 0;
user.rewardDebt = 0;
user.reflectionDebt = 0;
if (amountToTransfer > 0) {
stakingToken.safeTransfer(address(msg.sender), amountToTransfer);
totalStaked = totalStaked - amountToTransfer;
}
emit EmergencyWithdraw(msg.sender, amountToTransfer);
}
function availableRewardTokens() public view returns (uint256) {
if (address(earnedToken) == address(dividendToken)) return totalEarned;
uint256 _amount = earnedToken.balanceOf(address(this));
if (address(earnedToken) == address(stakingToken)) {
if (_amount < totalStaked) return 0;
return _amount - totalStaked;
}
return _amount;
}
function availableDividendTokens() public view returns (uint256) {
if (address(dividendToken) == address(0x0)) {
return address(this).balance;
}
uint256 _amount = IERC20(dividendToken).balanceOf(address(this));
if (address(dividendToken) == address(earnedToken)) {
if (_amount < totalEarned) return 0;
_amount = _amount - totalEarned;
}
if (address(dividendToken) == address(stakingToken)) {
if (_amount < totalStaked) return 0;
_amount = _amount - totalStaked;
}
return _amount;
}
function insufficientRewards() external view returns (uint256) {
uint256 adjustedShouldTotalPaid = shouldTotalPaid;
uint256 remainRewards = availableRewardTokens() + paidRewards;
if (startBlock == 0) {
adjustedShouldTotalPaid = adjustedShouldTotalPaid + rewardPerBlock * duration * BLOCKS_PER_DAY;
} else {
uint256 remainBlocks = _getMultiplier(lastRewardBlock, bonusEndBlock);
adjustedShouldTotalPaid = adjustedShouldTotalPaid + rewardPerBlock * remainBlocks;
}
if (remainRewards >= adjustedShouldTotalPaid) return 0;
return adjustedShouldTotalPaid - remainRewards;
}
function pendingReward(address _user) external view returns (uint256) {
UserInfo memory user = userInfo[_user];
uint256 adjustedTokenPerShare = accTokenPerShare;
if (block.number > lastRewardBlock && totalStaked != 0 && lastRewardBlock > 0) {
uint256 multiplier = _getMultiplier(lastRewardBlock, block.number);
uint256 rewards = multiplier * rewardPerBlock;
adjustedTokenPerShare = accTokenPerShare + (rewards * PRECISION_FACTOR / totalStaked);
}
return user.amount * adjustedTokenPerShare / PRECISION_FACTOR - user.rewardDebt;
}
function pendingDividends(address _user) external view returns (uint256) {
if (totalStaked == 0) return 0;
UserInfo memory user = userInfo[_user];
uint256 reflectionAmount = availableDividendTokens();
if (reflectionAmount > totalReflections) {
reflectionAmount -= totalReflections;
} else {
reflectionAmount = 0;
}
uint256 sTokenBal = totalStaked;
uint256 eTokenBal = availableRewardTokens();
if (address(stakingToken) == address(earnedToken)) {
sTokenBal = sTokenBal + eTokenBal;
}
uint256 adjustedReflectionPerShare =
accDividendPerShare + (reflectionAmount * PRECISION_FACTOR_REFLECTION / sTokenBal);
uint256 pendingReflection =
user.amount * adjustedReflectionPerShare / PRECISION_FACTOR_REFLECTION - user.reflectionDebt;
return pendingReflection;
}
function harvestTo(address _treasury) external onlyOwner {
_updatePool();
if (reflections > 0) {
if (address(dividendToken) == address(0x0)) {
payable(_treasury).transfer(estimateDividendAmount(reflections));
} else {
IERC20(dividendToken).safeTransfer(_treasury, estimateDividendAmount(reflections));
}
totalReflections = totalReflections - reflections;
reflections = 0;
}
}
function depositRewards(uint256 _amount) external onlyOwner nonReentrant {
require(_amount > 0, "invalid amount");
uint256 beforeAmt = earnedToken.balanceOf(address(this));
earnedToken.safeTransferFrom(msg.sender, address(this), _amount);
uint256 afterAmt = earnedToken.balanceOf(address(this));
totalEarned = totalEarned + afterAmt - beforeAmt;
}
function increaseEmissionRate(uint256 _amount) external onlyOwner {
require(startBlock > 0, "pool is not started");
require(bonusEndBlock > block.number, "pool was already finished");
require(_amount > 0, "invalid amount");
_updatePool();
uint256 beforeAmt = earnedToken.balanceOf(address(this));
earnedToken.safeTransferFrom(msg.sender, address(this), _amount);
uint256 afterAmt = earnedToken.balanceOf(address(this));
totalEarned = totalEarned + afterAmt - beforeAmt;
_updateRewardRate();
}
function _updateRewardRate() internal {
if (bonusEndBlock <= block.number) return;
uint256 remainRewards = availableRewardTokens() + paidRewards;
if (remainRewards > shouldTotalPaid) {
remainRewards = remainRewards - shouldTotalPaid;
uint256 remainBlocks = bonusEndBlock - block.number;
rewardPerBlock = remainRewards / remainBlocks;
emit NewRewardPerBlock(rewardPerBlock);
}
}
function emergencyRewardWithdraw(uint256 _amount) external onlyOwner {
require(block.number > bonusEndBlock, "Pool is running");
require(availableRewardTokens() >= _amount, "Insufficient reward tokens");
if (_amount == 0) _amount = availableRewardTokens();
earnedToken.safeTransfer(address(msg.sender), _amount);
if (totalEarned > 0) {
if (_amount > totalEarned) {
totalEarned = 0;
} else {
totalEarned = totalEarned - _amount;
}
}
}
function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) external onlyOwner {
require(_tokenAddress != address(earnedToken) || _tokenAddress == dividendToken, "Cannot be reward token");
if (_tokenAddress == address(stakingToken)) {
uint256 tokenBal = stakingToken.balanceOf(address(this));
require(_tokenAmount <= tokenBal - totalStaked, "Insufficient balance");
}
if (_tokenAddress == address(0x0)) {
payable(msg.sender).transfer(_tokenAmount);
} else {
IERC20(_tokenAddress).safeTransfer(address(msg.sender), _tokenAmount);
}
emit AdminTokenRecovered(_tokenAddress, _tokenAmount);
}
function startReward() external onlyOwner {
require(startBlock == 0, "Pool was already started");
startBlock = block.number + 100;
bonusEndBlock = startBlock + duration * BLOCKS_PER_DAY;
lastRewardBlock = startBlock;
emit NewStartAndEndBlocks(startBlock, bonusEndBlock);
}
function stopReward() external onlyOwner {
_updatePool();
uint256 remainRewards = availableRewardTokens() + paidRewards;
if (remainRewards > shouldTotalPaid) {
remainRewards = remainRewards - shouldTotalPaid;
earnedToken.transfer(msg.sender, remainRewards);
if (totalEarned > remainRewards) {
totalEarned = totalEarned - remainRewards;
} else {
totalEarned = 0;
}
}
bonusEndBlock = block.number;
emit RewardsStop(bonusEndBlock);
}
function updateEndBlock(uint256 _endBlock) external onlyOwner {
require(startBlock > 0, "Pool is not started");
require(bonusEndBlock > block.number, "Pool was already finished");
require(_endBlock > block.number && _endBlock > startBlock, "Invalid end block");
bonusEndBlock = _endBlock;
emit EndBlockUpdated(_endBlock);
}
function updatePoolLimitPerUser(bool _hasUserLimit, uint256 _poolLimitPerUser) external onlyOwner {
if (_hasUserLimit) {
require(_poolLimitPerUser > poolLimitPerUser, "New limit must be higher");
poolLimitPerUser = _poolLimitPerUser;
} else {
poolLimitPerUser = 0;
}
hasUserLimit = _hasUserLimit;
emit UpdatePoolLimit(poolLimitPerUser, hasUserLimit);
}
function updateRewardPerBlock(uint256 _rewardPerBlock) external onlyOwner {
rewardPerBlock = _rewardPerBlock;
emit NewRewardPerBlock(_rewardPerBlock);
}
function setServiceInfo(address _treasury, uint256 _fee) external {
require(msg.sender == treasury, "setServiceInfo: FORBIDDEN");
require(_treasury != address(0x0), "Invalid address");
treasury = _treasury;
performanceFee = _fee;
emit ServiceInfoUpadted(_treasury, _fee);
}
function updateWalletA(address _walletA) external onlyOwner {
require(_walletA != address(0x0) || _walletA != walletA, "Invalid address");
walletA = _walletA;
emit WalletAUpdated(_walletA);
}
function setDuration(uint256 _duration) external onlyOwner {
require(_duration >= 30, "lower limit reached");
duration = _duration;
if (startBlock > 0) {
bonusEndBlock = startBlock + duration * BLOCKS_PER_DAY;
require(bonusEndBlock > block.number, "invalid duration");
}
emit DurationUpdated(_duration);
}
function setAutoAdjustableForRewardRate(bool _status) external onlyOwner {
autoAdjustableForRewardRate = _status;
emit SetAutoAdjustableForRewardRate(_status);
}
function setSettings(
uint256 _depositFee,
uint256 _withdrawFee,
uint256 _slippageFactor,
address _uniRouter,
address[] memory _earnedToStakedPath,
address[] memory _reflectionToStakedPath
) external onlyOwner {
require(_depositFee < MAX_FEE, "Invalid deposit fee");
require(_withdrawFee < MAX_FEE, "Invalid withdraw fee");
require(_slippageFactor <= slippageFactorUL, "_slippageFactor too high");
depositFee = _depositFee;
withdrawFee = _withdrawFee;
slippageFactor = _slippageFactor;
uniRouterAddress = _uniRouter;
reflectionToStakedPath = _reflectionToStakedPath;
earnedToStakedPath = _earnedToStakedPath;
emit SetSettings(
_depositFee, _withdrawFee, _slippageFactor, _uniRouter, _earnedToStakedPath, _reflectionToStakedPath
);
}
function setWhitelist(address _whitelist) external onlyOwner {
whiteList = _whitelist;
emit SetWhiteList(_whitelist);
}
function _updatePool() internal {
if (totalStaked > 0 && hasDividend) {
uint256 reflectionAmount = availableDividendTokens();
if (reflectionAmount > totalReflections) {
reflectionAmount -= totalReflections;
} else {
reflectionAmount = 0;
}
uint256 sTokenBal = totalStaked;
uint256 eTokenBal = availableRewardTokens();
if (address(stakingToken) == address(earnedToken)) {
sTokenBal = sTokenBal + eTokenBal;
}
accDividendPerShare += reflectionAmount * PRECISION_FACTOR_REFLECTION / sTokenBal;
reflections += reflectionAmount * eTokenBal / sTokenBal;
totalReflections += reflectionAmount;
}
if (block.number <= lastRewardBlock || lastRewardBlock == 0) return;
if (totalStaked == 0) {
lastRewardBlock = block.number;
return;
}
uint256 multiplier = _getMultiplier(lastRewardBlock, block.number);
uint256 _reward = multiplier * rewardPerBlock;
accTokenPerShare += _reward * PRECISION_FACTOR / totalStaked;
lastRewardBlock = block.number;
shouldTotalPaid = shouldTotalPaid + _reward;
}
function estimateDividendAmount(uint256 amount) internal view returns (uint256) {
uint256 dTokenBal = availableDividendTokens();
if (amount > totalReflections) amount = totalReflections;
if (amount > dTokenBal) amount = dTokenBal;
return amount;
}
function _getMultiplier(uint256 _from, uint256 _to) internal view returns (uint256) {
if (_to <= bonusEndBlock) {
return _to - _from;
} else if (_from >= bonusEndBlock) {
return 0;
} else {
return bonusEndBlock - _from;
}
}
function _safeSwap(uint256 _amountIn, address[] memory _path, address _to) internal {
uint256[] memory amounts = IUniRouter02(uniRouterAddress).getAmountsOut(_amountIn, _path);
uint256 amountOut = amounts[amounts.length - 1];
IERC20(_path[0]).safeApprove(uniRouterAddress, _amountIn);
IUniRouter02(uniRouterAddress).swapExactTokensForTokensSupportingFeeOnTransferTokens(
_amountIn, amountOut * slippageFactor / PERCENT_PRECISION, _path, _to, block.timestamp + 600
);
}
receive() external payable {}
}
文件 3 的 12:Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
文件 4 的 12:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
文件 5 的 12:IERC20Metadata.sol
pragma solidity ^0.8.0;
import "../IERC20.sol";
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
文件 6 的 12:IUniRouter01.sol
pragma solidity ^0.8.0;
interface IUniRouter01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(uint256 amountOutMin, address[] calldata path, address to, uint256 deadline)
external
payable
returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(uint256 amountOut, address[] calldata path, address to, uint256 deadline)
external
payable
returns (uint256[] memory amounts);
function quote(uint256 amountA, uint256 reserveA, uint256 reserveB) external pure returns (uint256 amountB);
function getAmountOut(uint256 amountIn, uint256 reserveIn, uint256 reserveOut)
external
pure
returns (uint256 amountOut);
function getAmountIn(uint256 amountOut, uint256 reserveIn, uint256 reserveOut)
external
pure
returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
文件 7 的 12:IUniRouter02.sol
pragma solidity ^0.8.0;
import "./IUniRouter01.sol";
interface IUniRouter02 is IUniRouter01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
文件 8 的 12:IWETH.sol
pragma solidity >=0.5.0;
interface IWETH {
function deposit() external payable;
function transfer(address to, uint256 value) external returns (bool);
function withdraw(uint256) external;
}
文件 9 的 12:Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 10 的 12:ReentrancyGuard.sol
pragma solidity ^0.8.0;
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
}
function _nonReentrantAfter() private {
_status = _NOT_ENTERED;
}
}
文件 11 的 12:SafeERC20.sol
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
文件 12 的 12:draft-IERC20Permit.sol
pragma solidity ^0.8.0;
interface IERC20Permit {
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
function nonces(address owner) external view returns (uint256);
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
{
"compilationTarget": {
"contracts/pool/BrewlabsStaking.sol": "BrewlabsStaking"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 100
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenRecovered","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AdminTokenRecovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimDividend","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Compound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CompoundDividend","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"DurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"EndBlockUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewardPerBlock","type":"uint256"}],"name":"NewRewardPerBlock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"startBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endBlock","type":"uint256"}],"name":"NewStartAndEndBlocks","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"RewardsStop","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_addr","type":"address"},{"indexed":false,"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"ServiceInfoUpadted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"SetAutoAdjustableForRewardRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_depositFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_withdrawFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_slippageFactor","type":"uint256"},{"indexed":false,"internalType":"address","name":"_uniRouter","type":"address"},{"indexed":false,"internalType":"address[]","name":"_path0","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"_path1","type":"address[]"}],"name":"SetSettings","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_whitelist","type":"address"}],"name":"SetWhiteList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"poolLimitPerUser","type":"uint256"},{"indexed":false,"internalType":"bool","name":"hasLimit","type":"bool"}],"name":"UpdatePoolLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_addr","type":"address"}],"name":"WalletAUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"MAX_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION_FACTOR_REFLECTION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accDividendPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accTokenPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"autoAdjustableForRewardRate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"availableDividendTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"availableRewardTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bonusEndBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimDividend","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"claimReward","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"compoundDividend","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"compoundReward","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"depositFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dividendToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"duration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"earnedToStakedPath","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"earnedToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"emergencyRewardWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"harvestTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"hasDividend","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hasUserLimit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"increaseEmissionRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_stakingToken","type":"address"},{"internalType":"contract IERC20","name":"_earnedToken","type":"address"},{"internalType":"address","name":"_dividendToken","type":"address"},{"internalType":"uint256","name":"_rewardPerBlock","type":"uint256"},{"internalType":"uint256","name":"_depositFee","type":"uint256"},{"internalType":"uint256","name":"_withdrawFee","type":"uint256"},{"internalType":"address","name":"_uniRouter","type":"address"},{"internalType":"address[]","name":"_earnedToStakedPath","type":"address[]"},{"internalType":"address[]","name":"_reflectionToStakedPath","type":"address[]"},{"internalType":"address","name":"_whiteList","type":"address"},{"internalType":"bool","name":"_hasDividend","type":"bool"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"insufficientRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRewardBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paidRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"pendingDividends","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"performanceFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLimitPerUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_tokenAmount","type":"uint256"}],"name":"recoverWrongTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"reflectionToStakedPath","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"setAutoAdjustableForRewardRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"setDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setServiceInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_depositFee","type":"uint256"},{"internalType":"uint256","name":"_withdrawFee","type":"uint256"},{"internalType":"uint256","name":"_slippageFactor","type":"uint256"},{"internalType":"address","name":"_uniRouter","type":"address"},{"internalType":"address[]","name":"_earnedToStakedPath","type":"address[]"},{"internalType":"address[]","name":"_reflectionToStakedPath","type":"address[]"}],"name":"setSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_whitelist","type":"address"}],"name":"setWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slippageFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"slippageFactorUL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stopReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniRouterAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_endBlock","type":"uint256"}],"name":"updateEndBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_hasUserLimit","type":"bool"},{"internalType":"uint256","name":"_poolLimitPerUser","type":"uint256"}],"name":"updatePoolLimitPerUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardPerBlock","type":"uint256"}],"name":"updateRewardPerBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_walletA","type":"address"}],"name":"updateWalletA","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"},{"internalType":"uint256","name":"reflectionDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"walletA","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whiteList","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdrawFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]