Feature Tip: Add private address tag to any address under My Name Tag !
More Info
Private Name Tags
ContractCreator
Multi Chain
Multichain Addresses
6 addresses found via
Latest 25 from a total of 13,538 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
Unstake | 17412154 | 2 days 5 hrs ago | IN | 0 ETH | 0.00232776 | ||||
Unstake | 17400657 | 3 days 20 hrs ago | IN | 0 ETH | 0.00514551 | ||||
Unstake | 17400266 | 3 days 21 hrs ago | IN | 0 ETH | 0.00257639 | ||||
Unstake | 17395839 | 4 days 12 hrs ago | IN | 0 ETH | 0.00375833 | ||||
Unstake | 17394585 | 4 days 16 hrs ago | IN | 0 ETH | 0.0035041 | ||||
Unstake | 17384855 | 6 days 1 hr ago | IN | 0 ETH | 0.00416918 | ||||
Unstake | 17374264 | 7 days 13 hrs ago | IN | 0 ETH | 0.00449267 | ||||
Unstake | 17374023 | 7 days 14 hrs ago | IN | 0 ETH | 0.0052245 | ||||
Unstake | 17369126 | 8 days 6 hrs ago | IN | 0 ETH | 0.00724741 | ||||
Unstake | 17366269 | 8 days 16 hrs ago | IN | 0 ETH | 0.00441049 | ||||
Unstake | 17360341 | 9 days 12 hrs ago | IN | 0 ETH | 0.0039956 | ||||
Unstake | 17353404 | 10 days 11 hrs ago | IN | 0 ETH | 0.00329417 | ||||
Unstake | 17345675 | 11 days 13 hrs ago | IN | 0 ETH | 0.00351774 | ||||
Unstake | 17331705 | 13 days 12 hrs ago | IN | 0 ETH | 0.00544093 | ||||
Unstake | 17328125 | 14 days 1 hr ago | IN | 0 ETH | 0.00391448 | ||||
Unstake | 17316927 | 15 days 14 hrs ago | IN | 0 ETH | 0.00568484 | ||||
Unstake | 17312493 | 16 days 5 hrs ago | IN | 0 ETH | 0.00377025 | ||||
Unstake | 17302577 | 17 days 15 hrs ago | IN | 0 ETH | 0.00372585 | ||||
Unstake | 17302551 | 17 days 15 hrs ago | IN | 0 ETH | 0.00091573 | ||||
Unstake | 17294208 | 18 days 19 hrs ago | IN | 0 ETH | 0.00766692 | ||||
Unstake | 17292760 | 19 days 33 mins ago | IN | 0 ETH | 0.00475026 | ||||
Unstake | 17292609 | 19 days 1 hr ago | IN | 0 ETH | 0.00603654 | ||||
Unstake | 17281974 | 20 days 13 hrs ago | IN | 0 ETH | 0.01077319 | ||||
Unstake | 17262872 | 23 days 5 hrs ago | IN | 0 ETH | 0.00487287 | ||||
Unstake | 17254053 | 24 days 11 hrs ago | IN | 0 ETH | 0.00099547 |
Latest 1 internal transaction
Parent Txn Hash | Block | From | To | Value | ||
---|---|---|---|---|---|---|
13321960 | 615 days 17 hrs ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Name:
TempleStaking
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity ^0.8.4; // SPDX-License-Identifier: GPL-3.0-or-later import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./ABDKMath64x64.sol"; import "./TempleERC20Token.sol"; import "./OGTemple.sol"; import "./ExitQueue.sol"; // import "hardhat/console.sol"; /** * Mechancics of how a user can stake temple. */ contract TempleStaking is Ownable { using ABDKMath64x64 for int128; TempleERC20Token immutable public TEMPLE; // The token being staked, for which TEMPLE rewards are generated OGTemple immutable public OG_TEMPLE; // Token used to redeem staked TEMPLE ExitQueue public EXIT_QUEUE; // unstake exit queue // epoch percentage yield, as an ABDKMath64x64 int128 public epy; // epoch size, in seconds uint256 public epochSizeSeconds; // The starting timestamp. from where staking starts uint256 public startTimestamp; // epy compounded over every epoch since the contract creation up // until lastUpdatedEpoch. Represented as an ABDKMath64x64 int128 public accumulationFactor; // the epoch up to which we have calculated accumulationFactor. uint256 public lastUpdatedEpoch; event StakeCompleted(address _staker, uint256 _amount, uint256 _lockedUntil); event AccumulationFactorUpdated(uint256 _epochsProcessed, uint256 _currentEpoch, uint256 _accumulationFactor); event UnstakeCompleted(address _staker, uint256 _amount); constructor( TempleERC20Token _TEMPLE, ExitQueue _EXIT_QUEUE, uint256 _epochSizeSeconds, uint256 _startTimestamp) { require(_startTimestamp < block.timestamp, "Start timestamp must be in the past"); require(_startTimestamp > (block.timestamp - (24 * 2 * 60 * 60)), "Start timestamp can't be more than 2 days in the past"); TEMPLE = _TEMPLE; EXIT_QUEUE = _EXIT_QUEUE; // Each version of the staking contract needs it's own instance of OGTemple users can use to // claim back rewards OG_TEMPLE = new OGTemple(); epochSizeSeconds = _epochSizeSeconds; startTimestamp = _startTimestamp; epy = ABDKMath64x64.fromUInt(1); accumulationFactor = ABDKMath64x64.fromUInt(1); } /** Sets epoch percentage yield */ function setExitQueue(ExitQueue _EXIT_QUEUE) external onlyOwner { EXIT_QUEUE = _EXIT_QUEUE; } /** Sets epoch percentage yield */ function setEpy(uint256 _numerator, uint256 _denominator) external onlyOwner { _updateAccumulationFactor(); epy = ABDKMath64x64.fromUInt(1).add(ABDKMath64x64.divu(_numerator, _denominator)); } /** Get EPY as uint, scaled up the given factor (for reporting) */ function getEpy(uint256 _scale) external view returns (uint256) { return epy.sub(ABDKMath64x64.fromUInt(1)).mul(ABDKMath64x64.fromUInt(_scale)).toUInt(); } function currentEpoch() public view returns (uint256) { return (block.timestamp - startTimestamp) / epochSizeSeconds; } /** Return current accumulation factor, scaled up to account for fractional component */ function getAccumulationFactor(uint256 _scale) external view returns(uint256) { return _accumulationFactorAt(currentEpoch()).mul(ABDKMath64x64.fromUInt(_scale)).toUInt(); } /** Calculate the updated accumulation factor, based on the current epoch */ function _accumulationFactorAt(uint256 epoch) private view returns(int128) { uint256 _nUnupdatedEpochs = epoch - lastUpdatedEpoch; return accumulationFactor.mul(epy.pow(_nUnupdatedEpochs)); } /** Balance in TEMPLE for a given amount of OG_TEMPLE */ function balance(uint256 amountOgTemple) public view returns(uint256) { return _overflowSafeMul1e18( ABDKMath64x64.divu(amountOgTemple, 1e18).mul(_accumulationFactorAt(currentEpoch())) ); } /** updates rewards in pool */ function _updateAccumulationFactor() internal { uint256 _currentEpoch = currentEpoch(); // still in previous epoch, no action. // NOTE: should be a pre-condition that _currentEpoch >= lastUpdatedEpoch // It's possible to end up in this state if we shorten epoch size. // As such, it's not baked as a precondition if (_currentEpoch <= lastUpdatedEpoch) { return; } accumulationFactor = _accumulationFactorAt(_currentEpoch); lastUpdatedEpoch = _currentEpoch; uint256 _nUnupdatedEpochs = _currentEpoch - lastUpdatedEpoch; emit AccumulationFactorUpdated(_nUnupdatedEpochs, _currentEpoch, accumulationFactor.mul(10000).toUInt()); } /** Stake on behalf of a given address. Used by other contracts (like Presale) */ function stakeFor(address _staker, uint256 _amountTemple) public returns(uint256 amountOgTemple) { require(_amountTemple > 0, "Cannot stake 0 tokens"); _updateAccumulationFactor(); // net past value/genesis value/OG Value for the temple you are putting in. amountOgTemple = _overflowSafeMul1e18(ABDKMath64x64.divu(_amountTemple, 1e18).div(accumulationFactor)); SafeERC20.safeTransferFrom(TEMPLE, msg.sender, address(this), _amountTemple); OG_TEMPLE.mint(_staker, amountOgTemple); emit StakeCompleted(_staker, _amountTemple, 0); return amountOgTemple; } /** Stake temple */ function stake(uint256 _amountTemple) external returns(uint256 amountOgTemple) { return stakeFor(msg.sender, _amountTemple); } /** Unstake temple */ function unstake(uint256 _amountOgTemple) external { require(OG_TEMPLE.allowance(msg.sender, address(this)) >= _amountOgTemple, 'Insufficient OGTemple allowance. Cannot unstake'); _updateAccumulationFactor(); uint256 unstakeBalanceTemple = balance(_amountOgTemple); OG_TEMPLE.burnFrom(msg.sender, _amountOgTemple); SafeERC20.safeIncreaseAllowance(TEMPLE, address(EXIT_QUEUE), unstakeBalanceTemple); EXIT_QUEUE.join(msg.sender, unstakeBalanceTemple); emit UnstakeCompleted(msg.sender, _amountOgTemple); } function _overflowSafeMul1e18(int128 amountFixedPoint) internal pure returns (uint256) { uint256 integralDigits = amountFixedPoint.toUInt(); uint256 fractionalDigits = amountFixedPoint.sub(ABDKMath64x64.fromUInt(integralDigits)).mul(ABDKMath64x64.fromUInt(1e18)).toUInt(); return (integralDigits * 1e18) + fractionalDigits; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: BSD-4-Clause /* * ABDK Math 64.64 Smart Contract Library. Copyright © 2019 by ABDK Consulting. * Author: Mikhail Vladimirov <[email protected]> */ pragma solidity ^0.8.4; /** * Smart contract library of mathematical functions operating with signed * 64.64-bit fixed point numbers. Signed 64.64-bit fixed point number is * basically a simple fraction whose numerator is signed 128-bit integer and * denominator is 2^64. As long as denominator is always the same, there is no * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are * represented by int128 type holding only the numerator. */ library ABDKMath64x64 { /* * Minimum value signed 64.64-bit fixed point number may have. */ int128 private constant MIN_64x64 = -0x80000000000000000000000000000000; /* * Maximum value signed 64.64-bit fixed point number may have. */ int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; /** * Convert signed 256-bit integer number into signed 64.64-bit fixed point * number. Revert on overflow. * * @param x signed 256-bit integer number * @return signed 64.64-bit fixed point number */ function fromInt (int256 x) internal pure returns (int128) { unchecked { require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF); return int128 (x << 64); } } /** * Convert signed 64.64 fixed point number into signed 64-bit integer number * rounding down. * * @param x signed 64.64-bit fixed point number * @return signed 64-bit integer number */ function toInt (int128 x) internal pure returns (int64) { unchecked { return int64 (x >> 64); } } /** * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point * number. Revert on overflow. * * @param x unsigned 256-bit integer number * @return signed 64.64-bit fixed point number */ function fromUInt (uint256 x) internal pure returns (int128) { unchecked { require (x <= 0x7FFFFFFFFFFFFFFF); return int128 (int256 (x << 64)); } } /** * Convert signed 64.64 fixed point number into unsigned 64-bit integer * number rounding down. Revert on underflow. * * @param x signed 64.64-bit fixed point number * @return unsigned 64-bit integer number */ function toUInt (int128 x) internal pure returns (uint64) { unchecked { require (x >= 0); return uint64 (uint128 (x >> 64)); } } /** * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point * number rounding down. Revert on overflow. * * @param x signed 128.128-bin fixed point number * @return signed 64.64-bit fixed point number */ function from128x128 (int256 x) internal pure returns (int128) { unchecked { int256 result = x >> 64; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Convert signed 64.64 fixed point number into signed 128.128 fixed point * number. * * @param x signed 64.64-bit fixed point number * @return signed 128.128 fixed point number */ function to128x128 (int128 x) internal pure returns (int256) { unchecked { return int256 (x) << 64; } } /** * Calculate x + y. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function add (int128 x, int128 y) internal pure returns (int128) { unchecked { int256 result = int256(x) + y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate x - y. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function sub (int128 x, int128 y) internal pure returns (int128) { unchecked { int256 result = int256(x) - y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate x * y rounding down. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function mul (int128 x, int128 y) internal pure returns (int128) { unchecked { int256 result = int256(x) * y >> 64; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point * number and y is signed 256-bit integer number. Revert on overflow. * * @param x signed 64.64 fixed point number * @param y signed 256-bit integer number * @return signed 256-bit integer number */ function muli (int128 x, int256 y) internal pure returns (int256) { unchecked { if (x == MIN_64x64) { require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF && y <= 0x1000000000000000000000000000000000000000000000000); return -y << 63; } else { bool negativeResult = false; if (x < 0) { x = -x; negativeResult = true; } if (y < 0) { y = -y; // We rely on overflow behavior here negativeResult = !negativeResult; } uint256 absoluteResult = mulu (x, uint256 (y)); if (negativeResult) { require (absoluteResult <= 0x8000000000000000000000000000000000000000000000000000000000000000); return -int256 (absoluteResult); // We rely on overflow behavior here } else { require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return int256 (absoluteResult); } } } } /** * Calculate x * y rounding down, where x is signed 64.64 fixed point number * and y is unsigned 256-bit integer number. Revert on overflow. * * @param x signed 64.64 fixed point number * @param y unsigned 256-bit integer number * @return unsigned 256-bit integer number */ function mulu (int128 x, uint256 y) internal pure returns (uint256) { unchecked { if (y == 0) return 0; require (x >= 0); uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64; uint256 hi = uint256 (int256 (x)) * (y >> 128); require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); hi <<= 64; require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo); return hi + lo; } } /** * Calculate x / y rounding towards zero. Revert on overflow or when y is * zero. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function div (int128 x, int128 y) internal pure returns (int128) { unchecked { require (y != 0); int256 result = (int256 (x) << 64) / y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate x / y rounding towards zero, where x and y are signed 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x signed 256-bit integer number * @param y signed 256-bit integer number * @return signed 64.64-bit fixed point number */ function divi (int256 x, int256 y) internal pure returns (int128) { unchecked { require (y != 0); bool negativeResult = false; if (x < 0) { x = -x; // We rely on overflow behavior here negativeResult = true; } if (y < 0) { y = -y; // We rely on overflow behavior here negativeResult = !negativeResult; } uint128 absoluteResult = divuu (uint256 (x), uint256 (y)); if (negativeResult) { require (absoluteResult <= 0x80000000000000000000000000000000); return -int128 (absoluteResult); // We rely on overflow behavior here } else { require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return int128 (absoluteResult); // We rely on overflow behavior here } } } /** * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x unsigned 256-bit integer number * @param y unsigned 256-bit integer number * @return signed 64.64-bit fixed point number */ function divu (uint256 x, uint256 y) internal pure returns (int128) { unchecked { require (y != 0); uint128 result = divuu (x, y); require (result <= uint128 (MAX_64x64)); return int128 (result); } } /** * Calculate -x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function neg (int128 x) internal pure returns (int128) { unchecked { require (x != MIN_64x64); return -x; } } /** * Calculate |x|. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function abs (int128 x) internal pure returns (int128) { unchecked { require (x != MIN_64x64); return x < 0 ? -x : x; } } /** * Calculate 1 / x rounding towards zero. Revert on overflow or when x is * zero. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function inv (int128 x) internal pure returns (int128) { unchecked { require (x != 0); int256 result = int256 (0x100000000000000000000000000000000) / x; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function avg (int128 x, int128 y) internal pure returns (int128) { unchecked { return int128 ((int256 (x) + int256 (y)) >> 1); } } /** * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down. * Revert on overflow or in case x * y is negative. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function gavg (int128 x, int128 y) internal pure returns (int128) { unchecked { int256 m = int256 (x) * int256 (y); require (m >= 0); require (m < 0x4000000000000000000000000000000000000000000000000000000000000000); return int128 (sqrtu (uint256 (m))); } } /** * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number * and y is unsigned 256-bit integer number. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y uint256 value * @return signed 64.64-bit fixed point number */ function pow (int128 x, uint256 y) internal pure returns (int128) { unchecked { bool negative = x < 0 && y & 1 == 1; uint256 absX = uint128 (x < 0 ? -x : x); uint256 absResult; absResult = 0x100000000000000000000000000000000; if (absX <= 0x10000000000000000) { absX <<= 63; while (y != 0) { if (y & 0x1 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; if (y & 0x2 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; if (y & 0x4 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; if (y & 0x8 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; y >>= 4; } absResult >>= 64; } else { uint256 absXShift = 63; if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; } if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; } if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; } if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; } if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; } if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; } uint256 resultShift = 0; while (y != 0) { require (absXShift < 64); if (y & 0x1 != 0) { absResult = absResult * absX >> 127; resultShift += absXShift; if (absResult > 0x100000000000000000000000000000000) { absResult >>= 1; resultShift += 1; } } absX = absX * absX >> 127; absXShift <<= 1; if (absX >= 0x100000000000000000000000000000000) { absX >>= 1; absXShift += 1; } y >>= 1; } require (resultShift < 64); absResult >>= 64 - resultShift; } int256 result = negative ? -int256 (absResult) : int256 (absResult); require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate sqrt (x) rounding down. Revert if x < 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function sqrt (int128 x) internal pure returns (int128) { unchecked { require (x >= 0); return int128 (sqrtu (uint256 (int256 (x)) << 64)); } } /** * Calculate binary logarithm of x. Revert if x <= 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function log_2 (int128 x) internal pure returns (int128) { unchecked { require (x > 0); int256 msb = 0; int256 xc = x; if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; } if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } if (xc >= 0x100) { xc >>= 8; msb += 8; } if (xc >= 0x10) { xc >>= 4; msb += 4; } if (xc >= 0x4) { xc >>= 2; msb += 2; } if (xc >= 0x2) msb += 1; // No need to shift xc anymore int256 result = msb - 64 << 64; uint256 ux = uint256 (int256 (x)) << uint256 (127 - msb); for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) { ux *= ux; uint256 b = ux >> 255; ux >>= 127 + b; result += bit * int256 (b); } return int128 (result); } } /** * Calculate natural logarithm of x. Revert if x <= 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function ln (int128 x) internal pure returns (int128) { unchecked { require (x > 0); return int128 (int256 ( uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128)); } } /** * Calculate binary exponent of x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function exp_2 (int128 x) internal pure returns (int128) { unchecked { require (x < 0x400000000000000000); // Overflow if (x < -0x400000000000000000) return 0; // Underflow uint256 result = 0x80000000000000000000000000000000; if (x & 0x8000000000000000 > 0) result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128; if (x & 0x4000000000000000 > 0) result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128; if (x & 0x2000000000000000 > 0) result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128; if (x & 0x1000000000000000 > 0) result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128; if (x & 0x800000000000000 > 0) result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128; if (x & 0x400000000000000 > 0) result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128; if (x & 0x200000000000000 > 0) result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128; if (x & 0x100000000000000 > 0) result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128; if (x & 0x80000000000000 > 0) result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128; if (x & 0x40000000000000 > 0) result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128; if (x & 0x20000000000000 > 0) result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128; if (x & 0x10000000000000 > 0) result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128; if (x & 0x8000000000000 > 0) result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128; if (x & 0x4000000000000 > 0) result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128; if (x & 0x2000000000000 > 0) result = result * 0x1000162E525EE054754457D5995292026 >> 128; if (x & 0x1000000000000 > 0) result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128; if (x & 0x800000000000 > 0) result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128; if (x & 0x400000000000 > 0) result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128; if (x & 0x200000000000 > 0) result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128; if (x & 0x100000000000 > 0) result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128; if (x & 0x80000000000 > 0) result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128; if (x & 0x40000000000 > 0) result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128; if (x & 0x20000000000 > 0) result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128; if (x & 0x10000000000 > 0) result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128; if (x & 0x8000000000 > 0) result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128; if (x & 0x4000000000 > 0) result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128; if (x & 0x2000000000 > 0) result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128; if (x & 0x1000000000 > 0) result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128; if (x & 0x800000000 > 0) result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128; if (x & 0x400000000 > 0) result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128; if (x & 0x200000000 > 0) result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128; if (x & 0x100000000 > 0) result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128; if (x & 0x80000000 > 0) result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128; if (x & 0x40000000 > 0) result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128; if (x & 0x20000000 > 0) result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128; if (x & 0x10000000 > 0) result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128; if (x & 0x8000000 > 0) result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128; if (x & 0x4000000 > 0) result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128; if (x & 0x2000000 > 0) result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128; if (x & 0x1000000 > 0) result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128; if (x & 0x800000 > 0) result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128; if (x & 0x400000 > 0) result = result * 0x100000000002C5C85FDF477B662B26945 >> 128; if (x & 0x200000 > 0) result = result * 0x10000000000162E42FEFA3AE53369388C >> 128; if (x & 0x100000 > 0) result = result * 0x100000000000B17217F7D1D351A389D40 >> 128; if (x & 0x80000 > 0) result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128; if (x & 0x40000 > 0) result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128; if (x & 0x20000 > 0) result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128; if (x & 0x10000 > 0) result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128; if (x & 0x8000 > 0) result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128; if (x & 0x4000 > 0) result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128; if (x & 0x2000 > 0) result = result * 0x1000000000000162E42FEFA39F02B772C >> 128; if (x & 0x1000 > 0) result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128; if (x & 0x800 > 0) result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128; if (x & 0x400 > 0) result = result * 0x100000000000002C5C85FDF473DEA871F >> 128; if (x & 0x200 > 0) result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128; if (x & 0x100 > 0) result = result * 0x100000000000000B17217F7D1CF79E949 >> 128; if (x & 0x80 > 0) result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128; if (x & 0x40 > 0) result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128; if (x & 0x20 > 0) result = result * 0x100000000000000162E42FEFA39EF366F >> 128; if (x & 0x10 > 0) result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128; if (x & 0x8 > 0) result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128; if (x & 0x4 > 0) result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128; if (x & 0x2 > 0) result = result * 0x1000000000000000162E42FEFA39EF358 >> 128; if (x & 0x1 > 0) result = result * 0x10000000000000000B17217F7D1CF79AB >> 128; result >>= uint256 (int256 (63 - (x >> 64))); require (result <= uint256 (int256 (MAX_64x64))); return int128 (int256 (result)); } } /** * Calculate natural exponent of x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function exp (int128 x) internal pure returns (int128) { unchecked { require (x < 0x400000000000000000); // Overflow if (x < -0x400000000000000000) return 0; // Underflow return exp_2 ( int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128)); } } /** * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x unsigned 256-bit integer number * @param y unsigned 256-bit integer number * @return unsigned 64.64-bit fixed point number */ function divuu (uint256 x, uint256 y) private pure returns (uint128) { unchecked { require (y != 0); uint256 result; if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) result = (x << 64) / y; else { uint256 msb = 192; uint256 xc = x >> 192; if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } if (xc >= 0x100) { xc >>= 8; msb += 8; } if (xc >= 0x10) { xc >>= 4; msb += 4; } if (xc >= 0x4) { xc >>= 2; msb += 2; } if (xc >= 0x2) msb += 1; // No need to shift xc anymore result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1); require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); uint256 hi = result * (y >> 128); uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); uint256 xh = x >> 192; uint256 xl = x << 64; if (xl < lo) xh -= 1; xl -= lo; // We rely on overflow behavior here lo = hi << 128; if (xl < lo) xh -= 1; xl -= lo; // We rely on overflow behavior here assert (xh == hi >> 128); result += xl / y; } require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return uint128 (result); } } /** * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer * number. * * @param x unsigned 256-bit integer number * @return unsigned 128-bit integer number */ function sqrtu (uint256 x) private pure returns (uint128) { unchecked { if (x == 0) return 0; else { uint256 xx = x; uint256 r = 1; if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; } if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; } if (xx >= 0x100000000) { xx >>= 32; r <<= 16; } if (xx >= 0x10000) { xx >>= 16; r <<= 8; } if (xx >= 0x100) { xx >>= 8; r <<= 4; } if (xx >= 0x10) { xx >>= 4; r <<= 2; } if (xx >= 0x8) { r <<= 1; } r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; // Seven iterations should be enough uint256 r1 = x / r; return uint128 (r < r1 ? r : r1); } } } }
pragma solidity ^0.8.4; // SPDX-License-Identifier: GPL-3.0-or-later import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; contract TempleERC20Token is ERC20, ERC20Burnable, Ownable, AccessControl { bytes32 public constant CAN_MINT = keccak256("CAN_MINT"); constructor() ERC20("Temple", "TEMPLE") { _setupRole(DEFAULT_ADMIN_ROLE, owner()); } function mint(address to, uint256 amount) external { require(hasRole(CAN_MINT, msg.sender), "Caller cannot mint"); _mint(to, amount); } function addMinter(address account) external onlyOwner { grantRole(CAN_MINT, account); } function removeMinter(address account) external onlyOwner { revokeRole(CAN_MINT, account); } }
pragma solidity ^0.8.4; // SPDX-License-Identifier: GPL-3.0-or-later import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; /** * Created and owned by the staking contract. * * It mints and burns OGTemple as users stake/unstake */ contract OGTemple is ERC20, ERC20Burnable, Ownable { constructor() ERC20("OGTemple", "OG_TEMPLE") {} function mint(address to, uint256 amount) external onlyOwner { _mint(to, amount); } }
pragma solidity ^0.8.4; // SPDX-License-Identifier: GPL-3.0-or-later import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; // import "hardhat/console.sol"; /** * How all exit of TEMPLE rewards are managed. */ contract ExitQueue is Ownable { struct User { // Total currently in queue uint256 Amount; // First epoch for which the user is in the unstake queue uint256 FirstExitEpoch; // Last epoch for which the user has a pending unstake uint256 LastExitEpoch; // All epochs where the user has an exit allocation mapping(uint256 => uint256) Exits; } // total queued to be exited in a given epoch mapping(uint256 => uint256) public totalPerEpoch; // The first unwithdrawn epoch for the user mapping(address => User) public userData; IERC20 public TEMPLE; // TEMPLE // Limit of how much temple can exit per epoch uint256 public maxPerEpoch; // Limit of how much temple can exit per address per epoch uint256 public maxPerAddress; // epoch size, in blocks uint256 public epochSize; // the block we use to work out what epoch we are in uint256 public firstBlock; // The next free block on which a user can commence their unstake uint256 public nextUnallocatedEpoch; event JoinQueue(address exiter, uint256 amount); event Withdrawal(address exiter, uint256 amount); constructor( address _TEMPLE, uint256 _maxPerEpoch, uint256 _maxPerAddress, uint256 _epochSize) { TEMPLE = IERC20(_TEMPLE); maxPerEpoch = _maxPerEpoch; maxPerAddress = _maxPerAddress; epochSize = _epochSize; firstBlock = block.number; nextUnallocatedEpoch = 0; } function setMaxPerEpoch(uint256 _maxPerEpoch) external onlyOwner { maxPerEpoch = _maxPerEpoch; } function setMaxPerAddress(uint256 _maxPerAddress) external onlyOwner { maxPerAddress = _maxPerAddress; } function setEpochSize(uint256 _epochSize) external onlyOwner { epochSize = _epochSize; } function setStartingBlock(uint256 _firstBlock) external onlyOwner { require(_firstBlock < firstBlock, "Can only move start block back, not forward"); firstBlock = _firstBlock; } function currentEpoch() public view returns (uint256) { return (block.number - firstBlock) / epochSize; } function currentEpochAllocation(address _exiter, uint256 _epoch) external view returns (uint256) { return userData[_exiter].Exits[_epoch]; } function join(address _exiter, uint256 _amount) external { require(_amount > 0, "Amount must be > 0"); if (nextUnallocatedEpoch < currentEpoch()) { nextUnallocatedEpoch = currentEpoch(); } User storage user = userData[_exiter]; uint256 unallocatedAmount = _amount; uint256 _nextUnallocatedEpoch = nextUnallocatedEpoch; uint256 nextAvailableEpochForUser = _nextUnallocatedEpoch; if (user.LastExitEpoch > nextAvailableEpochForUser) { nextAvailableEpochForUser = user.LastExitEpoch; } while (unallocatedAmount > 0) { // work out allocation for the next available epoch uint256 allocationForEpoch = unallocatedAmount; if (user.Exits[nextAvailableEpochForUser] + allocationForEpoch > maxPerAddress) { allocationForEpoch = maxPerAddress - user.Exits[nextAvailableEpochForUser]; } if (totalPerEpoch[nextAvailableEpochForUser] + allocationForEpoch > maxPerEpoch) { allocationForEpoch = maxPerEpoch - totalPerEpoch[nextAvailableEpochForUser]; } // Bookkeeping if (allocationForEpoch > 0) { if (user.Amount == 0) { user.FirstExitEpoch = nextAvailableEpochForUser; } user.Amount += allocationForEpoch; user.Exits[nextAvailableEpochForUser] += allocationForEpoch; totalPerEpoch[nextAvailableEpochForUser] += allocationForEpoch; user.LastExitEpoch = nextAvailableEpochForUser; if (totalPerEpoch[nextAvailableEpochForUser] >= maxPerEpoch) { _nextUnallocatedEpoch = nextAvailableEpochForUser; } unallocatedAmount -= allocationForEpoch; } nextAvailableEpochForUser += 1; } // update outside of main loop, so we spend gas once nextUnallocatedEpoch = _nextUnallocatedEpoch; SafeERC20.safeTransferFrom(TEMPLE, msg.sender, address(this), _amount); emit JoinQueue(_exiter, _amount); } /** * Withdraw processed allowance from a specific epoch */ function withdraw(uint256 epoch) external { require(epoch < currentEpoch(), "Can only withdraw from past epochs"); User storage user = userData[msg.sender]; uint256 amount = user.Exits[epoch]; delete user.Exits[epoch]; totalPerEpoch[epoch] -= amount; // TODO: WHen this goes to 0, is it the same as the data being removed? user.Amount -= amount; // Once all allocations on queue have been claimed, reset user state if (user.Amount == 0) { // NOTE: triggers ExitQueue.withdraw(uint256) (contracts/ExitQueue.sol #150-167) deletes ExitQueue.User (contracts/ExitQueue.sol#15-27) which contains a mapping // This is okay as if Amount is 0, we'd expect user.Exits to be empty as well // TODO: Confirm this via tests delete userData[msg.sender]; } SafeERC20.safeTransfer(TEMPLE, msg.sender, amount); emit Withdrawal(msg.sender, amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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 meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { uint256 currentAllowance = allowance(account, _msgSender()); require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance"); unchecked { _approve(account, _msgSender(), currentAllowance - amount); } _burn(account, amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * 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 AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @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 override 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 override onlyRole(getRoleAdmin(role)) { _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 override onlyRole(getRoleAdmin(role)) { _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 override { 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 { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } function _grantRole(bytes32 role, address account) private { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @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 {AccessControl-_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) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @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) external; /** * @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) external; /** * @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) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT pragma solidity ^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); }
{ "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract TempleERC20Token","name":"_TEMPLE","type":"address"},{"internalType":"contract ExitQueue","name":"_EXIT_QUEUE","type":"address"},{"internalType":"uint256","name":"_epochSizeSeconds","type":"uint256"},{"internalType":"uint256","name":"_startTimestamp","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_epochsProcessed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_currentEpoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_accumulationFactor","type":"uint256"}],"name":"AccumulationFactorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_lockedUntil","type":"uint256"}],"name":"StakeCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"UnstakeCompleted","type":"event"},{"inputs":[],"name":"EXIT_QUEUE","outputs":[{"internalType":"contract ExitQueue","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OG_TEMPLE","outputs":[{"internalType":"contract OGTemple","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TEMPLE","outputs":[{"internalType":"contract TempleERC20Token","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accumulationFactor","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOgTemple","type":"uint256"}],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochSizeSeconds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epy","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_scale","type":"uint256"}],"name":"getAccumulationFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_scale","type":"uint256"}],"name":"getEpy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdatedEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_numerator","type":"uint256"},{"internalType":"uint256","name":"_denominator","type":"uint256"}],"name":"setEpy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ExitQueue","name":"_EXIT_QUEUE","type":"address"}],"name":"setExitQueue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountTemple","type":"uint256"}],"name":"stake","outputs":[{"internalType":"uint256","name":"amountOgTemple","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_staker","type":"address"},{"internalType":"uint256","name":"_amountTemple","type":"uint256"}],"name":"stakeFor","outputs":[{"internalType":"uint256","name":"amountOgTemple","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountOgTemple","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60c06040523480156200001157600080fd5b5060405162005027380380620050278339818101604052810190620000379190620003ca565b620000576200004b6200028760201b60201c565b6200028f60201b60201c565b4281106200009c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620000939062000484565b60405180910390fd5b6202a30042620000ad9190620004d9565b8111620000f1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620000e890620004a6565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b8152505082600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604051620001779062000377565b604051809103906000f08015801562000194573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b815250508160038190555080600481905550620001f060016200035360201b62000d201760201c565b600260006101000a8154816fffffffffffffffffffffffffffffffff0219169083600f0b6fffffffffffffffffffffffffffffffff1602179055506200024260016200035360201b62000d201760201c565b600560006101000a8154816fffffffffffffffffffffffffffffffff0219169083600f0b6fffffffffffffffffffffffffffffffff1602179055505050505062000695565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000677fffffffffffffff8211156200036b57600080fd5b604082901b9050919050565b6121c18062002e6683390190565b600081519050620003968162000647565b92915050565b600081519050620003ad8162000661565b92915050565b600081519050620003c4816200067b565b92915050565b60008060008060808587031215620003e157600080fd5b6000620003f1878288016200039c565b9450506020620004048782880162000385565b93505060406200041787828801620003b3565b92505060606200042a87828801620003b3565b91505092959194509250565b600062000445602383620004c8565b91506200045282620005a9565b604082019050919050565b60006200046c603583620004c8565b91506200047982620005f8565b604082019050919050565b600060208201905081810360008301526200049f8162000436565b9050919050565b60006020820190508181036000830152620004c1816200045d565b9050919050565b600082825260208201905092915050565b6000620004e68262000570565b9150620004f38362000570565b9250828210156200050957620005086200057a565b5b828203905092915050565b6000620005218262000550565b9050919050565b6000620005358262000514565b9050919050565b6000620005498262000514565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f53746172742074696d657374616d70206d75737420626520696e20746865207060008201527f6173740000000000000000000000000000000000000000000000000000000000602082015250565b7f53746172742074696d657374616d702063616e2774206265206d6f726520746860008201527f616e2032206461797320696e2074686520706173740000000000000000000000602082015250565b620006528162000528565b81146200065e57600080fd5b50565b6200066c816200053c565b81146200067857600080fd5b50565b620006868162000570565b81146200069257600080fd5b50565b60805160601c60a05160601c612782620006e4600039600081816103ca015281816104cb015281816107290152610a2201526000818161055b01528181610700015261091201526127826000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c80638da5cb5b116100ad578063cf98400d11610071578063cf98400d1461030f578063d3e06b5e1461033f578063e6fd48bc1461035d578063ed3b97041461037b578063f2fde38b146103ab5761012c565b80638da5cb5b146102695780638f1284aa14610287578063a694fc3a146102a5578063a9f53dac146102d5578063b7642a43146102f15761012c565b806350e23d00116100f457806350e23d00146101e757806359167e4814610205578063715018a614610223578063766718081461022d5780637ca076d71461024b5761012c565b80632e17de78146101315780632ee409081461014d5780633740d5561461017d578063386dea671461019b57806347bb89f0146101b7575b600080fd5b61014b60048036038101906101469190611d2e565b6103c7565b005b61016760048036038101906101629190611ca0565b61066f565b60405161017491906121f3565b60405180910390f35b6101856107f6565b60405161019291906120d6565b60405180910390f35b6101b560048036038101906101b09190611d05565b610809565b005b6101d160048036038101906101cc9190611d2e565b6108c9565b6040516101de91906121f3565b60405180910390f35b6101ef610910565b6040516101fc91906120bb565b60405180910390f35b61020d610934565b60405161021a91906120d6565b60405180910390f35b61022b610947565b005b6102356109cf565b60405161024291906121f3565b60405180910390f35b6102536109f1565b60405161026091906121f3565b60405180910390f35b6102716109f7565b60405161027e9190611faa565b60405180910390f35b61028f610a20565b60405161029c91906120a0565b60405180910390f35b6102bf60048036038101906102ba9190611d2e565b610a44565b6040516102cc91906121f3565b60405180910390f35b6102ef60048036038101906102ea9190611d80565b610a57565b005b6102f9610b42565b60405161030691906121f3565b60405180910390f35b61032960048036038101906103249190611d2e565b610b48565b60405161033691906121f3565b60405180910390f35b610347610b93565b6040516103549190612085565b60405180910390f35b610365610bb9565b60405161037291906121f3565b60405180910390f35b61039560048036038101906103909190611d2e565b610bbf565b6040516103a291906121f3565b60405180910390f35b6103c560048036038101906103c09190611c77565b610c28565b005b807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306040518363ffffffff1660e01b8152600401610423929190611fc5565b60206040518083038186803b15801561043b57600080fd5b505afa15801561044f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104739190611d57565b10156104b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ab90612153565b60405180910390fd5b6104bc610d43565b60006104c7826108c9565b90507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166379cc679033846040518363ffffffff1660e01b8152600401610524929190612025565b600060405180830381600087803b15801561053e57600080fd5b505af1158015610552573d6000803e3d6000fd5b505050506105a37f0000000000000000000000000000000000000000000000000000000000000000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683610e2c565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633b4da69f33836040518363ffffffff1660e01b8152600401610600929190612025565b600060405180830381600087803b15801561061a57600080fd5b505af115801561062e573d6000803e3d6000fd5b505050507fdf2b996992aeaae3212b8d32b9c3c224196146804bed6814ec28d864b4eb3fc53383604051610663929190612025565b60405180910390a15050565b60008082116106b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106aa906121d3565b60405180910390fd5b6106bb610d43565b6106f96106f4600560009054906101000a9004600f0b6106e385670de0b6b3a7640000610f4d565b600f0b610fb590919063ffffffff16565b611065565b90506107277f0000000000000000000000000000000000000000000000000000000000000000333085611104565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166340c10f1984836040518363ffffffff1660e01b8152600401610782929190612025565b600060405180830381600087803b15801561079c57600080fd5b505af11580156107b0573d6000803e3d6000fd5b505050507fcf5c56b135ea8f1d57357dad28d8a7f64f55756e226643908842181edd74d801838360006040516107e89392919061204e565b60405180910390a192915050565b600560009054906101000a9004600f0b81565b61081161118d565b73ffffffffffffffffffffffffffffffffffffffff1661082f6109f7565b73ffffffffffffffffffffffffffffffffffffffff1614610885576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087c90612173565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006109096109046108e16108dc6109cf565b611195565b6108f385670de0b6b3a7640000610f4d565b600f0b6111f990919063ffffffff16565b611065565b9050919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600260009054906101000a9004600f0b81565b61094f61118d565b73ffffffffffffffffffffffffffffffffffffffff1661096d6109f7565b73ffffffffffffffffffffffffffffffffffffffff16146109c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ba90612173565b60405180910390fd5b6109cd6000611264565b565b6000600354600454426109e29190612358565b6109ec91906122cd565b905090565b60035481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000610a50338361066f565b9050919050565b610a5f61118d565b73ffffffffffffffffffffffffffffffffffffffff16610a7d6109f7565b73ffffffffffffffffffffffffffffffffffffffff1614610ad3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aca90612173565b60405180910390fd5b610adb610d43565b610b03610ae88383610f4d565b610af26001610d20565b600f0b61132890919063ffffffff16565b600260006101000a8154816fffffffffffffffffffffffffffffffff0219169083600f0b6fffffffffffffffffffffffffffffffff1602179055505050565b60065481565b6000610b82610b7a610b5984610d20565b610b69610b646109cf565b611195565b600f0b6111f990919063ffffffff16565b600f0b61138f565b67ffffffffffffffff169050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b6000610c17610c0f610bd084610d20565b610bfe610bdd6001610d20565b600260009054906101000a9004600f0b600f0b6113b090919063ffffffff16565b600f0b6111f990919063ffffffff16565b600f0b61138f565b67ffffffffffffffff169050919050565b610c3061118d565b73ffffffffffffffffffffffffffffffffffffffff16610c4e6109f7565b73ffffffffffffffffffffffffffffffffffffffff1614610ca4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9b90612173565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610d14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0b90612113565b60405180910390fd5b610d1d81611264565b50565b6000677fffffffffffffff821115610d3757600080fd5b604082901b9050919050565b6000610d4d6109cf565b90506006548111610d5e5750610e2a565b610d6781611195565b600560006101000a8154816fffffffffffffffffffffffffffffffff0219169083600f0b6fffffffffffffffffffffffffffffffff16021790555080600681905550600060065482610db99190612358565b90507faede5390ed10bde4ef7003c320b4df98c2b8df8749030985178fdd5a55c506468183610e10610e08612710600560009054906101000a9004600f0b600f0b6111f990919063ffffffff16565b600f0b61138f565b604051610e1f9392919061220e565b60405180910390a150505b565b6000818473ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30866040518363ffffffff1660e01b8152600401610e6a929190611fc5565b60206040518083038186803b158015610e8257600080fd5b505afa158015610e96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eba9190611d57565b610ec49190612277565b9050610f478463095ea7b360e01b8584604051602401610ee5929190612025565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611417565b50505050565b600080821415610f5c57600080fd5b6000610f6884846114de565b90506f7fffffffffffffffffffffffffffffff6fffffffffffffffffffffffffffffffff16816fffffffffffffffffffffffffffffffff161115610fab57600080fd5b8091505092915050565b60008082600f0b1415610fc757600080fd5b600082600f0b604085600f0b901b81611009577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b0590507fffffffffffffffffffffffffffffffff80000000000000000000000000000000600f0b811215801561105257506f7fffffffffffffffffffffffffffffff600f0b8113155b61105b57600080fd5b8091505092915050565b60008061107483600f0b61138f565b67ffffffffffffffff16905060006110d06110c8611099670de0b6b3a7640000610d20565b6110b76110a586610d20565b88600f0b6113b090919063ffffffff16565b600f0b6111f990919063ffffffff16565b600f0b61138f565b67ffffffffffffffff16905080670de0b6b3a7640000836110f191906122fe565b6110fb9190612277565b92505050919050565b611187846323b872dd60e01b85858560405160240161112593929190611fee565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611417565b50505050565b600033905090565b600080600654836111a69190612358565b90506111f16111d082600260009054906101000a9004600f0b600f0b61175390919063ffffffff16565b600560009054906101000a9004600f0b600f0b6111f990919063ffffffff16565b915050919050565b600080604083600f0b85600f0b02901d90507fffffffffffffffffffffffffffffffff80000000000000000000000000000000600f0b811215801561125157506f7fffffffffffffffffffffffffffffff600f0b8113155b61125a57600080fd5b8091505092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60008082600f0b84600f0b0190507fffffffffffffffffffffffffffffffff80000000000000000000000000000000600f0b811215801561137c57506f7fffffffffffffffffffffffffffffff600f0b8113155b61138557600080fd5b8091505092915050565b60008082600f0b12156113a157600080fd5b604082600f0b901d9050919050565b60008082600f0b84600f0b0390507fffffffffffffffffffffffffffffffff80000000000000000000000000000000600f0b811215801561140457506f7fffffffffffffffffffffffffffffff600f0b8113155b61140d57600080fd5b8091505092915050565b6000611479826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611a689092919063ffffffff16565b90506000815111156114d957808060200190518101906114999190611cdc565b6114d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cf906121b3565b60405180910390fd5b5b505050565b6000808214156114ed57600080fd5b600077ffffffffffffffffffffffffffffffffffffffffffffffff84116115505782604085901b81611548577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b04905061172c565b600060c09050600060c086901c9050640100000000811061157957602081901c90506020820191505b62010000811061159157601081901c90506010820191505b61010081106115a857600881901c90506008820191505b601081106115be57600481901c90506004820191505b600481106115d457600281901c90506002820191505b600281106115e3576001820191505b600160bf830360018703901c018260ff0387901b8161162b577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b0492506fffffffffffffffffffffffffffffffff83111561164b57600080fd5b6000608086901c8402905060006fffffffffffffffffffffffffffffffff871685029050600060c089901c9050600060408a901b905082811015611690576001820391505b8281039050608084901b9250828110156116ab576001820391505b8281039050608084901c82146116ea577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b888181611720577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b04870196505050505050505b6fffffffffffffffffffffffffffffffff81111561174957600080fd5b8091505092915050565b600080600084600f0b12801561176b57506001808416145b905060008085600f0b1261177f5784611784565b846000035b6fffffffffffffffffffffffffffffffff1690506000700100000000000000000000000000000000905068010000000000000000821161185e57603f82901b91505b6000851461185257600060018616146117e357607f828202901c90505b607f828302901c91506000600286161461180157607f828202901c90505b607f828302901c91506000600486161461181f57607f828202901c90505b607f828302901c91506000600886161461183d57607f828202901c90505b607f828302901c9150600485901c94506117c6565b604081901c90506119f8565b6000603f90506c0100000000000000000000000083101561188757602083901b92506020810390505b6e0100000000000000000000000000008310156118ac57601083901b92506010810390505b6f010000000000000000000000000000008310156118d257600883901b92506008810390505b6f100000000000000000000000000000008310156118f857600483901b92506004810390505b6f4000000000000000000000000000000083101561191e57600283901b92506002810390505b6f8000000000000000000000000000000083101561194457600183901b92506001810390505b60005b600087146119df576040821061195c57600080fd5b6000600188161461199d57607f848402901c9250818101905070010000000000000000000000000000000083111561199c57600183901c92506001810190505b5b607f848502901c9350600182901b915070010000000000000000000000000000000084106119d357600184901c93506001820191505b600187901c9650611947565b604081106119ec57600080fd5b8060400383901c925050505b600083611a055781611a0a565b816000035b90507fffffffffffffffffffffffffffffffff80000000000000000000000000000000600f0b8112158015611a5257506f7fffffffffffffffffffffffffffffff600f0b8113155b611a5b57600080fd5b8094505050505092915050565b6060611a778484600085611a80565b90509392505050565b606082471015611ac5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611abc90612133565b60405180910390fd5b611ace85611b94565b611b0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b0490612193565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611b369190611f93565b60006040518083038185875af1925050503d8060008114611b73576040519150601f19603f3d011682016040523d82523d6000602084013e611b78565b606091505b5091509150611b88828286611ba7565b92505050949350505050565b600080823b905060008111915050919050565b60608315611bb757829050611c07565b600083511115611bca5782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bfe91906120f1565b60405180910390fd5b9392505050565b600081359050611c1d816126f0565b92915050565b600081519050611c3281612707565b92915050565b600081359050611c478161271e565b92915050565b600081359050611c5c81612735565b92915050565b600081519050611c7181612735565b92915050565b600060208284031215611c8957600080fd5b6000611c9784828501611c0e565b91505092915050565b60008060408385031215611cb357600080fd5b6000611cc185828601611c0e565b9250506020611cd285828601611c4d565b9150509250929050565b600060208284031215611cee57600080fd5b6000611cfc84828501611c23565b91505092915050565b600060208284031215611d1757600080fd5b6000611d2584828501611c38565b91505092915050565b600060208284031215611d4057600080fd5b6000611d4e84828501611c4d565b91505092915050565b600060208284031215611d6957600080fd5b6000611d7784828501611c62565b91505092915050565b60008060408385031215611d9357600080fd5b6000611da185828601611c4d565b9250506020611db285828601611c4d565b9150509250929050565b611dc58161238c565b82525050565b6000611dd682612245565b611de0818561225b565b9350611df0818560208601612497565b80840191505092915050565b611e0581612407565b82525050565b611e148161242b565b82525050565b611e238161244f565b82525050565b611e32816123bc565b82525050565b611e4181612473565b82525050565b6000611e5282612250565b611e5c8185612266565b9350611e6c818560208601612497565b611e7581612528565b840191505092915050565b6000611e8d602683612266565b9150611e9882612539565b604082019050919050565b6000611eb0602683612266565b9150611ebb82612588565b604082019050919050565b6000611ed3602f83612266565b9150611ede826125d7565b604082019050919050565b6000611ef6602083612266565b9150611f0182612626565b602082019050919050565b6000611f19601d83612266565b9150611f248261264f565b602082019050919050565b6000611f3c602a83612266565b9150611f4782612678565b604082019050919050565b6000611f5f601583612266565b9150611f6a826126c7565b602082019050919050565b611f7e816123e9565b82525050565b611f8d81612485565b82525050565b6000611f9f8284611dcb565b915081905092915050565b6000602082019050611fbf6000830184611dbc565b92915050565b6000604082019050611fda6000830185611dbc565b611fe76020830184611dbc565b9392505050565b60006060820190506120036000830186611dbc565b6120106020830185611dbc565b61201d6040830184611f75565b949350505050565b600060408201905061203a6000830185611dbc565b6120476020830184611f75565b9392505050565b60006060820190506120636000830186611dbc565b6120706020830185611f75565b61207d6040830184611e38565b949350505050565b600060208201905061209a6000830184611dfc565b92915050565b60006020820190506120b56000830184611e0b565b92915050565b60006020820190506120d06000830184611e1a565b92915050565b60006020820190506120eb6000830184611e29565b92915050565b6000602082019050818103600083015261210b8184611e47565b905092915050565b6000602082019050818103600083015261212c81611e80565b9050919050565b6000602082019050818103600083015261214c81611ea3565b9050919050565b6000602082019050818103600083015261216c81611ec6565b9050919050565b6000602082019050818103600083015261218c81611ee9565b9050919050565b600060208201905081810360008301526121ac81611f0c565b9050919050565b600060208201905081810360008301526121cc81611f2f565b9050919050565b600060208201905081810360008301526121ec81611f52565b9050919050565b60006020820190506122086000830184611f75565b92915050565b60006060820190506122236000830186611f75565b6122306020830185611f75565b61223d6040830184611f84565b949350505050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000612282826123e9565b915061228d836123e9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156122c2576122c16124ca565b5b828201905092915050565b60006122d8826123e9565b91506122e3836123e9565b9250826122f3576122f26124f9565b5b828204905092915050565b6000612309826123e9565b9150612314836123e9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561234d5761234c6124ca565b5b828202905092915050565b6000612363826123e9565b915061236e836123e9565b925082821015612381576123806124ca565b5b828203905092915050565b6000612397826123c9565b9050919050565b60008115159050919050565b60006123b58261238c565b9050919050565b600081600f0b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600067ffffffffffffffff82169050919050565b600061241282612419565b9050919050565b6000612424826123c9565b9050919050565b60006124368261243d565b9050919050565b6000612448826123c9565b9050919050565b600061245a82612461565b9050919050565b600061246c826123c9565b9050919050565b600061247e826123e9565b9050919050565b6000612490826123f3565b9050919050565b60005b838110156124b557808201518184015260208101905061249a565b838111156124c4576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f496e73756666696369656e74204f4754656d706c6520616c6c6f77616e63652e60008201527f2043616e6e6f7420756e7374616b650000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f43616e6e6f74207374616b65203020746f6b656e730000000000000000000000600082015250565b6126f98161238c565b811461270457600080fd5b50565b6127108161239e565b811461271b57600080fd5b50565b612727816123aa565b811461273257600080fd5b50565b61273e816123e9565b811461274957600080fd5b5056fea2646970667358221220fa8a13f727357febb4129603d2fdab8acda5007e0830461c4384dea669da241b64736f6c6343000804003360806040523480156200001157600080fd5b506040518060400160405280600881526020017f4f4754656d706c650000000000000000000000000000000000000000000000008152506040518060400160405280600981526020017f4f475f54454d504c450000000000000000000000000000000000000000000000815250816003908051906020019062000096929190620001a6565b508060049080519060200190620000af929190620001a6565b505050620000d2620000c6620000d860201b60201c565b620000e060201b60201c565b620002bb565b600033905090565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b828054620001b49062000256565b90600052602060002090601f016020900481019282620001d8576000855562000224565b82601f10620001f357805160ff191683800117855562000224565b8280016001018555821562000224579182015b828111156200022357825182559160200191906001019062000206565b5b50905062000233919062000237565b5090565b5b808211156200025257600081600090555060010162000238565b5090565b600060028204905060018216806200026f57607f821691505b602082108114156200028657620002856200028c565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b611ef680620002cb6000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c806370a08231116100a257806395d89b411161007157806395d89b41146102a6578063a457c2d7146102c4578063a9059cbb146102f4578063dd62ed3e14610324578063f2fde38b146103545761010b565b806370a0823114610232578063715018a61461026257806379cc67901461026c5780638da5cb5b146102885761010b565b8063313ce567116100de578063313ce567146101ac57806339509351146101ca57806340c10f19146101fa57806342966c68146102165761010b565b806306fdde0314610110578063095ea7b31461012e57806318160ddd1461015e57806323b872dd1461017c575b600080fd5b610118610370565b6040516101259190611714565b60405180910390f35b6101486004803603810190610143919061143d565b610402565b60405161015591906116f9565b60405180910390f35b610166610420565b60405161017391906118d6565b60405180910390f35b610196600480360381019061019191906113ee565b61042a565b6040516101a391906116f9565b60405180910390f35b6101b4610522565b6040516101c191906118f1565b60405180910390f35b6101e460048036038101906101df919061143d565b61052b565b6040516101f191906116f9565b60405180910390f35b610214600480360381019061020f919061143d565b6105d7565b005b610230600480360381019061022b9190611479565b610661565b005b61024c60048036038101906102479190611389565b610675565b60405161025991906118d6565b60405180910390f35b61026a6106bd565b005b6102866004803603810190610281919061143d565b610745565b005b6102906107c0565b60405161029d91906116de565b60405180910390f35b6102ae6107ea565b6040516102bb9190611714565b60405180910390f35b6102de60048036038101906102d9919061143d565b61087c565b6040516102eb91906116f9565b60405180910390f35b61030e6004803603810190610309919061143d565b610967565b60405161031b91906116f9565b60405180910390f35b61033e600480360381019061033991906113b2565b610985565b60405161034b91906118d6565b60405180910390f35b61036e60048036038101906103699190611389565b610a0c565b005b60606003805461037f90611a3a565b80601f01602080910402602001604051908101604052809291908181526020018280546103ab90611a3a565b80156103f85780601f106103cd576101008083540402835291602001916103f8565b820191906000526020600020905b8154815290600101906020018083116103db57829003601f168201915b5050505050905090565b600061041661040f610b04565b8484610b0c565b6001905092915050565b6000600254905090565b6000610437848484610cd7565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610482610b04565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610502576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104f9906117d6565b60405180910390fd5b6105168561050e610b04565b858403610b0c565b60019150509392505050565b60006012905090565b60006105cd610538610b04565b848460016000610546610b04565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105c89190611928565b610b0c565b6001905092915050565b6105df610b04565b73ffffffffffffffffffffffffffffffffffffffff166105fd6107c0565b73ffffffffffffffffffffffffffffffffffffffff1614610653576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161064a906117f6565b60405180910390fd5b61065d8282610f58565b5050565b61067261066c610b04565b826110b8565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6106c5610b04565b73ffffffffffffffffffffffffffffffffffffffff166106e36107c0565b73ffffffffffffffffffffffffffffffffffffffff1614610739576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610730906117f6565b60405180910390fd5b610743600061128f565b565b600061075883610753610b04565b610985565b90508181101561079d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079490611816565b60405180910390fd5b6107b1836107a9610b04565b848403610b0c565b6107bb83836110b8565b505050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600480546107f990611a3a565b80601f016020809104026020016040519081016040528092919081815260200182805461082590611a3a565b80156108725780601f1061084757610100808354040283529160200191610872565b820191906000526020600020905b81548152906001019060200180831161085557829003601f168201915b5050505050905090565b6000806001600061088b610b04565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610948576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093f90611896565b60405180910390fd5b61095c610953610b04565b85858403610b0c565b600191505092915050565b600061097b610974610b04565b8484610cd7565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610a14610b04565b73ffffffffffffffffffffffffffffffffffffffff16610a326107c0565b73ffffffffffffffffffffffffffffffffffffffff1614610a88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7f906117f6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610af8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aef90611776565b60405180910390fd5b610b018161128f565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b7390611876565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610bec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be390611796565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610cca91906118d6565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3e90611856565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610db7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dae90611736565b60405180910390fd5b610dc2838383611355565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610e48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3f906117b6565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610edb9190611928565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610f3f91906118d6565b60405180910390a3610f5284848461135a565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610fc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fbf906118b6565b60405180910390fd5b610fd460008383611355565b8060026000828254610fe69190611928565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461103b9190611928565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516110a091906118d6565b60405180910390a36110b46000838361135a565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611128576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111f90611836565b60405180910390fd5b61113482600083611355565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156111ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b190611756565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508160026000828254611211919061197e565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161127691906118d6565b60405180910390a361128a8360008461135a565b505050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b505050565b505050565b60008135905061136e81611e92565b92915050565b60008135905061138381611ea9565b92915050565b60006020828403121561139b57600080fd5b60006113a98482850161135f565b91505092915050565b600080604083850312156113c557600080fd5b60006113d38582860161135f565b92505060206113e48582860161135f565b9150509250929050565b60008060006060848603121561140357600080fd5b60006114118682870161135f565b93505060206114228682870161135f565b925050604061143386828701611374565b9150509250925092565b6000806040838503121561145057600080fd5b600061145e8582860161135f565b925050602061146f85828601611374565b9150509250929050565b60006020828403121561148b57600080fd5b600061149984828501611374565b91505092915050565b6114ab816119b2565b82525050565b6114ba816119c4565b82525050565b60006114cb8261190c565b6114d58185611917565b93506114e5818560208601611a07565b6114ee81611aca565b840191505092915050565b6000611506602383611917565b915061151182611adb565b604082019050919050565b6000611529602283611917565b915061153482611b2a565b604082019050919050565b600061154c602683611917565b915061155782611b79565b604082019050919050565b600061156f602283611917565b915061157a82611bc8565b604082019050919050565b6000611592602683611917565b915061159d82611c17565b604082019050919050565b60006115b5602883611917565b91506115c082611c66565b604082019050919050565b60006115d8602083611917565b91506115e382611cb5565b602082019050919050565b60006115fb602483611917565b915061160682611cde565b604082019050919050565b600061161e602183611917565b915061162982611d2d565b604082019050919050565b6000611641602583611917565b915061164c82611d7c565b604082019050919050565b6000611664602483611917565b915061166f82611dcb565b604082019050919050565b6000611687602583611917565b915061169282611e1a565b604082019050919050565b60006116aa601f83611917565b91506116b582611e69565b602082019050919050565b6116c9816119f0565b82525050565b6116d8816119fa565b82525050565b60006020820190506116f360008301846114a2565b92915050565b600060208201905061170e60008301846114b1565b92915050565b6000602082019050818103600083015261172e81846114c0565b905092915050565b6000602082019050818103600083015261174f816114f9565b9050919050565b6000602082019050818103600083015261176f8161151c565b9050919050565b6000602082019050818103600083015261178f8161153f565b9050919050565b600060208201905081810360008301526117af81611562565b9050919050565b600060208201905081810360008301526117cf81611585565b9050919050565b600060208201905081810360008301526117ef816115a8565b9050919050565b6000602082019050818103600083015261180f816115cb565b9050919050565b6000602082019050818103600083015261182f816115ee565b9050919050565b6000602082019050818103600083015261184f81611611565b9050919050565b6000602082019050818103600083015261186f81611634565b9050919050565b6000602082019050818103600083015261188f81611657565b9050919050565b600060208201905081810360008301526118af8161167a565b9050919050565b600060208201905081810360008301526118cf8161169d565b9050919050565b60006020820190506118eb60008301846116c0565b92915050565b600060208201905061190660008301846116cf565b92915050565b600081519050919050565b600082825260208201905092915050565b6000611933826119f0565b915061193e836119f0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561197357611972611a6c565b5b828201905092915050565b6000611989826119f0565b9150611994836119f0565b9250828210156119a7576119a6611a6c565b5b828203905092915050565b60006119bd826119d0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611a25578082015181840152602081019050611a0a565b83811115611a34576000848401525b50505050565b60006002820490506001821680611a5257607f821691505b60208210811415611a6657611a65611a9b565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f7760008201527f616e636500000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b611e9b816119b2565b8114611ea657600080fd5b50565b611eb2816119f0565b8114611ebd57600080fd5b5056fea264697066735822122067db9702597cb1b2bbf043f838411b5a2e6f0810d669fed61e5f64107370565864736f6c63430008040033000000000000000000000000470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7000000000000000000000000faeadcd9cb6870a5df09e403e4dcfcf1a6f20a0c0000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000006153c8a0
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7000000000000000000000000faeadcd9cb6870a5df09e403e4dcfcf1a6f20a0c0000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000006153c8a0
-----Decoded View---------------
Arg [0] : _TEMPLE (address): 0x470EBf5f030Ed85Fc1ed4C2d36B9DD02e77CF1b7
Arg [1] : _EXIT_QUEUE (address): 0xFaEAdCd9Cb6870a5Df09e403E4DCFCF1A6F20a0C
Arg [2] : _epochSizeSeconds (uint256): 86400
Arg [3] : _startTimestamp (uint256): 1632880800
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7
Arg [1] : 000000000000000000000000faeadcd9cb6870a5df09e403e4dcfcf1a6f20a0c
Arg [2] : 0000000000000000000000000000000000000000000000000000000000015180
Arg [3] : 000000000000000000000000000000000000000000000000000000006153c8a0
Loading...
Loading
Loading...
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.
[ Download: CSV Export ]
[ 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.