ETH Price: $3,511.71 (+2.77%)
Gas: 11 Gwei

Contract

0xA99980c64fc6C302377C39f21431217fcBAF39af
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Approve202427002024-07-05 20:29:3511 days ago1720211375IN
0xA99980c6...fcBAF39af
0 ETH0.000130732.80810829
Approve202306212024-07-04 3:59:5913 days ago1720065599IN
0xA99980c6...fcBAF39af
0 ETH0.000103373.82864209
Approve202306102024-07-04 3:57:4713 days ago1720065467IN
0xA99980c6...fcBAF39af
0 ETH0.000196914.22960423
Approve200966672024-06-15 10:42:3531 days ago1718448155IN
0xA99980c6...fcBAF39af
0 ETH0.000162273.48554476
Approve196990722024-04-20 20:40:3587 days ago1713645635IN
0xA99980c6...fcBAF39af
0 ETH0.000310396.70860832
Approve195358442024-03-28 23:38:23110 days ago1711669103IN
0xA99980c6...fcBAF39af
0 ETH0.0013856129.76240636
Approve195321082024-03-28 10:46:59110 days ago1711622819IN
0xA99980c6...fcBAF39af
0 ETH0.0014132830.54572626
Approve195137252024-03-25 20:01:47113 days ago1711396907IN
0xA99980c6...fcBAF39af
0 ETH0.0039269284.34838868
Approve194907922024-03-22 14:34:47116 days ago1711118087IN
0xA99980c6...fcBAF39af
0 ETH0.0021083945.54552324
Approve194728272024-03-20 2:05:11119 days ago1710900311IN
0xA99980c6...fcBAF39af
0 ETH0.0013378228.9070911
Approve194691422024-03-19 13:38:35119 days ago1710855515IN
0xA99980c6...fcBAF39af
0 ETH0.0016581935.61730306
Approve193957242024-03-09 6:22:59129 days ago1709965379IN
0xA99980c6...fcBAF39af
0 ETH0.0019387741.64403163
Approve193820172024-03-07 8:11:59131 days ago1709799119IN
0xA99980c6...fcBAF39af
0 ETH0.0025314354.69821641
Approve193095282024-02-26 5:02:23142 days ago1708923743IN
0xA99980c6...fcBAF39af
0 ETH0.0013109428.15836408
Approve192732582024-02-21 3:06:23147 days ago1708484783IN
0xA99980c6...fcBAF39af
0 ETH0.0017209536.96534304
Approve192536362024-02-18 8:55:11149 days ago1708246511IN
0xA99980c6...fcBAF39af
0 ETH0.0009762720.96994881
Approve191790652024-02-07 21:42:59160 days ago1707342179IN
0xA99980c6...fcBAF39af
0 ETH0.0008272734.08364509
Approve190746412024-01-24 6:13:47174 days ago1706076827IN
0xA99980c6...fcBAF39af
0 ETH0.000388038.3866683
Approve189670002024-01-09 4:21:23190 days ago1704774083IN
0xA99980c6...fcBAF39af
0 ETH0.0004074413.83230436
Approve189597842024-01-08 3:57:23191 days ago1704686243IN
0xA99980c6...fcBAF39af
0 ETH0.0014065630.40042599
Approve189374882024-01-05 0:21:35194 days ago1704414095IN
0xA99980c6...fcBAF39af
0 ETH0.0008412918.17833577
Approve189031122023-12-31 4:33:59199 days ago1703997239IN
0xA99980c6...fcBAF39af
0 ETH0.0005245711.33771902
Approve189005932023-12-30 20:04:47199 days ago1703966687IN
0xA99980c6...fcBAF39af
0 ETH0.0008807919.03178308
Approve188934072023-12-29 19:48:47200 days ago1703879327IN
0xA99980c6...fcBAF39af
0 ETH0.0009759521.09353823
Approve188840732023-12-28 12:20:59201 days ago1703766059IN
0xA99980c6...fcBAF39af
0 ETH0.0013413128.97514534
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
149482202022-06-12 4:32:11766 days ago1655008331  Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vault

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 999999 runs

Other Settings:
default evmVersion
File 1 of 16 : Vault.sol
pragma solidity ^0.8.4;
// SPDX-License-Identifier: AGPL-3.0-or-later

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

import "./RebasingERC20.sol";
import "./Rational.sol";
import "./Exposure.sol";
import "./JoiningFee.sol";

// import "hardhat/console.sol";

/**
 * @title A temple investment vault, allows deposits and withdrawals on a set period (eg. monthly)
 *
 * @notice Each vault is a rebasing ERC2O (token representing an accounts vault share), Vaults have a
 * cycle period, and a join/exit period. During the join/exit period, a vault account can withdraw their
 * share of temple from the vault, or deposit more temple in.
 *
 * Depending on when an account joins a vault, there is a linearly increasing joining fee shared by all
 * other vault accounts.
 *
 * If an account doesn't leave during the join/exit period, their holdings are automaticaly re-invested
 * into the next vault cycle.
 */
contract Vault is EIP712, Ownable, RebasingERC20 {
    uint256 constant public ENTER_EXIT_WINDOW_BUFFER = 60 * 5; // 5 minute buffer

    using Counters for Counters.Counter;
    mapping(address => Counters.Counter) public _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 public immutable WITHDRAW_FOR_TYPEHASH = keccak256("withdrawFor(address owner,address sender,uint256 amount,uint256 deadline,uint256 nonce)");

    // temple token which users deposit/withdraw
    IERC20 public immutable templeToken;

    // Vaults don't hold temple directly, there is a specific
    // exposure in which all deposited temple is moved into
    Exposure public immutable templeExposureToken;

    // All vaulted temple is held collectively (allows the DAO to use this collectively in leverage positions)
    address public immutable vaultedTempleAccount;

    /// @dev timestamp (in seconds) of the first period in this vault
    uint256 public immutable firstPeriodStartTimestamp;

    /// @dev how often a vault cycles, in seconds
    uint256 public immutable periodDuration;

    /// @dev window from cycle start in which accounts can enter/exit the vault
    uint256 public immutable enterExitWindowDuration;

    /// @dev how many shares in the various strategies does this vault get based on temple deposited
    Rational public shareBoostFactor;

    /// @dev Where to query the fee (per hour) when joining the vault
    JoiningFee public immutable joiningFee;

    constructor(
        string memory _name,
        string memory _symbol,
        IERC20 _templeToken,
        Exposure _templeExposureToken,
        address _vaultedTempleAccount,
        uint256 _periodDuration,
        uint256 _enterExitWindowDuration,
        Rational memory _shareBoostFactory,
        JoiningFee _joiningFee,
        uint256 _firstPeriodStartTimestamp
    ) EIP712(_name, "1") ERC20(_name, _symbol)  {
        templeToken = _templeToken;
        templeExposureToken = _templeExposureToken;
        vaultedTempleAccount = _vaultedTempleAccount;
        periodDuration = _periodDuration;
        enterExitWindowDuration = _enterExitWindowDuration;
        shareBoostFactor = _shareBoostFactory;
        joiningFee = _joiningFee;

        firstPeriodStartTimestamp = _firstPeriodStartTimestamp;
    }

    /**
     * @notice Withdraw temple (and any earned revenue) from the vault
     */
    function withdraw(uint256 amount) public {
        withdrawFor(msg.sender, msg.sender, amount);
    }

    /**
     * @notice Withdraw for another user (gasless for the vault token holder)
     * (assuming the owner has given authority for the caller to act on their behalf)
     *
     * @dev amount is explicit, to allow use case of partial vault withdrawals
     */
    function withdrawFor(address owner, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
        require(block.timestamp <= deadline, "Vault: expired deadline");

        bytes32 structHash = keccak256(abi.encode(WITHDRAW_FOR_TYPEHASH, owner, msg.sender, amount, deadline, _useNonce(owner)));
        bytes32 digest = _hashTypedDataV4(structHash);
        address signer = ECDSA.recover(digest, v, r, s);

        require(signer == owner, "Vault: invalid signature");

        withdrawFor(owner, msg.sender, amount);
    }

    function targetRevenueShare() external view returns (uint256) {
        return templeExposureToken.balanceOf(address(this)) * shareBoostFactor.p / shareBoostFactor.q;
    }

    /// @dev redeem a specific vault's exposure back into temple
    function redeemExposures(Exposure[] memory exposures) external onlyOwner {
        for (uint256 i = 0; i < exposures.length; i++) {
            exposures[i].redeem();
        }

        // no need for event, as exposures[i].redeem() triggers one
    }

    function amountPerShare() public view override returns (uint256 p, uint256 q) {
        p = templeExposureToken.balanceOf(address(this));
        q = totalShares;

        // NOTE(butlerji): Assuming this is fairly cheap in gas, as it gets called
        // often
        if (p == 0) {
            p = 1;
        }

        if (q == 0) {
            q = p;
        }
    }

    function inEnterExitWindow() public view returns (uint256 cycleNumber, bool inWindow) {
        if (block.timestamp < firstPeriodStartTimestamp) {
            return (0,false);
        }

        cycleNumber = (block.timestamp - firstPeriodStartTimestamp) / periodDuration;
        inWindow = cycleNumber * periodDuration + firstPeriodStartTimestamp + enterExitWindowDuration + ENTER_EXIT_WINDOW_BUFFER > block.timestamp;
    }

    function canEnter() public view returns (bool) {
        (, bool inWindow) = inEnterExitWindow();
        return inWindow;
    }

    function canExit() public view returns (bool) {
        (uint256 cycleNumber, bool inWindow) = inEnterExitWindow();
        return inWindow && cycleNumber > 0;
    }

    /**
    * See {IERC20Permit-DOMAIN_SEPARATOR}.
    */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
    * Current nonce for an given address
    */
    function nonces(address owner) public view returns (uint256) {
        return _nonces[owner].current();
    }

    /**
    * "Consume a nonce": return the current value and increment.
    */
    function _useNonce(address owner) internal returns (uint256 current) {
        Counters.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }

    /**
    * @notice Deposit temple into a vault
    */
    function deposit(uint256 amount) public {
        depositFor(msg.sender, amount);
    }

    /**
     * @dev shared implementation of depositFor. Allows callers to deposit and lock on behalf of _account. 
            Care needs to be taken when calling this to ensure that the caller is passing the correct args in,
            otherwise they may mistakenly lock _sender funds attributed to a wallet they have no control over.
     */
    function depositFor(address _account, uint256 _amount) public {
        require(canEnter(), "Vault: Cannot join vault when outside of enter/exit window");

        uint256 feePerTempleScaledPerHour = joiningFee.calc(firstPeriodStartTimestamp, periodDuration, address(this));
        uint256 fee = _amount * feePerTempleScaledPerHour / 1e18;

        require(_amount > fee, "Vault: Cannot join when fee is higher than amount");
        uint256 amountStaked = _amount - fee;

        if (_amount > 0) {
            _mint(_account, amountStaked);
            SafeERC20.safeTransferFrom(templeToken, msg.sender, vaultedTempleAccount, _amount);
            templeExposureToken.mint(address(this), _amount);
        }

        emit Deposit(_account, _amount, amountStaked);
    }

    /**
     * @dev shared private implementation of withdrawFor. Must be private, to prevent
     * security issue where anyone can withdraw for another account. Isn't as severe as
     * depositFor (as there are no locks), however still a nucance if an account is
     * exited from a vault without consent.
     */
    function withdrawFor(address _account, address _to, uint256 _amount) private {
        require(canExit(), "Vault: Cannot exit vault when outside of enter/exit window");

        if (_amount > 0) {
            _burn(_account, _amount);
        }

        templeExposureToken.redeemAmount(_amount, _to);
        emit Withdraw(_account, _amount);
    }

    event Deposit(address account, uint256 amount, uint256 amountStaked);
    event Withdraw(address account, uint256 amount);
}

File 2 of 16 : 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 3 of 16 : 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 4 of 16 : draft-EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)

pragma solidity ^0.8.0;

import "./ECDSA.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;
    address private immutable _CACHED_THIS;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        bytes32 typeHash = keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
        _CACHED_CHAIN_ID = block.chainid;
        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
        _CACHED_THIS = address(this);
        _TYPE_HASH = typeHash;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
            return _CACHED_DOMAIN_SEPARATOR;
        } else {
            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
        }
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }
}

File 5 of 16 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 6 of 16 : 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 16 : RebasingERC20.sol
pragma solidity ^0.8.4;
// SPDX-License-Identifier: AGPL-3.0-or-later

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

// import "hardhat/console.sol";

/**
 * @title A generic rebasing ERC20 implementation, based of openzepplin
 * 
 * @dev Intended to be inherited and customised per use case
 */
abstract contract RebasingERC20 is ERC20 {
    /**
     * @dev returns the total shares in existence. When scaled up
     * by amountPerShare we get the total supply
     */ 
    uint256 public totalShares;

    /**
     * @dev number of shares owned by any given account, this is
     * scalled up by amountPerShare to work out the totalSupply and
     * balanceOf any given account
     */
    mapping(address => uint256) public shareBalanceOf;

    /**
     * @dev Rebasing scaling factor - implemented by child classes and
     * controls the rebasing policy of the token.
     *
     * returns a rational (p/q where q != 0)
     */
    function amountPerShare() public view virtual returns (uint256 p, uint256 q);

    /**
     * @notice Returns the amount of tokens in existence.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return toTokenAmount(totalShares);
    }

    /**
     * @notice Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return toTokenAmount(shareBalanceOf[account]);
    }

    /**
     * @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 override {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        uint256 senderBalanceShares = shareBalanceOf[sender];
        uint256 amountShares = toSharesAmount(amount);

        require(senderBalanceShares >= amountShares, "ERC20: transfer amount exceeds balance");
        unchecked {
            shareBalanceOf[sender] -= amountShares;
        }
        shareBalanceOf[recipient] += amountShares;

        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual override {
        require(account != address(0), "ERC20: mint to the zero address");

        uint256 amountShares = toSharesAmount(amount);
        totalShares += amountShares;
        shareBalanceOf[account] += amountShares;
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual override {
        require(account != address(0), "ERC20: burn from the zero address");

        uint256 accountBalanceShares = shareBalanceOf[account];
        uint256 amountShares = toSharesAmount(amount);

        require(accountBalanceShares >= amountShares, "ERC20: burn amount exceeds balance");
        unchecked {
            shareBalanceOf[account] = accountBalanceShares - amountShares;
        }
        totalShares -= amountShares;

        emit Transfer(account, address(0), amount);
    }

    function toTokenAmount(uint sharesAmount) public view returns (uint256 tokenAmount) {
        (uint256 p, uint256 q) = amountPerShare();
        tokenAmount = sharesAmount * p / q;
    }

    function toSharesAmount(uint tokenAmount) public view returns (uint256 sharesAmount) {
        (uint256 p, uint256 q) = amountPerShare();
        sharesAmount = tokenAmount * q / p;
    }
}

File 8 of 16 : Rational.sol
pragma solidity ^0.8.4;
// SPDX-License-Identifier: AGPL-3.0-or-later

/**
 * @title Model for a rational number
 *
 * @dev A number of the form p/q where q != 0
 */
struct Rational {
    uint256 p;
    uint256 q;
}

File 9 of 16 : Exposure.sol
pragma solidity ^0.8.4;
// SPDX-License-Identifier: AGPL-3.0-or-later

import "@openzeppelin/contracts/access/Ownable.sol";

import "./RebasingERC20.sol";
import "./Rational.sol";

/**
 * @title Captures our exposure to a particular asset
 *
 * @dev Any given exposure is split among many holders, as the exposure changes
 * holders get rebased accordingly.
 */
contract Exposure is Ownable, RebasingERC20 {
    /// @dev The token which this particular strategy is
    /// accounted for in unused other than for information purposes
    IERC20 public revalToken;

    /// @dev total value of all share holders in this strategy
    uint256 public reval;

    /// @dev which actors can increase their stake in a given position
    /// in the temple core, only vaults should hold shares in a position
    mapping(address => bool) public canMint;

    /// @dev if set, automatically liquidates position and transfers temple
    /// minted as a result to the appropriate vault
    ILiquidator public liquidator;

    /**
     * @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, IERC20 _revalToken) ERC20(_name, _symbol) {
        revalToken = _revalToken;
    }

    /**
     * @dev increase reval associated with a strategy
     */
    function increaseReval(uint256 amount) external onlyOwner {
        uint256 oldVal = reval;
        reval += amount;

        emit IncreaseReval(oldVal, reval);
    }

    /**
     * @dev decrease reval associated with a strategy
     */
    function decreaseReval(uint256 amount) external onlyOwner {
        uint256 oldVal = reval;
        reval -= amount;

        emit DecreaseReval(oldVal, reval);
    }

    /**
     * @dev set actor which automatically liquidates any claimed position into temple
     */
    function setLiqidator(ILiquidator _liquidator) external onlyOwner {
        liquidator = _liquidator;

        emit SetLiquidator(address(liquidator));
    }

    /**
     * @dev set/unset an accounts ability to mint exposure tokens
     */
    function setMinterState(address account, bool state) external onlyOwner {
        canMint[account] = state;
        emit SetMinterState(account, state);
    }

    /**
     * @notice Generate new strategy shares
     *
     * @dev Only callable by minters. Increases a minters share of
     * a strategy
     */
    function mint(address account, uint256 amount) external onlyMinter {
        _mint(account, amount);
        reval += amount;

        // no need for event, handled via _mint
    }

    /**
     * @dev redeem the callers share of this exposure back to temple
     */
    function redeem() external {
        redeemAmount(balanceOf(msg.sender), msg.sender);
    }

    /**
     * @dev redeem the callers share of this exposure back to temple
     */
    function redeemAmount(uint256 amount, address to) public {
        _burn(msg.sender, amount);
        reval -= amount;

        if (address(liquidator) != address(0)) {
            liquidator.toTemple(amount, to);
        }

        emit Redeem(address(revalToken), msg.sender, to, amount);
    }

    function amountPerShare() public view override returns (uint256 p, uint256 q) {
        p = reval;
        q = totalShares;

        // NOTE(butlerji): Assuming this is fairly cheap in gas, as it gets called
        // often
        if (p == 0) {
            p = 1;
        }

        if (q == 0) {
            q = p;
        }
    }

    /**
     * Throws if called by an actor that cannot mint
     */
    modifier onlyMinter() {
        require(canMint[msg.sender], "Exposure: caller is not a vault");
        _;
    }

    event IncreaseReval(uint256 oldVal, uint256 newVal);
    event DecreaseReval(uint256 oldVal, uint256 newVal);
    event SetLiquidator(address liquidator);
    event SetMinterState(address account, bool state);
    event Redeem(address revalToken, address caller, address to, uint256 amount);
}

interface ILiquidator {
    function toTemple(uint256 amount, address toAccount) external;
}

File 10 of 16 : JoiningFee.sol
pragma solidity ^0.8.4;
// SPDX-License-Identifier: AGPL-3.0-or-later

import "@openzeppelin/contracts/access/Ownable.sol";

// import "hardhat/console.sol";

/**
 * @title Configurable joining fee per vault
 * @notice Implementation assumes a default, we can then tweak on a 
 * vault by vault basis
 *
 * Calc returns a value with units temple / templeScaled / hour (which a vault then multiplies by the temple
 * to be staked to work out the actual fee)
 */
contract JoiningFee is Ownable {
    uint256 public defaultHourlyJoiningFee;
    mapping(address => uint256) public hourlyJoiningFeeFor;

    constructor(uint256 _defaultHourlyJoiningFee) {
        defaultHourlyJoiningFee = _defaultHourlyJoiningFee;
    }

    /// @notice Fee multiplier, returned value is in temple / templeScaled / hour.
    /// scaling factor is 1e18
    function calc(
        uint256 firstPeriodStartTimestamp,
        uint256 periodDuration,
        address vault) external view returns (uint256) 
    {
        uint256 feePerHour = hourlyJoiningFeeFor[vault];
        if (feePerHour == 0) { 
            feePerHour = defaultHourlyJoiningFee;
        }

        uint256 numCycles = (block.timestamp - firstPeriodStartTimestamp) / periodDuration;
        // NOTE: divide before fee is the correct setup here, as the fee should be discrete per hour
        return (block.timestamp - (numCycles * periodDuration) - firstPeriodStartTimestamp) / 3600 * feePerHour;
    }

    function setHourlyJoiningFeeFor(address vault, uint256 amount) external onlyOwner {
        if (vault == address(0x0)) {
            defaultHourlyJoiningFee = amount;
        } else {
            hourlyJoiningFeeFor[vault] = amount;
        }

        emit SetJoiningFee(vault, amount);
    }

    event SetJoiningFee(address vault, uint256 amount);
}

File 11 of 16 : 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 12 of 16 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s;
        uint8 v;
        assembly {
            s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
            v := add(shr(255, vs), 27)
        }
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 13 of 16 : 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 14 of 16 : 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 15 of 16 : 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 16 : 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":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"contract IERC20","name":"_templeToken","type":"address"},{"internalType":"contract Exposure","name":"_templeExposureToken","type":"address"},{"internalType":"address","name":"_vaultedTempleAccount","type":"address"},{"internalType":"uint256","name":"_periodDuration","type":"uint256"},{"internalType":"uint256","name":"_enterExitWindowDuration","type":"uint256"},{"components":[{"internalType":"uint256","name":"p","type":"uint256"},{"internalType":"uint256","name":"q","type":"uint256"}],"internalType":"struct Rational","name":"_shareBoostFactory","type":"tuple"},{"internalType":"contract JoiningFee","name":"_joiningFee","type":"address"},{"internalType":"uint256","name":"_firstPeriodStartTimestamp","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountStaked","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ENTER_EXIT_WINDOW_BUFFER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAW_FOR_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_nonces","outputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"amountPerShare","outputs":[{"internalType":"uint256","name":"p","type":"uint256"},{"internalType":"uint256","name":"q","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canEnter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canExit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enterExitWindowDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"firstPeriodStartTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"inEnterExitWindow","outputs":[{"internalType":"uint256","name":"cycleNumber","type":"uint256"},{"internalType":"bool","name":"inWindow","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"joiningFee","outputs":[{"internalType":"contract JoiningFee","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract Exposure[]","name":"exposures","type":"address[]"}],"name":"redeemExposures","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"shareBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"shareBoostFactor","outputs":[{"internalType":"uint256","name":"p","type":"uint256"},{"internalType":"uint256","name":"q","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"targetRevenueShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"templeExposureToken","outputs":[{"internalType":"contract Exposure","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"templeToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"toSharesAmount","outputs":[{"internalType":"uint256","name":"sharesAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"sharesAmount","type":"uint256"}],"name":"toTokenAmount","outputs":[{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultedTempleAccount","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"withdrawFor","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6102406040527f826f68b7f2dc717b262281384d6e69ddaba3805f6e37a8c771db2cc5d6ba4013610140523480156200003757600080fd5b50604051620033f2380380620033f28339810160408190526200005a916200039d565b60408051808201825260018152603160f81b6020918201528b518c82012060e08190527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66101008190524660a081815285517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81870181905281880195909552606081810194909452608080820193909352308183018190528751808303909301835260c09182019097528151919095012090529290921b90526101205289896200012533620001a8565b81516200013a906004906020850190620001f8565b50805162000150906005906020840190620001f8565b5050506001600160601b0319606098891b81166101605296881b87166101805294871b86166101a0526101e09390935261020091909152805160095560200151600a5590921b16610220526101c05250620005079050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8280546200020690620004b4565b90600052602060002090601f0160209004810192826200022a576000855562000275565b82601f106200024557805160ff191683800117855562000275565b8280016001018555821562000275579182015b828111156200027557825182559160200191906001019062000258565b506200028392915062000287565b5090565b5b8082111562000283576000815560010162000288565b80516001600160a01b0381168114620002b657600080fd5b919050565b600082601f830112620002cc578081fd5b81516001600160401b03811115620002e857620002e8620004f1565b6020620002fe601f8301601f1916820162000481565b828152858284870101111562000312578384fd5b835b838110156200033157858101830151828201840152820162000314565b838111156200034257848385840101525b5095945050505050565b6000604082840312156200035e578081fd5b604080519081016001600160401b0381118282101715620003835762000383620004f1565b604052825181526020928301519281019290925250919050565b6000806000806000806000806000806101608b8d031215620003bd578586fd5b8a516001600160401b0380821115620003d4578788fd5b620003e28e838f01620002bb565b9b5060208d0151915080821115620003f8578788fd5b50620004078d828e01620002bb565b9950506200041860408c016200029e565b97506200042860608c016200029e565b96506200043860808c016200029e565b955060a08b0151945060c08b01519350620004578c60e08d016200034c565b9250620004686101208c016200029e565b91506101408b015190509295989b9194979a5092959850565b604051601f8201601f191681016001600160401b0381118282101715620004ac57620004ac620004f1565b604052919050565b600181811c90821680620004c957607f821691505b60208210811415620004eb57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b60805160a05160c05160601c60e0516101005161012051610140516101605160601c6101805160601c6101a05160601c6101c0516101e051610200516102205160601c612dc46200062e600039600081816104720152610b870152600081816106b3015261108f0152600081816105d001528181610b580152818161103401526110d401526000818161041b01528181610b32015281816110030152818161105801526110b00152600081816106790152610d0d01526000818161051b01528181610d67015281816112280152818161133601526117c80152600081816105a90152610ceb0152600081816104f4015261074801526000611f4801526000611f9701526000611f7201526000611ecb01526000611ef501526000611f1f0152612dc46000f3fe608060405234801561001057600080fd5b50600436106102d35760003560e01c806370a0823111610186578063a9059cbb116100e3578063b9844d8d11610097578063e1eda8f911610071578063e1eda8f914610674578063f2fde38b1461069b578063fc1d3de2146106ae57600080fd5b8063b9844d8d14610605578063bca8371f14610625578063dd62ed3e1461062e57600080fd5b8063b1a9069c116100c8578063b1a9069c146105a4578063b470aade146105cb578063b6b55f25146105f257600080fd5b8063a9059cbb1461057e578063b0ff11061461059157600080fd5b806382dad8ac1161013a57806395d89b411161011f57806395d89b411461055b578063981fc37214610563578063a457c2d71461056b57600080fd5b806382dad8ac146105165780638da5cb5b1461053d57600080fd5b80637c5a227c1161016b5780637c5a227c146104d45780637ecebe00146104dc57806381771329146104ef57600080fd5b806370a08231146104b9578063715018a6146104cc57600080fd5b80633644e515116102345780634473ad52116101e85780636823920a116101cd5780636823920a1461043d5780636b2f1417146104505780636eeeaaa51461046d57600080fd5b80634473ad52146103f657806363ceec651461041657600080fd5b80633a98ef39116102195780633a98ef39146103dd5780633d355f76146103e657806341ffb72e146103ee57600080fd5b80633644e515146103c257806339509351146103ca57600080fd5b806323b872dd1161028b5780632f4f21e2116102705780632f4f21e21461037d578063313ce56714610390578063341533d91461039f57600080fd5b806323b872dd146103575780632e1a7d4d1461036a57600080fd5b8063095ea7b3116102bc578063095ea7b31461030b578063174e4ea61461032e57806318160ddd1461034f57600080fd5b8063061e5844146102d857806306fdde03146102ed575b600080fd5b6102eb6102e63660046129b4565b6106d5565b005b6102f5610897565b6040516103029190612b65565b60405180910390f35b61031e610319366004612989565b610929565b6040519015158152602001610302565b61034161033c366004612b19565b61093f565b604051908152602001610302565b61034161096e565b61031e610365366004612949565b610980565b6102eb610378366004612b19565b610a68565b6102eb61038b366004612989565b610a76565b60405160128152602001610302565b600954600a546103ad919082565b60408051928352602083019190915201610302565b610341610e37565b61031e6103d8366004612989565b610e41565b61034160065481565b61031e610e8a565b61031e610e95565b6103416104043660046128f5565b60076020526000908152604090205481565b6103417f000000000000000000000000000000000000000000000000000000000000000081565b6102eb61044b366004612a14565b610eba565b610458610ffe565b60408051928352901515602083015201610302565b6104947f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610302565b6103416104c73660046128f5565b61111e565b6102eb611153565b6103ad6111e0565b6103416104ea3660046128f5565b6112c3565b6103417f000000000000000000000000000000000000000000000000000000000000000081565b6104947f000000000000000000000000000000000000000000000000000000000000000081565b60005473ffffffffffffffffffffffffffffffffffffffff16610494565b6102f56112ee565b6103416112fd565b61031e610579366004612989565b6113d9565b61031e61058c366004612989565b6114b1565b61034161059f366004612b19565b6114be565b6104947f000000000000000000000000000000000000000000000000000000000000000081565b6103417f000000000000000000000000000000000000000000000000000000000000000081565b6102eb610600366004612b19565b6114db565b6103416106133660046128f5565b60086020526000908152604090205481565b61034161012c81565b61034161063c366004612911565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260026020908152604080832093909416825291909152205490565b6104947f000000000000000000000000000000000000000000000000000000000000000081565b6102eb6106a93660046128f5565b6114e5565b6103417f000000000000000000000000000000000000000000000000000000000000000081565b83421115610744576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5661756c743a206578706972656420646561646c696e6500000000000000000060448201526064015b60405180910390fd5b60007f0000000000000000000000000000000000000000000000000000000000000000873388886107748c611612565b60408051602081019790975273ffffffffffffffffffffffffffffffffffffffff95861690870152939092166060850152608084015260a083015260c082015260e00160405160208183030381529060405280519060200120905060006107da82611647565b905060006107ea828787876116b0565b90508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610881576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5661756c743a20696e76616c6964207369676e61747572650000000000000000604482015260640161073b565b61088c89338a6116d8565b505050505050505050565b6060600480546108a690612c87565b80601f01602080910402602001604051908101604052809291908181526020018280546108d290612c87565b801561091f5780601f106108f45761010080835404028352916020019161091f565b820191906000526020600020905b81548152906001019060200180831161090257829003601f168201915b5050505050905090565b6000610936338484611879565b50600192915050565b600080600061094c6111e0565b90925090508061095c8386612c07565b6109669190612bce565b949350505050565b600061097b60065461093f565b905090565b600061098d848484611a2d565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260026020908152604080832033845290915290205482811015610a4e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000606482015260840161073b565b610a5b8533858403611879565b60019150505b9392505050565b610a733333836116d8565b50565b610a7e610e8a565b610b0a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f5661756c743a2043616e6e6f74206a6f696e207661756c74207768656e206f7560448201527f7473696465206f6620656e7465722f657869742077696e646f77000000000000606482015260840161073b565b6040517f07e7cc270000000000000000000000000000000000000000000000000000000081527f000000000000000000000000000000000000000000000000000000000000000060048201527f000000000000000000000000000000000000000000000000000000000000000060248201523060448201526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906307e7cc279060640160206040518083038186803b158015610bde57600080fd5b505afa158015610bf2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c169190612b31565b90506000670de0b6b3a7640000610c2d8385612c07565b610c379190612bce565b9050808311610cc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f5661756c743a2043616e6e6f74206a6f696e207768656e20666565206973206860448201527f6967686572207468616e20616d6f756e74000000000000000000000000000000606482015260840161073b565b6000610cd48285612c44565b90508315610dd957610ce68582611cf0565b610d327f0000000000000000000000000000000000000000000000000000000000000000337f000000000000000000000000000000000000000000000000000000000000000087611e16565b6040517f40c10f19000000000000000000000000000000000000000000000000000000008152306004820152602481018590527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906340c10f1990604401600060405180830381600087803b158015610dc057600080fd5b505af1158015610dd4573d6000803e3d6000fd5b505050505b6040805173ffffffffffffffffffffffffffffffffffffffff87168152602081018690529081018290527f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159060600160405180910390a15050505050565b600061097b611eb1565b33600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091610936918590610e85908690612bb6565b611879565b600080610a61610ffe565b6000806000610ea2610ffe565b91509150808015610eb35750600082115b9250505090565b60005473ffffffffffffffffffffffffffffffffffffffff163314610f3b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161073b565b60005b8151811015610ffa57818181518110610f80577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1663be040fb06040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610fcf57600080fd5b505af1158015610fe3573d6000803e3d6000fd5b505050508080610ff290612cd5565b915050610f3e565b5050565b6000807f00000000000000000000000000000000000000000000000000000000000000004210156110325750600091829150565b7f000000000000000000000000000000000000000000000000000000000000000061107d7f000000000000000000000000000000000000000000000000000000000000000042612c44565b6110879190612bce565b91504261012c7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006110f97f000000000000000000000000000000000000000000000000000000000000000087612c07565b6111039190612bb6565b61110d9190612bb6565b6111179190612bb6565b1190509091565b73ffffffffffffffffffffffffffffffffffffffff811660009081526007602052604081205461114d9061093f565b92915050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146111d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161073b565b6111de6000611fe5565b565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906370a082319060240160206040518083038186803b15801561126a57600080fd5b505afa15801561127e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a29190612b31565b9150600654905081600014156112b757600191505b806112bf5750805b9091565b73ffffffffffffffffffffffffffffffffffffffff811660009081526008602052604081205461114d565b6060600580546108a690612c87565b600a546009546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009291907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561138d57600080fd5b505afa1580156113a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c59190612b31565b6113cf9190612c07565b61097b9190612bce565b33600090815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091528120548281101561149a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161073b565b6114a73385858403611879565b5060019392505050565b6000610936338484611a2d565b60008060006114cb6111e0565b90925090508161095c8286612c07565b610a733382610a76565b60005473ffffffffffffffffffffffffffffffffffffffff163314611566576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161073b565b73ffffffffffffffffffffffffffffffffffffffff8116611609576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161073b565b610a7381611fe5565b73ffffffffffffffffffffffffffffffffffffffff811660009081526008602052604090208054600181018255905b50919050565b600061114d611654611eb1565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60008060006116c18787878761205a565b915091506116ce81612172565b5095945050505050565b6116e0610e95565b61176c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f5661756c743a2043616e6e6f742065786974207661756c74207768656e206f7560448201527f7473696465206f6620656e7465722f657869742077696e646f77000000000000606482015260840161073b565b801561177c5761177c838261248e565b6040517f982755930000000000000000000000000000000000000000000000000000000081526004810182905273ffffffffffffffffffffffffffffffffffffffff83811660248301527f00000000000000000000000000000000000000000000000000000000000000001690639827559390604401600060405180830381600087803b15801561180c57600080fd5b505af1158015611820573d6000803e3d6000fd5b50506040805173ffffffffffffffffffffffffffffffffffffffff87168152602081018590527f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364935001905060405180910390a1505050565b73ffffffffffffffffffffffffffffffffffffffff831661191b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff82166119be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316611ad0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff8216611b73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff831660009081526007602052604081205490611ba3836114be565b905080821015611c35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600760205260408082208054859003905591861681529081208054839290611c7b908490612bb6565b925050819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611ce191815260200190565b60405180910390a35050505050565b73ffffffffffffffffffffffffffffffffffffffff8216611d6d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161073b565b6000611d78826114be565b90508060066000828254611d8c9190612bb6565b909155505073ffffffffffffffffffffffffffffffffffffffff831660009081526007602052604081208054839290611dc6908490612bb6565b909155505060405182815273ffffffffffffffffffffffffffffffffffffffff8416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001611a20565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052611eab908590612688565b50505050565b60003073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016148015611f1757507f000000000000000000000000000000000000000000000000000000000000000046145b15611f4157507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156120915750600090506003612169565b8460ff16601b141580156120a957508460ff16601c14155b156120ba5750600090506004612169565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561210e573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661216257600060019250925050612169565b9150600090505b94509492505050565b60008160048111156121ad577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b14156121b65750565b60018160048111156121f1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415612259576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161073b565b6002816004811115612294577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b14156122fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161073b565b6003816004811115612337577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b14156123c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f7565000000000000000000000000000000000000000000000000000000000000606482015260840161073b565b6004816004811115612400577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415610a73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f7565000000000000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff8216612531576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff821660009081526007602052604081205490612561836114be565b9050808210156125f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260076020526040812082840390556006805483929061262f908490612c44565b909155505060405183815260009073ffffffffffffffffffffffffffffffffffffffff8616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a350505050565b60006126ea826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166127999092919063ffffffff16565b80519091501561279457808060200190518101906127089190612af9565b612794576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161073b565b505050565b6060610966848460008585843b61280c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161073b565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516128359190612b49565b60006040518083038185875af1925050503d8060008114612872576040519150601f19603f3d011682016040523d82523d6000602084013e612877565b606091505b5091509150612887828286612892565b979650505050505050565b606083156128a1575081610a61565b8251156128b15782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073b9190612b65565b80356128f081612d6c565b919050565b600060208284031215612906578081fd5b8135610a6181612d6c565b60008060408385031215612923578081fd5b823561292e81612d6c565b9150602083013561293e81612d6c565b809150509250929050565b60008060006060848603121561295d578081fd5b833561296881612d6c565b9250602084013561297881612d6c565b929592945050506040919091013590565b6000806040838503121561299b578182fd5b82356129a681612d6c565b946020939093013593505050565b60008060008060008060c087890312156129cc578182fd5b86356129d781612d6c565b95506020870135945060408701359350606087013560ff811681146129fa578283fd5b9598949750929560808101359460a0909101359350915050565b60006020808385031215612a26578182fd5b823567ffffffffffffffff80821115612a3d578384fd5b818501915085601f830112612a50578384fd5b813581811115612a6257612a62612d3d565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108582111715612aa557612aa5612d3d565b604052828152858101935084860182860187018a1015612ac3578788fd5b8795505b83861015612aec57612ad8816128e5565b855260019590950194938601938601612ac7565b5098975050505050505050565b600060208284031215612b0a578081fd5b81518015158114610a61578182fd5b600060208284031215612b2a578081fd5b5035919050565b600060208284031215612b42578081fd5b5051919050565b60008251612b5b818460208701612c5b565b9190910192915050565b6020815260008251806020840152612b84816040850160208701612c5b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60008219821115612bc957612bc9612d0e565b500190565b600082612c02577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c3f57612c3f612d0e565b500290565b600082821015612c5657612c56612d0e565b500390565b60005b83811015612c76578181015183820152602001612c5e565b83811115611eab5750506000910152565b600181811c90821680612c9b57607f821691505b60208210811415611641577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612d0757612d07612d0e565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610a7357600080fdfea26469706673582212200e36cf53c0a5c42e3a16897eae33531dd51c68632077fcb4cc9114509fe86a0464736f6c63430008040033000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7000000000000000000000000c3940f86a16f54a6d74e200616eb7309e31ac004000000000000000000000000ec3c1abdab15ebc069ec5e320eaacf716edfc011000000000000000000000000000000000000000000000000000000000024ea000000000000000000000000000000000000000000000000000000000000093a80000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000008a17403b929ed1b6b50ea880d9c93068a5105d4c0000000000000000000000000000000000000000000000000000000062ae3b120000000000000000000000000000000000000000000000000000000000000007316d2d636f7265000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009316d2d636f72652d620000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102d35760003560e01c806370a0823111610186578063a9059cbb116100e3578063b9844d8d11610097578063e1eda8f911610071578063e1eda8f914610674578063f2fde38b1461069b578063fc1d3de2146106ae57600080fd5b8063b9844d8d14610605578063bca8371f14610625578063dd62ed3e1461062e57600080fd5b8063b1a9069c116100c8578063b1a9069c146105a4578063b470aade146105cb578063b6b55f25146105f257600080fd5b8063a9059cbb1461057e578063b0ff11061461059157600080fd5b806382dad8ac1161013a57806395d89b411161011f57806395d89b411461055b578063981fc37214610563578063a457c2d71461056b57600080fd5b806382dad8ac146105165780638da5cb5b1461053d57600080fd5b80637c5a227c1161016b5780637c5a227c146104d45780637ecebe00146104dc57806381771329146104ef57600080fd5b806370a08231146104b9578063715018a6146104cc57600080fd5b80633644e515116102345780634473ad52116101e85780636823920a116101cd5780636823920a1461043d5780636b2f1417146104505780636eeeaaa51461046d57600080fd5b80634473ad52146103f657806363ceec651461041657600080fd5b80633a98ef39116102195780633a98ef39146103dd5780633d355f76146103e657806341ffb72e146103ee57600080fd5b80633644e515146103c257806339509351146103ca57600080fd5b806323b872dd1161028b5780632f4f21e2116102705780632f4f21e21461037d578063313ce56714610390578063341533d91461039f57600080fd5b806323b872dd146103575780632e1a7d4d1461036a57600080fd5b8063095ea7b3116102bc578063095ea7b31461030b578063174e4ea61461032e57806318160ddd1461034f57600080fd5b8063061e5844146102d857806306fdde03146102ed575b600080fd5b6102eb6102e63660046129b4565b6106d5565b005b6102f5610897565b6040516103029190612b65565b60405180910390f35b61031e610319366004612989565b610929565b6040519015158152602001610302565b61034161033c366004612b19565b61093f565b604051908152602001610302565b61034161096e565b61031e610365366004612949565b610980565b6102eb610378366004612b19565b610a68565b6102eb61038b366004612989565b610a76565b60405160128152602001610302565b600954600a546103ad919082565b60408051928352602083019190915201610302565b610341610e37565b61031e6103d8366004612989565b610e41565b61034160065481565b61031e610e8a565b61031e610e95565b6103416104043660046128f5565b60076020526000908152604090205481565b6103417f0000000000000000000000000000000000000000000000000000000062ae3b1281565b6102eb61044b366004612a14565b610eba565b610458610ffe565b60408051928352901515602083015201610302565b6104947f0000000000000000000000008a17403b929ed1b6b50ea880d9c93068a5105d4c81565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610302565b6103416104c73660046128f5565b61111e565b6102eb611153565b6103ad6111e0565b6103416104ea3660046128f5565b6112c3565b6103417f826f68b7f2dc717b262281384d6e69ddaba3805f6e37a8c771db2cc5d6ba401381565b6104947f000000000000000000000000c3940f86a16f54a6d74e200616eb7309e31ac00481565b60005473ffffffffffffffffffffffffffffffffffffffff16610494565b6102f56112ee565b6103416112fd565b61031e610579366004612989565b6113d9565b61031e61058c366004612989565b6114b1565b61034161059f366004612b19565b6114be565b6104947f000000000000000000000000470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b781565b6103417f000000000000000000000000000000000000000000000000000000000024ea0081565b6102eb610600366004612b19565b6114db565b6103416106133660046128f5565b60086020526000908152604090205481565b61034161012c81565b61034161063c366004612911565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260026020908152604080832093909416825291909152205490565b6104947f000000000000000000000000ec3c1abdab15ebc069ec5e320eaacf716edfc01181565b6102eb6106a93660046128f5565b6114e5565b6103417f0000000000000000000000000000000000000000000000000000000000093a8081565b83421115610744576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5661756c743a206578706972656420646561646c696e6500000000000000000060448201526064015b60405180910390fd5b60007f826f68b7f2dc717b262281384d6e69ddaba3805f6e37a8c771db2cc5d6ba4013873388886107748c611612565b60408051602081019790975273ffffffffffffffffffffffffffffffffffffffff95861690870152939092166060850152608084015260a083015260c082015260e00160405160208183030381529060405280519060200120905060006107da82611647565b905060006107ea828787876116b0565b90508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610881576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5661756c743a20696e76616c6964207369676e61747572650000000000000000604482015260640161073b565b61088c89338a6116d8565b505050505050505050565b6060600480546108a690612c87565b80601f01602080910402602001604051908101604052809291908181526020018280546108d290612c87565b801561091f5780601f106108f45761010080835404028352916020019161091f565b820191906000526020600020905b81548152906001019060200180831161090257829003601f168201915b5050505050905090565b6000610936338484611879565b50600192915050565b600080600061094c6111e0565b90925090508061095c8386612c07565b6109669190612bce565b949350505050565b600061097b60065461093f565b905090565b600061098d848484611a2d565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260026020908152604080832033845290915290205482811015610a4e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000606482015260840161073b565b610a5b8533858403611879565b60019150505b9392505050565b610a733333836116d8565b50565b610a7e610e8a565b610b0a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f5661756c743a2043616e6e6f74206a6f696e207661756c74207768656e206f7560448201527f7473696465206f6620656e7465722f657869742077696e646f77000000000000606482015260840161073b565b6040517f07e7cc270000000000000000000000000000000000000000000000000000000081527f0000000000000000000000000000000000000000000000000000000062ae3b1260048201527f000000000000000000000000000000000000000000000000000000000024ea0060248201523060448201526000907f0000000000000000000000008a17403b929ed1b6b50ea880d9c93068a5105d4c73ffffffffffffffffffffffffffffffffffffffff16906307e7cc279060640160206040518083038186803b158015610bde57600080fd5b505afa158015610bf2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c169190612b31565b90506000670de0b6b3a7640000610c2d8385612c07565b610c379190612bce565b9050808311610cc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f5661756c743a2043616e6e6f74206a6f696e207768656e20666565206973206860448201527f6967686572207468616e20616d6f756e74000000000000000000000000000000606482015260840161073b565b6000610cd48285612c44565b90508315610dd957610ce68582611cf0565b610d327f000000000000000000000000470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7337f000000000000000000000000ec3c1abdab15ebc069ec5e320eaacf716edfc01187611e16565b6040517f40c10f19000000000000000000000000000000000000000000000000000000008152306004820152602481018590527f000000000000000000000000c3940f86a16f54a6d74e200616eb7309e31ac00473ffffffffffffffffffffffffffffffffffffffff16906340c10f1990604401600060405180830381600087803b158015610dc057600080fd5b505af1158015610dd4573d6000803e3d6000fd5b505050505b6040805173ffffffffffffffffffffffffffffffffffffffff87168152602081018690529081018290527f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159060600160405180910390a15050505050565b600061097b611eb1565b33600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091610936918590610e85908690612bb6565b611879565b600080610a61610ffe565b6000806000610ea2610ffe565b91509150808015610eb35750600082115b9250505090565b60005473ffffffffffffffffffffffffffffffffffffffff163314610f3b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161073b565b60005b8151811015610ffa57818181518110610f80577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1663be040fb06040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610fcf57600080fd5b505af1158015610fe3573d6000803e3d6000fd5b505050508080610ff290612cd5565b915050610f3e565b5050565b6000807f0000000000000000000000000000000000000000000000000000000062ae3b124210156110325750600091829150565b7f000000000000000000000000000000000000000000000000000000000024ea0061107d7f0000000000000000000000000000000000000000000000000000000062ae3b1242612c44565b6110879190612bce565b91504261012c7f0000000000000000000000000000000000000000000000000000000000093a807f0000000000000000000000000000000000000000000000000000000062ae3b126110f97f000000000000000000000000000000000000000000000000000000000024ea0087612c07565b6111039190612bb6565b61110d9190612bb6565b6111179190612bb6565b1190509091565b73ffffffffffffffffffffffffffffffffffffffff811660009081526007602052604081205461114d9061093f565b92915050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146111d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161073b565b6111de6000611fe5565b565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c3940f86a16f54a6d74e200616eb7309e31ac00416906370a082319060240160206040518083038186803b15801561126a57600080fd5b505afa15801561127e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a29190612b31565b9150600654905081600014156112b757600191505b806112bf5750805b9091565b73ffffffffffffffffffffffffffffffffffffffff811660009081526008602052604081205461114d565b6060600580546108a690612c87565b600a546009546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009291907f000000000000000000000000c3940f86a16f54a6d74e200616eb7309e31ac00473ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561138d57600080fd5b505afa1580156113a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c59190612b31565b6113cf9190612c07565b61097b9190612bce565b33600090815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091528120548281101561149a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161073b565b6114a73385858403611879565b5060019392505050565b6000610936338484611a2d565b60008060006114cb6111e0565b90925090508161095c8286612c07565b610a733382610a76565b60005473ffffffffffffffffffffffffffffffffffffffff163314611566576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161073b565b73ffffffffffffffffffffffffffffffffffffffff8116611609576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161073b565b610a7381611fe5565b73ffffffffffffffffffffffffffffffffffffffff811660009081526008602052604090208054600181018255905b50919050565b600061114d611654611eb1565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60008060006116c18787878761205a565b915091506116ce81612172565b5095945050505050565b6116e0610e95565b61176c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f5661756c743a2043616e6e6f742065786974207661756c74207768656e206f7560448201527f7473696465206f6620656e7465722f657869742077696e646f77000000000000606482015260840161073b565b801561177c5761177c838261248e565b6040517f982755930000000000000000000000000000000000000000000000000000000081526004810182905273ffffffffffffffffffffffffffffffffffffffff83811660248301527f000000000000000000000000c3940f86a16f54a6d74e200616eb7309e31ac0041690639827559390604401600060405180830381600087803b15801561180c57600080fd5b505af1158015611820573d6000803e3d6000fd5b50506040805173ffffffffffffffffffffffffffffffffffffffff87168152602081018590527f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364935001905060405180910390a1505050565b73ffffffffffffffffffffffffffffffffffffffff831661191b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff82166119be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316611ad0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff8216611b73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff831660009081526007602052604081205490611ba3836114be565b905080821015611c35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600760205260408082208054859003905591861681529081208054839290611c7b908490612bb6565b925050819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611ce191815260200190565b60405180910390a35050505050565b73ffffffffffffffffffffffffffffffffffffffff8216611d6d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161073b565b6000611d78826114be565b90508060066000828254611d8c9190612bb6565b909155505073ffffffffffffffffffffffffffffffffffffffff831660009081526007602052604081208054839290611dc6908490612bb6565b909155505060405182815273ffffffffffffffffffffffffffffffffffffffff8416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001611a20565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052611eab908590612688565b50505050565b60003073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000a99980c64fc6c302377c39f21431217fcbaf39af16148015611f1757507f000000000000000000000000000000000000000000000000000000000000000146145b15611f4157507f37da8c6f8c973b992a4923109568feb04368c15e888ae142934523060c5c4db590565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f85e5fcce92b1a7b9a1589c6c5b4f5cb5dd95201fa55c6ebf5cd850b8b185ae6f828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156120915750600090506003612169565b8460ff16601b141580156120a957508460ff16601c14155b156120ba5750600090506004612169565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561210e573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661216257600060019250925050612169565b9150600090505b94509492505050565b60008160048111156121ad577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b14156121b65750565b60018160048111156121f1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415612259576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161073b565b6002816004811115612294577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b14156122fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161073b565b6003816004811115612337577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b14156123c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f7565000000000000000000000000000000000000000000000000000000000000606482015260840161073b565b6004816004811115612400577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415610a73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f7565000000000000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff8216612531576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff821660009081526007602052604081205490612561836114be565b9050808210156125f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161073b565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260076020526040812082840390556006805483929061262f908490612c44565b909155505060405183815260009073ffffffffffffffffffffffffffffffffffffffff8616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a350505050565b60006126ea826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166127999092919063ffffffff16565b80519091501561279457808060200190518101906127089190612af9565b612794576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161073b565b505050565b6060610966848460008585843b61280c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161073b565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516128359190612b49565b60006040518083038185875af1925050503d8060008114612872576040519150601f19603f3d011682016040523d82523d6000602084013e612877565b606091505b5091509150612887828286612892565b979650505050505050565b606083156128a1575081610a61565b8251156128b15782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073b9190612b65565b80356128f081612d6c565b919050565b600060208284031215612906578081fd5b8135610a6181612d6c565b60008060408385031215612923578081fd5b823561292e81612d6c565b9150602083013561293e81612d6c565b809150509250929050565b60008060006060848603121561295d578081fd5b833561296881612d6c565b9250602084013561297881612d6c565b929592945050506040919091013590565b6000806040838503121561299b578182fd5b82356129a681612d6c565b946020939093013593505050565b60008060008060008060c087890312156129cc578182fd5b86356129d781612d6c565b95506020870135945060408701359350606087013560ff811681146129fa578283fd5b9598949750929560808101359460a0909101359350915050565b60006020808385031215612a26578182fd5b823567ffffffffffffffff80821115612a3d578384fd5b818501915085601f830112612a50578384fd5b813581811115612a6257612a62612d3d565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108582111715612aa557612aa5612d3d565b604052828152858101935084860182860187018a1015612ac3578788fd5b8795505b83861015612aec57612ad8816128e5565b855260019590950194938601938601612ac7565b5098975050505050505050565b600060208284031215612b0a578081fd5b81518015158114610a61578182fd5b600060208284031215612b2a578081fd5b5035919050565b600060208284031215612b42578081fd5b5051919050565b60008251612b5b818460208701612c5b565b9190910192915050565b6020815260008251806020840152612b84816040850160208701612c5b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60008219821115612bc957612bc9612d0e565b500190565b600082612c02577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c3f57612c3f612d0e565b500290565b600082821015612c5657612c56612d0e565b500390565b60005b83811015612c76578181015183820152602001612c5e565b83811115611eab5750506000910152565b600181811c90821680612c9b57607f821691505b60208210811415611641577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612d0757612d07612d0e565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610a7357600080fdfea26469706673582212200e36cf53c0a5c42e3a16897eae33531dd51c68632077fcb4cc9114509fe86a0464736f6c63430008040033

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

000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7000000000000000000000000c3940f86a16f54a6d74e200616eb7309e31ac004000000000000000000000000ec3c1abdab15ebc069ec5e320eaacf716edfc011000000000000000000000000000000000000000000000000000000000024ea000000000000000000000000000000000000000000000000000000000000093a80000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000008a17403b929ed1b6b50ea880d9c93068a5105d4c0000000000000000000000000000000000000000000000000000000062ae3b120000000000000000000000000000000000000000000000000000000000000007316d2d636f7265000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009316d2d636f72652d620000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _name (string): 1m-core
Arg [1] : _symbol (string): 1m-core-b
Arg [2] : _templeToken (address): 0x470EBf5f030Ed85Fc1ed4C2d36B9DD02e77CF1b7
Arg [3] : _templeExposureToken (address): 0xC3940F86A16F54A6D74E200616Eb7309e31AC004
Arg [4] : _vaultedTempleAccount (address): 0xEc3C1aBDAb15EbC069ec5e320EaACf716eDfC011
Arg [5] : _periodDuration (uint256): 2419200
Arg [6] : _enterExitWindowDuration (uint256): 604800
Arg [7] : _shareBoostFactory (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
Arg [8] : _joiningFee (address): 0x8A17403B929ed1B6B50ea880d9C93068a5105D4C
Arg [9] : _firstPeriodStartTimestamp (uint256): 1655585554

-----Encoded View---------------
15 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [1] : 00000000000000000000000000000000000000000000000000000000000001a0
Arg [2] : 000000000000000000000000470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7
Arg [3] : 000000000000000000000000c3940f86a16f54a6d74e200616eb7309e31ac004
Arg [4] : 000000000000000000000000ec3c1abdab15ebc069ec5e320eaacf716edfc011
Arg [5] : 000000000000000000000000000000000000000000000000000000000024ea00
Arg [6] : 0000000000000000000000000000000000000000000000000000000000093a80
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [9] : 0000000000000000000000008a17403b929ed1b6b50ea880d9c93068a5105d4c
Arg [10] : 0000000000000000000000000000000000000000000000000000000062ae3b12
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [12] : 316d2d636f726500000000000000000000000000000000000000000000000000
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000009
Arg [14] : 316d2d636f72652d620000000000000000000000000000000000000000000000


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  ]
[ 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.