Polygon Sponsored slots available. Book your slot here!
Overview
POL Balance
0 POL
POL Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x1eCF385D...0204855dd The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
FarmFacet
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; import "../libraries/LibFarm.sol"; import "../abstract/ReentrancyGuard.sol"; import "../abstract/Ownable.sol"; contract FarmFacet is Ownable, ReentrancyGuard { // Add a new lp to the pool. Can only be called by the owner. // DO NOT add the same LP token more than once. Rewards will be messed up if you do. function add( uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate ) external onlyOwner { LibFarm.add(_allocPoint, _lpToken, _withUpdate); } // Update the given pool's ERC20 allocation point. Can only be called by the owner. function set( uint256 _pid, uint256 _allocPoint, bool _withUpdate ) external onlyOwner { LibFarm.set(_pid, _allocPoint, _withUpdate); } // Update reward variables for all pools. Be careful of gas spending! function massUpdatePools() external { LibFarm.massUpdatePools(); } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _pid) external { LibFarm.updatePool(_pid); } // Deposit LP tokens to Farm for ERC20 allocation. function deposit(uint256 _pid, uint256 _amount) external nonReentrant { LibFarm.deposit(_pid, _amount); } // Withdraw LP tokens from Farm. function withdraw(uint256 _pid, uint256 _amount) external nonReentrant { LibFarm.withdraw(_pid, _amount); } // Harvest rewards function harvest(uint256 _pid) external nonReentrant { LibFarm.updatePoolAndHarvest(msg.sender, _pid); } // Batch harvest rewards function batchHarvest(uint256[] memory _pids) external nonReentrant { for (uint256 i = 0; i < _pids.length; ++i) { LibFarm.updatePoolAndHarvest(msg.sender, _pids[i]); } } // Withdraw without caring about rewards. EMERGENCY ONLY. function emergencyWithdraw(uint256 _pid) external nonReentrant { LibFarm.emergencyWithdraw(_pid); } ////////////////////////////////////////////////////////////////////////////// // GETTERS ////////////////////////////////////////////////////////////////////////////// // Storage pointer helper function s() private pure returns (FarmStorage.Layout storage fs) { return FarmStorage.layout(); } // Number of LP pools function poolLength() external view returns (uint256) { return s().poolInfo.length; } // View function to see deposited LP for a user. function deposited(uint256 _pid, address _user) external view returns (uint256) { return s().userInfo[_pid][_user].amount; } // View function to see pending ERC20s for a user. function pending(uint256 _pid, address _user) public view returns (uint256) { PoolInfo storage pool = s().poolInfo[_pid]; UserInfo storage user = s().userInfo[_pid][_user]; uint256 accERC20PerShare = pool.accERC20PerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.number > pool.lastRewardBlock && lpSupply != 0) { uint256 nrOfBlocks = block.number - pool.lastRewardBlock; uint256 erc20Reward = (LibFarm.sumRewardPerBlock( pool.lastRewardBlock, nrOfBlocks ) * pool.allocPoint) / s().totalAllocPoint; accERC20PerShare += (erc20Reward * 1e18) / lpSupply; } uint256 userReward = (user.amount * accERC20PerShare) / 1e18; if (userReward <= user.rewardDebt) return 0; else return userReward - user.rewardDebt; } // View function for total reward the farm has yet to pay out. function totalPending() external view returns (uint256 totalPending_) { uint256 _startBlock = s().startBlock; if (block.number <= _startBlock) { return 0; } totalPending_ = LibFarm.sumRewardPerBlock( _startBlock, block.number - _startBlock ) - s().paidOut; } struct UserInfoOutput { IERC20 lpToken; // LP Token of the pool uint256 allocPoint; uint256 pending; // Amount of reward pending for this lp token pool uint256 userBalance; // Amount user has deposited uint256 poolBalance; // Amount of LP tokens in the pool } function allUserInfo(address _user) external view returns (UserInfoOutput[] memory) { UserInfoOutput[] memory userInfo_ = new UserInfoOutput[]( s().poolInfo.length ); for (uint256 i = 0; i < s().poolInfo.length; i++) { userInfo_[i] = UserInfoOutput({ lpToken: s().poolInfo[i].lpToken, allocPoint: s().poolInfo[i].allocPoint, pending: pending(i, _user), userBalance: s().userInfo[i][_user].amount, poolBalance: s().poolInfo[i].lpToken.balanceOf(address(this)) }); } return userInfo_; } function rewardToken() external view returns (IERC20) { return s().rewardToken; } function paidOut() external view returns (uint256) { return s().paidOut; } // Returns the reward per block for the specified year. 0 is the first year function rewardPerBlock(uint256 year) external pure returns (uint256) { return LibFarm.rewardPerBlock(year); } function currentRewardPerBlock() external view returns (uint256) { if (block.number < s().startBlock) return 0; return LibFarm.rewardPerBlock( (block.number - s().startBlock) / s().decayPeriod ); } function poolInfo(uint256 _pid) external view returns (PoolInfo memory pi) { return s().poolInfo[_pid]; } function poolTokens(address _token) external view returns (bool) { return s().poolTokens[_token]; } function poolBalance(uint256 _pid) external view returns (uint256) { return s().poolInfo[_pid].lpToken.balanceOf(address(this)); } function userInfo(uint256 _pid, address _user) external view returns (UserInfo memory ui) { return s().userInfo[_pid][_user]; } function totalAllocPoint() external view returns (uint256) { return s().totalAllocPoint; } function startBlock() external view returns (uint256) { return s().startBlock; } function decayPeriod() external view returns (uint256) { return s().decayPeriod; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { FarmStorage, PoolInfo, UserInfo } from "./FarmStorage.sol"; // Farm distributes the ERC20 rewards based on staked LP to each user. // // Forked from https://github.com/SashimiProject/sashimiswap/blob/master/contracts/MasterChef.sol // Modified for diamonds and decay rate support library LibFarm { using SafeERC20 for IERC20; 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 Harvest(address indexed user, uint256 amount); // Helper getter function for a predefined set of rewards for 30 years function rewardPerBlock(uint256 period) internal pure returns (uint256) { // assumes 13,870,000 blocks per year to distribute a total of 1 trillion GLTR uint256[30] memory _rewardPerBlock = [ uint256(7_209_805_335_256 gwei), // cast to force array to be uint256 (compiler issue) 6_039_405_905_650 gwei, 5_059_002_566_246 gwei, 4_237_752_415_572 gwei, 3_549_819_416_085 gwei, 2_973_561_607_920 gwei, 2_490_850_265_800 gwei, 2_086_499_580_203 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei, 1_747_788_920_901 gwei ]; // Rewards should be zero after rewards are exhausted if (period >= _rewardPerBlock.length) { return 0; } else { return _rewardPerBlock[period]; } } /// @notice Sums up the rewards for a specified number of blocks from the last reward block /// @param lastRewardBlock The block number of the last reward block to calculate from /// @param nrOfBlocks The number of blocks to calculate rewards for function sumRewardPerBlock( uint256 lastRewardBlock, uint256 nrOfBlocks ) internal view returns (uint256 totalReward) { uint256 decayPeriod = s().decayPeriod; // Blocks passed from the start block to the last reward block uint256 blocksPassedToLastRewardSinceStart = lastRewardBlock - s().startBlock; // Total amount of blocks left in the current period uint256 blocksLeftInCurrentPeriod = decayPeriod - (blocksPassedToLastRewardSinceStart % decayPeriod); // The period of the last reward block uint256 currentPeriod = blocksPassedToLastRewardSinceStart / decayPeriod; // Add min(current period, nrOfBlocks) * rewardPerBlock to total reward totalReward += rewardPerBlock(currentPeriod) * ( nrOfBlocks < blocksLeftInCurrentPeriod ? nrOfBlocks : blocksLeftInCurrentPeriod ); // This block should be skipped and reward should be returned if the first period is the last one if (nrOfBlocks > blocksLeftInCurrentPeriod) { // We account for rewards being distributed for the first period ++currentPeriod; nrOfBlocks -= blocksLeftInCurrentPeriod; // Add to total rewards for each period that nrOfBlocks fills while (nrOfBlocks >= decayPeriod) { totalReward += rewardPerBlock(currentPeriod) * decayPeriod; nrOfBlocks -= decayPeriod; ++currentPeriod; } // Add the final rewards totalReward += rewardPerBlock(currentPeriod) * nrOfBlocks; } } function s() private pure returns (FarmStorage.Layout storage fs) { return FarmStorage.layout(); } // Add a new lp to the pool. Can only be called by the owner. // DO NOT add the same LP token more than once. Rewards will be messed up if you do. function add( uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate ) internal { require( !s().poolTokens[address(_lpToken)], "add: LP token already added" ); s().poolTokens[address(_lpToken)] = true; if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > s().startBlock ? block.number : s().startBlock; s().totalAllocPoint += _allocPoint; s().poolInfo.push( PoolInfo({ lpToken: _lpToken, allocPoint: _allocPoint, lastRewardBlock: lastRewardBlock, accERC20PerShare: 0 }) ); } // Update the given pool's ERC20 allocation point. Can only be called by the owner. function set( uint256 _pid, uint256 _allocPoint, bool _withUpdate ) internal { require( s().poolTokens[address(s().poolInfo[_pid].lpToken)], "set: LP token not added" ); if (_withUpdate) { massUpdatePools(); } s().totalAllocPoint = s().totalAllocPoint - s().poolInfo[_pid].allocPoint + _allocPoint; s().poolInfo[_pid].allocPoint = _allocPoint; } // Update reward variables for all pools. Be careful of gas spending! function massUpdatePools() internal { uint256 length = s().poolInfo.length; for (uint256 pid = 0; pid < length; ) { updatePool(pid); unchecked { ++pid; } } } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _pid) internal { PoolInfo storage pool = s().poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number; return; } uint256 nrOfBlocks = block.number - pool.lastRewardBlock; uint256 erc20Reward = (sumRewardPerBlock( pool.lastRewardBlock, nrOfBlocks ) * pool.allocPoint) / s().totalAllocPoint; pool.accERC20PerShare += (erc20Reward * 1e18) / lpSupply; pool.lastRewardBlock = block.number; } // Deposit LP tokens to Farm for ERC20 allocation. function deposit(uint256 _pid, uint256 _amount) internal { PoolInfo storage pool = s().poolInfo[_pid]; UserInfo storage user = s().userInfo[_pid][msg.sender]; updatePoolAndHarvest(msg.sender, _pid); if (_amount > 0) { pool.lpToken.safeTransferFrom( address(msg.sender), address(this), _amount ); user.amount += _amount; } user.rewardDebt = (user.amount * pool.accERC20PerShare) / 1e18; emit Deposit(msg.sender, _pid, _amount); } // Withdraw LP tokens from Farm. function withdraw(uint256 _pid, uint256 _amount) internal { PoolInfo storage pool = s().poolInfo[_pid]; UserInfo storage user = s().userInfo[_pid][msg.sender]; require( user.amount >= _amount, "withdraw: can't withdraw more than deposit" ); updatePoolAndHarvest(msg.sender, _pid); user.amount = user.amount - _amount; user.rewardDebt = (user.amount * pool.accERC20PerShare) / 1e18; pool.lpToken.safeTransfer(address(msg.sender), _amount); emit Withdraw(msg.sender, _pid, _amount); } // Withdraw without caring about rewards. EMERGENCY ONLY. function emergencyWithdraw(uint256 _pid) internal { PoolInfo storage pool = s().poolInfo[_pid]; UserInfo storage user = s().userInfo[_pid][msg.sender]; pool.lpToken.safeTransfer(address(msg.sender), user.amount); emit EmergencyWithdraw(msg.sender, _pid, user.amount); user.amount = 0; user.rewardDebt = 0; } // Updates the pool and harvests reward tokens function updatePoolAndHarvest(address _to, uint256 _pid) internal { PoolInfo storage pool = s().poolInfo[_pid]; UserInfo storage user = s().userInfo[_pid][_to]; updatePool(_pid); uint256 userReward = (user.amount * pool.accERC20PerShare) / 1e18; if (user.amount > 0) { uint256 pendingAmount = userReward - user.rewardDebt; s().paidOut += pendingAmount; user.rewardDebt = userReward; s().rewardToken.transfer(_to, pendingAmount); emit Harvest(_to, pendingAmount); } else { user.rewardDebt = userReward; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { ReentrancyGuardStorage } from "../libraries/ReentrancyGuardStorage.sol"; /** * @title Utility contract for preventing reentrancy attacks */ abstract contract ReentrancyGuard { modifier nonReentrant() { ReentrancyGuardStorage.Layout storage l = ReentrancyGuardStorage .layout(); require(l.status != 2, "ReentrancyGuard: reentrant call"); l.status = 2; _; l.status = 1; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../diamond/libraries/LibDiamond.sol"; /** * @title Utility contract for preventing reentrancy attacks */ abstract contract Ownable { modifier onlyOwner() { LibDiamond.enforceIsContractOwner(); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^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.8.0; import "../IERC20.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 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' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @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 require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. } // Info of each pool. struct PoolInfo { IERC20 lpToken; // Address of LP token contract. uint256 allocPoint; // How many allocation points assigned to this pool. ERC20s to distribute per block. uint256 lastRewardBlock; // Last block number that ERC20s distribution occurs. uint256 accERC20PerShare; // Accumulated ERC20s per share, times 1e12. } library FarmStorage { struct Layout { IERC20 rewardToken; // Address of the ERC20 Token contract. uint256 totalRewards; // Amount of rewards to be distributed over the lifetime of the contract uint256 paidOut; // The total amount of ERC20 that's paid out as reward. PoolInfo[] poolInfo; // Info of each pool. mapping(address => bool) poolTokens; // Keep track of which LP tokens are assigned to a pool mapping(uint256 => mapping(address => UserInfo)) userInfo; // Info of each user that stakes LP tokens. uint256 totalAllocPoint; // Total allocation points. Must be the sum of all allocation points in all pools. uint256 startBlock; // The block number when farming starts. uint256 decayPeriod; // # of blocks after which rewards decay. } bytes32 internal constant STORAGE_SLOT = keccak256("aavegotchi.gax.storage.Farm"); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT pragma solidity ^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; 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"); (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"); (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"); (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"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library ReentrancyGuardStorage { struct Layout { uint256 status; } bytes32 internal constant STORAGE_SLOT = keccak256("solidstate.contracts.storage.ReentrancyGuard"); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ import {IDiamondCut} from "../interfaces/IDiamondCut.sol"; library LibDiamond { bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage"); struct FacetAddressAndSelectorPosition { address facetAddress; uint16 selectorPosition; } struct DiamondStorage { // function selector => facet address and selector position in selectors array mapping(bytes4 => FacetAddressAndSelectorPosition) facetAddressAndSelectorPosition; bytes4[] selectors; mapping(bytes4 => bool) supportedInterfaces; // owner of the contract address contractOwner; } function diamondStorage() internal pure returns (DiamondStorage storage ds) { bytes32 position = DIAMOND_STORAGE_POSITION; assembly { ds.slot := position } } event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function setContractOwner(address _newOwner) internal { DiamondStorage storage ds = diamondStorage(); address previousOwner = ds.contractOwner; ds.contractOwner = _newOwner; emit OwnershipTransferred(previousOwner, _newOwner); } function contractOwner() internal view returns (address contractOwner_) { contractOwner_ = diamondStorage().contractOwner; } function enforceIsContractOwner() internal view { require(msg.sender == diamondStorage().contractOwner, "LibDiamond: Must be contract owner"); } event DiamondCut(IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata); // Internal function version of diamondCut function diamondCut( IDiamondCut.FacetCut[] memory _diamondCut, address _init, bytes memory _calldata ) internal { for (uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++) { IDiamondCut.FacetCutAction action = _diamondCut[facetIndex].action; if (action == IDiamondCut.FacetCutAction.Add) { addFunctions( _diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors ); } else if (action == IDiamondCut.FacetCutAction.Replace) { replaceFunctions( _diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors ); } else if (action == IDiamondCut.FacetCutAction.Remove) { removeFunctions( _diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors ); } else { revert("LibDiamondCut: Incorrect FacetCutAction"); } } emit DiamondCut(_diamondCut, _init, _calldata); initializeDiamondCut(_init, _calldata); } function addFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal { require(_functionSelectors.length > 0, "LibDiamondCut: No selectors in facet to cut"); DiamondStorage storage ds = diamondStorage(); uint16 selectorCount = uint16(ds.selectors.length); require(_facetAddress != address(0), "LibDiamondCut: Add facet can't be address(0)"); enforceHasContractCode(_facetAddress, "LibDiamondCut: Add facet has no code"); for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) { bytes4 selector = _functionSelectors[selectorIndex]; address oldFacetAddress = ds.facetAddressAndSelectorPosition[selector].facetAddress; require( oldFacetAddress == address(0), "LibDiamondCut: Can't add function that already exists" ); ds.facetAddressAndSelectorPosition[selector] = FacetAddressAndSelectorPosition( _facetAddress, selectorCount ); ds.selectors.push(selector); selectorCount++; } } function replaceFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal { require(_functionSelectors.length > 0, "LibDiamondCut: No selectors in facet to cut"); DiamondStorage storage ds = diamondStorage(); require(_facetAddress != address(0), "LibDiamondCut: Replace facet can't be address(0)"); enforceHasContractCode(_facetAddress, "LibDiamondCut: Replace facet has no code"); for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) { bytes4 selector = _functionSelectors[selectorIndex]; address oldFacetAddress = ds.facetAddressAndSelectorPosition[selector].facetAddress; // can't replace immutable functions -- functions defined directly in the diamond require( oldFacetAddress != address(this), "LibDiamondCut: Can't replace immutable function" ); require( oldFacetAddress != _facetAddress, "LibDiamondCut: Can't replace function with same function" ); require( oldFacetAddress != address(0), "LibDiamondCut: Can't replace function that doesn't exist" ); // replace old facet address ds.facetAddressAndSelectorPosition[selector].facetAddress = _facetAddress; } } function removeFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal { require(_functionSelectors.length > 0, "LibDiamondCut: No selectors in facet to cut"); DiamondStorage storage ds = diamondStorage(); uint256 selectorCount = ds.selectors.length; require( _facetAddress == address(0), "LibDiamondCut: Remove facet address must be address(0)" ); for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) { bytes4 selector = _functionSelectors[selectorIndex]; FacetAddressAndSelectorPosition memory oldFacetAddressAndSelectorPosition = ds .facetAddressAndSelectorPosition[selector]; require( oldFacetAddressAndSelectorPosition.facetAddress != address(0), "LibDiamondCut: Can't remove function that doesn't exist" ); // can't remove immutable functions -- functions defined directly in the diamond require( oldFacetAddressAndSelectorPosition.facetAddress != address(this), "LibDiamondCut: Can't remove immutable function." ); // replace selector with last selector selectorCount--; if (oldFacetAddressAndSelectorPosition.selectorPosition != selectorCount) { bytes4 lastSelector = ds.selectors[selectorCount]; ds.selectors[oldFacetAddressAndSelectorPosition.selectorPosition] = lastSelector; ds .facetAddressAndSelectorPosition[lastSelector] .selectorPosition = oldFacetAddressAndSelectorPosition.selectorPosition; } // delete last selector ds.selectors.pop(); delete ds.facetAddressAndSelectorPosition[selector]; } } function initializeDiamondCut(address _init, bytes memory _calldata) internal { if (_init == address(0)) { require( _calldata.length == 0, "LibDiamondCut: _init is address(0) but_calldata is not empty" ); } else { require( _calldata.length > 0, "LibDiamondCut: _calldata is empty but _init is not address(0)" ); if (_init != address(this)) { enforceHasContractCode(_init, "LibDiamondCut: _init address has no code"); } (bool success, bytes memory error) = _init.delegatecall(_calldata); if (!success) { if (error.length > 0) { // bubble up the error revert(string(error)); } else { revert("LibDiamondCut: _init function reverted"); } } } } function enforceHasContractCode(address _contract, string memory _errorMessage) internal view { uint256 contractSize; assembly { contractSize := extcodesize(_contract) } require(contractSize > 0, _errorMessage); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ interface IDiamondCut { enum FacetCutAction { Add, Replace, Remove } // Add=0, Replace=1, Remove=2 struct FacetCut { address facetAddress; FacetCutAction action; bytes4[] functionSelectors; } /// @notice Add/replace/remove any number of functions and optionally execute /// a function with delegatecall /// @param _diamondCut Contains the facet addresses and function selectors /// @param _init The address of the contract or facet to execute _calldata /// @param _calldata A function call, including function selector and arguments /// _calldata is executed with delegatecall on _init function diamondCut( FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata ) external; event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata); }
{ "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"contract IERC20","name":"_lpToken","type":"address"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"allUserInfo","outputs":[{"components":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"pending","type":"uint256"},{"internalType":"uint256","name":"userBalance","type":"uint256"},{"internalType":"uint256","name":"poolBalance","type":"uint256"}],"internalType":"struct FarmFacet.UserInfoOutput[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_pids","type":"uint256[]"}],"name":"batchHarvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentRewardPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decayPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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"},{"internalType":"address","name":"_user","type":"address"}],"name":"deposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paidOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pending","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"poolBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"poolInfo","outputs":[{"components":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accERC20PerShare","type":"uint256"}],"internalType":"struct PoolInfo","name":"pi","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"poolTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"year","type":"uint256"}],"name":"rewardPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalPending","outputs":[{"internalType":"uint256","name":"totalPending_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"userInfo","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"internalType":"struct UserInfo","name":"ui","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101735760003560e01c8063630b5ba1116100de578063a912616911610097578063ddc6326211610071578063ddc632621461044c578063e2bbb15814610468578063e4c75c2714610484578063f7c618c1146104b457610173565b8063a9126169146103e2578063bf7f332e14610412578063cb4aec611461042e57610173565b8063630b5ba1146102fc57806364482f79146103065780636a6d964e14610322578063791f39cd1461035257806393f1a40b14610382578063a2383106146103b257610173565b8063441a3e7011610130578063441a3e701461024e57806348cd4cb11461026a57806348d67e1b1461028857806351eb05a6146102a65780635312ea8e146102c25780635c76ca2d146102de57610173565b8063081e3eda146101785780631526fe2714610196578063170956ad146101c657806317caf6f1146101f65780631eaaa045146102145780633f90916a14610230575b600080fd5b6101806104d2565b60405161018d919061255b565b60405180910390f35b6101b060048036038101906101ab91906125b6565b6104e8565b6040516101bd91906126c6565b60405180910390f35b6101e060048036038101906101db919061271f565b6105a1565b6040516101ed9190612863565b60405180910390f35b6101fe610842565b60405161020b919061255b565b60405180910390f35b61022e600480360381019061022991906128fb565b610855565b005b61023861086d565b604051610245919061255b565b60405180910390f35b6102686004803603810190610263919061294e565b6108c1565b005b610272610937565b60405161027f919061255b565b60405180910390f35b61029061094a565b60405161029d919061255b565b60405180910390f35b6102c060048036038101906102bb91906125b6565b61095d565b005b6102dc60048036038101906102d791906125b6565b610969565b005b6102e66109dd565b6040516102f3919061255b565b60405180910390f35b6103046109f0565b005b610320600480360381019061031b919061298e565b6109fa565b005b61033c600480360381019061033791906125b6565b610a12565b604051610349919061255b565b60405180910390f35b61036c600480360381019061036791906125b6565b610ae3565b604051610379919061255b565b60405180910390f35b61039c600480360381019061039791906129e1565b610af5565b6040516103a99190612a50565b60405180910390f35b6103cc60048036038101906103c791906129e1565b610b7d565b6040516103d9919061255b565b60405180910390f35b6103fc60048036038101906103f7919061271f565b610be4565b6040516104099190612a7a565b60405180910390f35b61042c60048036038101906104279190612bee565b610c43565b005b610436610cf0565b604051610443919061255b565b60405180910390f35b610466600480360381019061046191906125b6565b610d49565b005b610482600480360381019061047d919061294e565b610dbe565b005b61049e600480360381019061049991906129e1565b610e34565b6040516104ab919061255b565b60405180910390f35b6104bc61105d565b6040516104c99190612c46565b60405180910390f35b60006104dc611090565b60030180549050905090565b6104f06124a5565b6104f8611090565b600301828154811061050d5761050c612c61565b5b90600052602060002090600402016040518060800160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015481526020016003820154815250509050919050565b606060006105ad611090565b6003018054905067ffffffffffffffff8111156105cd576105cc612aab565b5b60405190808252806020026020018201604052801561060657816020015b6105f36124e3565b8152602001906001900390816105eb5790505b50905060005b610614611090565b60030180549050811015610838576040518060a00160405280610635611090565b600301838154811061064a57610649612c61565b5b906000526020600020906004020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200161069f611090565b60030183815481106106b4576106b3612c61565b5b90600052602060002090600402016001015481526020016106d58387610e34565b81526020016106e2611090565b600501600084815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548152602001610744611090565b600301838154811061075957610758612c61565b5b906000526020600020906004020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016107c39190612c9f565b602060405180830381865afa1580156107e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108049190612ccf565b81525082828151811061081a57610819612c61565b5b6020026020010181905250808061083090612d2b565b91505061060c565b5080915050919050565b600061084c611090565b60060154905090565b61085d61109f565b61086883838361113a565b505050565b600080610878611090565b60070154905080431161088f5760009150506108be565b610897611090565b600201546108b08283436108ab9190612d73565b611364565b6108ba9190612d73565b9150505b90565b60006108cb611480565b90506002816000015403610914576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b90612e04565b60405180910390fd5b6002816000018190555061092883836114ad565b60018160000181905550505050565b6000610941611090565b60070154905090565b6000610954611090565b60080154905090565b61096681611675565b50565b6000610973611480565b905060028160000154036109bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b390612e04565b60405180910390fd5b600281600001819055506109cf82611804565b600181600001819055505050565b60006109e7611090565b60020154905090565b6109f861194f565b565b610a0261109f565b610a0d838383611985565b505050565b6000610a1c611090565b6003018281548110610a3157610a30612c61565b5b906000526020600020906004020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610a9b9190612c9f565b602060405180830381865afa158015610ab8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adc9190612ccf565b9050919050565b6000610aee82611b0e565b9050919050565b610afd612528565b610b05611090565b600501600084815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180604001604052908160008201548152602001600182015481525050905092915050565b6000610b87611090565b600501600084815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154905092915050565b6000610bee611090565b60040160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000610c4d611480565b90506002816000015403610c96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8d90612e04565b60405180910390fd5b6002816000018190555060005b8251811015610ce157610cd033848381518110610cc357610cc2612c61565b5b6020026020010151611d15565b80610cda90612d2b565b9050610ca3565b50600181600001819055505050565b6000610cfa611090565b60070154431015610d0e5760009050610d46565b610d43610d19611090565b60080154610d25611090565b6007015443610d349190612d73565b610d3e9190612e53565b611b0e565b90505b90565b6000610d53611480565b90506002816000015403610d9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d9390612e04565b60405180910390fd5b60028160000181905550610db03383611d15565b600181600001819055505050565b6000610dc8611480565b90506002816000015403610e11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0890612e04565b60405180910390fd5b60028160000181905550610e258383611f30565b60018160000181905550505050565b600080610e3f611090565b6003018481548110610e5457610e53612c61565b5b906000526020600020906004020190506000610e6e611090565b600501600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008260030154905060008360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610f299190612c9f565b602060405180830381865afa158015610f46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f6a9190612ccf565b9050836002015443118015610f80575060008114155b15610fff576000846002015443610f979190612d73565b90506000610fa3611090565b600601548660010154610fba886002015485611364565b610fc49190612e84565b610fce9190612e53565b905082670de0b6b3a764000082610fe59190612e84565b610fef9190612e53565b84610ffa9190612ede565b935050505b6000670de0b6b3a764000083856000015461101a9190612e84565b6110249190612e53565b90508360010154811161103f57600095505050505050611057565b83600101548161104f9190612d73565b955050505050505b92915050565b6000611067611090565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600061109a6120c0565b905090565b6110a76120ed565b60030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611138576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112f90612fa6565b60405180910390fd5b565b61114261211a565b60040160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c790613012565b60405180910390fd5b60016111da61211a565b60040160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080156112405761123f61194f565b5b600061124a61211a565b6007015443116112655761125c61211a565b60070154611267565b435b90508361127261211a565b60060160008282546112849190612ede565b9250508190555061129361211a565b60030160405180608001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018381526020016000815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002015560608201518160030155505050505050565b60008061136f61211a565b600801549050600061137f61211a565b600701548561138e9190612d73565b90506000828261139e9190613032565b836113a99190612d73565b9050600083836113b99190612e53565b90508186106113c857816113ca565b855b6113d382611b0e565b6113dd9190612e84565b856113e89190612ede565b94508186111561147657806113fc90612d2b565b9050818661140a9190612d73565b95505b838610611454578361141e82611b0e565b6114289190612e84565b856114339190612ede565b945083866114419190612d73565b95508061144d90612d2b565b905061140d565b8561145e82611b0e565b6114689190612e84565b856114739190612ede565b94505b5050505092915050565b6000807f09acf4e54214992e70883cf7dcd6957ff2c71cd9e14df4bec4383bc0d11607dc90508091505090565b60006114b761211a565b60030183815481106114cc576114cb612c61565b5b9060005260206000209060040201905060006114e661211a565b600501600085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508281600001541015611580576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611577906130d5565b60405180910390fd5b61158a3385611d15565b82816000015461159a9190612d73565b8160000181905550670de0b6b3a7640000826003015482600001546115bf9190612e84565b6115c99190612e53565b816001018190555061162033848460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166121299092919063ffffffff16565b833373ffffffffffffffffffffffffffffffffffffffff167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56885604051611667919061255b565b60405180910390a350505050565b600061167f61211a565b600301828154811061169457611693612c61565b5b90600052602060002090600402019050806002015443116116b55750611801565b60008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016117149190612c9f565b602060405180830381865afa158015611731573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117559190612ccf565b90506000810361176f574382600201819055505050611801565b60008260020154436117819190612d73565b9050600061178d61211a565b6006015484600101546117a4866002015485611364565b6117ae9190612e84565b6117b89190612e53565b905082670de0b6b3a7640000826117cf9190612e84565b6117d99190612e53565b8460030160008282546117ec9190612ede565b92505081905550438460020181905550505050505b50565b600061180e61211a565b600301828154811061182357611822612c61565b5b90600052602060002090600402019050600061183d61211a565b600501600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506118e33382600001548460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166121299092919063ffffffff16565b823373ffffffffffffffffffffffffffffffffffffffff167fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae0595836000015460405161192e919061255b565b60405180910390a36000816000018190555060008160010181905550505050565b600061195961211a565b60030180549050905060005b818110156119815761197681611675565b806001019050611965565b5050565b61198d61211a565b600401600061199a61211a565b60030185815481106119af576119ae612c61565b5b906000526020600020906004020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611a68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5f90613141565b60405180910390fd5b8015611a7757611a7661194f565b5b81611a8061211a565b6003018481548110611a9557611a94612c61565b5b906000526020600020906004020160010154611aaf61211a565b60060154611abd9190612d73565b611ac79190612ede565b611acf61211a565b6006018190555081611adf61211a565b6003018481548110611af457611af3612c61565b5b906000526020600020906004020160010181905550505050565b600080604051806103c00160405280690186d826093ac1fe700081526020016901476597f90b788ef40081526020016901123fc39e41a2687c00815260200168e5baa0f9635e9c4800815260200168c06fa3ff2e12fe9200815260200168a13274ffcc72f9600081526020016887077dcfa7a051d000815260200168711bff99723179ee008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152602001685ebf719b607b6872008152509050601e8310611cf4576000915050611d10565b8083601e8110611d0757611d06612c61565b5b60200201519150505b919050565b6000611d1f61211a565b6003018281548110611d3457611d33612c61565b5b906000526020600020906004020190506000611d4e61211a565b600501600084815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050611daa83611675565b6000670de0b6b3a764000083600301548360000154611dc99190612e84565b611dd39190612e53565b9050600082600001541115611f1f576000826001015482611df49190612d73565b905080611dff61211a565b6002016000828254611e119190612ede565b92505081905550818360010181905550611e2961211a565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb87836040518363ffffffff1660e01b8152600401611e87929190613161565b6020604051808303816000875af1158015611ea6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eca919061319f565b508573ffffffffffffffffffffffffffffffffffffffff167fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba82604051611f11919061255b565b60405180910390a250611f29565b8082600101819055505b5050505050565b6000611f3a61211a565b6003018381548110611f4f57611f4e612c61565b5b906000526020600020906004020190506000611f6961211a565b600501600085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050611fc63385611d15565b600083111561203c576120203330858560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166121af909392919063ffffffff16565b828160000160008282546120349190612ede565b925050819055505b670de0b6b3a7640000826003015482600001546120599190612e84565b6120639190612e53565b8160010181905550833373ffffffffffffffffffffffffffffffffffffffff167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15856040516120b2919061255b565b60405180910390a350505050565b6000807fb1c09c23d0c9173e32635facb59575f7e70731254f8f6977e454deff413dd56a90508091505090565b6000807fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90508091505090565b60006121246120c0565b905090565b6121aa8363a9059cbb60e01b8484604051602401612148929190613161565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612238565b505050565b612232846323b872dd60e01b8585856040516024016121d0939291906131cc565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612238565b50505050565b600061229a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166122ff9092919063ffffffff16565b90506000815111156122fa57808060200190518101906122ba919061319f565b6122f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122f090613275565b60405180910390fd5b5b505050565b606061230e8484600085612317565b90509392505050565b60608247101561235c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161235390613307565b60405180910390fd5b6123658561242b565b6123a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161239b90613373565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516123cd919061340d565b60006040518083038185875af1925050503d806000811461240a576040519150601f19603f3d011682016040523d82523d6000602084013e61240f565b606091505b509150915061241f82828661243e565b92505050949350505050565b600080823b905060008111915050919050565b6060831561244e5782905061249e565b6000835111156124615782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124959190613468565b60405180910390fd5b9392505050565b6040518060800160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001600081525090565b6040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001600081525090565b604051806040016040528060008152602001600081525090565b6000819050919050565b61255581612542565b82525050565b6000602082019050612570600083018461254c565b92915050565b6000604051905090565b600080fd5b600080fd5b61259381612542565b811461259e57600080fd5b50565b6000813590506125b08161258a565b92915050565b6000602082840312156125cc576125cb612580565b5b60006125da848285016125a1565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061262861262361261e846125e3565b612603565b6125e3565b9050919050565b600061263a8261260d565b9050919050565b600061264c8261262f565b9050919050565b61265c81612641565b82525050565b61266b81612542565b82525050565b6080820160008201516126876000850182612653565b50602082015161269a6020850182612662565b5060408201516126ad6040850182612662565b5060608201516126c06060850182612662565b50505050565b60006080820190506126db6000830184612671565b92915050565b60006126ec826125e3565b9050919050565b6126fc816126e1565b811461270757600080fd5b50565b600081359050612719816126f3565b92915050565b60006020828403121561273557612734612580565b5b60006127438482850161270a565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60a08201600082015161278e6000850182612653565b5060208201516127a16020850182612662565b5060408201516127b46040850182612662565b5060608201516127c76060850182612662565b5060808201516127da6080850182612662565b50505050565b60006127ec8383612778565b60a08301905092915050565b6000602082019050919050565b60006128108261274c565b61281a8185612757565b935061282583612768565b8060005b8381101561285657815161283d88826127e0565b9750612848836127f8565b925050600181019050612829565b5085935050505092915050565b6000602082019050818103600083015261287d8184612805565b905092915050565b6000612890826126e1565b9050919050565b6128a081612885565b81146128ab57600080fd5b50565b6000813590506128bd81612897565b92915050565b60008115159050919050565b6128d8816128c3565b81146128e357600080fd5b50565b6000813590506128f5816128cf565b92915050565b60008060006060848603121561291457612913612580565b5b6000612922868287016125a1565b9350506020612933868287016128ae565b9250506040612944868287016128e6565b9150509250925092565b6000806040838503121561296557612964612580565b5b6000612973858286016125a1565b9250506020612984858286016125a1565b9150509250929050565b6000806000606084860312156129a7576129a6612580565b5b60006129b5868287016125a1565b93505060206129c6868287016125a1565b92505060406129d7868287016128e6565b9150509250925092565b600080604083850312156129f8576129f7612580565b5b6000612a06858286016125a1565b9250506020612a178582860161270a565b9150509250929050565b604082016000820151612a376000850182612662565b506020820151612a4a6020850182612662565b50505050565b6000604082019050612a656000830184612a21565b92915050565b612a74816128c3565b82525050565b6000602082019050612a8f6000830184612a6b565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612ae382612a9a565b810181811067ffffffffffffffff82111715612b0257612b01612aab565b5b80604052505050565b6000612b15612576565b9050612b218282612ada565b919050565b600067ffffffffffffffff821115612b4157612b40612aab565b5b602082029050602081019050919050565b600080fd5b6000612b6a612b6584612b26565b612b0b565b90508083825260208201905060208402830185811115612b8d57612b8c612b52565b5b835b81811015612bb65780612ba288826125a1565b845260208401935050602081019050612b8f565b5050509392505050565b600082601f830112612bd557612bd4612a95565b5b8135612be5848260208601612b57565b91505092915050565b600060208284031215612c0457612c03612580565b5b600082013567ffffffffffffffff811115612c2257612c21612585565b5b612c2e84828501612bc0565b91505092915050565b612c4081612641565b82525050565b6000602082019050612c5b6000830184612c37565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b612c99816126e1565b82525050565b6000602082019050612cb46000830184612c90565b92915050565b600081519050612cc98161258a565b92915050565b600060208284031215612ce557612ce4612580565b5b6000612cf384828501612cba565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612d3682612542565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612d6857612d67612cfc565b5b600182019050919050565b6000612d7e82612542565b9150612d8983612542565b925082821015612d9c57612d9b612cfc565b5b828203905092915050565b600082825260208201905092915050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000612dee601f83612da7565b9150612df982612db8565b602082019050919050565b60006020820190508181036000830152612e1d81612de1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612e5e82612542565b9150612e6983612542565b925082612e7957612e78612e24565b5b828204905092915050565b6000612e8f82612542565b9150612e9a83612542565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612ed357612ed2612cfc565b5b828202905092915050565b6000612ee982612542565b9150612ef483612542565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612f2957612f28612cfc565b5b828201905092915050565b7f4c69624469616d6f6e643a204d75737420626520636f6e7472616374206f776e60008201527f6572000000000000000000000000000000000000000000000000000000000000602082015250565b6000612f90602283612da7565b9150612f9b82612f34565b604082019050919050565b60006020820190508181036000830152612fbf81612f83565b9050919050565b7f6164643a204c5020746f6b656e20616c72656164792061646465640000000000600082015250565b6000612ffc601b83612da7565b915061300782612fc6565b602082019050919050565b6000602082019050818103600083015261302b81612fef565b9050919050565b600061303d82612542565b915061304883612542565b92508261305857613057612e24565b5b828206905092915050565b7f77697468647261773a2063616e2774207769746864726177206d6f726520746860008201527f616e206465706f73697400000000000000000000000000000000000000000000602082015250565b60006130bf602a83612da7565b91506130ca82613063565b604082019050919050565b600060208201905081810360008301526130ee816130b2565b9050919050565b7f7365743a204c5020746f6b656e206e6f74206164646564000000000000000000600082015250565b600061312b601783612da7565b9150613136826130f5565b602082019050919050565b6000602082019050818103600083015261315a8161311e565b9050919050565b60006040820190506131766000830185612c90565b613183602083018461254c565b9392505050565b600081519050613199816128cf565b92915050565b6000602082840312156131b5576131b4612580565b5b60006131c38482850161318a565b91505092915050565b60006060820190506131e16000830186612c90565b6131ee6020830185612c90565b6131fb604083018461254c565b949350505050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b600061325f602a83612da7565b915061326a82613203565b604082019050919050565b6000602082019050818103600083015261328e81613252565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b60006132f1602683612da7565b91506132fc82613295565b604082019050919050565b60006020820190508181036000830152613320816132e4565b9050919050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b600061335d601d83612da7565b915061336882613327565b602082019050919050565b6000602082019050818103600083015261338c81613350565b9050919050565b600081519050919050565b600081905092915050565b60005b838110156133c75780820151818401526020810190506133ac565b838111156133d6576000848401525b50505050565b60006133e782613393565b6133f1818561339e565b93506134018185602086016133a9565b80840191505092915050565b600061341982846133dc565b915081905092915050565b600081519050919050565b600061343a82613424565b6134448185612da7565b93506134548185602086016133a9565b61345d81612a9a565b840191505092915050565b60006020820190508181036000830152613482818461342f565b90509291505056fea26469706673582212203dcdbd2b38e3099c79cb0aa31031f76024fe4b73892928a41a3353a95f320d9464736f6c634300080d0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.