|
|
|
|
|
|
|
|
|
pragma solidity =0.8.15;
|
|
|
|
abstract contract Context {
|
|
function _msgSender() internal view virtual returns (address payable) {
|
|
return payable(msg.sender);
|
|
}
|
|
|
|
function _msgData() internal view virtual returns (bytes memory) {
|
|
this;
|
|
return msg.data;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
interface IERC20 {
|
|
|
|
|
|
|
|
function totalSupply() external view returns (uint256);
|
|
|
|
|
|
|
|
|
|
function balanceOf(address account) external view returns (uint256);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function transfer(address recipient, 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 sender, address recipient, uint256 amount) external returns (bool);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
event Transfer(address indexed from, address indexed to, uint256 value);
|
|
|
|
|
|
|
|
|
|
|
|
event Approval(address indexed owner, address indexed spender, uint256 value);
|
|
}
|
|
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
library Address {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isContract(address account) internal view returns (bool) {
|
|
|
|
|
|
|
|
|
|
uint256 size;
|
|
|
|
assembly { size := extcodesize(account) }
|
|
return size > 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 functionCall(target, data, "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");
|
|
require(isContract(target), "Address: call to non-contract");
|
|
|
|
|
|
(bool success, bytes memory returndata) = target.call{ value: value }(data);
|
|
return _verifyCallResult(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) {
|
|
require(isContract(target), "Address: static call to non-contract");
|
|
|
|
|
|
(bool success, bytes memory returndata) = target.staticcall(data);
|
|
return _verifyCallResult(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) {
|
|
require(isContract(target), "Address: delegate call to non-contract");
|
|
|
|
|
|
(bool success, bytes memory returndata) = target.delegatecall(data);
|
|
return _verifyCallResult(success, returndata, errorMessage);
|
|
}
|
|
|
|
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
|
|
if (success) {
|
|
return returndata;
|
|
} else {
|
|
|
|
if (returndata.length > 0) {
|
|
|
|
|
|
|
|
assembly {
|
|
let returndata_size := mload(returndata)
|
|
revert(add(32, returndata), returndata_size)
|
|
}
|
|
} else {
|
|
revert(errorMessage);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
abstract contract Ownable is Context {
|
|
address private _owner;
|
|
|
|
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
|
|
|
|
|
|
|
|
|
|
constructor () {
|
|
address msgSender = _msgSender();
|
|
_owner = msgSender;
|
|
emit OwnershipTransferred(address(0), msgSender);
|
|
}
|
|
|
|
|
|
|
|
|
|
function owner() public view virtual returns (address) {
|
|
return _owner;
|
|
}
|
|
|
|
|
|
|
|
|
|
modifier onlyOwner() {
|
|
require(owner() == _msgSender(), "Ownable: caller is not the owner");
|
|
_;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function renounceOwnership() public virtual onlyOwner {
|
|
emit OwnershipTransferred(_owner, address(0));
|
|
_owner = address(0);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function transferOwnership(address newOwner) public virtual onlyOwner {
|
|
require(newOwner != address(0), "Ownable: new owner is the zero address");
|
|
emit OwnershipTransferred(_owner, newOwner);
|
|
_owner = newOwner;
|
|
}
|
|
}
|
|
|
|
library SafeERC20 {
|
|
using SafeMath for uint256;
|
|
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).add(value);
|
|
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
|
|
}
|
|
|
|
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
|
|
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
|
|
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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");
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
contract TLRStaking is ReentrancyGuard, Ownable {
|
|
using SafeMath for uint256;
|
|
using SafeERC20 for IERC20;
|
|
|
|
struct PoolInfo {
|
|
uint256 lockupDuration;
|
|
uint256 returnPer;
|
|
}
|
|
struct OrderInfo {
|
|
address beneficiary;
|
|
uint256 amount;
|
|
uint256 lockupDuration;
|
|
uint256 returnPer;
|
|
uint256 starttime;
|
|
uint256 endtime;
|
|
uint256 claimedReward;
|
|
bool claimed;
|
|
}
|
|
IERC20 public token;
|
|
bool public started;
|
|
uint256 private latestOrderId;
|
|
uint256 public emergencyWithdrawFees;
|
|
uint256 public totalStake;
|
|
uint256 public totalWithdrawal;
|
|
uint256 public totalRewardsDistribution;
|
|
uint256 public totalRewardPending;
|
|
uint256 public baseTime = 1 days;
|
|
|
|
mapping(uint256 => PoolInfo) public pooldata;
|
|
|
|
mapping(address => uint256) public balanceOf;
|
|
mapping(address => uint256) public totalRewardEarn;
|
|
mapping(uint256 => OrderInfo) public orders;
|
|
mapping(address => uint256[]) private orderIds;
|
|
|
|
constructor(
|
|
address _token,
|
|
bool _started,
|
|
uint256 _emergencyWithdrawFees
|
|
|
|
) {
|
|
token = IERC20(_token);
|
|
started = _started;
|
|
emergencyWithdrawFees = _emergencyWithdrawFees;
|
|
|
|
|
|
pooldata[15].lockupDuration = 15;
|
|
pooldata[15].returnPer = 30000 ;
|
|
|
|
|
|
pooldata[30].lockupDuration = 30;
|
|
pooldata[30].returnPer = 40000;
|
|
|
|
|
|
pooldata[45].lockupDuration = 45;
|
|
pooldata[45].returnPer = 50000;
|
|
|
|
|
|
pooldata[60].lockupDuration = 60;
|
|
pooldata[60].returnPer = 60000;
|
|
|
|
}
|
|
|
|
event Deposit(address indexed user, uint256 indexed lockupDuration, uint256 amount , uint256 returnPer);
|
|
event MappedInvestment(address indexed user, uint256 indexed lockupDuration, uint256 amount , uint256 returnPer);
|
|
event Withdraw(address indexed user, uint256 amount , uint256 reward , uint256 total );
|
|
event WithdrawAll(address indexed user, uint256 amount);
|
|
|
|
function addPool(uint256 _lockupDuration , uint256 _returnPer ) external onlyOwner {
|
|
require(_lockupDuration > 0 , "LockupDuration must be greater than zero");
|
|
require(_returnPer > 0 , "ReturnPer must be greater than zero");
|
|
PoolInfo storage pool = pooldata[_lockupDuration];
|
|
pool.lockupDuration = _lockupDuration;
|
|
pool.returnPer = _returnPer;
|
|
}
|
|
|
|
function investorOrderIds(address investor)
|
|
external
|
|
view
|
|
returns (uint256[] memory ids)
|
|
{
|
|
uint256[] memory arr = orderIds[investor];
|
|
return arr;
|
|
}
|
|
|
|
|
|
function setToken(IERC20 _token) public onlyOwner {
|
|
token = _token;
|
|
}
|
|
|
|
function setBaseTime(uint _basetime) public onlyOwner{
|
|
require(_basetime > 0 , "basetime must be greatar than zero!!");
|
|
baseTime = _basetime;
|
|
}
|
|
|
|
function getStakingBalance(address _user) public view returns (uint256 stakedAmount){
|
|
return balanceOf[_user];
|
|
}
|
|
|
|
function setEmergencyWithdrawalFees(uint256 _emergencyWithdrawFees) public onlyOwner {
|
|
require(_emergencyWithdrawFees != emergencyWithdrawFees, "Already set to the value!");
|
|
require(_emergencyWithdrawFees <= 35, "Can't set higher than 35%");
|
|
emergencyWithdrawFees = _emergencyWithdrawFees;
|
|
}
|
|
|
|
function toggleStaking(bool _start) public onlyOwner {
|
|
started = _start;
|
|
}
|
|
|
|
function pendingRewards(uint256 _orderId ) public view returns (uint256) {
|
|
OrderInfo storage orderInfo = orders[_orderId];
|
|
|
|
if(_orderId <= latestOrderId && orderInfo.amount > 0 && !orderInfo.claimed){
|
|
|
|
if(block.timestamp >= orderInfo.endtime){
|
|
uint256 reward = (orderInfo.amount.mul(orderInfo.returnPer).mul(orderInfo.lockupDuration)).div(10000*365);
|
|
uint256 claimAvailable = reward.sub(orderInfo.claimedReward);
|
|
return claimAvailable;
|
|
}
|
|
|
|
uint256 stakeTime = block.timestamp.sub(orderInfo.starttime);
|
|
uint256 totalReward = orderInfo.amount.mul(stakeTime).mul(orderInfo.returnPer).div(10000*365*86400);
|
|
uint256 claimAvailableNow = totalReward.sub(orderInfo.claimedReward);
|
|
return claimAvailableNow;
|
|
}
|
|
else{
|
|
return 0;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
function deposit(uint256 _amount , uint256 _lockupDuration ) public {
|
|
require(address(token) != address(0), "Token Not Set Yet");
|
|
require(address(msg.sender) != address(0), "please Enter Valid Adderss");
|
|
require(started , "Not Stared yet!");
|
|
require(_amount > 0, "Amount must be greater than Zero!");
|
|
|
|
PoolInfo storage pool = pooldata[_lockupDuration];
|
|
|
|
require(pool.lockupDuration > 0 && pool.returnPer > 0 , "No Pool exist With Locktime!");
|
|
uint256 userReward = (_amount.mul(pool.returnPer).mul(_lockupDuration)).div(10000*365);
|
|
uint256 requiredToken = totalStake.add(totalRewardPending).add(userReward).sub(totalWithdrawal);
|
|
require(token.balanceOf(address(this)) > requiredToken , "Sorry, Insufficient Staking Reward, Please Try Later.");
|
|
require(token.transferFrom(msg.sender, address(this), _amount), "Transfer failed");
|
|
|
|
orders[++latestOrderId] = OrderInfo(
|
|
msg.sender,
|
|
_amount,
|
|
_lockupDuration,
|
|
pool.returnPer,
|
|
block.timestamp,
|
|
block.timestamp.add(_lockupDuration.mul(baseTime)),
|
|
0,
|
|
false
|
|
);
|
|
|
|
totalStake = totalStake.add(_amount);
|
|
totalRewardPending = totalRewardPending.add(userReward);
|
|
balanceOf[msg.sender] = balanceOf[msg.sender].add(_amount);
|
|
orderIds[msg.sender].push(latestOrderId);
|
|
emit Deposit(msg.sender , _lockupDuration , _amount ,pool.returnPer );
|
|
}
|
|
|
|
|
|
function withdraw(uint256 orderId) public nonReentrant{
|
|
require(orderId <= latestOrderId, "the order ID is incorrect");
|
|
require(address(msg.sender) != address(0), "please Enter Valid Adderss");
|
|
OrderInfo storage orderInfo = orders[orderId];
|
|
require(msg.sender == orderInfo.beneficiary, "not order beneficiary");
|
|
require(balanceOf[msg.sender] >= orderInfo.amount && !orderInfo.claimed, "insufficient redeemable tokens");
|
|
require(block.timestamp >= orderInfo.endtime,"tokens are being locked");
|
|
|
|
require(!orderInfo.claimed, "tokens are ready to be claimed");
|
|
|
|
uint256 amount = orderInfo.amount;
|
|
uint256 reward = (amount.mul(orderInfo.returnPer).mul(orderInfo.lockupDuration)).div(10000*365);
|
|
uint256 claimAvailable = reward.sub(orderInfo.claimedReward);
|
|
uint256 total = amount.add(claimAvailable);
|
|
|
|
require(token.balanceOf(address(this)) >= total, "Currently Withdraw not Avalible");
|
|
|
|
totalRewardEarn[msg.sender] = totalRewardEarn[msg.sender].add(claimAvailable);
|
|
totalWithdrawal = totalWithdrawal.add(amount);
|
|
totalRewardsDistribution = totalRewardsDistribution.add(claimAvailable);
|
|
totalRewardPending = totalRewardPending.sub(reward);
|
|
orderInfo.claimed = true;
|
|
balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount);
|
|
token.transfer(address(msg.sender) , total);
|
|
emit Withdraw(msg.sender , amount , claimAvailable , total);
|
|
}
|
|
|
|
function emergencyWithdraw(uint256 orderId) public nonReentrant{
|
|
require(orderId <= latestOrderId, "the order ID is incorrect");
|
|
require(address(msg.sender) != address(0), "please Enter Valid Adderss");
|
|
|
|
OrderInfo storage orderInfo = orders[orderId];
|
|
require(msg.sender == orderInfo.beneficiary, "not order beneficiary");
|
|
require(balanceOf[msg.sender] >= orderInfo.amount && !orderInfo.claimed, "insufficient redeemable tokens or already claimed");
|
|
|
|
uint256 fees = orderInfo.amount.mul(emergencyWithdrawFees).div(10000);
|
|
uint256 total = orderInfo.amount.sub(fees);
|
|
|
|
require(token.balanceOf(address(this)) >= total, "Currently Withdraw not Avalible");
|
|
|
|
totalWithdrawal = totalWithdrawal.add(orderInfo.amount);
|
|
orderInfo.claimed = true;
|
|
balanceOf[msg.sender] = balanceOf[msg.sender].sub(orderInfo.amount);
|
|
uint256 userReward = (orderInfo.amount.mul(orderInfo.returnPer).mul(orderInfo.lockupDuration)).div(10000*365);
|
|
totalRewardPending = totalRewardPending.sub(userReward);
|
|
token.transfer(address(msg.sender) , total);
|
|
|
|
emit WithdrawAll(msg.sender , total);
|
|
}
|
|
|
|
function withdrawBNB(address payable _reciever, uint256 _amount) public onlyOwner {
|
|
_reciever.transfer(_amount);
|
|
}
|
|
|
|
function withdrawToken() public onlyOwner
|
|
{
|
|
uint256 contract_balance = token.balanceOf(address(this));
|
|
uint256 totalStaked = totalStake.sub(totalWithdrawal);
|
|
uint256 total = contract_balance.sub(totalStaked).sub(totalRewardPending);
|
|
require(total > 0 , "No Token Avalible for withdraw!!");
|
|
token.transfer(address(owner()) , total);
|
|
}
|
|
|
|
function withdrawOtherTokens(IERC20 _token) public onlyOwner {
|
|
require(IERC20(_token) != IERC20(token), "Can't withdraw reward token!");
|
|
uint256 contract_balance = IERC20(_token).balanceOf(address(this));
|
|
IERC20(_token).transfer(address(owner()) , contract_balance);
|
|
}
|
|
} |