More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 1,068 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw | 17241691 | 572 days ago | IN | 0 ETH | 0.01292884 | ||||
Withdraw | 17011329 | 604 days ago | IN | 0 ETH | 0.00397375 | ||||
Withdraw | 17011298 | 604 days ago | IN | 0 ETH | 0.00367286 | ||||
Withdraw | 16947778 | 613 days ago | IN | 0 ETH | 0.00610668 | ||||
Withdraw | 16902580 | 619 days ago | IN | 0 ETH | 0.00228354 | ||||
Withdraw | 16887427 | 622 days ago | IN | 0 ETH | 0.00226217 | ||||
Withdraw | 16883256 | 622 days ago | IN | 0 ETH | 0.00292467 | ||||
Withdraw | 16883073 | 622 days ago | IN | 0 ETH | 0.00219922 | ||||
Withdraw | 16882728 | 622 days ago | IN | 0 ETH | 0.0024779 | ||||
Withdraw | 16762565 | 639 days ago | IN | 0 ETH | 0.00452894 | ||||
Withdraw | 16762560 | 639 days ago | IN | 0 ETH | 0.00410477 | ||||
Withdraw | 16762555 | 639 days ago | IN | 0 ETH | 0.00533305 | ||||
Withdraw | 16712763 | 646 days ago | IN | 0 ETH | 0.00359315 | ||||
Withdraw | 16634712 | 657 days ago | IN | 0 ETH | 0.00911311 | ||||
Withdraw | 16541122 | 670 days ago | IN | 0 ETH | 0.00332615 | ||||
Deposit | 16502826 | 676 days ago | IN | 0 ETH | 0.00221508 | ||||
Withdraw | 16502806 | 676 days ago | IN | 0 ETH | 0.00287608 | ||||
Withdraw | 16381316 | 692 days ago | IN | 0 ETH | 0.0027185 | ||||
Withdraw | 16380674 | 693 days ago | IN | 0 ETH | 0.00303363 | ||||
Withdraw | 16380615 | 693 days ago | IN | 0 ETH | 0.00327124 | ||||
Withdraw | 16079953 | 735 days ago | IN | 0 ETH | 0.00214116 | ||||
Deposit | 15857427 | 766 days ago | IN | 0 ETH | 0.00034375 | ||||
Deposit | 15857427 | 766 days ago | IN | 0 ETH | 0.00110836 | ||||
Deposit | 15857363 | 766 days ago | IN | 0 ETH | 0.00080737 | ||||
Withdraw | 15857341 | 766 days ago | IN | 0 ETH | 0.00173213 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
YFBTCMaster
Compiler Version
v0.6.12+commit.27d51765
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./YFBitcoin.sol"; import "./UniswapV2Pair.sol"; contract YFBTCMaster is Ownable { using SafeMath for *; 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 lastRewardBlock; uint256 accYfbtcPerShare; // Accumulated YFBTC per share, times 1e12. See below. uint256 totalSupply; } struct RewardInfo { uint256 startBlock; uint256 endBlock; uint256 rewardFrom; uint256 rewardTo; uint256 rewardPerBlock; } uint256 public lastPrice = 0; uint256 public constant PERIOD = 24 hours; uint256 public constant CHANGE_IN_PERCENTAGE = 5; // hold factory address that will be used to fetch pair address address public pairAddress; // block time of last update uint32 public blockTimestampLast; // The YFBTC TOKEN! YFBitcoin public yfbtc; // Info of each pool. PoolInfo[] public poolInfo; //info of reward pools RewardInfo[] public rewardInfo; // Info of each user that stakes LP tokens. mapping(uint256 => mapping(address => UserInfo)) public userInfo; // The block number when YFBTC mining starts. uint256 public startedBlock; event SetDevAddress(address indexed _devAddress); event SetTransferFee(uint256 _fee); event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdrawExceptional(address indexed user, uint256 amount); constructor( YFBitcoin _yfbtc, address _pairAddress, uint256 _startedBlock ) public { yfbtc = _yfbtc; pairAddress = _pairAddress; startedBlock = _startedBlock; (uint112 reserve0, uint112 reserve1, uint32 blockTime) = UniswapV2Pair(pairAddress).getReserves(); // gas savings blockTimestampLast = blockTime; lastPrice = reserve1; require(reserve0 != 0 && reserve1 != 0, "ORACLE: NO_RESERVES"); // ensure that there's liquidity in the pair addRewardSet(); } function currentBlockTimestamp() internal view returns (uint32) { return uint32(block.timestamp % 2**32); } function setDevAddress(address _devAddress) external onlyOwner { require(_devAddress != address(0x0), "zero address is not allowed"); yfbtc.setDevAddress(_devAddress); emit SetDevAddress(_devAddress); } function setTransferFee(uint256 _fee) external onlyOwner { require(_fee > 0 && _fee < 1000, "YFBTC: fee should be between 0 and 10"); yfbtc.setTransferFee(_fee); emit SetTransferFee(_fee); } function mint(address _to, uint256 _amount) public onlyOwner { yfbtc.mint(_to, _amount); } function burn(address _sender, uint256 _amount) public onlyOwner { yfbtc.burn(_sender, _amount); } function update() public returns (bool) { uint32 blockTimestamp = currentBlockTimestamp(); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired // ensure that at least one full period has passed since the last update if (timeElapsed >= PERIOD) { uint256 change = 0; (, uint112 _reserve1, ) = UniswapV2Pair(pairAddress).getReserves(); // gas savings uint256 currentPrice = _reserve1; if (lastPrice > currentPrice) { change = lastPrice.sub(currentPrice).mul(100).div(lastPrice); } if (change >= CHANGE_IN_PERCENTAGE) { return false; } else { lastPrice = currentPrice; blockTimestampLast = blockTimestamp; } } return true; } function updateOwnerShip(address newOwner) public onlyOwner { yfbtc.transferOwnership(newOwner); } function poolLength() external view returns (uint256) { return poolInfo.length; } // Add a new lp to the pool. Can only be called by the owner. // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. function add(IERC20 _lpToken) external onlyOwner { //EDIT commenting lastRewardBlock per pool (it is now common for all pools) //uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; require(address(_lpToken) != address(0), "MC: _lpToken should not be address zero"); for (uint256 i = 0; i < poolInfo.length; i++) { require(address(poolInfo[i].lpToken) != address(_lpToken), "MC: DO NOT add the same LP token more than once"); } uint256 lastRewardBlock = block.number > startedBlock ? block.number : startedBlock; poolInfo.push(PoolInfo({lpToken: _lpToken, accYfbtcPerShare: 0, lastRewardBlock: lastRewardBlock, totalSupply: 0})); } function addRewardSet() internal returns (uint256) { rewardInfo.push( RewardInfo({ startBlock: startedBlock, endBlock: startedBlock.add(172800), rewardFrom: 1900 * 10**18, rewardTo: 3150 * 10**18, rewardPerBlock: 17606095680000000 }) ); rewardInfo.push( RewardInfo({ startBlock: startedBlock.add(172800), endBlock: startedBlock.add(1036800), rewardFrom: 3150 * 10**18, rewardTo: 8960 * 10**18, rewardPerBlock: 8641975309000000 }) ); rewardInfo.push( RewardInfo({ startBlock: startedBlock.add(1036800), endBlock: startedBlock.add(2073600), rewardFrom: 8960 * 10**18, rewardTo: 16590 * 10**18, rewardPerBlock: 4320987654000000 }) ); rewardInfo.push( RewardInfo({ startBlock: startedBlock.add(2073600), endBlock: startedBlock.add(3110400), rewardFrom: 16590 * 10**18, rewardTo: 18830 * 10**18, rewardPerBlock: 2160493827000000 }) ); rewardInfo.push( RewardInfo({ startBlock: startedBlock.add(3110400), endBlock: startedBlock.add(4147200), rewardFrom: 18830 * 10**18, rewardTo: 19950 * 10**18, rewardPerBlock: 1080246914000000 }) ); rewardInfo.push( RewardInfo({ startBlock: startedBlock.add(4147200), endBlock: startedBlock.add(5184000), rewardFrom: 19950 * 10**18, rewardTo: 20510 * 10**18, rewardPerBlock: 540123456800000 }) ); rewardInfo.push( RewardInfo({ startBlock: startedBlock.add(5184000), endBlock: startedBlock.add(6220800), rewardFrom: 20510 * 10**18, rewardTo: 20790 * 10**18, rewardPerBlock: 270061728400000 }) ); rewardInfo.push( RewardInfo({ startBlock: startedBlock.add(6220800), endBlock: startedBlock.add(7257600), rewardFrom: 20790 * 10**18, rewardTo: 20930 * 10**18, rewardPerBlock: 135030864200000 }) ); rewardInfo.push( RewardInfo({ startBlock: startedBlock.add(7257600), endBlock: startedBlock.add(8294400), rewardFrom: 20930 * 10**18, rewardTo: 21000 * 10**18, rewardPerBlock: 67515432100000 }) ); return 0; } function getPoolBaseMultiplier(uint256 _pid) public view returns (uint256) { if (_pid == 0) { return 20; } else if (_pid == 1) { return 4; } else if (_pid == 2) { return 1; } else { return 1; } } // Return reward multiplier over the given _from to _to block. function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) { uint256 difference = _to.sub(_from); if (difference <= 0 || _from < startedBlock) return 0; uint256 totalReward = 0; uint256 supply = yfbtc.totalSupply(); if (supply >= rewardInfo[rewardInfo.length.sub(1)].rewardTo) return 0; uint256 rewardSetlength = rewardInfo.length; if (_to >= rewardInfo[rewardInfo.length.sub(1)].endBlock) { totalReward = _to.sub(_from).mul(rewardInfo[3].rewardPerBlock); } else { for (uint256 rid = 0; rid < rewardSetlength; ++rid) { // if (supply >= rewardInfo[rid].rewardFrom) { if (_to <= rewardInfo[rid].endBlock) { totalReward = totalReward.add(((_to.sub(_from)).mul(rewardInfo[rid].rewardPerBlock))); break; } else { if (rewardInfo[rid].endBlock <= _from) { continue; } totalReward = totalReward.add(((rewardInfo[rid].endBlock.sub(_from)).mul(rewardInfo[rid].rewardPerBlock))); supply = rewardInfo[rid].rewardTo; _from = rewardInfo[rid].endBlock; } // } } } uint256 totalMultipliers = sumOfMultipliers(); if (totalMultipliers == 0) return 0; uint256 rewardPerPool = totalReward.div(totalMultipliers); return rewardPerPool; } // View function to see pending YFBTC on frontend. function pendingReward(uint256 _pid, address _user) external view returns (uint256) { PoolInfo memory pool = poolInfo[_pid]; require(address(pool.lpToken) != address(0), "MC: _pid is incorrect"); UserInfo memory user = userInfo[_pid][_user]; uint256 accYfbtcPerShare = pool.accYfbtcPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.number > pool.lastRewardBlock && lpSupply != 0) { uint256 rewardPerPool = getMultiplier(pool.lastRewardBlock, block.number); accYfbtcPerShare = accYfbtcPerShare.add(rewardPerPool.mul(getPoolBaseMultiplier(_pid)).mul(1e12).div(lpSupply)); } return user.amount.mul(accYfbtcPerShare).div(1e12).sub(user.rewardDebt); } function estimateReward( uint256 _pid, address _user, uint256 to ) external view returns (uint256) { PoolInfo memory pool = poolInfo[_pid]; require(address(pool.lpToken) != address(0), "MC: _pid is incorrect"); UserInfo memory user = userInfo[_pid][_user]; uint256 accYfbtcPerShare = pool.accYfbtcPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.number > pool.lastRewardBlock && lpSupply != 0) { uint256 rewardPerPool = getMultiplier(pool.lastRewardBlock, to); accYfbtcPerShare = accYfbtcPerShare.add(rewardPerPool.mul(getPoolBaseMultiplier(_pid)).mul(1e12).div(lpSupply)); } return user.amount.mul(accYfbtcPerShare).div(1e12).sub(user.rewardDebt); } function sumOfMultipliers() internal view returns (uint256) { uint256 eligibleMultipliers = 0; uint256 length = poolInfo.length; // Reward will only be assign to pools when they the staked balance is > 0 for (uint256 pid = 0; pid < length; ++pid) { if (poolInfo[pid].totalSupply > 0) { eligibleMultipliers = eligibleMultipliers.add(getPoolBaseMultiplier(pid)); } } return eligibleMultipliers; } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; require(address(pool.lpToken) != address(0), "MC: _pid is incorrect"); if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number; return; } bool doMint = update(); if (doMint) { uint256 yfbtcReward = getMultiplier(pool.lastRewardBlock, block.number); if (yfbtcReward <= 0) return; yfbtcReward = yfbtcReward.mul(getPoolBaseMultiplier(_pid)); pool.accYfbtcPerShare = pool.accYfbtcPerShare.add(yfbtcReward.mul(1e12).div(lpSupply)); yfbtc.mint(address(this), yfbtcReward); pool.lastRewardBlock = block.number; } } // Deposit LP tokens to MasterChef for YFBTC allocation. function deposit(uint256 _pid, uint256 _amount) external { PoolInfo storage pool = poolInfo[_pid]; require(address(pool.lpToken) != address(0), "MC: _pid is incorrect"); UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accYfbtcPerShare).div(1e12).sub(user.rewardDebt); if (pending > 0) { safeYfbtcTransfer(msg.sender, pending); } } if (_amount > 0) { pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); pool.totalSupply = pool.totalSupply.add(_amount); user.amount = user.amount.add(_amount); } user.rewardDebt = user.amount.mul(pool.accYfbtcPerShare).div(1e12); emit Deposit(msg.sender, _pid, _amount); } // Withdraw LP tokens from MasterChef. function withdraw(uint256 _pid, uint256 _amount) external { PoolInfo storage pool = poolInfo[_pid]; require(address(pool.lpToken) != address(0), "MC: _pid is incorrect"); UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accYfbtcPerShare).div(1e12).sub(user.rewardDebt); if (pending > 0) { safeYfbtcTransfer(msg.sender, pending); } if (_amount > 0) { user.amount = user.amount.sub(_amount); pool.lpToken.safeTransfer(address(msg.sender), _amount); pool.totalSupply = pool.totalSupply.sub(_amount); } user.rewardDebt = user.amount.mul(pool.accYfbtcPerShare).div(1e12); emit Withdraw(msg.sender, _pid, _amount); } // let user exist in case of emergency function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; require(address(pool.lpToken) != address(0), "MC: _pid is incorrect"); UserInfo storage user = userInfo[_pid][msg.sender]; uint256 amount = user.amount; user.amount = 0; user.rewardDebt = 0; pool.lpToken.safeTransfer(address(msg.sender), amount); pool.totalSupply = pool.totalSupply.sub(amount); emit EmergencyWithdraw(msg.sender, _pid, amount); } // Safe yfbtcReward transfer function, just in case if rounding error causes pool to not have enough YFBTC. function safeYfbtcTransfer(address _to, uint256 _amount) internal { uint256 yfbtcBal = yfbtc.balanceOf(address(this)); if (_amount > yfbtcBal) { yfbtc.transfer(_to, yfbtcBal); emit EmergencyWithdrawExceptional(_to, _amount); } else { yfbtc.transfer(_to, _amount); } } }
// SPDX-License-Identifier: MIT 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); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.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.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } }
// 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, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @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) { 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, reverting 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) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * 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); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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 <0.8.0; import "../utils/Context.sol"; /** * @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 virtual 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; } }
pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./ERC20.sol"; // YFEToken with Governance. // YFEToken with Governance. contract YFBitcoin is ERC20("AddToken", "ADD"), Ownable { uint256 public transferFee = 1; uint256 public devFee = 300; address public devAddress; uint256 public cap; constructor(uint256 _cap, address _devAddress) public { cap = _cap; devAddress = _devAddress; } function setTransferFee(uint256 _fee) public onlyOwner { require(_fee > 0 && _fee < 1000, "YFBTC: fee should be between 0 and 10"); transferFee = _fee; } function setDevAddress(address _devAddress) public onlyOwner { devAddress = _devAddress; } function burn(address sender, uint256 amount) public onlyOwner { _burn(sender, amount); } /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); _moveDelegates(_delegates[msg.sender], _delegates[recipient], amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { uint256 allowedAmount = allowance(sender, _msgSender()); _transfer(sender, recipient, amount); _moveDelegates(_delegates[sender], _delegates[recipient], amount); _approve(sender, _msgSender(), allowedAmount.sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } // Copied and modified from YAM code: // https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol // https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol // Which is copied and modified from COMPOUND: // https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol mapping(address => address) internal _delegates; /// @notice A checkpoint for marking number of votes from a given block struct Checkpoint { uint32 fromBlock; uint256 votes; } /// @notice A record of votes checkpoints for each account, by index mapping(address => mapping(uint32 => Checkpoint)) public checkpoints; /// @notice The number of checkpoints for each account mapping(address => uint32) public numCheckpoints; /// @notice The EIP-712 typehash for the contract's domain bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"); /// @notice The EIP-712 typehash for the delegation struct used by the contract bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); /// @notice A record of states for signing / validating signatures mapping(address => uint256) public nonces; /// @notice An event thats emitted when an account changes its delegate event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate); /// @notice An event thats emitted when a delegate account's vote balance changes event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance); /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegator The address to get delegatee for */ function delegates(address delegator) external view returns (address) { return _delegates[delegator]; } /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegatee The address to delegate votes to */ function delegate(address delegatee) external { return _delegate(msg.sender, delegatee); } /** * @notice Delegates votes from signatory to `delegatee` * @param delegatee The address to delegate votes to * @param nonce The contract state required to match the signature * @param expiry The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name())), getChainId(), address(this))); bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry)); bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), "YFBTC::delegateBySig: invalid signature"); require(nonce == nonces[signatory]++, "YFBTC::delegateBySig: invalid nonce"); require(now <= expiry, "YFBTC::delegateBySig: signature expired"); return _delegate(signatory, delegatee); } /** * @notice Gets the current votes balance for `account` * @param account The address to get votes balance * @return The number of current votes for `account` */ function getCurrentVotes(address account) external view returns (uint256) { uint32 nCheckpoints = numCheckpoints[account]; return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0; } /** * @notice Determine the prior number of votes for an account as of a block number * @dev Block number must be a finalized block or else this function will revert to prevent misinformation. * @param account The address of the account to check * @param blockNumber The block number to get the vote balance at * @return The number of votes the account had as of the given block */ function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256) { require(blockNumber < block.number, "YFBTC::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } // First check most recent balance if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } // Next check implicit zero balance if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; } else if (cp.fromBlock < blockNumber) { lower = center; } else { upper = center - 1; } } return checkpoints[account][lower].votes; } function _delegate(address delegator, address delegatee) internal { address currentDelegate = _delegates[delegator]; uint256 delegatorBalance = balanceOf(delegator); // balance of underlying YFEs (not scaled); _delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveDelegates(currentDelegate, delegatee, delegatorBalance); } function _moveDelegates( address srcRep, address dstRep, uint256 amount ) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { // decrease old representative uint32 srcRepNum = numCheckpoints[srcRep]; uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint256 srcRepNew = srcRepOld.sub(amount); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { // increase new representative uint32 dstRepNum = numCheckpoints[dstRep]; uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint256 dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _writeCheckpoint( address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes ) internal { uint32 blockNumber = safe32(block.number, "YFBTC::_writeCheckpoint: block number exceeds 32 bits"); if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) { checkpoints[delegatee][nCheckpoints - 1].votes = newVotes; } else { checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes); numCheckpoints[delegatee] = nCheckpoints + 1; } emit DelegateVotesChanged(delegatee, oldVotes, newVotes); } function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) { require(n < 2**32, errorMessage); return uint32(n); } function getChainId() internal pure returns (uint256) { uint256 chainId; assembly { chainId := chainid() } return chainId; } /** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - minted tokens must not cause the total supply to go over the cap. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._beforeTokenTransfer(from, to, amount); if (from == address(0)) { // When minting tokens require(totalSupply().add(amount) <= cap, "YFBTC:: cap exceeded"); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface UniswapV2Pair{ function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); }
// SPDX-License-Identifier: MIT 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // 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); } } } }
// SPDX-License-Identifier: MIT 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; } }
pragma solidity ^0.6.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor(string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( amount, "ERC20: transfer amount exceeds allowance" ) ); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue) ); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].sub( subtractedValue, "ERC20: decreased allowance below zero" ) ); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub( amount, "ERC20: transfer amount exceeds balance" ); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub( amount, "ERC20: burn amount exceeds balance" ); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract YFBitcoin","name":"_yfbtc","type":"address"},{"internalType":"address","name":"_pairAddress","type":"address"},{"internalType":"uint256","name":"_startedBlock","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdrawExceptional","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_devAddress","type":"address"}],"name":"SetDevAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"SetTransferFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"CHANGE_IN_PERCENTAGE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_lpToken","type":"address"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"blockTimestampLast","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"to","type":"uint256"}],"name":"estimateReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"getPoolBaseMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pairAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accYfbtcPerShare","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardInfo","outputs":[{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"uint256","name":"endBlock","type":"uint256"},{"internalType":"uint256","name":"rewardFrom","type":"uint256"},{"internalType":"uint256","name":"rewardTo","type":"uint256"},{"internalType":"uint256","name":"rewardPerBlock","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_devAddress","type":"address"}],"name":"setDevAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setTransferFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startedBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"update","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"updateOwnerShip","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"yfbtc","outputs":[{"internalType":"contract YFBitcoin","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405260006001553480156200001657600080fd5b50604051620030a7380380620030a7833981810160405260608110156200003c57600080fd5b50805160208201516040909201519091906000620000596200020a565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600380546001600160a01b038086166001600160a01b0319928316179092556002805485841692169190911790819055600783905560408051630240bc6b60e21b8152905160009384938493911691630902f1ac91600480820192606092909190829003018186803b1580156200011957600080fd5b505afa1580156200012e573d6000803e3d6000fd5b505050506040513d60608110156200014557600080fd5b50805160208201516040909201516002805463ffffffff60a01b1916600160a01b63ffffffff8416021790556001600160701b03808416600155919550919350909150831615801590620001a157506001600160701b03821615155b620001f3576040805162461bcd60e51b815260206004820152601360248201527f4f5241434c453a204e4f5f524553455256455300000000000000000000000000604482015290519081900360640190fd5b620001fd6200020e565b5050505050505062000a09565b3390565b600060056040518060a001604052806007548152602001620002446202a300600754620009a760201b62001dc71790919060201c565b81526020016866ffcbfd5e5a300000815260200168aac3081695b07800008152602001663e8ca696e3500081525090806001815401808255809150506001900390600052602060002090600502016000909190919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040155505060056040518060a00160405280620002fb6202a300600754620009a760201b62001dc71790919060201c565b81526020016200031f620fd200600754620009a760201b62001dc71790919060201c565b815260200168aac3081695b078000081526020016901e5b8fa8fe2ac0000008152602001661eb3d4ac735d4081525090806001815401808255809150506001900390600052602060002090600502016000909190919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040155505060056040518060a00160405280620003d7620fd200600754620009a760201b62001dc71790919060201c565b8152602001620003fb621fa400600754620009a760201b62001dc71790919060201c565b81526020016901e5b8fa8fe2ac0000008152602001690383587fee69b27800008152602001660f59ea56320d8081525090806001815401808255809150506001900390600052602060002090600502016000909190919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040155505060056040518060a00160405280620004b4621fa400600754620009a760201b62001dc71790919060201c565b8152602001620004d8622f7600600754620009a760201b62001dc71790919060201c565b8152602001690383587fee69b278000081526020016903fcc6be92625d78000081526020016607acf52b1906c081525090806001815401808255809150506001900390600052602060002090600502016000909190919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040155505060056040518060a0016040528062000591622f7600600754620009a760201b62001dc71790919060201c565b8152602001620005b5623f4800600754620009a760201b62001dc71790919060201c565b81526020016903fcc6be92625d78000081526020016904397ddde45eb2f8000081526020016603d67a9594248081525090806001815401808255809150506001900390600052602060002090600502016000909190919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040155505060056040518060a001604052806200066e623f4800600754620009a760201b62001dc71790919060201c565b815260200162000692624f1a00600754620009a760201b62001dc71790919060201c565b81526020016904397ddde45eb2f800008152602001690457d96d8d5cddb8000081526020016601eb3d4ac7050081525090806001815401808255809150506001900390600052602060002090600502016000909190919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040155505060056040518060a001604052806200074b624f1a00600754620009a760201b62001dc71790919060201c565b81526020016200076f625eec00600754620009a760201b62001dc71790919060201c565b8152602001690457d96d8d5cddb800008152602001690467073561dbf3180000815260200165f59ea563828081525090806001815401808255809150506001900390600052602060002090600502016000909190919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040155505060056040518060a0016040528062000827625eec00600754620009a760201b62001dc71790919060201c565b81526020016200084b626ebe00600754620009a760201b62001dc71790919060201c565b8152602001690467073561dbf3180000815260200169046e9e194c1b7dc800008152602001657acf52b1c14081525090806001815401808255809150506001900390600052602060002090600502016000909190919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040155505060056040518060a0016040528062000903626ebe00600754620009a760201b62001dc71790919060201c565b815260200162000927627e9000600754620009a760201b62001dc71790919060201c565b815269046e9e194c1b7dc80000602080830191909152690472698b413b43200000604080840191909152653d67a958e0a06060938401528454600181810187556000968752838720865160059093020191825592850151928101929092558301516002820155908201516003820155608090910151600490910155905090565b60008282018381101562000a02576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b61268e8062000a196000396000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c806385e6293f11610104578063a2e62045116100a2578063d0d41fe111610071578063d0d41fe1146104ed578063e27472ac14610513578063e2bbb15814610545578063f2fde38b14610568576101cf565b8063a2e62045146104a0578063a8b08982146104bc578063b4d1d795146104c4578063c5700a02146104cc576101cf565b80638f02bb5b116100de5780638f02bb5b146103e657806393f1a40b1461040357806398969e82146104485780639dc29fac14610474576101cf565b806385e6293f146103975780638da5cb5b146103bb5780638dbb1e3a146103c3576101cf565b8063441a3e70116101715780636d6577a41161014b5780636d6577a4146103375780636ea52fd31461033f578063715018a61461034757806381a00f831461034f576101cf565b8063441a3e70146102da57806351eb05a6146102fd5780635312ea8e1461031a576101cf565b80630a3b0a4f116101ad5780630a3b0a4f1461021e5780631526fe27146102445780632ccbbaaf1461029157806340c10f19146102ae576101cf565b806304c76ace146101d4578063053f14da146101fc578063081e3eda14610216575b600080fd5b6101fa600480360360208110156101ea57600080fd5b50356001600160a01b031661058e565b005b610204610659565b60408051918252519081900360200190f35b61020461065f565b6101fa6004803603602081101561023457600080fd5b50356001600160a01b0316610666565b6102616004803603602081101561025a57600080fd5b503561089a565b604080516001600160a01b0390951685526020850193909352838301919091526060830152519081900360800190f35b610204600480360360208110156102a757600080fd5b50356108db565b6101fa600480360360408110156102c457600080fd5b506001600160a01b038135169060200135610915565b6101fa600480360360408110156102f057600080fd5b50803590602001356109e8565b6101fa6004803603602081101561031357600080fd5b5035610bb4565b6101fa6004803603602081101561033057600080fd5b5035610daf565b610204610eb5565b610204610ebb565b6101fa610ec0565b61036c6004803603602081101561036557600080fd5b5035610f6c565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b61039f610faa565b604080516001600160a01b039092168252519081900360200190f35b61039f610fb9565b610204600480360360408110156103d957600080fd5b5080359060200135610fc8565b6101fa600480360360208110156103fc57600080fd5b50356112a6565b61042f6004803603604081101561041957600080fd5b50803590602001356001600160a01b03166113f0565b6040805192835260208301919091528051918290030190f35b6102046004803603604081101561045e57600080fd5b50803590602001356001600160a01b0316611414565b6101fa6004803603604081101561048a57600080fd5b506001600160a01b038135169060200135611601565b6104a86116b8565b604080519115158252519081900360200190f35b61039f6117e2565b6102046117f1565b6104d46117f8565b6040805163ffffffff9092168252519081900360200190f35b6101fa6004803603602081101561050357600080fd5b50356001600160a01b031661180b565b6102046004803603606081101561052957600080fd5b508035906001600160a01b036020820135169060400135611965565b6101fa6004803603604081101561055b57600080fd5b5080359060200135611b47565b6101fa6004803603602081101561057e57600080fd5b50356001600160a01b0316611cc5565b610596611e21565b6001600160a01b03166105a7610fb9565b6001600160a01b0316146105f0576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b6003546040805163f2fde38b60e01b81526001600160a01b0384811660048301529151919092169163f2fde38b91602480830192600092919082900301818387803b15801561063e57600080fd5b505af1158015610652573d6000803e3d6000fd5b5050505050565b60015481565b6004545b90565b61066e611e21565b6001600160a01b031661067f610fb9565b6001600160a01b0316146106c8576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b6001600160a01b03811661070d5760405162461bcd60e51b81526004018080602001828103825260278152602001806125a16027913960400191505060405180910390fd5b60005b60045481101561079057816001600160a01b03166004828154811061073157fe5b60009182526020909120600490910201546001600160a01b031614156107885760405162461bcd60e51b815260040180806020018281038252602f815260200180612527602f913960400191505060405180910390fd5b600101610710565b50600060075443116107a4576007546107a6565b435b604080516080810182526001600160a01b03948516815260208101928352600091810182815260608201838152600480546001810182559481905292517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b9490930293840180546001600160a01b031916939097169290921790955591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c82015592517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d840155517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19e9092019190915550565b600481815481106108a757fe5b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169350919084565b6000816108ea57506014610910565b81600114156108fb57506004610910565b816002141561090c57506001610910565b5060015b919050565b61091d611e21565b6001600160a01b031661092e610fb9565b6001600160a01b031614610977576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b600354604080516340c10f1960e01b81526001600160a01b03858116600483015260248201859052915191909216916340c10f1991604480830192600092919082900301818387803b1580156109cc57600080fd5b505af11580156109e0573d6000803e3d6000fd5b505050505050565b6000600483815481106109f757fe5b6000918252602090912060049091020180549091506001600160a01b0316610a5e576040805162461bcd60e51b81526020600482015260156024820152741350ce8817dc1a59081a5cc81a5b98dbdc9c9958dd605a1b604482015290519081900360640190fd5b600083815260066020908152604080832033845290915290208054831115610ac2576040805162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b604482015290519081900360640190fd5b610acb84610bb4565b6000610b058260010154610aff64e8d4a51000610af987600201548760000154611e2590919063ffffffff16565b90611e7e565b90611ee5565b90508015610b1757610b173382611f42565b8315610b56578154610b299085611ee5565b82558254610b41906001600160a01b0316338661210e565b6003830154610b509085611ee5565b60038401555b60028301548254610b719164e8d4a5100091610af991611e25565b6001830155604080518581529051869133917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360200190a35050505050565b600060048281548110610bc357fe5b6000918252602090912060049091020180549091506001600160a01b0316610c2a576040805162461bcd60e51b81526020600482015260156024820152741350ce8817dc1a59081a5cc81a5b98dbdc9c9958dd605a1b604482015290519081900360640190fd5b80600101544311610c3b5750610dac565b8054604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610c8557600080fd5b505afa158015610c99573d6000803e3d6000fd5b505050506040513d6020811015610caf57600080fd5b5051905080610cc5575043600190910155610dac565b6000610ccf6116b8565b90508015610da8576000610ce7846001015443610fc8565b905060008111610cfa5750505050610dac565b610d0d610d06866108db565b8290611e25565b9050610d30610d2584610af98464e8d4a51000611e25565b600286015490611dc7565b6002850155600354604080516340c10f1960e01b81523060048201526024810184905290516001600160a01b03909216916340c10f199160448082019260009290919082900301818387803b158015610d8857600080fd5b505af1158015610d9c573d6000803e3d6000fd5b50504360018701555050505b5050505b50565b600060048281548110610dbe57fe5b6000918252602090912060049091020180549091506001600160a01b0316610e25576040805162461bcd60e51b81526020600482015260156024820152741350ce8817dc1a59081a5cc81a5b98dbdc9c9958dd605a1b604482015290519081900360640190fd5b60008281526006602090815260408083203380855292528220805483825560018201939093558354909291610e64916001600160a01b0316908361210e565b6003830154610e739082611ee5565b6003840155604080518281529051859133917fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959181900360200190a350505050565b60075481565b600581565b610ec8611e21565b6001600160a01b0316610ed9610fb9565b6001600160a01b031614610f22576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60058181548110610f7957fe5b6000918252602090912060059091020180546001820154600283015460038401546004909401549294509092909185565b6003546001600160a01b031681565b6000546001600160a01b031690565b600080610fd58385611ee5565b9050801580610fe5575060075484105b15610ff45760009150506112a0565b600080600360009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561104557600080fd5b505afa158015611059573d6000803e3d6000fd5b505050506040513d602081101561106f57600080fd5b50516005805491925090611084906001611ee5565b8154811061108e57fe5b90600052602060002090600502016003015481106110b257600093505050506112a0565b60058054906110c2826001611ee5565b815481106110cc57fe5b90600052602060002090600502016001015486106111275761112060056003815481106110f557fe5b90600052602060002090600502016004015461111a8989611ee590919063ffffffff16565b90611e25565b925061126c565b60005b8181101561126a576005818154811061113f57fe5b906000526020600020906005020160010154871161119d5761119661118f6005838154811061116a57fe5b90600052602060002090600502016004015461111a8b8b611ee590919063ffffffff16565b8590611dc7565b935061126a565b87600582815481106111ab57fe5b906000526020600020906005020160010154116111c757611262565b61121d61118f600583815481106111da57fe5b90600052602060002090600502016004015461111a8b600586815481106111fd57fe5b906000526020600020906005020160010154611ee590919063ffffffff16565b93506005818154811061122c57fe5b90600052602060002090600502016003015492506005818154811061124d57fe5b90600052602060002090600502016001015497505b60010161112a565b505b6000611276612160565b90508061128b576000955050505050506112a0565b60006112978583611e7e565b96505050505050505b92915050565b6112ae611e21565b6001600160a01b03166112bf610fb9565b6001600160a01b031614611308576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b60008111801561131957506103e881105b6113545760405162461bcd60e51b81526004018080602001828103825260258152602001806125566025913960400191505060405180910390fd5b60035460408051638f02bb5b60e01b81526004810184905290516001600160a01b0390921691638f02bb5b9160248082019260009290919082900301818387803b1580156113a157600080fd5b505af11580156113b5573d6000803e3d6000fd5b50506040805184815290517f7a85e8a0c3f3d4bafa6ac516212f769dfdb9bbf7c6f058d391aa03b0596212439350908190036020019150a150565b60066020908152600092835260408084209091529082529020805460019091015482565b600061141e6124db565b6004848154811061142b57fe5b600091825260209182902060408051608081018252600490930290910180546001600160a01b031680845260018201549484019490945260028101549183019190915260030154606082015291506114c2576040805162461bcd60e51b81526020600482015260156024820152741350ce8817dc1a59081a5cc81a5b98dbdc9c9958dd605a1b604482015290519081900360640190fd5b6114ca61250c565b5060008481526006602090815260408083206001600160a01b03808816855290835281842082518084018452815481526001909101548185015285830151865184516370a0823160e01b815230600482015294519296919591949316926370a082319260248083019392829003018186803b15801561154857600080fd5b505afa15801561155c573d6000803e3d6000fd5b505050506040513d602081101561157257600080fd5b505160208501519091504311801561158957508015155b156115ce57600061159e856020015143610fc8565b90506115ca6115c383610af964e8d4a5100061111a6115bc8e6108db565b8790611e25565b8490611dc7565b9250505b6115f68360200151610aff64e8d4a51000610af9868860000151611e2590919063ffffffff16565b979650505050505050565b611609611e21565b6001600160a01b031661161a610fb9565b6001600160a01b031614611663576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b60035460408051632770a7eb60e21b81526001600160a01b0385811660048301526024820185905291519190921691639dc29fac91604480830192600092919082900301818387803b1580156109cc57600080fd5b6000806116c36121b8565b60025490915063ffffffff600160a01b909104811682039062015180908216106117d957600080600260009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561173857600080fd5b505afa15801561174c573d6000803e3d6000fd5b505050506040513d606081101561176257600080fd5b50602001516001549091506dffffffffffffffffffffffffffff82169081101561179f5760015461179c90610af9606461111a8386611ee5565b92505b600583106117b557600095505050505050610663565b60015550506002805463ffffffff60a01b1916600160a01b63ffffffff8516021790555b60019250505090565b6002546001600160a01b031681565b6201518081565b600254600160a01b900463ffffffff1681565b611813611e21565b6001600160a01b0316611824610fb9565b6001600160a01b03161461186d576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b6001600160a01b0381166118c8576040805162461bcd60e51b815260206004820152601b60248201527f7a65726f2061646472657373206973206e6f7420616c6c6f7765640000000000604482015290519081900360640190fd5b6003546040805163d0d41fe160e01b81526001600160a01b0384811660048301529151919092169163d0d41fe191602480830192600092919082900301818387803b15801561191657600080fd5b505af115801561192a573d6000803e3d6000fd5b50506040516001600160a01b03841692507ff5721dfa6ddbf8e4a2cd38b2152fff4008050b9b37de59ae1e022dde4bd5df739150600090a250565b600061196f6124db565b6004858154811061197c57fe5b600091825260209182902060408051608081018252600490930290910180546001600160a01b03168084526001820154948401949094526002810154918301919091526003015460608201529150611a13576040805162461bcd60e51b81526020600482015260156024820152741350ce8817dc1a59081a5cc81a5b98dbdc9c9958dd605a1b604482015290519081900360640190fd5b611a1b61250c565b5060008581526006602090815260408083206001600160a01b03808916855290835281842082518084018452815481526001909101548185015285830151865184516370a0823160e01b815230600482015294519296919591949316926370a082319260248083019392829003018186803b158015611a9957600080fd5b505afa158015611aad573d6000803e3d6000fd5b505050506040513d6020811015611ac357600080fd5b5051602085015190915043118015611ada57508015155b15611b11576000611aef856020015188610fc8565b9050611b0d6115c383610af964e8d4a5100061111a6115bc8f6108db565b9250505b611b398360200151610aff64e8d4a51000610af9868860000151611e2590919063ffffffff16565b9450505050505b9392505050565b600060048381548110611b5657fe5b6000918252602090912060049091020180549091506001600160a01b0316611bbd576040805162461bcd60e51b81526020600482015260156024820152741350ce8817dc1a59081a5cc81a5b98dbdc9c9958dd605a1b604482015290519081900360640190fd5b60008381526006602090815260408083203384529091529020611bdf84610bb4565b805415611c28576000611c148260010154610aff64e8d4a51000610af987600201548760000154611e2590919063ffffffff16565b90508015611c2657611c263382611f42565b505b8215611c68578154611c45906001600160a01b03163330866121c2565b6003820154611c549084611dc7565b60038301558054611c659084611dc7565b81555b60028201548154611c839164e8d4a5100091610af991611e25565b6001820155604080518481529051859133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a350505050565b611ccd611e21565b6001600160a01b0316611cde610fb9565b6001600160a01b031614611d27576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b6001600160a01b038116611d6c5760405162461bcd60e51b815260040180806020018281038252602681526020018061257b6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600082820183811015611b40576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b600082611e34575060006112a0565b82820282848281611e4157fe5b0414611b405760405162461bcd60e51b81526004018080602001828103825260218152602001806125ee6021913960400191505060405180910390fd5b6000808211611ed4576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381611edd57fe5b049392505050565b600082821115611f3c576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600354604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611f8d57600080fd5b505afa158015611fa1573d6000803e3d6000fd5b505050506040513d6020811015611fb757600080fd5b5051905080821115612089576003546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561201957600080fd5b505af115801561202d573d6000803e3d6000fd5b505050506040513d602081101561204357600080fd5b50506040805183815290516001600160a01b038516917f7f109ab19e38643629874672a85accf6eac4a0ffb10befc63f25d6b9eab3be90919081900360200190a2612109565b6003546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b1580156120df57600080fd5b505af11580156120f3573d6000803e3d6000fd5b505050506040513d602081101561065257600080fd5b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612109908490612218565b6004546000908190815b818110156121b05760006004828154811061218157fe5b90600052602060002090600402016003015411156121a8576121a56115c3826108db565b92505b60010161216a565b509091505090565b63ffffffff421690565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610da89085905b606061226d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122c99092919063ffffffff16565b8051909150156121095780806020019051602081101561228c57600080fd5b50516121095760405162461bcd60e51b815260040180806020018281038252602a81526020018061262f602a913960400191505060405180910390fd5b60606122d884846000856122e0565b949350505050565b6060824710156123215760405162461bcd60e51b81526004018080602001828103825260268152602001806125c86026913960400191505060405180910390fd5b61232a85612431565b61237b576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106123ba5780518252601f19909201916020918201910161239b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461241c576040519150601f19603f3d011682016040523d82523d6000602084013e612421565b606091505b50915091506115f6828286612437565b3b151590565b60608315612446575081611b40565b8251156124565782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124a0578181015183820152602001612488565b50505050905090810190601f1680156124cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b604051806080016040528060006001600160a01b031681526020016000815260200160008152602001600081525090565b60405180604001604052806000815260200160008152509056fe4d433a20444f204e4f5420616464207468652073616d65204c5020746f6b656e206d6f7265207468616e206f6e636559464254433a206665652073686f756c64206265206265747765656e203020616e642031304f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734d433a205f6c70546f6b656e2073686f756c64206e6f742062652061646472657373207a65726f416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212201ce767ee4be1313163664362f037adb8beafa504cb1ca25dfa3cda8c4213acff64736f6c634300060c0033000000000000000000000000ff034d12353867fc4228f4ae3e689cd6dcaad1200000000000000000000000009fb24efec63c6a978efd21bda010099cb4f237070000000000000000000000000000000000000000000000000000000000bce9e0
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c806385e6293f11610104578063a2e62045116100a2578063d0d41fe111610071578063d0d41fe1146104ed578063e27472ac14610513578063e2bbb15814610545578063f2fde38b14610568576101cf565b8063a2e62045146104a0578063a8b08982146104bc578063b4d1d795146104c4578063c5700a02146104cc576101cf565b80638f02bb5b116100de5780638f02bb5b146103e657806393f1a40b1461040357806398969e82146104485780639dc29fac14610474576101cf565b806385e6293f146103975780638da5cb5b146103bb5780638dbb1e3a146103c3576101cf565b8063441a3e70116101715780636d6577a41161014b5780636d6577a4146103375780636ea52fd31461033f578063715018a61461034757806381a00f831461034f576101cf565b8063441a3e70146102da57806351eb05a6146102fd5780635312ea8e1461031a576101cf565b80630a3b0a4f116101ad5780630a3b0a4f1461021e5780631526fe27146102445780632ccbbaaf1461029157806340c10f19146102ae576101cf565b806304c76ace146101d4578063053f14da146101fc578063081e3eda14610216575b600080fd5b6101fa600480360360208110156101ea57600080fd5b50356001600160a01b031661058e565b005b610204610659565b60408051918252519081900360200190f35b61020461065f565b6101fa6004803603602081101561023457600080fd5b50356001600160a01b0316610666565b6102616004803603602081101561025a57600080fd5b503561089a565b604080516001600160a01b0390951685526020850193909352838301919091526060830152519081900360800190f35b610204600480360360208110156102a757600080fd5b50356108db565b6101fa600480360360408110156102c457600080fd5b506001600160a01b038135169060200135610915565b6101fa600480360360408110156102f057600080fd5b50803590602001356109e8565b6101fa6004803603602081101561031357600080fd5b5035610bb4565b6101fa6004803603602081101561033057600080fd5b5035610daf565b610204610eb5565b610204610ebb565b6101fa610ec0565b61036c6004803603602081101561036557600080fd5b5035610f6c565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b61039f610faa565b604080516001600160a01b039092168252519081900360200190f35b61039f610fb9565b610204600480360360408110156103d957600080fd5b5080359060200135610fc8565b6101fa600480360360208110156103fc57600080fd5b50356112a6565b61042f6004803603604081101561041957600080fd5b50803590602001356001600160a01b03166113f0565b6040805192835260208301919091528051918290030190f35b6102046004803603604081101561045e57600080fd5b50803590602001356001600160a01b0316611414565b6101fa6004803603604081101561048a57600080fd5b506001600160a01b038135169060200135611601565b6104a86116b8565b604080519115158252519081900360200190f35b61039f6117e2565b6102046117f1565b6104d46117f8565b6040805163ffffffff9092168252519081900360200190f35b6101fa6004803603602081101561050357600080fd5b50356001600160a01b031661180b565b6102046004803603606081101561052957600080fd5b508035906001600160a01b036020820135169060400135611965565b6101fa6004803603604081101561055b57600080fd5b5080359060200135611b47565b6101fa6004803603602081101561057e57600080fd5b50356001600160a01b0316611cc5565b610596611e21565b6001600160a01b03166105a7610fb9565b6001600160a01b0316146105f0576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b6003546040805163f2fde38b60e01b81526001600160a01b0384811660048301529151919092169163f2fde38b91602480830192600092919082900301818387803b15801561063e57600080fd5b505af1158015610652573d6000803e3d6000fd5b5050505050565b60015481565b6004545b90565b61066e611e21565b6001600160a01b031661067f610fb9565b6001600160a01b0316146106c8576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b6001600160a01b03811661070d5760405162461bcd60e51b81526004018080602001828103825260278152602001806125a16027913960400191505060405180910390fd5b60005b60045481101561079057816001600160a01b03166004828154811061073157fe5b60009182526020909120600490910201546001600160a01b031614156107885760405162461bcd60e51b815260040180806020018281038252602f815260200180612527602f913960400191505060405180910390fd5b600101610710565b50600060075443116107a4576007546107a6565b435b604080516080810182526001600160a01b03948516815260208101928352600091810182815260608201838152600480546001810182559481905292517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b9490930293840180546001600160a01b031916939097169290921790955591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c82015592517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d840155517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19e9092019190915550565b600481815481106108a757fe5b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169350919084565b6000816108ea57506014610910565b81600114156108fb57506004610910565b816002141561090c57506001610910565b5060015b919050565b61091d611e21565b6001600160a01b031661092e610fb9565b6001600160a01b031614610977576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b600354604080516340c10f1960e01b81526001600160a01b03858116600483015260248201859052915191909216916340c10f1991604480830192600092919082900301818387803b1580156109cc57600080fd5b505af11580156109e0573d6000803e3d6000fd5b505050505050565b6000600483815481106109f757fe5b6000918252602090912060049091020180549091506001600160a01b0316610a5e576040805162461bcd60e51b81526020600482015260156024820152741350ce8817dc1a59081a5cc81a5b98dbdc9c9958dd605a1b604482015290519081900360640190fd5b600083815260066020908152604080832033845290915290208054831115610ac2576040805162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b604482015290519081900360640190fd5b610acb84610bb4565b6000610b058260010154610aff64e8d4a51000610af987600201548760000154611e2590919063ffffffff16565b90611e7e565b90611ee5565b90508015610b1757610b173382611f42565b8315610b56578154610b299085611ee5565b82558254610b41906001600160a01b0316338661210e565b6003830154610b509085611ee5565b60038401555b60028301548254610b719164e8d4a5100091610af991611e25565b6001830155604080518581529051869133917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360200190a35050505050565b600060048281548110610bc357fe5b6000918252602090912060049091020180549091506001600160a01b0316610c2a576040805162461bcd60e51b81526020600482015260156024820152741350ce8817dc1a59081a5cc81a5b98dbdc9c9958dd605a1b604482015290519081900360640190fd5b80600101544311610c3b5750610dac565b8054604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610c8557600080fd5b505afa158015610c99573d6000803e3d6000fd5b505050506040513d6020811015610caf57600080fd5b5051905080610cc5575043600190910155610dac565b6000610ccf6116b8565b90508015610da8576000610ce7846001015443610fc8565b905060008111610cfa5750505050610dac565b610d0d610d06866108db565b8290611e25565b9050610d30610d2584610af98464e8d4a51000611e25565b600286015490611dc7565b6002850155600354604080516340c10f1960e01b81523060048201526024810184905290516001600160a01b03909216916340c10f199160448082019260009290919082900301818387803b158015610d8857600080fd5b505af1158015610d9c573d6000803e3d6000fd5b50504360018701555050505b5050505b50565b600060048281548110610dbe57fe5b6000918252602090912060049091020180549091506001600160a01b0316610e25576040805162461bcd60e51b81526020600482015260156024820152741350ce8817dc1a59081a5cc81a5b98dbdc9c9958dd605a1b604482015290519081900360640190fd5b60008281526006602090815260408083203380855292528220805483825560018201939093558354909291610e64916001600160a01b0316908361210e565b6003830154610e739082611ee5565b6003840155604080518281529051859133917fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959181900360200190a350505050565b60075481565b600581565b610ec8611e21565b6001600160a01b0316610ed9610fb9565b6001600160a01b031614610f22576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60058181548110610f7957fe5b6000918252602090912060059091020180546001820154600283015460038401546004909401549294509092909185565b6003546001600160a01b031681565b6000546001600160a01b031690565b600080610fd58385611ee5565b9050801580610fe5575060075484105b15610ff45760009150506112a0565b600080600360009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561104557600080fd5b505afa158015611059573d6000803e3d6000fd5b505050506040513d602081101561106f57600080fd5b50516005805491925090611084906001611ee5565b8154811061108e57fe5b90600052602060002090600502016003015481106110b257600093505050506112a0565b60058054906110c2826001611ee5565b815481106110cc57fe5b90600052602060002090600502016001015486106111275761112060056003815481106110f557fe5b90600052602060002090600502016004015461111a8989611ee590919063ffffffff16565b90611e25565b925061126c565b60005b8181101561126a576005818154811061113f57fe5b906000526020600020906005020160010154871161119d5761119661118f6005838154811061116a57fe5b90600052602060002090600502016004015461111a8b8b611ee590919063ffffffff16565b8590611dc7565b935061126a565b87600582815481106111ab57fe5b906000526020600020906005020160010154116111c757611262565b61121d61118f600583815481106111da57fe5b90600052602060002090600502016004015461111a8b600586815481106111fd57fe5b906000526020600020906005020160010154611ee590919063ffffffff16565b93506005818154811061122c57fe5b90600052602060002090600502016003015492506005818154811061124d57fe5b90600052602060002090600502016001015497505b60010161112a565b505b6000611276612160565b90508061128b576000955050505050506112a0565b60006112978583611e7e565b96505050505050505b92915050565b6112ae611e21565b6001600160a01b03166112bf610fb9565b6001600160a01b031614611308576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b60008111801561131957506103e881105b6113545760405162461bcd60e51b81526004018080602001828103825260258152602001806125566025913960400191505060405180910390fd5b60035460408051638f02bb5b60e01b81526004810184905290516001600160a01b0390921691638f02bb5b9160248082019260009290919082900301818387803b1580156113a157600080fd5b505af11580156113b5573d6000803e3d6000fd5b50506040805184815290517f7a85e8a0c3f3d4bafa6ac516212f769dfdb9bbf7c6f058d391aa03b0596212439350908190036020019150a150565b60066020908152600092835260408084209091529082529020805460019091015482565b600061141e6124db565b6004848154811061142b57fe5b600091825260209182902060408051608081018252600490930290910180546001600160a01b031680845260018201549484019490945260028101549183019190915260030154606082015291506114c2576040805162461bcd60e51b81526020600482015260156024820152741350ce8817dc1a59081a5cc81a5b98dbdc9c9958dd605a1b604482015290519081900360640190fd5b6114ca61250c565b5060008481526006602090815260408083206001600160a01b03808816855290835281842082518084018452815481526001909101548185015285830151865184516370a0823160e01b815230600482015294519296919591949316926370a082319260248083019392829003018186803b15801561154857600080fd5b505afa15801561155c573d6000803e3d6000fd5b505050506040513d602081101561157257600080fd5b505160208501519091504311801561158957508015155b156115ce57600061159e856020015143610fc8565b90506115ca6115c383610af964e8d4a5100061111a6115bc8e6108db565b8790611e25565b8490611dc7565b9250505b6115f68360200151610aff64e8d4a51000610af9868860000151611e2590919063ffffffff16565b979650505050505050565b611609611e21565b6001600160a01b031661161a610fb9565b6001600160a01b031614611663576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b60035460408051632770a7eb60e21b81526001600160a01b0385811660048301526024820185905291519190921691639dc29fac91604480830192600092919082900301818387803b1580156109cc57600080fd5b6000806116c36121b8565b60025490915063ffffffff600160a01b909104811682039062015180908216106117d957600080600260009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561173857600080fd5b505afa15801561174c573d6000803e3d6000fd5b505050506040513d606081101561176257600080fd5b50602001516001549091506dffffffffffffffffffffffffffff82169081101561179f5760015461179c90610af9606461111a8386611ee5565b92505b600583106117b557600095505050505050610663565b60015550506002805463ffffffff60a01b1916600160a01b63ffffffff8516021790555b60019250505090565b6002546001600160a01b031681565b6201518081565b600254600160a01b900463ffffffff1681565b611813611e21565b6001600160a01b0316611824610fb9565b6001600160a01b03161461186d576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b6001600160a01b0381166118c8576040805162461bcd60e51b815260206004820152601b60248201527f7a65726f2061646472657373206973206e6f7420616c6c6f7765640000000000604482015290519081900360640190fd5b6003546040805163d0d41fe160e01b81526001600160a01b0384811660048301529151919092169163d0d41fe191602480830192600092919082900301818387803b15801561191657600080fd5b505af115801561192a573d6000803e3d6000fd5b50506040516001600160a01b03841692507ff5721dfa6ddbf8e4a2cd38b2152fff4008050b9b37de59ae1e022dde4bd5df739150600090a250565b600061196f6124db565b6004858154811061197c57fe5b600091825260209182902060408051608081018252600490930290910180546001600160a01b03168084526001820154948401949094526002810154918301919091526003015460608201529150611a13576040805162461bcd60e51b81526020600482015260156024820152741350ce8817dc1a59081a5cc81a5b98dbdc9c9958dd605a1b604482015290519081900360640190fd5b611a1b61250c565b5060008581526006602090815260408083206001600160a01b03808916855290835281842082518084018452815481526001909101548185015285830151865184516370a0823160e01b815230600482015294519296919591949316926370a082319260248083019392829003018186803b158015611a9957600080fd5b505afa158015611aad573d6000803e3d6000fd5b505050506040513d6020811015611ac357600080fd5b5051602085015190915043118015611ada57508015155b15611b11576000611aef856020015188610fc8565b9050611b0d6115c383610af964e8d4a5100061111a6115bc8f6108db565b9250505b611b398360200151610aff64e8d4a51000610af9868860000151611e2590919063ffffffff16565b9450505050505b9392505050565b600060048381548110611b5657fe5b6000918252602090912060049091020180549091506001600160a01b0316611bbd576040805162461bcd60e51b81526020600482015260156024820152741350ce8817dc1a59081a5cc81a5b98dbdc9c9958dd605a1b604482015290519081900360640190fd5b60008381526006602090815260408083203384529091529020611bdf84610bb4565b805415611c28576000611c148260010154610aff64e8d4a51000610af987600201548760000154611e2590919063ffffffff16565b90508015611c2657611c263382611f42565b505b8215611c68578154611c45906001600160a01b03163330866121c2565b6003820154611c549084611dc7565b60038301558054611c659084611dc7565b81555b60028201548154611c839164e8d4a5100091610af991611e25565b6001820155604080518481529051859133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a350505050565b611ccd611e21565b6001600160a01b0316611cde610fb9565b6001600160a01b031614611d27576040805162461bcd60e51b8152602060048201819052602482015260008051602061260f833981519152604482015290519081900360640190fd5b6001600160a01b038116611d6c5760405162461bcd60e51b815260040180806020018281038252602681526020018061257b6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600082820183811015611b40576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b600082611e34575060006112a0565b82820282848281611e4157fe5b0414611b405760405162461bcd60e51b81526004018080602001828103825260218152602001806125ee6021913960400191505060405180910390fd5b6000808211611ed4576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381611edd57fe5b049392505050565b600082821115611f3c576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600354604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611f8d57600080fd5b505afa158015611fa1573d6000803e3d6000fd5b505050506040513d6020811015611fb757600080fd5b5051905080821115612089576003546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561201957600080fd5b505af115801561202d573d6000803e3d6000fd5b505050506040513d602081101561204357600080fd5b50506040805183815290516001600160a01b038516917f7f109ab19e38643629874672a85accf6eac4a0ffb10befc63f25d6b9eab3be90919081900360200190a2612109565b6003546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b1580156120df57600080fd5b505af11580156120f3573d6000803e3d6000fd5b505050506040513d602081101561065257600080fd5b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612109908490612218565b6004546000908190815b818110156121b05760006004828154811061218157fe5b90600052602060002090600402016003015411156121a8576121a56115c3826108db565b92505b60010161216a565b509091505090565b63ffffffff421690565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610da89085905b606061226d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122c99092919063ffffffff16565b8051909150156121095780806020019051602081101561228c57600080fd5b50516121095760405162461bcd60e51b815260040180806020018281038252602a81526020018061262f602a913960400191505060405180910390fd5b60606122d884846000856122e0565b949350505050565b6060824710156123215760405162461bcd60e51b81526004018080602001828103825260268152602001806125c86026913960400191505060405180910390fd5b61232a85612431565b61237b576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106123ba5780518252601f19909201916020918201910161239b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461241c576040519150601f19603f3d011682016040523d82523d6000602084013e612421565b606091505b50915091506115f6828286612437565b3b151590565b60608315612446575081611b40565b8251156124565782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124a0578181015183820152602001612488565b50505050905090810190601f1680156124cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b604051806080016040528060006001600160a01b031681526020016000815260200160008152602001600081525090565b60405180604001604052806000815260200160008152509056fe4d433a20444f204e4f5420616464207468652073616d65204c5020746f6b656e206d6f7265207468616e206f6e636559464254433a206665652073686f756c64206265206265747765656e203020616e642031304f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734d433a205f6c70546f6b656e2073686f756c64206e6f742062652061646472657373207a65726f416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212201ce767ee4be1313163664362f037adb8beafa504cb1ca25dfa3cda8c4213acff64736f6c634300060c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000ff034d12353867fc4228f4ae3e689cd6dcaad1200000000000000000000000009fb24efec63c6a978efd21bda010099cb4f237070000000000000000000000000000000000000000000000000000000000bce9e0
-----Decoded View---------------
Arg [0] : _yfbtc (address): 0xff034D12353867fC4228f4Ae3E689CD6dCAad120
Arg [1] : _pairAddress (address): 0x9fb24Efec63c6a978Efd21bDa010099CB4f23707
Arg [2] : _startedBlock (uint256): 12380640
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000ff034d12353867fc4228f4ae3e689cd6dcaad120
Arg [1] : 0000000000000000000000009fb24efec63c6a978efd21bda010099cb4f23707
Arg [2] : 0000000000000000000000000000000000000000000000000000000000bce9e0
Loading...
Loading
Loading...
Loading
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.