More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 113 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw | 19570796 | 216 days ago | IN | 0 ETH | 0.00349346 | ||||
Withdraw | 18851248 | 317 days ago | IN | 0 ETH | 0.00151668 | ||||
Withdraw | 18798472 | 325 days ago | IN | 0 ETH | 0.00288896 | ||||
Withdraw | 18762031 | 330 days ago | IN | 0 ETH | 0.00263085 | ||||
Withdraw | 18751823 | 331 days ago | IN | 0 ETH | 0.00062195 | ||||
Withdraw | 18696969 | 339 days ago | IN | 0 ETH | 0.0023356 | ||||
Withdraw | 18694424 | 339 days ago | IN | 0 ETH | 0.00300734 | ||||
Withdraw | 18692049 | 340 days ago | IN | 0 ETH | 0.00348949 | ||||
Withdraw | 17016980 | 575 days ago | IN | 0 ETH | 0.00182926 | ||||
Withdraw | 16367029 | 666 days ago | IN | 0 ETH | 0.00124774 | ||||
Withdraw | 16204413 | 689 days ago | IN | 0 ETH | 0.00104517 | ||||
Withdraw | 16031230 | 713 days ago | IN | 0 ETH | 0.00134049 | ||||
Withdraw | 15949146 | 724 days ago | IN | 0 ETH | 0.00131235 | ||||
Withdraw | 15909395 | 730 days ago | IN | 0 ETH | 0.0008967 | ||||
Withdraw | 15841125 | 739 days ago | IN | 0 ETH | 0.00185843 | ||||
Withdraw | 15841117 | 739 days ago | IN | 0 ETH | 0.00199394 | ||||
Withdraw | 15803843 | 745 days ago | IN | 0 ETH | 0.0013382 | ||||
Withdraw | 15788366 | 747 days ago | IN | 0 ETH | 0.00135601 | ||||
Withdraw | 15738978 | 754 days ago | IN | 0 ETH | 0.0010848 | ||||
Withdraw | 15717335 | 757 days ago | IN | 0 ETH | 0.00365918 | ||||
Withdraw | 15687862 | 761 days ago | IN | 0 ETH | 0.00044843 | ||||
Withdraw | 15641217 | 767 days ago | IN | 0 ETH | 0.00144736 | ||||
Withdraw | 15624550 | 770 days ago | IN | 0 ETH | 0.00090848 | ||||
Withdraw | 15616609 | 771 days ago | IN | 0 ETH | 0.00050471 | ||||
Withdraw | 15596352 | 774 days ago | IN | 0 ETH | 0.00073959 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x130aE574...1CD354924 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
FestakedWithReward
Compiler Version
v0.6.6+commit.6c089d02
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity >=0.6.0 <0.8.0; import "./IFestaked.sol"; import "./FestakedOptimized.sol"; abstract contract RewardAdder is IFestaked { address public rewardTokenAddress; FestakedLib.FestakeRewardState public rewardState; address public rewardSetter; // Not using Ownable to save on deployment gas function rewardsTotal() external view returns (uint256) { return rewardState.rewardsTotal; } function earlyWithdrawReward() external view returns (uint256) { return rewardState.earlyWithdrawReward; } function rewardBalance() external view returns (uint256) { return rewardState.rewardBalance; } function addReward(uint256 rewardAmount, uint256 withdrawableAmount) external returns (bool) { return FestakedLib.addReward(rewardAmount, withdrawableAmount, rewardTokenAddress, rewardState); } } contract FestakedWithReward is FestakedOptimized, RewardAdder { constructor (string memory name_, address tokenAddress_, address rewardTokenAddress_, uint stakingStarts_, uint stakingEnds_, uint withdrawStarts_, uint withdrawEnds_, uint256 stakingCap_) FestakedOptimized ( name_, tokenAddress_, stakingStarts_, stakingEnds_, withdrawStarts_, withdrawEnds_, stakingCap_ ) public { require(rewardTokenAddress_ != address(0), "Festaking: 0 reward address"); rewardTokenAddress = rewardTokenAddress_; rewardSetter = msg.sender; } function addMarginalReward(uint256 withdrawableAmount) external { require(msg.sender == rewardSetter, "Festaking: Not allowed"); rewardState.earlyWithdrawReward = withdrawableAmount; FestakedLib.addMarginalReward(rewardTokenAddress, tokenAddress, address(this), stakedBalance(), rewardState); } function withdraw(uint256 amount) virtual public returns (bool) { return FestakedLib.withdraw( msg.sender, tokenAddress, rewardTokenAddress, amount, withdrawStarts, withdrawEnds, stakingEnds, stakeState, rewardState); } }
pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; library SafeAmount { using SafeMath for uint256; using SafeERC20 for IERC20; function safeTransferFrom( address token, address from, address to, uint256 amount) internal returns (uint256) { uint256 preBalance = IERC20(token).balanceOf(to); IERC20(token).transferFrom(from, to, amount); uint256 postBalance = IERC20(token).balanceOf(to); return postBalance.sub(preBalance); } }
pragma solidity >=0.6.0 <0.8.0; import "../common/SafeAmount.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; library FestakedLib { using SafeMath for uint256; using SafeERC20 for IERC20; event Staked(address indexed token, address indexed staker_, uint256 requestedAmount_, uint256 stakedAmount_); event PaidOut(address indexed token, address indexed rewardToken, address indexed staker_, uint256 amount_, uint256 reward_); struct FestakeState { uint256 stakedTotal; uint256 stakingCap; uint256 stakedBalance; uint256 withdrawnEarly; mapping(address => uint256) _stakes; } struct FestakeRewardState { uint256 rewardBalance; uint256 rewardsTotal; uint256 earlyWithdrawReward; } function VERSION() external pure returns(uint) { return 1001; } function tryStake(address payer, address staker, uint256 amount, uint256 stakingStarts, uint256 stakingEnds, uint256 stakingCap, address tokenAddress, FestakeState storage state ) public _after(stakingStarts) _before(stakingEnds) _positive(amount) returns (uint256) { // check the remaining amount to be staked // For pay per transfer tokens we limit the cap on incoming tokens for simplicity. This might // mean that cap may not necessary fill completely which is ok. uint256 remaining = amount; // uint256 stakedTotal = state.stakedTotal; { uint256 stakedBalance = state.stakedBalance; if (stakingCap > 0 && remaining > (stakingCap.sub(stakedBalance))) { remaining = stakingCap.sub(stakedBalance); } } // These requires are not necessary, because it will never happen, but won't hurt to double check // this is because stakedTotal and stakedBalance are only modified in this method during the staking period require(remaining > 0, "Festaking: Staking cap is filled"); // require((remaining + stakedTotal) <= stakingCap, "Festaking: this will increase staking amount pass the cap"); // Update remaining in case actual amount paid was different. remaining = _payMe(payer, remaining, tokenAddress); emit Staked(tokenAddress, staker, amount, remaining); // Transfer is completed return remaining; } function stake(address payer, address staker, uint256 amount, uint256 stakingStarts, uint256 stakingEnds, uint256 stakingCap, address tokenAddress, FestakeState storage state ) external returns (bool) { uint256 remaining = tryStake(payer, staker, amount, stakingStarts, stakingEnds, stakingCap, tokenAddress, state); // Transfer is completed state.stakedBalance = state.stakedBalance.add(remaining); state.stakedTotal = state.stakedTotal.add(remaining); state._stakes[staker] = state._stakes[staker].add(remaining); return true; } function addReward( uint256 rewardAmount, uint256 withdrawableAmount, address rewardTokenAddress, FestakeRewardState storage state ) external returns (bool) { require(rewardAmount > 0, "Festaking: reward must be positive"); require(withdrawableAmount >= 0, "Festaking: withdrawable amount cannot be negative"); require(withdrawableAmount <= rewardAmount, "Festaking: withdrawable amount must be less than or equal to the reward amount"); address from = msg.sender; rewardAmount = _payMe(from, rewardAmount, rewardTokenAddress); state.rewardsTotal = state.rewardsTotal.add(rewardAmount); state.rewardBalance = state.rewardBalance.add(rewardAmount); state.earlyWithdrawReward = state.earlyWithdrawReward.add(withdrawableAmount); return true; } function addMarginalReward( address rewardTokenAddress, address tokenAddress, address me, uint256 stakedBalance, FestakeRewardState storage state) external returns (bool) { uint256 amount = IERC20(rewardTokenAddress).balanceOf(me).sub(state.rewardsTotal); if (rewardTokenAddress == tokenAddress) { amount = amount.sub(stakedBalance); } if (amount == 0) { return true; // No reward to add. Its ok. No need to fail callers. } state.rewardsTotal = state.rewardsTotal.add(amount); state.rewardBalance = state.rewardBalance.add(amount); return true; } function tryWithdraw( address from, address tokenAddress, address rewardTokenAddress, uint256 amount, uint256 withdrawStarts, uint256 withdrawEnds, uint256 stakingEnds, FestakeState storage state, FestakeRewardState storage rewardState ) public _after(withdrawStarts) _positive(amount) _realAddress(msg.sender) returns (uint256) { require(amount <= state._stakes[from], "Festaking: not enough balance"); if (now < withdrawEnds) { return _withdrawEarly(tokenAddress, rewardTokenAddress, from, amount, withdrawEnds, stakingEnds, state, rewardState); } else { return _withdrawAfterClose(tokenAddress, rewardTokenAddress, from, amount, state, rewardState); } } function withdraw( address from, address tokenAddress, address rewardTokenAddress, uint256 amount, uint256 withdrawStarts, uint256 withdrawEnds, uint256 stakingEnds, FestakeState storage state, FestakeRewardState storage rewardState ) public returns (bool) { uint256 wdAmount = tryWithdraw(from, tokenAddress, rewardTokenAddress, amount, withdrawStarts, withdrawEnds, stakingEnds, state, rewardState); state.stakedBalance = state.stakedBalance.sub(wdAmount); state._stakes[from] = state._stakes[from].sub(wdAmount); return true; } function _withdrawEarly( address tokenAddress, address rewardTokenAddress, address from, uint256 amount, uint256 withdrawEnds, uint256 stakingEnds, FestakeState storage state, FestakeRewardState storage rewardState ) private _realAddress(from) returns (uint256) { // This is the formula to calculate reward: // r = (earlyWithdrawReward / stakedTotal) * (now - stakingEnds) / (withdrawEnds - stakingEnds) // w = (1+r) * a uint256 denom = (withdrawEnds.sub(stakingEnds)).mul(state.stakedTotal); uint256 reward = ( ( (now.sub(stakingEnds)).mul(rewardState.earlyWithdrawReward) ).mul(amount) ).div(denom); rewardState.rewardBalance = rewardState.rewardBalance.sub(reward); bool principalPaid = _payDirect(from, amount, tokenAddress); bool rewardPaid = _payDirect(from, reward, rewardTokenAddress); require(principalPaid && rewardPaid, "Festaking: error paying"); emit PaidOut(tokenAddress, rewardTokenAddress, from, amount, reward); return amount; } function _withdrawAfterClose( address tokenAddress, address rewardTokenAddress, address from, uint256 amount, FestakeState storage state, FestakeRewardState storage rewardState ) private _realAddress(from) returns (uint256) { uint256 rewBal = rewardState.rewardBalance; uint256 reward = (rewBal.mul(amount)).div(state.stakedBalance); rewardState.rewardBalance = rewBal.sub(reward); bool principalPaid = _payDirect(from, amount, tokenAddress); bool rewardPaid = _payDirect(from, reward, rewardTokenAddress); require(principalPaid && rewardPaid, "Festaking: error paying"); emit PaidOut(tokenAddress, rewardTokenAddress, from, amount, reward); return amount; } function _payMe(address payer, uint256 amount, address token) internal returns (uint256) { return _payTo(payer, address(this), amount, token); } function _payTo(address allower, address receiver, uint256 amount, address token) internal returns (uint256) { // Request to transfer amount from the contract to receiver. // contract does not own the funds, so the allower must have added allowance to the contract // Allower is the original owner. return SafeAmount.safeTransferFrom(token, allower, receiver, amount); } function _payDirect(address to, uint256 amount, address token) private returns (bool) { if (amount == 0) { return true; } IERC20(token).safeTransfer(to, amount); return true; } modifier _realAddress(address addr) { require(addr != address(0), "Festaking: zero address"); _; } modifier _positive(uint256 amount) { require(amount != 0, "Festaking: negative amount"); _; } modifier _after(uint eventTime) { require(now >= eventTime, "Festaking: bad timing for the request"); _; } modifier _before(uint eventTime) { require(now < eventTime, "Festaking: bad timing for the request"); _; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IFestaked.sol"; import "./Festaked.Library.sol"; /** * A staking contract distributes rewards. * One can create several TraditionalFestaking over one * staking and give different rewards for a single * staking contract. */ contract FestakedOptimized is IFestaked { mapping (address => uint256) internal _stakes; string private _name; address public override tokenAddress; uint public override stakingStarts; uint public override stakingEnds; uint public withdrawStarts; uint public withdrawEnds; uint public stakingCap; FestakedLib.FestakeState public stakeState; uint constant LIB_VERSION = 1001; /** * Fixed periods. For an open ended contract use end dates from very distant future. */ constructor ( string memory name_, address tokenAddress_, uint stakingStarts_, uint stakingEnds_, uint withdrawStarts_, uint withdrawEnds_, uint256 stakingCap_) public { require(FestakedLib.VERSION() == LIB_VERSION, "Bad linked library version"); _name = name_; require(tokenAddress_ != address(0), "Festaking: 0 address"); tokenAddress = tokenAddress_; require(stakingStarts_ > 0, "Festaking: zero staking start time"); if (stakingStarts_ < now) { stakingStarts = now; } else { stakingStarts = stakingStarts_; } require(stakingEnds_ >= stakingStarts, "Festaking: staking end must be after staking starts"); stakingEnds = stakingEnds_; require(withdrawStarts_ >= stakingEnds, "Festaking: withdrawStarts must be after staking ends"); withdrawStarts = withdrawStarts_; require(withdrawEnds_ >= withdrawStarts, "Festaking: withdrawEnds must be after withdraw starts"); withdrawEnds = withdrawEnds_; require(stakingCap_ >= 0, "Festaking: stakingCap cannot be negative"); stakingCap = stakingCap_; } function name() external view returns (string memory) { return _name; } function stakedTotal() external override view returns (uint256) { return stakeState.stakedTotal; } function stakedBalance() public override view returns (uint256) { return stakeState.stakedBalance; } function stakeOf(address account) external override view returns (uint256) { return stakeState._stakes[account]; } function stakeFor(address staker, uint256 amount) external override returns (bool) { return _stake(msg.sender, staker, amount); } /** * Requirements: * - `amount` Amount to be staked */ function stake(uint256 amount) external override returns (bool) { address from = msg.sender; return _stake(from, from, amount); } function _stake(address payer, address staker, uint256 amount) internal virtual returns (bool) { return FestakedLib.stake(payer, staker, amount, stakingStarts, stakingEnds, stakingCap, tokenAddress, stakeState); } }
pragma solidity >=0.6.0 <0.8.0; /** * @dev Ferrum Staking interface */ interface IFestaked { event Staked(address indexed token, address indexed staker_, uint256 requestedAmount_, uint256 stakedAmount_); event PaidOut(address indexed token, address indexed rewardToken, address indexed staker_, uint256 amount_, uint256 reward_); function stake (uint256 amount) external returns (bool); function stakeFor (address staker, uint256 amount) external returns (bool); function stakeOf(address account) external view returns (uint256); function tokenAddress() external view returns (address); function stakedTotal() external view returns (uint256); function stakedBalance() external view returns (uint256); function stakingStarts() external view returns (uint256); function stakingEnds() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ 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)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length 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)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ 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"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ 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"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
{ "remappings": [], "optimizer": { "enabled": false, "runs": 200 }, "evmVersion": "istanbul", "libraries": { "/home/naiemk/nk/open-staking_/contracts/staking/Festaked.Library.sol": { "FestakedLib": "0xbce3Ed9c430DDC9d695BCca825a5e20aD08009dd" } }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"address","name":"tokenAddress_","type":"address"},{"internalType":"address","name":"rewardTokenAddress_","type":"address"},{"internalType":"uint256","name":"stakingStarts_","type":"uint256"},{"internalType":"uint256","name":"stakingEnds_","type":"uint256"},{"internalType":"uint256","name":"withdrawStarts_","type":"uint256"},{"internalType":"uint256","name":"withdrawEnds_","type":"uint256"},{"internalType":"uint256","name":"stakingCap_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":true,"internalType":"address","name":"staker_","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount_","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reward_","type":"uint256"}],"name":"PaidOut","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"staker_","type":"address"},{"indexed":false,"internalType":"uint256","name":"requestedAmount_","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stakedAmount_","type":"uint256"}],"name":"Staked","type":"event"},{"inputs":[{"internalType":"uint256","name":"withdrawableAmount","type":"uint256"}],"name":"addMarginalReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"uint256","name":"withdrawableAmount","type":"uint256"}],"name":"addReward","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"earlyWithdrawReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardSetter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardState","outputs":[{"internalType":"uint256","name":"rewardBalance","type":"uint256"},{"internalType":"uint256","name":"rewardsTotal","type":"uint256"},{"internalType":"uint256","name":"earlyWithdrawReward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakeFor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"stakeOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakeState","outputs":[{"internalType":"uint256","name":"stakedTotal","type":"uint256"},{"internalType":"uint256","name":"stakingCap","type":"uint256"},{"internalType":"uint256","name":"stakedBalance","type":"uint256"},{"internalType":"uint256","name":"withdrawnEarly","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakedBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakedTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingEnds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingStarts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawEnds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawStarts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101425760003560e01c806361539de7116100b8578063a694fc3a1161007c578063a694fc3a1461051f578063aa5c3ab414610565578063b410e2a114610583578063bb2d7f3a146105a1578063d66692a7146105bf578063eacebf61146105dd57610142565b806361539de7146103ea5780636d68c7d41461043457806375c93bb9146104525780638c09a2f9146104a25780639d76ea58146104d557610142565b80632ee409081161010a5780632ee40908146102a65780633f7fd60a1461030c578063426233601461032a57806344c370d314610382578063582c7928146103a05780635b9f0016146103cc57610142565b806306fdde0314610147578063125f9e33146101ca57806321b13cdf146102145780632853c542146102325780632e1a7d4d14610260575b600080fd5b61014f6105fb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018f578082015181840152602081019050610174565b50505050905090810190601f1680156101bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d261069d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61021c6106c3565b6040518082815260200191505060405180910390f35b61025e6004803603602081101561024857600080fd5b81019080803590602001909291905050506106c9565b005b61028c6004803603602081101561027657600080fd5b8101908080359060200190929190505050610914565b604051808215151515815260200191505060405180910390f35b6102f2600480360360408110156102bc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ab7565b604051808215151515815260200191505060405180910390f35b610314610acc565b6040518082815260200191505060405180910390f35b61036c6004803603602081101561034057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ad9565b6040518082815260200191505060405180910390f35b61038a610b25565b6040518082815260200191505060405180910390f35b6103a8610b2b565b60405180848152602001838152602001828152602001935050505060405180910390f35b6103d4610b43565b6040518082815260200191505060405180910390f35b6103f2610b50565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61043c610b76565b6040518082815260200191505060405180910390f35b6104886004803603604081101561046857600080fd5b810190808035906020019092919080359060200190929190505050610b7c565b604051808215151515815260200191505060405180910390f35b6104aa610c77565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b6104dd610c95565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61054b6004803603602081101561053557600080fd5b8101908080359060200190929190505050610cbb565b604051808215151515815260200191505060405180910390f35b61056d610cd4565b6040518082815260200191505060405180910390f35b61058b610ce1565b6040518082815260200191505060405180910390f35b6105a9610ce7565b6040518082815260200191505060405180910390f35b6105c7610cf4565b6040518082815260200191505060405180910390f35b6105e5610d01565b6040518082815260200191505060405180910390f35b606060018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106935780601f1061066857610100808354040283529160200191610693565b820191906000526020600020905b81548152906001019060200180831161067657829003601f168201915b5050505050905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461078c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f46657374616b696e673a204e6f7420616c6c6f7765640000000000000000000081525060200191505060405180910390fd5b80600e6002018190555073bce3ed9c430ddc9d695bcca825a5e20ad08009dd633362c3cd600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16306107ff610b43565b600e6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019550505050505060206040518083038186803b1580156108d557600080fd5b505af41580156108e9573d6000803e3d6000fd5b505050506040513d60208110156108ff57600080fd5b81019080805190602001909291905050505050565b600073bce3ed9c430ddc9d695bcca825a5e20ad08009dd63f3ec689233600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866005546006546004546008600e6040518a63ffffffff1660e01b8152600401808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001878152602001868152602001858152602001848152602001838152602001828152602001995050505050505050505060206040518083038186803b158015610a7557600080fd5b505af4158015610a89573d6000803e3d6000fd5b505050506040513d6020811015610a9f57600080fd5b81019080805190602001909291905050509050919050565b6000610ac4338484610d07565b905092915050565b6000600e60020154905090565b6000600860040160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60075481565b600e8060000154908060010154908060020154905083565b6000600860020154905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60035481565b600073bce3ed9c430ddc9d695bcca825a5e20ad08009dd6356fb23a98484600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600e6040518563ffffffff1660e01b8152600401808581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200194505050505060206040518083038186803b158015610c3457600080fd5b505af4158015610c48573d6000803e3d6000fd5b505050506040513d6020811015610c5e57600080fd5b8101908080519060200190929190505050905092915050565b60088060000154908060010154908060020154908060030154905084565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080339050610ccc818285610d07565b915050919050565b6000600e60000154905090565b60045481565b6000600e60010154905090565b6000600860000154905090565b60065481565b600073bce3ed9c430ddc9d695bcca825a5e20ad08009dd6314b6043e858585600354600454600754600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660086040518963ffffffff1660e01b8152600401808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019850505050505050505060206040518083038186803b158015610e3d57600080fd5b505af4158015610e51573d6000803e3d6000fd5b505050506040513d6020811015610e6757600080fd5b81019080805190602001909291905050509050939250505056fea264697066735822122072419711e15df548eb6147b6d7acd1aabb7a50156737b1c736e92092aeb3e7ab64736f6c63430006060033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 100.00% | $0.005674 | 140,383.7419 | $796.58 |
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.