More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 1,508 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw All | 13537037 | 1209 days ago | IN | 0 ETH | 0.01698668 | ||||
Withdraw LP Toke... | 13445414 | 1223 days ago | IN | 0 ETH | 0.00785733 | ||||
Withdraw LP Toke... | 13442553 | 1224 days ago | IN | 0 ETH | 0.01119772 | ||||
Withdraw LP Toke... | 13441591 | 1224 days ago | IN | 0 ETH | 0.00690744 | ||||
Withdraw LP Toke... | 13440355 | 1224 days ago | IN | 0 ETH | 0.00615277 | ||||
Withdraw LP Toke... | 13435962 | 1225 days ago | IN | 0 ETH | 0.00783037 | ||||
Withdraw LP Toke... | 13390884 | 1232 days ago | IN | 0 ETH | 0.00641887 | ||||
Withdraw LP Toke... | 13361438 | 1236 days ago | IN | 0 ETH | 0.0232429 | ||||
Withdraw LP Toke... | 13346481 | 1239 days ago | IN | 0 ETH | 0.00422011 | ||||
Withdraw LP Toke... | 13339028 | 1240 days ago | IN | 0 ETH | 0.00518968 | ||||
Withdraw LP Toke... | 13332728 | 1241 days ago | IN | 0 ETH | 0.00779993 | ||||
Withdraw LP Toke... | 13326337 | 1242 days ago | IN | 0 ETH | 0.00609855 | ||||
Withdraw LP Toke... | 13320511 | 1243 days ago | IN | 0 ETH | 0.00541116 | ||||
Withdraw LP Toke... | 13320398 | 1243 days ago | IN | 0 ETH | 0.00604977 | ||||
Withdraw LP Toke... | 13311012 | 1244 days ago | IN | 0 ETH | 0.00794157 | ||||
Withdraw LP Toke... | 13311012 | 1244 days ago | IN | 0 ETH | 0.0095666 | ||||
Withdraw LP Toke... | 13278055 | 1249 days ago | IN | 0 ETH | 0.00798742 | ||||
Withdraw LP Toke... | 13277369 | 1249 days ago | IN | 0 ETH | 0.00672173 | ||||
Withdraw LP Toke... | 13254736 | 1253 days ago | IN | 0 ETH | 0.00355453 | ||||
Withdraw LP Toke... | 13254665 | 1253 days ago | IN | 0 ETH | 0.00457382 | ||||
Withdraw LP Toke... | 13254505 | 1253 days ago | IN | 0 ETH | 0.00340941 | ||||
Withdraw LP Toke... | 13250604 | 1254 days ago | IN | 0 ETH | 0.00630296 | ||||
Withdraw LP Toke... | 13194130 | 1262 days ago | IN | 0 ETH | 0.0073976 | ||||
Withdraw LP Toke... | 13111185 | 1275 days ago | IN | 0 ETH | 0.00815905 | ||||
Withdraw LP Toke... | 13087803 | 1279 days ago | IN | 0 ETH | 0.00528243 |
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers. Name tag integration is not available in advanced view.
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
||||
---|---|---|---|---|---|---|---|
13537037 | 1209 days ago | 0 ETH | |||||
13537037 | 1209 days ago | 0 ETH | |||||
13537037 | 1209 days ago | 0 ETH | |||||
13537037 | 1209 days ago | 0 ETH | |||||
13537037 | 1209 days ago | 0 ETH | |||||
13537037 | 1209 days ago | 0 ETH | |||||
13445414 | 1223 days ago | 0 ETH | |||||
13445414 | 1223 days ago | 0 ETH | |||||
13445414 | 1223 days ago | 0 ETH | |||||
13445414 | 1223 days ago | 0 ETH | |||||
13445414 | 1223 days ago | 0 ETH | |||||
13445414 | 1223 days ago | 0 ETH | |||||
13442553 | 1224 days ago | 0 ETH | |||||
13442553 | 1224 days ago | 0 ETH | |||||
13442553 | 1224 days ago | 0 ETH | |||||
13442553 | 1224 days ago | 0 ETH | |||||
13442553 | 1224 days ago | 0 ETH | |||||
13442553 | 1224 days ago | 0 ETH | |||||
13441591 | 1224 days ago | 0 ETH | |||||
13441591 | 1224 days ago | 0 ETH | |||||
13441591 | 1224 days ago | 0 ETH | |||||
13441591 | 1224 days ago | 0 ETH | |||||
13441591 | 1224 days ago | 0 ETH | |||||
13441591 | 1224 days ago | 0 ETH | |||||
13440355 | 1224 days ago | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
AxionMine
Compiler Version
v0.6.8+commit.0bbfe453
Optimization Enabled:
Yes with 0 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.6.8; import '../abstracts/Manageable.sol'; import '@openzeppelin/contracts/math/SafeMath.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import '@uniswap/lib/contracts/libraries/TransferHelper.sol'; import '@openzeppelin/contracts-upgradeable/proxy/Initializable.sol'; contract AxionMine is Initializable, Manageable { using SafeMath for uint256; using SafeERC20 for IERC20; struct Miner { uint256 lpDeposit; uint256 accReward; } struct Mine { IERC20 lpToken; IERC20 rewardToken; uint256 startBlock; uint256 lastRewardBlock; uint256 blockReward; uint256 accRewardPerLPToken; IERC721 liqRepNFT; IERC721 OG5555_25NFT; IERC721 OG5555_100NFT; } Mine public mineInfo; mapping(address => Miner) public minerInfo; event Deposit(address indexed minerAddress, uint256 lpTokenAmount); event Withdraw(address indexed minerAddress, uint256 lpTokenAmount); event WithdrawReward( address indexed minerAddress, uint256 rewardTokenAmount ); modifier mineUpdater() { updateMine(); _; } function updateMine() internal { if (block.number <= mineInfo.lastRewardBlock) { return; } uint256 lpSupply = mineInfo.lpToken.balanceOf(address(this)); if (lpSupply != 0) { mineInfo.accRewardPerLPToken = getAccRewardPerLPToken(lpSupply); } mineInfo.lastRewardBlock = block.number; } function getAccRewardPerLPToken(uint256 _lpSupply) internal view returns (uint256) { uint256 newBlocks = block.number.sub(mineInfo.lastRewardBlock); uint256 reward = newBlocks.mul(mineInfo.blockReward); return mineInfo.accRewardPerLPToken.add(reward.mul(1e12).div(_lpSupply)); } function getAccReward(uint256 _lpDeposit) internal view returns (uint256) { return _lpDeposit.mul(mineInfo.accRewardPerLPToken).div(1e12); } function withdrawReward() external mineUpdater { Miner storage miner = minerInfo[msg.sender]; uint256 accReward = getAccReward(miner.lpDeposit); uint256 reward = handleNFT(accReward.sub(miner.accReward)); require(reward != 0, 'NOTHING_TO_WITHDRAW'); safeRewardTransfer(reward); emit WithdrawReward(msg.sender, reward); miner.accReward = accReward; } function depositLPTokens(uint256 _amount) external mineUpdater { require(_amount != 0, 'ZERO_AMOUNT'); Miner storage miner = minerInfo[msg.sender]; uint256 reward = getReward(miner); if (reward != 0) { safeRewardTransfer(reward); emit WithdrawReward(msg.sender, reward); } mineInfo.lpToken.safeTransferFrom( address(msg.sender), address(this), _amount ); emit Deposit(msg.sender, _amount); miner.lpDeposit = miner.lpDeposit.add(_amount); miner.accReward = getAccReward(miner.lpDeposit); } function withdrawLPTokens(uint256 _amount) external mineUpdater { Miner storage miner = minerInfo[msg.sender]; require(miner.lpDeposit != 0, 'NOTHING_TO_WITHDRAW'); require(miner.lpDeposit >= _amount, 'INVALID_AMOUNT'); uint256 reward = getReward(miner); if (reward != 0) { safeRewardTransfer(reward); emit WithdrawReward(msg.sender, reward); } mineInfo.lpToken.safeTransfer(address(msg.sender), _amount); emit Withdraw(msg.sender, _amount); miner.lpDeposit = miner.lpDeposit.sub(_amount); miner.accReward = getAccReward(miner.lpDeposit); } function withdrawAll() external mineUpdater { Miner storage miner = minerInfo[msg.sender]; require(miner.lpDeposit != 0, 'NOTHING_TO_WITHDRAW'); uint256 reward = getReward(miner); if (reward != 0) { safeRewardTransfer(reward); emit WithdrawReward(msg.sender, reward); } mineInfo.lpToken.safeTransfer(address(msg.sender), miner.lpDeposit); emit Withdraw(msg.sender, miner.lpDeposit); miner.lpDeposit = 0; miner.accReward = 0; } function safeRewardTransfer(uint256 _amount) internal { uint256 rewardBalance = mineInfo.rewardToken.balanceOf(address(this)); if (rewardBalance == 0) return; if (_amount > rewardBalance) { mineInfo.rewardToken.transfer(msg.sender, rewardBalance); } else { mineInfo.rewardToken.transfer(msg.sender, _amount); } } function getReward(Miner storage miner) internal view returns (uint256) { return handleNFT(getAccReward(miner.lpDeposit).sub(miner.accReward)); } function handleNFT(uint256 _amount) internal view returns (uint256) { uint256 penalty = _amount.div(10); if (mineInfo.liqRepNFT.balanceOf(msg.sender) == 0) { _amount = _amount.sub(penalty); } if (mineInfo.OG5555_25NFT.balanceOf(msg.sender) == 0) { _amount = _amount.sub(penalty); } if (mineInfo.OG5555_100NFT.balanceOf(msg.sender) == 0) { _amount = _amount.sub(penalty); } return _amount; } function transferRewardTokens(address _to) external onlyManager { uint256 rewardBalance = mineInfo.rewardToken.balanceOf(address(this)); mineInfo.rewardToken.transfer(_to, rewardBalance); } constructor(address _mineManager) public { _setupRole(MANAGER_ROLE, _mineManager); } function initialize( address _rewardTokenAddress, uint256 _rewardTokenAmount, address _lpTokenAddress, uint256 _startBlock, uint256 _blockReward, address _liqRepNFTAddress, address _OG5555_25NFTAddress, address _OG5555_100NFTAddress ) public initializer { TransferHelper.safeTransferFrom( address(_rewardTokenAddress), msg.sender, address(this), _rewardTokenAmount ); uint256 lastRewardBlock = block.number > _startBlock ? block.number : _startBlock; mineInfo = Mine( IERC20(_lpTokenAddress), IERC20(_rewardTokenAddress), _startBlock, lastRewardBlock, _blockReward, 0, IERC721(_liqRepNFTAddress), IERC721(_OG5555_25NFTAddress), IERC721(_OG5555_100NFTAddress) ); } function getPendingReward() external view returns (uint256) { uint256 rewardBalance = mineInfo.rewardToken.balanceOf(address(this)); if (rewardBalance == 0) return 0; Miner storage miner = minerInfo[msg.sender]; uint256 accRewardPerLPToken = mineInfo.accRewardPerLPToken; uint256 lpSupply = mineInfo.lpToken.balanceOf(address(this)); if (block.number > mineInfo.lastRewardBlock && lpSupply != 0) { accRewardPerLPToken = getAccRewardPerLPToken(lpSupply); } return handleNFT( miner.lpDeposit.mul(accRewardPerLPToken).div(1e12).sub( miner.accReward ) ); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.4.25 <0.7.0; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; abstract contract Manageable is AccessControlUpgradeable { bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE"); modifier onlyManager() { require( hasRole(MANAGER_ROLE, _msgSender()), "Caller is not a manager role" ); _; } /** Roles management - only for multi sig address */ function setupRole(bytes32 role, address account) external onlyManager { _setupRole(role, account); } function isManager() external view returns (bool) { return hasRole(MANAGER_ROLE, _msgSender()); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
// 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.2 <0.8.0; import "../../introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; }
// 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"); } } }
pragma solidity >=0.6.0; // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove(address token, address to, uint value) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED'); } function safeTransfer(address token, address to, uint value) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED'); } function safeTransferFrom(address token, address from, address to, uint value) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED'); } function safeTransferETH(address to, uint value) internal { (bool success,) = to.call{value:value}(new bytes(0)); require(success, 'TransferHelper: ETH_TRANSFER_FAILED'); } }
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. address self = address(this); uint256 cs; // solhint-disable-next-line no-inline-assembly assembly { cs := extcodesize(self) } return cs == 0; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/EnumerableSetUpgradeable.sol"; import "../utils/AddressUpgradeable.sol"; import "../GSN/ContextUpgradeable.sol"; import "../proxy/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable { function __AccessControl_init() internal initializer { __Context_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal initializer { } using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; using AddressUpgradeable for address; struct RoleData { EnumerableSetUpgradeable.AddressSet members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view returns (bool) { return _roles[role].members.contains(account); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view returns (address) { return _roles[role].members.at(index); } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke"); _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { emit RoleAdminChanged(role, _roles[role].adminRole, adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (_roles[role].members.add(account)) { emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (_roles[role].members.remove(account)) { emit RoleRevoked(role, account, _msgSender()); } } uint256[49] private __gap; }
// 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 EnumerableSetUpgradeable { // 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(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(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(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(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.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../proxy/Initializable.sol"; /* * @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 ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } 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; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// 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); } 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); } } } }
{ "optimizer": { "enabled": true, "runs": 0 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_mineManager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"minerAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"lpTokenAmount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"minerAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"lpTokenAmount","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"minerAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardTokenAmount","type":"uint256"}],"name":"WithdrawReward","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositLPTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getPendingReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardTokenAddress","type":"address"},{"internalType":"uint256","name":"_rewardTokenAmount","type":"uint256"},{"internalType":"address","name":"_lpTokenAddress","type":"address"},{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_blockReward","type":"uint256"},{"internalType":"address","name":"_liqRepNFTAddress","type":"address"},{"internalType":"address","name":"_OG5555_25NFTAddress","type":"address"},{"internalType":"address","name":"_OG5555_100NFTAddress","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isManager","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mineInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"contract IERC20","name":"rewardToken","type":"address"},{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"blockReward","type":"uint256"},{"internalType":"uint256","name":"accRewardPerLPToken","type":"uint256"},{"internalType":"contract IERC721","name":"liqRepNFT","type":"address"},{"internalType":"contract IERC721","name":"OG5555_25NFT","type":"address"},{"internalType":"contract IERC721","name":"OG5555_100NFT","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"minerInfo","outputs":[{"internalType":"uint256","name":"lpDeposit","type":"uint256"},{"internalType":"uint256","name":"accReward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"setupRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"transferRewardTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawLPTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawReward","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50604051620020ba380380620020ba833981810160405260208110156200003757600080fd5b5051604080516b4d414e414745525f524f4c4560a01b8152905190819003600c0190206200006f90826001600160e01b036200007616565b50620001b0565b6200008b82826001600160e01b036200008f16565b5050565b6000828152603360209081526040909120620000b691839062000f6d62000113821b17901c565b156200008b57620000cf6001600160e01b036200013c16565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600062000133836001600160a01b0384166001600160e01b036200014016565b90505b92915050565b3390565b60006200015783836001600160e01b036200019816565b6200018f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000136565b50600062000136565b60009081526001919091016020526040902054151590565b611efa80620001c06000396000f3fe608060405234801561001057600080fd5b50600436106100fc5760003560e01c806303337fd814610101578063248a9ca3146101405780632f2ff15d1461016f57806336568abe1461019d5780633b7b67ec146101c957806341f264f114610222578063452d003f1461023f5780635a23248d1461025c578063853828b6146102645780639010d07c1461026c578063912d6eb6146102ab57806391d14854146102d1578063a217fddf14610311578063ab5f522114610319578063c56a3e881461037d578063c885bc5814610385578063ca15c8731461038d578063d547741f146103aa578063ec87621c146103d6578063fa82ac76146103de575b600080fd5b6101276004803603602081101561011757600080fd5b50356001600160a01b031661040a565b6040805192835260208301919091528051918290030190f35b61015d6004803603602081101561015657600080fd5b5035610423565b60408051918252519081900360200190f35b61019b6004803603604081101561018557600080fd5b50803590602001356001600160a01b0316610438565b005b61019b600480360360408110156101b357600080fd5b50803590602001356001600160a01b03166104a4565b61019b60048036036101008110156101e057600080fd5b506001600160a01b038135811691602081013591604082013581169160608101359160808201359160a081013582169160c082013581169160e0013516610505565b61019b6004803603602081101561023857600080fd5b5035610686565b61019b6004803603602081101561025557600080fd5b503561079c565b61015d6108d7565b61019b610a67565b61028f6004803603604081101561028257600080fd5b5080359060200135610b5d565b604080516001600160a01b039092168252519081900360200190f35b61019b600480360360208110156102c157600080fd5b50356001600160a01b0316610b84565b6102fd600480360360408110156102e757600080fd5b50803590602001356001600160a01b0316610d00565b604080519115158252519081900360200190f35b61015d610d1e565b610321610d23565b604080516001600160a01b039a8b168152988a1660208a0152888101979097526060880195909552608087019390935260a0860191909152851660c0850152841660e08401529092166101008201529051908190036101200190f35b6102fd610d5a565b61019b610d8f565b61015d600480360360208110156103a357600080fd5b5035610e52565b61019b600480360360408110156103c057600080fd5b50803590602001356001600160a01b0316610e69565b61015d610ec2565b61019b600480360360408110156103f457600080fd5b50803590602001356001600160a01b0316610ee6565b606e602052600090815260409020805460019091015482565b60009081526033602052604090206002015490565b60008281526033602052604090206002015461045b90610456610f82565b610d00565b6104965760405162461bcd60e51b815260040180806020018281038252602f815260200180611d5a602f913960400191505060405180910390fd5b6104a08282610f86565b5050565b6104ac610f82565b6001600160a01b0316816001600160a01b0316146104fb5760405162461bcd60e51b815260040180806020018281038252602f815260200180611e96602f913960400191505060405180910390fd5b6104a08282610ff5565b600054610100900460ff168061051e575061051e611064565b8061052c575060005460ff16155b6105675760405162461bcd60e51b815260040180806020018281038252602e815260200180611dd9602e913960400191505060405180910390fd5b600054610100900460ff16158015610592576000805460ff1961ff0019909116610100171660011790555b61059e8933308b61106a565b60008643116105ad57866105af565b435b60408051610120810182526001600160a01b03808c168083528e8216602084018190529383018c905260608301859052608083018b9052600060a084018190528a831660c085018190528a841660e08601819052938a16610100909501859052606580546001600160a01b0319908116909417905560668054841690961790955560678d905560689590955560698b9055606a94909455606b80548516909317909255606c80548416909217909155606d805490921617905550801561067b576000805461ff00191690555b505050505050505050565b61068e6111c7565b806106ce576040805162461bcd60e51b815260206004820152600b60248201526a16915493d7d05353d5539560aa1b604482015290519081900360640190fd5b336000908152606e60205260408120906106e782611269565b9050801561071d576106f881611283565b6040805182815290513391600080516020611e28833981519152919081900360200190a25b60655461073b906001600160a01b031633308663ffffffff6113ec16565b60408051848152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a28154610783908463ffffffff61144616565b80835561078f9061149e565b8260010181905550505050565b6107a46111c7565b336000908152606e6020526040902080546107fc576040805162461bcd60e51b81526020600482015260136024820152724e4f5448494e475f544f5f574954484452415760681b604482015290519081900360640190fd5b8054821115610843576040805162461bcd60e51b815260206004820152600e60248201526d1253959053125117d05353d5539560921b604482015290519081900360640190fd5b600061084e82611269565b905080156108845761085f81611283565b6040805182815290513391600080516020611e28833981519152919081900360200190a25b6065546108a1906001600160a01b0316338563ffffffff6114c116565b6040805184815290513391600080516020611d89833981519152919081900360200190a28154610783908463ffffffff61151816565b606654604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561092757600080fd5b505afa15801561093b573d6000803e3d6000fd5b505050506040513d602081101561095157600080fd5b5051905080610964576000915050610a64565b336000908152606e60209081526040808320606a5460655483516370a0823160e01b815230600482015293519295919491936001600160a01b03909116926370a0823192602480840193919291829003018186803b1580156109c557600080fd5b505afa1580156109d9573d6000803e3d6000fd5b505050506040513d60208110156109ef57600080fd5b505160685490915043118015610a0457508015155b15610a1557610a128161155a565b91505b610a5d610a588460010154610a4c64e8d4a51000610a408789600001546115c290919063ffffffff16565b9063ffffffff61161b16565b9063ffffffff61151816565b61165a565b9450505050505b90565b610a6f6111c7565b336000908152606e602052604090208054610ac7576040805162461bcd60e51b81526020600482015260136024820152724e4f5448494e475f544f5f574954484452415760681b604482015290519081900360640190fd5b6000610ad282611269565b90508015610b0857610ae381611283565b6040805182815290513391600080516020611e28833981519152919081900360200190a25b8154606554610b2a916001600160a01b0390911690339063ffffffff6114c116565b815460408051918252513391600080516020611d89833981519152919081900360200190a2506000808255600190910155565b6000828152603360205260408120610b7b908363ffffffff61182216565b90505b92915050565b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c019020610bb190610456610f82565b610c01576040805162461bcd60e51b815260206004820152601c60248201527b43616c6c6572206973206e6f742061206d616e6167657220726f6c6560201b604482015290519081900360640190fd5b606654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610c4c57600080fd5b505afa158015610c60573d6000803e3d6000fd5b505050506040513d6020811015610c7657600080fd5b50516066546040805163a9059cbb60e01b81526001600160a01b03868116600483015260248201859052915193945091169163a9059cbb916044808201926020929091908290030181600087803b158015610cd057600080fd5b505af1158015610ce4573d6000803e3d6000fd5b505050506040513d6020811015610cfa57600080fd5b50505050565b6000828152603360205260408120610b7b908363ffffffff61182e16565b600081565b606554606654606754606854606954606a54606b54606c54606d546001600160a01b03988916989788169792831692918216911689565b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c019020600090610d8a90610456610f82565b905090565b610d976111c7565b336000908152606e602052604081208054909190610db49061149e565b90506000610dd2610a5884600101548461151890919063ffffffff16565b905080610e1c576040805162461bcd60e51b81526020600482015260136024820152724e4f5448494e475f544f5f574954484452415760681b604482015290519081900360640190fd5b610e2581611283565b6040805182815290513391600080516020611e28833981519152919081900360200190a250600190910155565b6000818152603360205260408120610b7e90611843565b600082815260336020526040902060020154610e8790610456610f82565b6104fb5760405162461bcd60e51b8152600401808060200182810382526030815260200180611da96030913960400191505060405180910390fd5b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c01902081565b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c019020610f1390610456610f82565b610f63576040805162461bcd60e51b815260206004820152601c60248201527b43616c6c6572206973206e6f742061206d616e6167657220726f6c6560201b604482015290519081900360640190fd5b6104a08282610496565b6000610b7b836001600160a01b03841661184e565b3390565b6000828152603360205260409020610fa4908263ffffffff610f6d16565b156104a057610fb1610f82565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152603360205260409020611013908263ffffffff61189816565b156104a057611020610f82565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b303b1590565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17815292518251600094606094938a169392918291908083835b602083106110ef5780518252601f1990920191602091820191016110d0565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611151576040519150601f19603f3d011682016040523d82523d6000602084013e611156565b606091505b5091509150818015611184575080511580611184575080806020019051602081101561118157600080fd5b50515b6111bf5760405162461bcd60e51b8152600401808060200182810382526024815260200180611e726024913960400191505060405180910390fd5b505050505050565b60685443116111d557611267565b606554604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561122057600080fd5b505afa158015611234573d6000803e3d6000fd5b505050506040513d602081101561124a57600080fd5b5051905080156112615761125d8161155a565b606a555b50436068555b565b6000610b7e610a588360010154610a4c856000015461149e565b606654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156112ce57600080fd5b505afa1580156112e2573d6000803e3d6000fd5b505050506040513d60208110156112f857600080fd5b505190508061130757506113e9565b80821115611395576066546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561136357600080fd5b505af1158015611377573d6000803e3d6000fd5b505050506040513d602081101561138d57600080fd5b506104a09050565b6066546040805163a9059cbb60e01b81523360048201526024810185905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b158015610cd057600080fd5b50565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610cfa9085906118ad565b600082820183811015610b7b576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b6000610b7e64e8d4a51000610a40606560050154856115c290919063ffffffff16565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526115139084906118ad565b505050565b6000610b7b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061195e565b606854600090819061157390439063ffffffff61151816565b60695490915060009061158d90839063ffffffff6115c216565b90506115ba6115ab85610a408464e8d4a5100063ffffffff6115c216565b606a549063ffffffff61144616565b949350505050565b6000826115d157506000610b7e565b828202828482816115de57fe5b0414610b7b5760405162461bcd60e51b8152600401808060200182810382526021815260200180611e076021913960400191505060405180910390fd5b6000610b7b83836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b8152506119fa565b60008061166e83600a63ffffffff61161b16565b606b54604080516370a0823160e01b815233600482015290519293506001600160a01b03909116916370a0823191602480820192602092909190829003018186803b1580156116bc57600080fd5b505afa1580156116d0573d6000803e3d6000fd5b505050506040513d60208110156116e657600080fd5b50516116ff576116fc838263ffffffff61151816565b92505b606c54604080516370a0823160e01b815233600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561174a57600080fd5b505afa15801561175e573d6000803e3d6000fd5b505050506040513d602081101561177457600080fd5b505161178d5761178a838263ffffffff61151816565b92505b606d54604080516370a0823160e01b815233600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156117d857600080fd5b505afa1580156117ec573d6000803e3d6000fd5b505050506040513d602081101561180257600080fd5b505161181b57611818838263ffffffff61151816565b92505b5090919050565b6000610b7b8383611a5f565b6000610b7b836001600160a01b038416611ac3565b6000610b7e82611adb565b600061185a8383611ac3565b61189057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b7e565b506000610b7e565b6000610b7b836001600160a01b038416611adf565b6060611902826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611ba59092919063ffffffff16565b8051909150156115135780806020019051602081101561192157600080fd5b50516115135760405162461bcd60e51b815260040180806020018281038252602a815260200180611e48602a913960400191505060405180910390fd5b600081848411156119ed5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119b257818101518382015260200161199a565b50505050905090810190601f1680156119df5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50508183035b9392505050565b60008183611a495760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156119b257818101518382015260200161199a565b506000838581611a5557fe5b0495945050505050565b81546000908210611aa15760405162461bcd60e51b8152600401808060200182810382526022815260200180611d386022913960400191505060405180910390fd5b826000018281548110611ab057fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b5490565b60008181526001830160205260408120548015611b9b5783546000198083019190810190600090879083908110611b1257fe5b9060005260206000200154905080876000018481548110611b2f57fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080611b5f57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610b7e565b6000915050610b7e565b60606115ba848460008585611bb985611ccb565b611c0a576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310611c495780518252601f199092019160209182019101611c2a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611cab576040519150601f19603f3d011682016040523d82523d6000602084013e611cb0565b606091505b5091509150611cc0828286611cd1565b979650505050505050565b3b151590565b60608315611ce05750816119f3565b825115611cf05782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156119b257818101518382015260200161199a56fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e74884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77bc84835063c693975166f00cffb19f01a94c2db55b1bf259238c5da3594e50665361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645472616e7366657248656c7065723a205452414e534645525f46524f4d5f4641494c4544416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a2646970667358221220400b8fb64a5740f46d5b1a8dc5b2bae03bb23e5ed1444040b26062cdc754e25064736f6c63430006080033000000000000000000000000e8b283b606a212d82036f74f88177375125440f6
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100fc5760003560e01c806303337fd814610101578063248a9ca3146101405780632f2ff15d1461016f57806336568abe1461019d5780633b7b67ec146101c957806341f264f114610222578063452d003f1461023f5780635a23248d1461025c578063853828b6146102645780639010d07c1461026c578063912d6eb6146102ab57806391d14854146102d1578063a217fddf14610311578063ab5f522114610319578063c56a3e881461037d578063c885bc5814610385578063ca15c8731461038d578063d547741f146103aa578063ec87621c146103d6578063fa82ac76146103de575b600080fd5b6101276004803603602081101561011757600080fd5b50356001600160a01b031661040a565b6040805192835260208301919091528051918290030190f35b61015d6004803603602081101561015657600080fd5b5035610423565b60408051918252519081900360200190f35b61019b6004803603604081101561018557600080fd5b50803590602001356001600160a01b0316610438565b005b61019b600480360360408110156101b357600080fd5b50803590602001356001600160a01b03166104a4565b61019b60048036036101008110156101e057600080fd5b506001600160a01b038135811691602081013591604082013581169160608101359160808201359160a081013582169160c082013581169160e0013516610505565b61019b6004803603602081101561023857600080fd5b5035610686565b61019b6004803603602081101561025557600080fd5b503561079c565b61015d6108d7565b61019b610a67565b61028f6004803603604081101561028257600080fd5b5080359060200135610b5d565b604080516001600160a01b039092168252519081900360200190f35b61019b600480360360208110156102c157600080fd5b50356001600160a01b0316610b84565b6102fd600480360360408110156102e757600080fd5b50803590602001356001600160a01b0316610d00565b604080519115158252519081900360200190f35b61015d610d1e565b610321610d23565b604080516001600160a01b039a8b168152988a1660208a0152888101979097526060880195909552608087019390935260a0860191909152851660c0850152841660e08401529092166101008201529051908190036101200190f35b6102fd610d5a565b61019b610d8f565b61015d600480360360208110156103a357600080fd5b5035610e52565b61019b600480360360408110156103c057600080fd5b50803590602001356001600160a01b0316610e69565b61015d610ec2565b61019b600480360360408110156103f457600080fd5b50803590602001356001600160a01b0316610ee6565b606e602052600090815260409020805460019091015482565b60009081526033602052604090206002015490565b60008281526033602052604090206002015461045b90610456610f82565b610d00565b6104965760405162461bcd60e51b815260040180806020018281038252602f815260200180611d5a602f913960400191505060405180910390fd5b6104a08282610f86565b5050565b6104ac610f82565b6001600160a01b0316816001600160a01b0316146104fb5760405162461bcd60e51b815260040180806020018281038252602f815260200180611e96602f913960400191505060405180910390fd5b6104a08282610ff5565b600054610100900460ff168061051e575061051e611064565b8061052c575060005460ff16155b6105675760405162461bcd60e51b815260040180806020018281038252602e815260200180611dd9602e913960400191505060405180910390fd5b600054610100900460ff16158015610592576000805460ff1961ff0019909116610100171660011790555b61059e8933308b61106a565b60008643116105ad57866105af565b435b60408051610120810182526001600160a01b03808c168083528e8216602084018190529383018c905260608301859052608083018b9052600060a084018190528a831660c085018190528a841660e08601819052938a16610100909501859052606580546001600160a01b0319908116909417905560668054841690961790955560678d905560689590955560698b9055606a94909455606b80548516909317909255606c80548416909217909155606d805490921617905550801561067b576000805461ff00191690555b505050505050505050565b61068e6111c7565b806106ce576040805162461bcd60e51b815260206004820152600b60248201526a16915493d7d05353d5539560aa1b604482015290519081900360640190fd5b336000908152606e60205260408120906106e782611269565b9050801561071d576106f881611283565b6040805182815290513391600080516020611e28833981519152919081900360200190a25b60655461073b906001600160a01b031633308663ffffffff6113ec16565b60408051848152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a28154610783908463ffffffff61144616565b80835561078f9061149e565b8260010181905550505050565b6107a46111c7565b336000908152606e6020526040902080546107fc576040805162461bcd60e51b81526020600482015260136024820152724e4f5448494e475f544f5f574954484452415760681b604482015290519081900360640190fd5b8054821115610843576040805162461bcd60e51b815260206004820152600e60248201526d1253959053125117d05353d5539560921b604482015290519081900360640190fd5b600061084e82611269565b905080156108845761085f81611283565b6040805182815290513391600080516020611e28833981519152919081900360200190a25b6065546108a1906001600160a01b0316338563ffffffff6114c116565b6040805184815290513391600080516020611d89833981519152919081900360200190a28154610783908463ffffffff61151816565b606654604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561092757600080fd5b505afa15801561093b573d6000803e3d6000fd5b505050506040513d602081101561095157600080fd5b5051905080610964576000915050610a64565b336000908152606e60209081526040808320606a5460655483516370a0823160e01b815230600482015293519295919491936001600160a01b03909116926370a0823192602480840193919291829003018186803b1580156109c557600080fd5b505afa1580156109d9573d6000803e3d6000fd5b505050506040513d60208110156109ef57600080fd5b505160685490915043118015610a0457508015155b15610a1557610a128161155a565b91505b610a5d610a588460010154610a4c64e8d4a51000610a408789600001546115c290919063ffffffff16565b9063ffffffff61161b16565b9063ffffffff61151816565b61165a565b9450505050505b90565b610a6f6111c7565b336000908152606e602052604090208054610ac7576040805162461bcd60e51b81526020600482015260136024820152724e4f5448494e475f544f5f574954484452415760681b604482015290519081900360640190fd5b6000610ad282611269565b90508015610b0857610ae381611283565b6040805182815290513391600080516020611e28833981519152919081900360200190a25b8154606554610b2a916001600160a01b0390911690339063ffffffff6114c116565b815460408051918252513391600080516020611d89833981519152919081900360200190a2506000808255600190910155565b6000828152603360205260408120610b7b908363ffffffff61182216565b90505b92915050565b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c019020610bb190610456610f82565b610c01576040805162461bcd60e51b815260206004820152601c60248201527b43616c6c6572206973206e6f742061206d616e6167657220726f6c6560201b604482015290519081900360640190fd5b606654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610c4c57600080fd5b505afa158015610c60573d6000803e3d6000fd5b505050506040513d6020811015610c7657600080fd5b50516066546040805163a9059cbb60e01b81526001600160a01b03868116600483015260248201859052915193945091169163a9059cbb916044808201926020929091908290030181600087803b158015610cd057600080fd5b505af1158015610ce4573d6000803e3d6000fd5b505050506040513d6020811015610cfa57600080fd5b50505050565b6000828152603360205260408120610b7b908363ffffffff61182e16565b600081565b606554606654606754606854606954606a54606b54606c54606d546001600160a01b03988916989788169792831692918216911689565b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c019020600090610d8a90610456610f82565b905090565b610d976111c7565b336000908152606e602052604081208054909190610db49061149e565b90506000610dd2610a5884600101548461151890919063ffffffff16565b905080610e1c576040805162461bcd60e51b81526020600482015260136024820152724e4f5448494e475f544f5f574954484452415760681b604482015290519081900360640190fd5b610e2581611283565b6040805182815290513391600080516020611e28833981519152919081900360200190a250600190910155565b6000818152603360205260408120610b7e90611843565b600082815260336020526040902060020154610e8790610456610f82565b6104fb5760405162461bcd60e51b8152600401808060200182810382526030815260200180611da96030913960400191505060405180910390fd5b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c01902081565b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c019020610f1390610456610f82565b610f63576040805162461bcd60e51b815260206004820152601c60248201527b43616c6c6572206973206e6f742061206d616e6167657220726f6c6560201b604482015290519081900360640190fd5b6104a08282610496565b6000610b7b836001600160a01b03841661184e565b3390565b6000828152603360205260409020610fa4908263ffffffff610f6d16565b156104a057610fb1610f82565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152603360205260409020611013908263ffffffff61189816565b156104a057611020610f82565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b303b1590565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17815292518251600094606094938a169392918291908083835b602083106110ef5780518252601f1990920191602091820191016110d0565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611151576040519150601f19603f3d011682016040523d82523d6000602084013e611156565b606091505b5091509150818015611184575080511580611184575080806020019051602081101561118157600080fd5b50515b6111bf5760405162461bcd60e51b8152600401808060200182810382526024815260200180611e726024913960400191505060405180910390fd5b505050505050565b60685443116111d557611267565b606554604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561122057600080fd5b505afa158015611234573d6000803e3d6000fd5b505050506040513d602081101561124a57600080fd5b5051905080156112615761125d8161155a565b606a555b50436068555b565b6000610b7e610a588360010154610a4c856000015461149e565b606654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156112ce57600080fd5b505afa1580156112e2573d6000803e3d6000fd5b505050506040513d60208110156112f857600080fd5b505190508061130757506113e9565b80821115611395576066546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561136357600080fd5b505af1158015611377573d6000803e3d6000fd5b505050506040513d602081101561138d57600080fd5b506104a09050565b6066546040805163a9059cbb60e01b81523360048201526024810185905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b158015610cd057600080fd5b50565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610cfa9085906118ad565b600082820183811015610b7b576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b6000610b7e64e8d4a51000610a40606560050154856115c290919063ffffffff16565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526115139084906118ad565b505050565b6000610b7b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061195e565b606854600090819061157390439063ffffffff61151816565b60695490915060009061158d90839063ffffffff6115c216565b90506115ba6115ab85610a408464e8d4a5100063ffffffff6115c216565b606a549063ffffffff61144616565b949350505050565b6000826115d157506000610b7e565b828202828482816115de57fe5b0414610b7b5760405162461bcd60e51b8152600401808060200182810382526021815260200180611e076021913960400191505060405180910390fd5b6000610b7b83836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b8152506119fa565b60008061166e83600a63ffffffff61161b16565b606b54604080516370a0823160e01b815233600482015290519293506001600160a01b03909116916370a0823191602480820192602092909190829003018186803b1580156116bc57600080fd5b505afa1580156116d0573d6000803e3d6000fd5b505050506040513d60208110156116e657600080fd5b50516116ff576116fc838263ffffffff61151816565b92505b606c54604080516370a0823160e01b815233600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561174a57600080fd5b505afa15801561175e573d6000803e3d6000fd5b505050506040513d602081101561177457600080fd5b505161178d5761178a838263ffffffff61151816565b92505b606d54604080516370a0823160e01b815233600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156117d857600080fd5b505afa1580156117ec573d6000803e3d6000fd5b505050506040513d602081101561180257600080fd5b505161181b57611818838263ffffffff61151816565b92505b5090919050565b6000610b7b8383611a5f565b6000610b7b836001600160a01b038416611ac3565b6000610b7e82611adb565b600061185a8383611ac3565b61189057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b7e565b506000610b7e565b6000610b7b836001600160a01b038416611adf565b6060611902826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611ba59092919063ffffffff16565b8051909150156115135780806020019051602081101561192157600080fd5b50516115135760405162461bcd60e51b815260040180806020018281038252602a815260200180611e48602a913960400191505060405180910390fd5b600081848411156119ed5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119b257818101518382015260200161199a565b50505050905090810190601f1680156119df5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50508183035b9392505050565b60008183611a495760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156119b257818101518382015260200161199a565b506000838581611a5557fe5b0495945050505050565b81546000908210611aa15760405162461bcd60e51b8152600401808060200182810382526022815260200180611d386022913960400191505060405180910390fd5b826000018281548110611ab057fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b5490565b60008181526001830160205260408120548015611b9b5783546000198083019190810190600090879083908110611b1257fe5b9060005260206000200154905080876000018481548110611b2f57fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080611b5f57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610b7e565b6000915050610b7e565b60606115ba848460008585611bb985611ccb565b611c0a576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310611c495780518252601f199092019160209182019101611c2a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611cab576040519150601f19603f3d011682016040523d82523d6000602084013e611cb0565b606091505b5091509150611cc0828286611cd1565b979650505050505050565b3b151590565b60608315611ce05750816119f3565b825115611cf05782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156119b257818101518382015260200161199a56fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e74884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77bc84835063c693975166f00cffb19f01a94c2db55b1bf259238c5da3594e50665361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645472616e7366657248656c7065723a205452414e534645525f46524f4d5f4641494c4544416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a2646970667358221220400b8fb64a5740f46d5b1a8dc5b2bae03bb23e5ed1444040b26062cdc754e25064736f6c63430006080033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000e8b283b606a212d82036f74f88177375125440f6
-----Decoded View---------------
Arg [0] : _mineManager (address): 0xe8B283B606A212d82036F74f88177375125440F6
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000e8b283b606a212d82036f74f88177375125440f6
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.