ETH Price: $3,106.04 (+5.43%)
Gas: 4 Gwei

Contract

0x98257C876ACe5009e7B97843F8c71b3AE795c71E
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Swap Exact Templ...187157082023-12-04 21:33:23165 days ago1701725603IN
0x98257C87...AE795c71E
0 ETH0.0058393449.51197177
Swap Exact Stabl...186483782023-11-25 11:20:59174 days ago1700911259IN
0x98257C87...AE795c71E
0 ETH0.0027407125.42403608
Swap Exact Templ...186144982023-11-20 17:31:11179 days ago1700501471IN
0x98257C87...AE795c71E
0 ETH0.0051670943.80301541
Swap Exact Templ...185544132023-11-12 7:42:11187 days ago1699774931IN
0x98257C87...AE795c71E
0 ETH0.002878724.4036405
Swap Exact Templ...185126582023-11-06 11:31:35193 days ago1699270295IN
0x98257C87...AE795c71E
0 ETH0.0031849423.58347465
Swap Exact Stabl...185072722023-11-05 17:24:47194 days ago1699205087IN
0x98257C87...AE795c71E
0 ETH0.0029373227.2418838
Swap Exact Stabl...185072292023-11-05 17:15:59194 days ago1699204559IN
0x98257C87...AE795c71E
0 ETH0.0032389830.03951449
Swap Exact Stabl...183780442023-10-18 15:10:47212 days ago1697641847IN
0x98257C87...AE795c71E
0 ETH0.0019379317.97310202
Swap Exact Templ...183690972023-10-17 9:08:11213 days ago1697533691IN
0x98257C87...AE795c71E
0 ETH0.0012831310.87754061
Swap Exact Stabl...183641472023-10-16 16:31:23214 days ago1697473883IN
0x98257C87...AE795c71E
0 ETH0.0027461925.4635741
Swap Exact Templ...183609512023-10-16 5:49:11214 days ago1697435351IN
0x98257C87...AE795c71E
0 ETH0.0012420310.52910523
Swap Exact Stabl...182828212023-10-05 7:28:47225 days ago1696490927IN
0x98257C87...AE795c71E
0 ETH0.000706346.55240826
Swap Exact Stabl...182543652023-10-01 8:02:11229 days ago1696147331IN
0x98257C87...AE795c71E
0 ETH0.000929948.62562469
Swap Exact Templ...182297892023-09-27 21:30:59233 days ago1695850259IN
0x98257C87...AE795c71E
0 ETH0.0026430122.40566303
Swap Exact Stabl...181710222023-09-19 16:02:59241 days ago1695139379IN
0x98257C87...AE795c71E
0 ETH0.0070942365.79460802
Swap Exact Stabl...181545082023-09-17 8:13:35243 days ago1694938415IN
0x98257C87...AE795c71E
0 ETH0.000896188.31159134
Swap Exact Stabl...181517272023-09-16 22:44:11244 days ago1694904251IN
0x98257C87...AE795c71E
0 ETH0.001096238.77354388
Swap Exact Templ...181123022023-09-11 9:44:59249 days ago1694425499IN
0x98257C87...AE795c71E
0 ETH0.0022059119.49341864
Swap Exact Stabl...180464772023-09-02 4:32:35258 days ago1693629155IN
0x98257C87...AE795c71E
0 ETH0.0020105916.09457281
Swap Exact Templ...180133502023-08-28 13:09:59263 days ago1693228199IN
0x98257C87...AE795c71E
0 ETH0.004594340.59931931
Swap Exact Stabl...179403002023-08-18 7:50:23273 days ago1692345023IN
0x98257C87...AE795c71E
0 ETH0.0018810517.44559519
Swap Exact Stabl...179386852023-08-18 2:24:35274 days ago1692325475IN
0x98257C87...AE795c71E
0 ETH0.0035479132.90465754
Swap Exact Stabl...179385522023-08-18 1:57:47274 days ago1692323867IN
0x98257C87...AE795c71E
0 ETH0.0029991227.8149963
Swap Exact Stabl...179385242023-08-18 1:52:11274 days ago1692323531IN
0x98257C87...AE795c71E
0 ETH0.0031711829.41078575
Swap Exact Templ...179385142023-08-18 1:50:11274 days ago1692323411IN
0x98257C87...AE795c71E
0 ETH0.0036466330.91363709
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TempleStableAMMRouter

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 999999 runs

Other Settings:
default evmVersion
File 1 of 17 : TempleStableAMMRouter.sol
pragma solidity ^0.8.4;
// SPDX-License-Identifier: GPL-3.0-or-later

import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

import "../TempleERC20Token.sol";


interface ITempleTWAP {
    function update() external;
    function consult(uint amountIn) external view;
}

interface ITempleTreasury {
    function intrinsicValueRatio() external view returns (uint256 frax, uint256 temple);
}

contract TempleStableAMMRouter is Ownable {

    // Token to uniswap pair contract mapping
    mapping(address => address) public tokenPair; 

    TempleERC20Token public immutable templeToken;
    ITempleTreasury public templeTreasury;

    address public defendStable; // stable to swap for when defend is active

    modifier ensure(uint deadline) {
        require(deadline >= block.timestamp, 'TempleStableAMMRouter: EXPIRED');
        _;
    }

    constructor(
            TempleERC20Token _templeToken,
            ITempleTreasury _templeTreasury,
            address  _defendStable
            ) {

        templeToken = _templeToken;
        templeTreasury = _templeTreasury;
        defendStable  = _defendStable;
    }

    function addPair(address _token, address _pair) external onlyOwner {
        tokenPair[_token] = _pair;
    }

    function setTreasury(address _templeTreasury) external onlyOwner {
        templeTreasury = ITempleTreasury(_templeTreasury);
    }

    function setDefendStable(address _defendStable) external onlyOwner {
        defendStable = _defendStable;
    }

    // **** ADD LIQUIDITY ****
    function _addLiquidity(
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        IUniswapV2Pair pair
    ) internal virtual returns (uint amountA, uint amountB) {
        (uint reserveA, uint reserveB,) = pair.getReserves();
        if (reserveA == 0 && reserveB == 0) {
            (amountA, amountB) = (amountADesired, amountBDesired);
        } else {
            uint amountBOptimal = quote(amountADesired, reserveA, reserveB);
            if (amountBOptimal <= amountBDesired) {
                require(amountBOptimal >= amountBMin, 'TempleStableAMMRouter: INSUFFICIENT_STABLE');
                (amountA, amountB) = (amountADesired, amountBOptimal);
            } else {
                uint amountAOptimal = quote(amountBDesired, reserveB, reserveA);
                assert(amountAOptimal <= amountADesired);
                require(amountAOptimal >= amountAMin, 'TempleStableAMMRouter: INSUFFICIENT_TEMPLE');
                (amountA, amountB) = (amountAOptimal, amountBDesired);
            }
        }
    }

    function addLiquidity(
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address stable,
        address to,
        uint deadline
    ) external virtual ensure(deadline) returns (uint amountA, uint amountB, uint liquidity) {
        IUniswapV2Pair pair = IUniswapV2Pair(tokenPair[stable]);
        require(address(pair) != address(0), 'TempleStableAMMRouter: UNSUPPORTED_PAIR');
        require(amountADesired >= amountAMin && amountBDesired >= amountBMin, 'TempleStableAMMRouter: MEV_EXTRACTABLE');

        (amountA, amountB) = _addLiquidity(amountADesired, amountBDesired, amountAMin, amountBMin, pair);
        SafeERC20.safeTransferFrom(templeToken, msg.sender, address(pair), amountA);
        SafeERC20.safeTransferFrom(IERC20(stable), msg.sender, address(pair), amountB);
        liquidity = pair.mint(to);
    }

    // **** REMOVE LIQUIDITY ****
    function removeLiquidity(
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address stable,
        address to,
        uint deadline
    ) public virtual ensure(deadline) returns (uint amountA, uint amountB) {
        IUniswapV2Pair pair = IUniswapV2Pair(tokenPair[stable]);
        require(address(pair) != address(0), 'TempleStableAMMRouter: UNSUPPORTED_PAIR');
  
        SafeERC20.safeTransferFrom(IERC20(address(pair)), msg.sender, address(pair), liquidity);
        (amountA, amountB) = pair.burn(to);
        require(amountA >= amountAMin, 'TempleStableAMMRouter: INSUFFICIENT_TEMPLE');
        require(amountB >= amountBMin, 'TempleFraxAMMRouter: INSUFFICIENT_FRAX');
    }

    function swapExactStableForTemple(
        uint amountIn,
        uint amountOutMin,
        address stable,
        address to,
        uint deadline
    ) external virtual ensure(deadline) returns (uint amountOut) {

        address pair = tokenPair[stable];
        require(pair != address(0), 'TempleStableAMMRouter: UNSUPPORTED_PAIR');

        uint amountOut = swapExactStableForTempleQuote(pair, amountIn);
        require(amountOut >= amountOutMin, 'TempleStableAMMRouter: INSUFFICIENT_OUTPUT_AMOUNT');

        // Swap on AMM
        SafeERC20.safeTransferFrom(IERC20(stable), msg.sender, pair, amountIn);
        IUniswapV2Pair(pair).swap(amountOut, 0, to, new bytes(0));
    }


    function swapExactTempleForStable(
        uint amountIn,
        uint amountOutMin,
        address stable,
        address to,
        uint deadline
    ) external virtual ensure(deadline) returns (uint) {
        
        address pair = tokenPair[stable];
        require(pair != address(0), 'TempleStableAMMRouter: UNSUPPORTED_PAIR');


        (bool priceBelowIV, uint amountOut) = swapExactTempleForStableQuote(pair, amountIn);
        if (priceBelowIV) {
            require(amountOut >= amountOutMin, 'TempleStableAMMRouter: INSUFFICIENT_OUTPUT_AMOUNT');
            templeToken.burnFrom(msg.sender, amountIn);
            SafeERC20.safeTransfer(IERC20(defendStable), to, amountOut);
        } else {
            
            require(amountOut >= amountOutMin, 'TempleStableAMMRouter: INSUFFICIENT_OUTPUT_AMOUNT');
            SafeERC20.safeTransferFrom(templeToken, msg.sender, pair, amountIn);
            IUniswapV2Pair(pair).swap(0, amountOut, to, new bytes(0));
        }

        return amountOut;
    }


    // **** LIBRARY FUNCTIONS ****

    /** 
     * given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
     *
     * Direct copy of UniswapV2Library.quote(amountA, reserveA, reserveB) - can't use as directly as it's built off a different version of solidity
     */
    function quote(uint amountA, uint reserveA, uint reserveB) public pure returns (uint amountB) {
        require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');
        require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        amountB = (amountA * reserveB) / reserveA;

    }

    /**
     * given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
     *
     * Direct copy of UniswapV2Library.getAmountOut
     */
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut)
        public
        pure
        returns (uint amountOut)
    {
        require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        uint amountInWithFee = amountIn * 995;
        uint numerator = amountInWithFee * reserveOut;
        uint denominator = (reserveIn * 1000) + amountInWithFee;
        amountOut = numerator / denominator;
    }

    function swapExactStableForTempleQuote(address pair, uint amountIn) public view returns (uint amountOut ) {
        (uint reserveTemple, uint reserveFrax,) = IUniswapV2Pair(pair).getReserves();
        amountOut = getAmountOut(amountIn, reserveFrax, reserveTemple);
    }

    function swapExactTempleForStableQuote(address pair, uint amountIn) public view returns (bool priceBelowIV, uint amountOut) {
        (uint reserveTemple, uint reserveFrax,) = IUniswapV2Pair(pair).getReserves();
  
        (uint256 ivFrax, uint256 ivTemple) = templeTreasury.intrinsicValueRatio();

        uint256 amountOutAmm = getAmountOut(amountIn, reserveTemple, reserveFrax);
        uint256 amountOutIvSwap = (amountIn * ivFrax) / ivTemple;

        if (amountOutIvSwap > amountOutAmm) {
            amountOut = amountOutIvSwap;
            priceBelowIV = true;
        } else {
            amountOut = amountOutAmm;
        }
    }

  /**
   * transfer out amount of token to provided address
   */
  function withdraw(address token, address to, uint256 amount) external onlyOwner {
    require(to != address(0), "to address zero");
    if (token == address(0)) {
      (bool sent,) = payable(to).call{value: amount}("");
      require(sent, "send failed");
    } else {
      SafeERC20.safeTransfer(IERC20(token), to, amount);
    }
  }
}

File 3 of 17 : IUniswapV2Pair.sol
pragma solidity >=0.5.0;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

File 4 of 17 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

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);
}

File 5 of 17 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

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");
        }
    }
}

File 6 of 17 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

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() {
        _transferOwnership(_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 {
        _transferOwnership(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");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 7 of 17 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)

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 revoked `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}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    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);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 8 of 17 : TempleERC20Token.sol
pragma solidity ^0.8.4;
// SPDX-License-Identifier: AGPL-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);
    }
}

File 9 of 17 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

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);
            }
        }
    }
}

File 10 of 17 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

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;
    }
}

File 11 of 17 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

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;
}

File 12 of 17 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

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);
    }
}

File 13 of 17 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

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;
    }
}

File 14 of 17 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

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);
}

File 15 of 17 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)

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 {}
}

File 16 of 17 : ERC20Burnable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Burnable.sol)

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);
    }
}

File 17 of 17 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

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());
    }
}

File 18 of 17 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

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);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 999999
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract TempleERC20Token","name":"_templeToken","type":"address"},{"internalType":"contract ITempleTreasury","name":"_templeTreasury","type":"address"},{"internalType":"address","name":"_defendStable","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint256","name":"amountADesired","type":"uint256"},{"internalType":"uint256","name":"amountBDesired","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"stable","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_pair","type":"address"}],"name":"addPair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"defendStable","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"reserveIn","type":"uint256"},{"internalType":"uint256","name":"reserveOut","type":"uint256"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"reserveA","type":"uint256"},{"internalType":"uint256","name":"reserveB","type":"uint256"}],"name":"quote","outputs":[{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"stable","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_defendStable","type":"address"}],"name":"setDefendStable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_templeTreasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address","name":"stable","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactStableForTemple","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pair","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"swapExactStableForTempleQuote","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address","name":"stable","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTempleForStable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pair","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"swapExactTempleForStableQuote","outputs":[{"internalType":"bool","name":"priceBelowIV","type":"bool"},{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"templeToken","outputs":[{"internalType":"contract TempleERC20Token","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"templeTreasury","outputs":[{"internalType":"contract ITempleTreasury","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenPair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040523480156200001157600080fd5b5060405162002804380380620028048339810160408190526200003491620000d5565b6200003f3362000085565b60609290921b6001600160601b031916608052600280546001600160a01b03199081166001600160a01b0393841617909155600380549091169190921617905562000141565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080600060608486031215620000ea578283fd5b8351620000f78162000128565b60208501519093506200010a8162000128565b60408501519092506200011d8162000128565b809150509250925092565b6001600160a01b03811681146200013e57600080fd5b50565b60805160601c61268f62000175600039600081816102dd015281816106e9015281816116ff015261182f015261268f6000f3fe608060405234801561001057600080fd5b50600436106101515760003560e01c80638da5cb5b116100cd578063c4b58a1e11610081578063e94e36b911610066578063e94e36b914610358578063f0f442601461036b578063f2fde38b1461037e57600080fd5b8063c4b58a1e14610332578063d9caed121461034557600080fd5b8063b1a9069c116100b2578063b1a9069c146102d8578063b272d5a2146102ff578063b6f3e0871461031f57600080fd5b80638da5cb5b146102a7578063ad615dec146102c557600080fd5b80632c908de5116101245780636727a70b116101095780636727a70b14610262578063715018a61461028a578063854f71061461029457600080fd5b80632c908de5146102255780634dfe82a51461023857600080fd5b8063054d50d41461015657806314e920981461017c5780631cc6391e146101aa57806328fef2a114610205575b600080fd5b6101696101643660046123ce565b610391565b6040519081526020015b60405180910390f35b61018f61018a366004612450565b610511565b60408051938452602084019290925290820152606001610173565b6101e06101b8366004612228565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610173565b6002546101e09073ffffffffffffffffffffffffffffffffffffffff1681565b6101696102333660046122af565b6107ce565b61024b6102463660046122af565b61088a565b604080519215158352602083019190915201610173565b6102756102703660046123f9565b610a26565b60408051928352602083019190915201610173565b610292610d27565b005b6101696102a2366004612381565b610db4565b60005473ffffffffffffffffffffffffffffffffffffffff166101e0565b6101696102d33660046123ce565b611022565b6101e07f000000000000000000000000000000000000000000000000000000000000000081565b6003546101e09073ffffffffffffffffffffffffffffffffffffffff1681565b61029261032d366004612242565b61116c565b610292610340366004612228565b611240565b610292610353366004612274565b611308565b610169610366366004612381565b611501565b610292610379366004612228565b6118fb565b61029261038c366004612228565b6119c3565b6000808411610427576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f556e697377617056324c6962726172793a20494e53554646494349454e545f4960448201527f4e5055545f414d4f554e5400000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6000831180156104375750600082115b6104c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f556e697377617056324c6962726172793a20494e53554646494349454e545f4c60448201527f4951554944495459000000000000000000000000000000000000000000000000606482015260840161041e565b60006104d1856103e36125c1565b905060006104df84836125c1565b90506000826104f0876103e86125c1565b6104fa9190612570565b90506105068183612588565b979650505050505050565b60008060008342811015610581576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f54656d706c65537461626c65414d4d526f757465723a20455850495245440000604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff8088166000908152600160205260409020541680610636576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f54656d706c65537461626c65414d4d526f757465723a20554e535550504f525460448201527f45445f5041495200000000000000000000000000000000000000000000000000606482015260840161041e565b898c101580156106465750888b10155b6106d2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54656d706c65537461626c65414d4d526f757465723a204d45565f455854524160448201527f435441424c450000000000000000000000000000000000000000000000000000606482015260840161041e565b6106df8c8c8c8c85611af3565b90955093506107107f0000000000000000000000000000000000000000000000000000000000000000338388611d55565b61071c88338387611d55565b6040517f6a62784200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152821690636a62784290602401602060405180830381600087803b15801561078557600080fd5b505af1158015610799573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bd9190612346565b925050509750975097945050505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561081957600080fd5b505afa15801561082d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085191906122f8565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff169150610881848284610391565b95945050505050565b6000806000808573ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156108d657600080fd5b505afa1580156108ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090e91906122f8565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff169150600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a340bae26040518163ffffffff1660e01b8152600401604080518083038186803b15801561099d57600080fd5b505afa1580156109b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d5919061235e565b9150915060006109e6888686610391565b90506000826109f5858b6125c1565b6109ff9190612588565b905081811115610a155780965060019750610a19565b8196505b5050505050509250929050565b6000808242811015610a94576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f54656d706c65537461626c65414d4d526f757465723a20455850495245440000604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff8087166000908152600160205260409020541680610b49576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f54656d706c65537461626c65414d4d526f757465723a20554e535550504f525460448201527f45445f5041495200000000000000000000000000000000000000000000000000606482015260840161041e565b610b558133838d611d55565b6040517f89afcb4400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87811660048301528216906389afcb44906024016040805180830381600087803b158015610bbd57600080fd5b505af1158015610bd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf5919061235e565b909450925088841015610c8a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54656d706c65537461626c65414d4d526f757465723a20494e5355464649434960448201527f454e545f54454d504c4500000000000000000000000000000000000000000000606482015260840161041e565b87831015610d1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54656d706c6546726178414d4d526f757465723a20494e53554646494349454e60448201527f545f465241580000000000000000000000000000000000000000000000000000606482015260840161041e565b5050965096945050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610da8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b610db26000611e31565b565b60008142811015610e21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f54656d706c65537461626c65414d4d526f757465723a20455850495245440000604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600160205260409020541680610ed6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f54656d706c65537461626c65414d4d526f757465723a20554e535550504f525460448201527f45445f5041495200000000000000000000000000000000000000000000000000606482015260840161041e565b6000610ee2828a6107ce565b905087811015610f74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54656d706c65537461626c65414d4d526f757465723a20494e5355464649434960448201527f454e545f4f55545055545f414d4f554e54000000000000000000000000000000606482015260840161041e565b610f808733848c611d55565b60408051600080825260208201928390527f022c0d9f0000000000000000000000000000000000000000000000000000000090925273ffffffffffffffffffffffffffffffffffffffff84169163022c0d9f91610fe49185918b9060248101612518565b600060405180830381600087803b158015610ffe57600080fd5b505af1158015611012573d6000803e3d6000fd5b5050505050505095945050505050565b60008084116110b3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f556e697377617056324c6962726172793a20494e53554646494349454e545f4160448201527f4d4f554e54000000000000000000000000000000000000000000000000000000606482015260840161041e565b6000831180156110c35750600082115b61114f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f556e697377617056324c6962726172793a20494e53554646494349454e545f4c60448201527f4951554944495459000000000000000000000000000000000000000000000000606482015260840161041e565b8261115a83866125c1565b6111649190612588565b949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146111ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001691909216179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146112c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff163314611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff8216611406576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f746f2061646472657373207a65726f0000000000000000000000000000000000604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff83166114f15760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461147b576040519150601f19603f3d011682016040523d82523d6000602084013e611480565b606091505b50509050806114eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f73656e64206661696c6564000000000000000000000000000000000000000000604482015260640161041e565b50505050565b6114fc838383611ea6565b505050565b6000814281101561156e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f54656d706c65537461626c65414d4d526f757465723a20455850495245440000604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600160205260409020541680611623576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f54656d706c65537461626c65414d4d526f757465723a20554e535550504f525460448201527f45445f5041495200000000000000000000000000000000000000000000000000606482015260840161041e565b600080611630838b61088a565b91509150811561179a57888110156116ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54656d706c65537461626c65414d4d526f757465723a20494e5355464649434960448201527f454e545f4f55545055545f414d4f554e54000000000000000000000000000000606482015260840161041e565b6040517f79cc6790000000000000000000000000000000000000000000000000000000008152336004820152602481018b90527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906379cc679090604401600060405180830381600087803b15801561175857600080fd5b505af115801561176c573d6000803e3d6000fd5b5050600354611795925073ffffffffffffffffffffffffffffffffffffffff1690508883611ea6565b6118ee565b8881101561182a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54656d706c65537461626c65414d4d526f757465723a20494e5355464649434960448201527f454e545f4f55545055545f414d4f554e54000000000000000000000000000000606482015260840161041e565b6118567f000000000000000000000000000000000000000000000000000000000000000033858d611d55565b60408051600080825260208201928390527f022c0d9f0000000000000000000000000000000000000000000000000000000090925273ffffffffffffffffffffffffffffffffffffffff85169163022c0d9f916118bb919085908c9060248101612518565b600060405180830381600087803b1580156118d557600080fd5b505af11580156118e9573d6000803e3d6000fd5b505050505b9998505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461197c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff163314611a44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff8116611ae7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161041e565b611af081611e31565b50565b6000806000808473ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015611b3f57600080fd5b505afa158015611b53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b7791906122f8565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff169150816000148015611baa575080155b15611bba57889350879250611d49565b6000611bc78a8484611022565b9050888111611c6b5786811015611c60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54656d706c65537461626c65414d4d526f757465723a20494e5355464649434960448201527f454e545f535441424c4500000000000000000000000000000000000000000000606482015260840161041e565b899450925082611d47565b6000611c788a8486611022565b90508a811115611cb1577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b88811015611d41576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54656d706c65537461626c65414d4d526f757465723a20494e5355464649434960448201527f454e545f54454d504c4500000000000000000000000000000000000000000000606482015260840161041e565b94508893505b505b50509550959350505050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526114eb9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611efc565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526114fc9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611daf565b6000611f5e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166120089092919063ffffffff16565b8051909150156114fc5780806020019051810190611f7c91906122d8565b6114fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161041e565b6060611164848460008561201e565b9392505050565b6060824710156120b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161041e565b843b612118576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161041e565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161214191906124fc565b60006040518083038185875af1925050503d806000811461217e576040519150601f19603f3d011682016040523d82523d6000602084013e612183565b606091505b50915091506105068282866060831561219d575081612017565b8251156121ad5782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161041e919061255d565b803573ffffffffffffffffffffffffffffffffffffffff8116811461220557600080fd5b919050565b80516dffffffffffffffffffffffffffff8116811461220557600080fd5b600060208284031215612239578081fd5b612017826121e1565b60008060408385031215612254578081fd5b61225d836121e1565b915061226b602084016121e1565b90509250929050565b600080600060608486031215612288578081fd5b612291846121e1565b925061229f602085016121e1565b9150604084013590509250925092565b600080604083850312156122c1578182fd5b6122ca836121e1565b946020939093013593505050565b6000602082840312156122e9578081fd5b81518015158114612017578182fd5b60008060006060848603121561230c578283fd5b6123158461220a565b92506123236020850161220a565b9150604084015163ffffffff8116811461233b578182fd5b809150509250925092565b600060208284031215612357578081fd5b5051919050565b60008060408385031215612370578182fd5b505080516020909101519092909150565b600080600080600060a08688031215612398578081fd5b85359450602086013593506123af604087016121e1565b92506123bd606087016121e1565b949793965091946080013592915050565b6000806000606084860312156123e2578283fd5b505081359360208301359350604090920135919050565b60008060008060008060c08789031215612411578081fd5b86359550602087013594506040870135935061242f606088016121e1565b925061243d608088016121e1565b915060a087013590509295509295509295565b600080600080600080600060e0888a03121561246a578081fd5b8735965060208801359550604088013594506060880135935061248f608089016121e1565b925061249d60a089016121e1565b915060c0880135905092959891949750929550565b600081518084526124ca8160208601602086016125fe565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000825161250e8184602087016125fe565b9190910192915050565b84815283602082015273ffffffffffffffffffffffffffffffffffffffff8316604082015260806060820152600061255360808301846124b2565b9695505050505050565b60208152600061201760208301846124b2565b600082198211156125835761258361262a565b500190565b6000826125bc577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156125f9576125f961262a565b500290565b60005b83811015612619578181015183820152602001612601565b838111156114eb5750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea264697066735822122070c0d0cb6081916a70525c735d78c7194afbe9985d28da775a5b1e5ee81654d564736f6c63430008040033000000000000000000000000470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b700000000000000000000000022c2fe05f55f81bf32310acd9a7c51c4d7b4e443000000000000000000000000956f47f50a910163d8bf957cf5846d573e7f87ca

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101515760003560e01c80638da5cb5b116100cd578063c4b58a1e11610081578063e94e36b911610066578063e94e36b914610358578063f0f442601461036b578063f2fde38b1461037e57600080fd5b8063c4b58a1e14610332578063d9caed121461034557600080fd5b8063b1a9069c116100b2578063b1a9069c146102d8578063b272d5a2146102ff578063b6f3e0871461031f57600080fd5b80638da5cb5b146102a7578063ad615dec146102c557600080fd5b80632c908de5116101245780636727a70b116101095780636727a70b14610262578063715018a61461028a578063854f71061461029457600080fd5b80632c908de5146102255780634dfe82a51461023857600080fd5b8063054d50d41461015657806314e920981461017c5780631cc6391e146101aa57806328fef2a114610205575b600080fd5b6101696101643660046123ce565b610391565b6040519081526020015b60405180910390f35b61018f61018a366004612450565b610511565b60408051938452602084019290925290820152606001610173565b6101e06101b8366004612228565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610173565b6002546101e09073ffffffffffffffffffffffffffffffffffffffff1681565b6101696102333660046122af565b6107ce565b61024b6102463660046122af565b61088a565b604080519215158352602083019190915201610173565b6102756102703660046123f9565b610a26565b60408051928352602083019190915201610173565b610292610d27565b005b6101696102a2366004612381565b610db4565b60005473ffffffffffffffffffffffffffffffffffffffff166101e0565b6101696102d33660046123ce565b611022565b6101e07f000000000000000000000000470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b781565b6003546101e09073ffffffffffffffffffffffffffffffffffffffff1681565b61029261032d366004612242565b61116c565b610292610340366004612228565b611240565b610292610353366004612274565b611308565b610169610366366004612381565b611501565b610292610379366004612228565b6118fb565b61029261038c366004612228565b6119c3565b6000808411610427576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f556e697377617056324c6962726172793a20494e53554646494349454e545f4960448201527f4e5055545f414d4f554e5400000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6000831180156104375750600082115b6104c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f556e697377617056324c6962726172793a20494e53554646494349454e545f4c60448201527f4951554944495459000000000000000000000000000000000000000000000000606482015260840161041e565b60006104d1856103e36125c1565b905060006104df84836125c1565b90506000826104f0876103e86125c1565b6104fa9190612570565b90506105068183612588565b979650505050505050565b60008060008342811015610581576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f54656d706c65537461626c65414d4d526f757465723a20455850495245440000604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff8088166000908152600160205260409020541680610636576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f54656d706c65537461626c65414d4d526f757465723a20554e535550504f525460448201527f45445f5041495200000000000000000000000000000000000000000000000000606482015260840161041e565b898c101580156106465750888b10155b6106d2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54656d706c65537461626c65414d4d526f757465723a204d45565f455854524160448201527f435441424c450000000000000000000000000000000000000000000000000000606482015260840161041e565b6106df8c8c8c8c85611af3565b90955093506107107f000000000000000000000000470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7338388611d55565b61071c88338387611d55565b6040517f6a62784200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152821690636a62784290602401602060405180830381600087803b15801561078557600080fd5b505af1158015610799573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bd9190612346565b925050509750975097945050505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561081957600080fd5b505afa15801561082d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085191906122f8565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff169150610881848284610391565b95945050505050565b6000806000808573ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156108d657600080fd5b505afa1580156108ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090e91906122f8565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff169150600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a340bae26040518163ffffffff1660e01b8152600401604080518083038186803b15801561099d57600080fd5b505afa1580156109b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d5919061235e565b9150915060006109e6888686610391565b90506000826109f5858b6125c1565b6109ff9190612588565b905081811115610a155780965060019750610a19565b8196505b5050505050509250929050565b6000808242811015610a94576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f54656d706c65537461626c65414d4d526f757465723a20455850495245440000604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff8087166000908152600160205260409020541680610b49576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f54656d706c65537461626c65414d4d526f757465723a20554e535550504f525460448201527f45445f5041495200000000000000000000000000000000000000000000000000606482015260840161041e565b610b558133838d611d55565b6040517f89afcb4400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87811660048301528216906389afcb44906024016040805180830381600087803b158015610bbd57600080fd5b505af1158015610bd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf5919061235e565b909450925088841015610c8a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54656d706c65537461626c65414d4d526f757465723a20494e5355464649434960448201527f454e545f54454d504c4500000000000000000000000000000000000000000000606482015260840161041e565b87831015610d1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54656d706c6546726178414d4d526f757465723a20494e53554646494349454e60448201527f545f465241580000000000000000000000000000000000000000000000000000606482015260840161041e565b5050965096945050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610da8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b610db26000611e31565b565b60008142811015610e21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f54656d706c65537461626c65414d4d526f757465723a20455850495245440000604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600160205260409020541680610ed6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f54656d706c65537461626c65414d4d526f757465723a20554e535550504f525460448201527f45445f5041495200000000000000000000000000000000000000000000000000606482015260840161041e565b6000610ee2828a6107ce565b905087811015610f74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54656d706c65537461626c65414d4d526f757465723a20494e5355464649434960448201527f454e545f4f55545055545f414d4f554e54000000000000000000000000000000606482015260840161041e565b610f808733848c611d55565b60408051600080825260208201928390527f022c0d9f0000000000000000000000000000000000000000000000000000000090925273ffffffffffffffffffffffffffffffffffffffff84169163022c0d9f91610fe49185918b9060248101612518565b600060405180830381600087803b158015610ffe57600080fd5b505af1158015611012573d6000803e3d6000fd5b5050505050505095945050505050565b60008084116110b3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f556e697377617056324c6962726172793a20494e53554646494349454e545f4160448201527f4d4f554e54000000000000000000000000000000000000000000000000000000606482015260840161041e565b6000831180156110c35750600082115b61114f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f556e697377617056324c6962726172793a20494e53554646494349454e545f4c60448201527f4951554944495459000000000000000000000000000000000000000000000000606482015260840161041e565b8261115a83866125c1565b6111649190612588565b949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146111ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001691909216179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146112c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff163314611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff8216611406576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f746f2061646472657373207a65726f0000000000000000000000000000000000604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff83166114f15760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461147b576040519150601f19603f3d011682016040523d82523d6000602084013e611480565b606091505b50509050806114eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f73656e64206661696c6564000000000000000000000000000000000000000000604482015260640161041e565b50505050565b6114fc838383611ea6565b505050565b6000814281101561156e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f54656d706c65537461626c65414d4d526f757465723a20455850495245440000604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600160205260409020541680611623576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f54656d706c65537461626c65414d4d526f757465723a20554e535550504f525460448201527f45445f5041495200000000000000000000000000000000000000000000000000606482015260840161041e565b600080611630838b61088a565b91509150811561179a57888110156116ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54656d706c65537461626c65414d4d526f757465723a20494e5355464649434960448201527f454e545f4f55545055545f414d4f554e54000000000000000000000000000000606482015260840161041e565b6040517f79cc6790000000000000000000000000000000000000000000000000000000008152336004820152602481018b90527f000000000000000000000000470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b773ffffffffffffffffffffffffffffffffffffffff16906379cc679090604401600060405180830381600087803b15801561175857600080fd5b505af115801561176c573d6000803e3d6000fd5b5050600354611795925073ffffffffffffffffffffffffffffffffffffffff1690508883611ea6565b6118ee565b8881101561182a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54656d706c65537461626c65414d4d526f757465723a20494e5355464649434960448201527f454e545f4f55545055545f414d4f554e54000000000000000000000000000000606482015260840161041e565b6118567f000000000000000000000000470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b733858d611d55565b60408051600080825260208201928390527f022c0d9f0000000000000000000000000000000000000000000000000000000090925273ffffffffffffffffffffffffffffffffffffffff85169163022c0d9f916118bb919085908c9060248101612518565b600060405180830381600087803b1580156118d557600080fd5b505af11580156118e9573d6000803e3d6000fd5b505050505b9998505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461197c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff163314611a44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff8116611ae7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161041e565b611af081611e31565b50565b6000806000808473ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015611b3f57600080fd5b505afa158015611b53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b7791906122f8565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff169150816000148015611baa575080155b15611bba57889350879250611d49565b6000611bc78a8484611022565b9050888111611c6b5786811015611c60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54656d706c65537461626c65414d4d526f757465723a20494e5355464649434960448201527f454e545f535441424c4500000000000000000000000000000000000000000000606482015260840161041e565b899450925082611d47565b6000611c788a8486611022565b90508a811115611cb1577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b88811015611d41576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54656d706c65537461626c65414d4d526f757465723a20494e5355464649434960448201527f454e545f54454d504c4500000000000000000000000000000000000000000000606482015260840161041e565b94508893505b505b50509550959350505050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526114eb9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611efc565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526114fc9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611daf565b6000611f5e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166120089092919063ffffffff16565b8051909150156114fc5780806020019051810190611f7c91906122d8565b6114fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161041e565b6060611164848460008561201e565b9392505050565b6060824710156120b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161041e565b843b612118576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161041e565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161214191906124fc565b60006040518083038185875af1925050503d806000811461217e576040519150601f19603f3d011682016040523d82523d6000602084013e612183565b606091505b50915091506105068282866060831561219d575081612017565b8251156121ad5782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161041e919061255d565b803573ffffffffffffffffffffffffffffffffffffffff8116811461220557600080fd5b919050565b80516dffffffffffffffffffffffffffff8116811461220557600080fd5b600060208284031215612239578081fd5b612017826121e1565b60008060408385031215612254578081fd5b61225d836121e1565b915061226b602084016121e1565b90509250929050565b600080600060608486031215612288578081fd5b612291846121e1565b925061229f602085016121e1565b9150604084013590509250925092565b600080604083850312156122c1578182fd5b6122ca836121e1565b946020939093013593505050565b6000602082840312156122e9578081fd5b81518015158114612017578182fd5b60008060006060848603121561230c578283fd5b6123158461220a565b92506123236020850161220a565b9150604084015163ffffffff8116811461233b578182fd5b809150509250925092565b600060208284031215612357578081fd5b5051919050565b60008060408385031215612370578182fd5b505080516020909101519092909150565b600080600080600060a08688031215612398578081fd5b85359450602086013593506123af604087016121e1565b92506123bd606087016121e1565b949793965091946080013592915050565b6000806000606084860312156123e2578283fd5b505081359360208301359350604090920135919050565b60008060008060008060c08789031215612411578081fd5b86359550602087013594506040870135935061242f606088016121e1565b925061243d608088016121e1565b915060a087013590509295509295509295565b600080600080600080600060e0888a03121561246a578081fd5b8735965060208801359550604088013594506060880135935061248f608089016121e1565b925061249d60a089016121e1565b915060c0880135905092959891949750929550565b600081518084526124ca8160208601602086016125fe565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000825161250e8184602087016125fe565b9190910192915050565b84815283602082015273ffffffffffffffffffffffffffffffffffffffff8316604082015260806060820152600061255360808301846124b2565b9695505050505050565b60208152600061201760208301846124b2565b600082198211156125835761258361262a565b500190565b6000826125bc577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156125f9576125f961262a565b500290565b60005b83811015612619578181015183820152602001612601565b838111156114eb5750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea264697066735822122070c0d0cb6081916a70525c735d78c7194afbe9985d28da775a5b1e5ee81654d564736f6c63430008040033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b700000000000000000000000022c2fe05f55f81bf32310acd9a7c51c4d7b4e443000000000000000000000000956f47f50a910163d8bf957cf5846d573e7f87ca

-----Decoded View---------------
Arg [0] : _templeToken (address): 0x470EBf5f030Ed85Fc1ed4C2d36B9DD02e77CF1b7
Arg [1] : _templeTreasury (address): 0x22c2fE05f55F81Bf32310acD9a7C51c4d7b4e443
Arg [2] : _defendStable (address): 0x956F47F50A910163D8BF957Cf5846D573E7f87CA

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7
Arg [1] : 00000000000000000000000022c2fe05f55f81bf32310acd9a7c51c4d7b4e443
Arg [2] : 000000000000000000000000956f47f50a910163d8bf957cf5846d573e7f87ca


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.