Contract Address Details

0x80f2cF7059336b44a75F00451B81f8d742DD2b94

Contract Name
SwapRewardsChef
Creator
0xfbe420–98b5e1 at 0xa0ddd0–c6eb67
Balance
0 ELA
Tokens
Fetching tokens...
Transactions
Transfers
Gas Used
Last Balance Update
29406430
Contract name:
SwapRewardsChef




Optimization enabled
true
Compiler version
v0.6.12+commit.27d51765




Optimization runs
999999
EVM Version
constantinople




Verified at
2021-10-23 17:53:45.975439Z

Contract source code

// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.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;
}
}
// File: @openzeppelin/contracts/math/Math.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity >=0.6.0 <0.8.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);
}
// File: @openzeppelin/contracts/utils/Address.sol
pragma solidity >=0.6.2 <0.8.0;
/**
* @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 on 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");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(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 {
// 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);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @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");
}
}
}
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: @openzeppelin/contracts/utils/ReentrancyGuard.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor () internal {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
// File: contracts/Dividends/interfaces/IWrappedNative.sol
pragma solidity =0.6.12;
interface IWrappedNative is IERC20 {
function deposit() external payable;
function withdraw(uint256 wad) external;
}
// File: contracts/Dividends/SwapRewardsChef.sol
pragma solidity 0.6.12;
contract SwapRewardsChef is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount;
uint256 rewardDebt;
}
// Info of each pool.
struct PoolInfo {
IERC20 lpToken; // Address of LP token contract.
uint256 allocPoint; // How many allocation points assigned to this pool.
uint256 lastRewardBlock; // Last block number that reward distribution occurs.
uint256 accRewardPerShare; // Accumulated reward per share, times 1e18. See below.
uint256 currentDepositAmount; // Current total deposit amount in this pool
}
address public wrappedNativeAddress;
// The reward token
IERC20 public rewardToken;
// Reward tokens created per block.
uint256 public rewardsPerBlock;
// Emission Settings
uint256 public denominationEmitAmount = 403200; //Blocks
uint256 public minimumEmitAmount = 0; //Min Output Per Block
uint256 public maximumEmitAmount = 1 ether; //Max Output Per Block
// Info of each pool.
PoolInfo[] public poolInfo;
// Info of each user that stakes LP tokens.
mapping(address => UserInfo) public userInfo;
// Total allocation points. Must be the sum of all allocation points in all pools.
uint256 public totalAllocPoint = 0;
// The block number when mining starts.
uint256 public startBlock;
uint256 public remainingRewards = 0;
event Harvest(address indexed user, uint256 amount);
event Deposit(address indexed user, uint256 amount);
event Withdraw(address indexed user, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 amount);
event UpdateEmissionSettings(address indexed user, uint256 denomination, uint256 minimum, uint256 maximum, uint256 rewardsPerBlock);
event RescueTokens(address indexed user, address indexed token, uint256 amount);
constructor(IERC20 _stakeToken, IERC20 _rewardToken, address _wrappedNativeAddress) public {
rewardToken = _rewardToken;
poolInfo.push(PoolInfo({
lpToken : _stakeToken,
allocPoint : 100,
lastRewardBlock : startBlock,
accRewardPerShare : 0,
currentDepositAmount : 0
}));
wrappedNativeAddress = _wrappedNativeAddress;
totalAllocPoint = 100;
}
// Return reward multiplier over the given _from to _to block.
function getMultiplier(uint256 _from, uint256 _to) private pure returns (uint256) {
return _to.sub(_from);
}
// View function to see pending rewards on frontend.
function pendingRewards(address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[_user];
uint256 accRewardPerShare = pool.accRewardPerShare;
uint256 lpSupply = pool.currentDepositAmount;
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
//calculate total rewards based on remaining funds
if (remainingRewards > 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 totalRewards = multiplier.mul(rewardsPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
totalRewards = Math.min(totalRewards, remainingRewards);
accRewardPerShare = accRewardPerShare.add(totalRewards.mul(1e18).div(lpSupply));
}
}
return user.amount.mul(accRewardPerShare).div(1e18).sub(user.rewardDebt);
}
// Update reward variables of the given pool to be up-to-date.
function updatePool() public {
PoolInfo storage pool = poolInfo[0];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.currentDepositAmount;
if (lpSupply == 0 || pool.allocPoint == 0) {
pool.lastRewardBlock = block.number;
return;
}
if (remainingRewards == 0) {
pool.lastRewardBlock = block.number;
return;
}
//calculate total rewards based on remaining funds
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 totalRewards = multiplier.mul(rewardsPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
totalRewards = Math.min(totalRewards, remainingRewards);
remainingRewards = remainingRewards.sub(totalRewards);
pool.accRewardPerShare = pool.accRewardPerShare.add(totalRewards.mul(1e18).div(lpSupply));
pool.lastRewardBlock = block.number;
}
function income(uint256 _amount) external nonReentrant {
updatePool();
rewardToken.safeTransferFrom(msg.sender, address(this), _amount);
remainingRewards = remainingRewards.add(_amount);
updateEmissionRate();
}
function updateEmissionRate() private {
if (remainingRewards > 0) {
rewardsPerBlock = remainingRewards.div(denominationEmitAmount);
rewardsPerBlock = Math.min(maximumEmitAmount, rewardsPerBlock);
rewardsPerBlock = Math.max(minimumEmitAmount, rewardsPerBlock);
} else {
rewardsPerBlock = 0;
}
}
// Deposit LP tokens to Chef
function deposit(uint256 _amount) public nonReentrant {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[msg.sender];
updatePool();
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accRewardPerShare).div(1e18).sub(user.rewardDebt);
if (pending > 0) {
safeRewardTransfer(msg.sender, pending);
emit Harvest(msg.sender, pending);
}
}
if (_amount > 0) {
pool.lpToken.safeTransferFrom(msg.sender, address(this), _amount);
user.amount = user.amount.add(_amount);
pool.currentDepositAmount = pool.currentDepositAmount.add(_amount);
}
user.rewardDebt = user.amount.mul(pool.accRewardPerShare).div(1e18);
emit Deposit(msg.sender, _amount);
}
// Withdraw LP tokens from Chef.
function withdraw(uint256 _amount) public nonReentrant {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool();
uint256 pending = user.amount.mul(pool.accRewardPerShare).div(1e18).sub(user.rewardDebt);
if (pending > 0) {
safeRewardTransfer(msg.sender, pending);
emit Harvest(msg.sender, pending);
}
if (_amount > 0) {
user.amount = user.amount.sub(_amount);
pool.currentDepositAmount = pool.currentDepositAmount.sub(_amount);
pool.lpToken.safeTransfer(msg.sender, _amount);
}
user.rewardDebt = user.amount.mul(pool.accRewardPerShare).div(1e18);
emit Withdraw(msg.sender, _amount);
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw() public nonReentrant {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[msg.sender];
uint256 amount = user.amount;
user.amount = 0;
user.rewardDebt = 0;
pool.currentDepositAmount = pool.currentDepositAmount.sub(amount);
pool.lpToken.safeTransfer(msg.sender, amount);
emit EmergencyWithdraw(msg.sender, amount);
}
// Safe rewards transfer function, just in case if rounding error causes pool to not have enough tokens.
function safeRewardTransfer(address _to, uint256 _amount) internal {
uint256 balance = rewardToken.balanceOf(address(this));
uint256 transferAmount = Math.min(balance, _amount);
if (address(rewardToken) == wrappedNativeAddress) {
//If the reward token is a wrapped native token, we will unwrap it and send native
IWrappedNative(wrappedNativeAddress).withdraw(transferAmount);
safeTransferETH(_to, transferAmount);
} else {
bool transferSuccess = rewardToken.transfer(_to, transferAmount);
require(transferSuccess, "safeRewardTransfer: transfer failed");
}
}
//For unwrapping native tokens
receive() external payable {
}
function safeTransferETH(address to, uint value) internal {
(bool success,) = to.call{value : value}(new bytes(0));
require(success, 'safeTransferETH: ETH_TRANSFER_FAILED');
}
function updateEmissionSettings(uint256 denomination, uint256 minimum, uint256 maximum) external onlyOwner {
updatePool();
denominationEmitAmount = denomination;
minimumEmitAmount = minimum;
maximumEmitAmount = maximum;
updateEmissionRate();
emit UpdateEmissionSettings(msg.sender, denomination, minimum, maximum, rewardsPerBlock);
}
//New function to trigger harvest for a specific user and pool
//A specific user address is provided to facilitate aggregating harvests on multiple chefs
//Also, it is harmless monetary-wise to help someone else harvests
function harvestFor(address _user) public nonReentrant {
//Limit to self or delegated harvest to avoid unnecessary confusion
require(msg.sender == _user || tx.origin == _user, "harvestFor: FORBIDDEN");
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[_user];
updatePool();
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accRewardPerShare).div(1e18).sub(user.rewardDebt);
if (pending > 0) {
safeRewardTransfer(_user, pending);
user.rewardDebt = user.amount.mul(pool.accRewardPerShare).div(1e18);
emit Harvest(_user, pending);
}
}
}
function rescueToken(address token, address addressForReceive) external onlyOwner {
uint256 balance = IERC20(token).balanceOf(address(this));
IERC20(token).safeTransfer(addressForReceive, balance);
emit RescueTokens(msg.sender, token, balance);
}
}

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_stakeToken","internalType":"contract IERC20"},{"type":"address","name":"_rewardToken","internalType":"contract IERC20"},{"type":"address","name":"_wrappedNativeAddress","internalType":"address"}]},{"type":"event","name":"Deposit","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"EmergencyWithdraw","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Harvest","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RescueTokens","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"UpdateEmissionSettings","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"denomination","internalType":"uint256","indexed":false},{"type":"uint256","name":"minimum","internalType":"uint256","indexed":false},{"type":"uint256","name":"maximum","internalType":"uint256","indexed":false},{"type":"uint256","name":"rewardsPerBlock","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Withdraw","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"denominationEmitAmount","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deposit","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyWithdraw","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"harvestFor","inputs":[{"type":"address","name":"_user","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"income","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maximumEmitAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minimumEmitAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"pendingRewards","inputs":[{"type":"address","name":"_user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"lpToken","internalType":"contract IERC20"},{"type":"uint256","name":"allocPoint","internalType":"uint256"},{"type":"uint256","name":"lastRewardBlock","internalType":"uint256"},{"type":"uint256","name":"accRewardPerShare","internalType":"uint256"},{"type":"uint256","name":"currentDepositAmount","internalType":"uint256"}],"name":"poolInfo","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"remainingRewards","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"rescueToken","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"addressForReceive","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"rewardToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardsPerBlock","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"startBlock","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalAllocPoint","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateEmissionSettings","inputs":[{"type":"uint256","name":"denomination","internalType":"uint256"},{"type":"uint256","name":"minimum","internalType":"uint256"},{"type":"uint256","name":"maximum","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updatePool","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"rewardDebt","internalType":"uint256"}],"name":"userInfo","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"wrappedNativeAddress","inputs":[]},{"type":"receive","stateMutability":"payable"}]
            

Deployed ByteCode

0x6080604052600436106101845760003560e01c806384ed8c56116100d6578063dd5998441161007f578063f2fde38b11610059578063f2fde38b146104ca578063f7c618c11461050a578063fbe1ebec1461051f5761018b565b8063dd5998441461046a578063e3161ddd1461047f578063eebf65f3146104945761018b565b8063afb62e56116100b0578063afb62e5614610416578063b6b55f251461042b578063db2e21bc146104555761018b565b806384ed8c56146103c25780638b1c0d1b146103ec5780638da5cb5b146104015761018b565b806346f0cfba116101385780635eeb6710116101125780635eeb67101461035a578063715018a61461036f57806376ab8136146103845761018b565b806346f0cfba146102e85780634707d000146102fd57806348cd4cb1146103455761018b565b80631959a002116101695780631959a002146102235780632e1a7d4d1461027c57806331d7a262146102a85761018b565b80631526fe271461019057806317caf6f1146101fc5761018b565b3661018b57005b600080fd5b34801561019c57600080fd5b506101ba600480360360208110156101b357600080fd5b503561055f565b6040805173ffffffffffffffffffffffffffffffffffffffff909616865260208601949094528484019290925260608401526080830152519081900360a00190f35b34801561020857600080fd5b506102116105b4565b60408051918252519081900360200190f35b34801561022f57600080fd5b506102636004803603602081101561024657600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166105ba565b6040805192835260208301919091528051918290030190f35b34801561028857600080fd5b506102a66004803603602081101561029f57600080fd5b50356105d3565b005b3480156102b457600080fd5b50610211600480360360208110156102cb57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661082a565b3480156102f457600080fd5b50610211610946565b34801561030957600080fd5b506102a66004803603604081101561032057600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602001351661094c565b34801561035157600080fd5b50610211610ae7565b34801561036657600080fd5b50610211610aed565b34801561037b57600080fd5b506102a6610af3565b34801561039057600080fd5b50610399610bf3565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156103ce57600080fd5b506102a6600480360360208110156103e557600080fd5b5035610c0f565b3480156103f857600080fd5b50610211610cd2565b34801561040d57600080fd5b50610399610cd8565b34801561042257600080fd5b50610211610cf4565b34801561043757600080fd5b506102a66004803603602081101561044e57600080fd5b5035610cfa565b34801561046157600080fd5b506102a6610edf565b34801561047657600080fd5b5061021161100f565b34801561048b57600080fd5b506102a6611015565b3480156104a057600080fd5b506102a6600480360360608110156104b757600080fd5b5080359060208101359060400135611111565b3480156104d657600080fd5b506102a6600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611213565b34801561051657600080fd5b5061039961139d565b34801561052b57600080fd5b506102a66004803603602081101561054257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113b9565b6008818154811061056c57fe5b60009182526020909120600590910201805460018201546002830154600384015460049094015473ffffffffffffffffffffffffffffffffffffffff90931694509092909185565b600a5481565b6009602052600090815260409020805460019091015482565b6002600154141561064557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026001819055506000600860008154811061065d57fe5b60009182526020808320338452600990915260409092208054600590920290920192508311156106ee57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f77697468647261773a206e6f7420676f6f640000000000000000000000000000604482015290519081900360640190fd5b6106f6611015565b6000610733826001015461072d670de0b6b3a7640000610727876003015487600001546115e890919063ffffffff16565b90611664565b906116a6565b9050801561077c5761074533826116e8565b60408051828152905133917fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba919081900360200190a25b83156107c757815461078e90856116a6565b8255600483015461079f90856116a6565b600484015582546107c79073ffffffffffffffffffffffffffffffffffffffff163386611961565b600383015482546107e591670de0b6b3a764000091610727916115e8565b600183015560408051858152905133917f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364919081900360200190a25050600180555050565b600080600860008154811061083b57fe5b6000918252602080832073ffffffffffffffffffffffffffffffffffffffff871684526009909152604090922060036005909202909201908101546004820154600283015492945090914311801561089257508015155b1561091157600c54156109115760006108af8560020154436119f3565b905060006108dc600a5461072788600101546108d6600454876115e890919063ffffffff16565b906115e8565b90506108ea81600c546119ff565b905061090c6109058461072784670de0b6b3a76400006115e8565b8590611a15565b935050505b61093c836001015461072d670de0b6b3a76400006107278688600001546115e890919063ffffffff16565b9695505050505050565b60055481565b610954611a89565b60005473ffffffffffffffffffffffffffffffffffffffff9081169116146109dd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610a4657600080fd5b505afa158015610a5a573d6000803e3d6000fd5b505050506040513d6020811015610a7057600080fd5b50519050610a9573ffffffffffffffffffffffffffffffffffffffff84168383611961565b60408051828152905173ffffffffffffffffffffffffffffffffffffffff85169133917f0de377c3f3362540c047602ad996510f81ec5d84f9ad151c7b6ebecce8ea6b7b9181900360200190a3505050565b600b5481565b60045481565b610afb611a89565b60005473ffffffffffffffffffffffffffffffffffffffff908116911614610b8457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b60026001541415610c8157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600155610c8e611015565b600354610cb39073ffffffffffffffffffffffffffffffffffffffff16333084611a8d565b600c54610cc09082611a15565b600c55610ccb611b22565b5060018055565b60075481565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b600c5481565b60026001541415610d6c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260018190555060006008600081548110610d8457fe5b600091825260208083203384526009909152604090922060059091029091019150610dad611015565b805415610e30576000610de5826001015461072d670de0b6b3a7640000610727876003015487600001546115e890919063ffffffff16565b90508015610e2e57610df733826116e8565b60408051828152905133917fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba919081900360200190a25b505b8215610e7d578154610e5a9073ffffffffffffffffffffffffffffffffffffffff16333086611a8d565b8054610e669084611a15565b81556004820154610e779084611a15565b60048301555b60038201548154610e9b91670de0b6b3a764000091610727916115e8565b600182015560408051848152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a250506001805550565b60026001541415610f5157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260018190555060006008600081548110610f6957fe5b6000918252602080832033845260099091526040832080548482556001820194909455600592909202016004810154909350909190610fa890826116a6565b60048401558254610fd09073ffffffffffffffffffffffffffffffffffffffff163383611961565b60408051828152905133917f5fafa99d0643513820be26656b45130b01e1c03062e1266bf36f88cbd3bd9695919081900360200190a250506001805550565b60065481565b6000600860008154811061102557fe5b9060005260206000209060050201905080600201544311611046575061110f565b600481015480158061105a57506001820154155b1561106c57504360029091015561110f565b600c5461108057504360029091015561110f565b60006110908360020154436119f3565b905060006110b7600a5461072786600101546108d6600454876115e890919063ffffffff16565b90506110c581600c546119ff565b600c549091506110d590826116a6565b600c556110fc6110f18461072784670de0b6b3a76400006115e8565b600386015490611a15565b6003850155505043600290920191909155505b565b611119611a89565b60005473ffffffffffffffffffffffffffffffffffffffff9081169116146111a257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6111aa611015565b6005839055600682905560078190556111c1611b22565b600454604080518581526020810185905280820184905260608101929092525133917fa2ccc6b6183e466f6e7b59cc83e6a4a0fd8a4adab25b95ac0fcb805b963ea0f3919081900360800190a2505050565b61121b611a89565b60005473ffffffffffffffffffffffffffffffffffffffff9081169116146112a457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116611310576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806121396026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b6002600154141561142b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026001553373ffffffffffffffffffffffffffffffffffffffff8216148061146957503273ffffffffffffffffffffffffffffffffffffffff8216145b6114d457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f68617276657374466f723a20464f5242494444454e0000000000000000000000604482015290519081900360640190fd5b600060086000815481106114e457fe5b6000918252602080832073ffffffffffffffffffffffffffffffffffffffff861684526009909152604090922060059091029091019150611523611015565b8054156115df57600061155b826001015461072d670de0b6b3a7640000610727876003015487600001546115e890919063ffffffff16565b905080156115dd5761156d84826116e8565b6003830154825461158b91670de0b6b3a764000091610727916115e8565b600183015560408051828152905173ffffffffffffffffffffffffffffffffffffffff8616917fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba919081900360200190a25b505b50506001805550565b6000826115f75750600061165e565b8282028284828161160457fe5b041461165b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806121a96021913960400191505060405180910390fd5b90505b92915050565b600061165b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b6a565b600061165b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c28565b600354604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905160009273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b15801561175957600080fd5b505afa15801561176d573d6000803e3d6000fd5b505050506040513d602081101561178357600080fd5b50519050600061179382846119ff565b60025460035491925073ffffffffffffffffffffffffffffffffffffffff9182169116141561185657600254604080517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815260048101849052905173ffffffffffffffffffffffffffffffffffffffff90921691632e1a7d4d9160248082019260009290919082900301818387803b15801561182f57600080fd5b505af1158015611843573d6000803e3d6000fd5b505050506118518482611c9c565b61195b565b600354604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018590529151600093929092169163a9059cbb9160448082019260209290919082900301818787803b1580156118d557600080fd5b505af11580156118e9573d6000803e3d6000fd5b505050506040513d60208110156118ff57600080fd5b5051905080611959576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806121166023913960400191505060405180910390fd5b505b50505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526119ee908490611dd4565b505050565b600061165b82846116a6565b6000818310611a0e578161165b565b5090919050565b60008282018381101561165b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b6040805173ffffffffffffffffffffffffffffffffffffffff80861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905261195b908590611dd4565b600c5415611b6357600554600c54611b3991611664565b6004819055600754611b4a916119ff565b6004819055600654611b5b91611eac565b60045561110f565b6000600455565b60008183611c10576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611bd5578181015183820152602001611bbd565b50505050905090810190601f168015611c025780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611c1c57fe5b049150505b9392505050565b60008184841115611c94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201818152835160248401528351909283926044909101919085019080838360008315611bd5578181015183820152602001611bbd565b505050900390565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff84169083906040518082805190602001908083835b60208310611d1357805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611cd6565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611d75576040519150601f19603f3d011682016040523d82523d6000602084013e611d7a565b606091505b50509050806119ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061215f6024913960400191505060405180910390fd5b6060611e36826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611ebc9092919063ffffffff16565b8051909150156119ee57808060200190516020811015611e5557600080fd5b50516119ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806121ca602a913960400191505060405180910390fd5b600081831015611a0e578161165b565b6060611ecb8484600085611ed3565b949350505050565b60603031831115611f2f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806121836026913960400191505060405180910390fd5b611f388561208f565b611fa357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b6020831061200d57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611fd0565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461206f576040519150601f19603f3d011682016040523d82523d6000602084013e612074565b606091505b5091509150612084828286612095565b979650505050505050565b3b151590565b606083156120a4575081611c21565b8251156120b45782518084602001fd5b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201818152845160248401528451859391928392604401919085019080838360008315611bd5578181015183820152602001611bbd56fe736166655265776172645472616e736665723a207472616e73666572206661696c65644f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373736166655472616e736665724554483a204554485f5452414e534645525f4641494c4544416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220cdf1ffa7e0e73eec65fac61702dbb3a3100c10734edaf065f75b18b9ba81106764736f6c634300060c0033