POL Price: $0.714421 (+2.04%)
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VaultLogic

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
File 1 of 13 : VaultLogic.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../libs/UniversalERC20.sol";
import "../interfaces/IVault.sol";
import "../interfaces/IDistribution.sol";
import "./Helpers.sol";

contract DSMath is Helpers {
	function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
		require((z = x + y) >= x, "math-not-safe");
	}

	function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
		require((z = x - y) <= x, "math-not-safe");
	}

	function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
		require(y == 0 || (z = x * y) / y == x, "math-not-safe");
	}

	function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
		require(_b > 0); // Solidity only automatically asserts when dividing by 0
		uint256 c = _a / _b;
		// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
		return c;
	}

	uint256 constant WAD = 10**18;

	function wmul(uint256 x, uint256 y) internal pure returns (uint256 z) {
		z = add(mul(x, y), WAD / 2) / WAD;
	}

	function wdiv(uint256 x, uint256 y) internal pure returns (uint256 z) {
		z = add(mul(x, WAD), y / 2) / y;
	}
}

contract VaultResolver is DSMath {
	using UniversalERC20 for IERC20;
	using SafeMath for uint256;

	event VaultDeposit(address indexed erc20, uint256 tokenAmt);
	event VaultWithdraw(address indexed erc20, uint256 tokenAmt);
	event VaultClaim(address indexed erc20, uint256 tokenAmt);
	event Claim(address indexed erc20, uint256 tokenAmt);

	function _payFees(
		address _vault,
		address underlying,
		uint256 amt
	) internal returns (uint256 feesPaid) {
		(uint256 fee, uint256 maxFee, address feeRecipient) = getVaultFee(
			_vault
		);

		if (fee > 0) {
			require(feeRecipient != address(0), "ZERO ADDRESS");

			feesPaid = div(mul(amt, fee), maxFee);

			IERC20(underlying).universalTransfer(feeRecipient, feesPaid);
		}
	}

	/**
	 * @dev Deposit tokens to ETHA Vault
	 * @param vault address of vault
	 * @param tokenAmt amount of tokens to deposit
	 * @param getId read value of tokenAmt from memory contract
	 */
	function deposit(
		IVault vault,
		uint256 tokenAmt,
		uint256 getId
	) external payable {
		uint256 realAmt = getId > 0 ? getUint(getId) : tokenAmt;

		require(realAmt > 0, "!AMOUNT");

		IERC20 erc20 = IERC20(address(vault.underlying()));
		erc20.universalApprove(address(vault), realAmt);

		vault.deposit(realAmt);
		emit VaultDeposit(address(erc20), realAmt);
	}

	/**
	 * @dev Withdraw tokens from ETHA Vault
	 * @param vault address of vault
	 * @param tokenAmt amount of vault tokens to withdraw
	 * @param getId read value of tokenAmt from memory contract
	 */
	function withdraw(
		IVault vault,
		uint256 tokenAmt,
		uint256 getId,
		uint256 setId
	) external payable {
		uint256 realAmt = getId > 0 ? getUint(getId) : tokenAmt;

		require(vault.balanceOf(address(this)) >= realAmt, "!BALANCE");

		address distToken = IDistribution(vault.distribution()).rewardsToken();
		uint256 initialBal = IERC20(distToken).balanceOf(address(this));

		vault.withdraw(realAmt);
		address underlying = address(vault.underlying());
		emit VaultWithdraw(underlying, realAmt);

		uint256 feesPaid = _payFees(address(vault), underlying, realAmt);

		uint256 _claimed = IERC20(distToken).balanceOf(address(this)).sub(
			initialBal
		);

		// set tokens received after paying fees
		if (setId > 0) {
			setUint(setId, realAmt.sub(feesPaid));
		}

		if (_claimed > 0) {
			emit Claim(distToken, _claimed);
		}
	}

	/**
	 * @dev claim rewards from ETHA Vault
	 * @param vault address of vault
	 * @param setId store value of rewards received to memory contract
	 */
	function claim(IVault vault, uint256 setId) external {
		address distToken = IDistribution(vault.distribution()).rewardsToken();
		uint256 initialBal = IERC20(distToken).balanceOf(address(this));

		uint256 claimed = vault.claim();

		// set rewards received
		if (setId > 0) {
			setUint(setId, claimed);
		}

		emit VaultClaim(address(vault.target()), claimed);

		uint256 _claimed = IERC20(distToken).balanceOf(address(this)).sub(
			initialBal
		);

		if (_claimed > 0) {
			emit Claim(distToken, _claimed);
		}
	}
}

contract VaultLogic is VaultResolver {
	receive() external payable {}
}

File 2 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 3 of 13 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 4 of 13 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) private pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 5 of 13 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 6 of 13 : IDistribution.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IDistribution {
	function stake(address user, uint256 redeemTokens) external;

	function withdraw(address user, uint256 redeemAmount) external;

	function getReward(address user) external;

	function balanceOf(address account) external view returns (uint256);

	function rewardsToken() external view returns (address);

	function earned(address account) external view returns (uint256);

	function rewardPerToken() external view returns (uint256);

	function rewardRate() external view returns (uint256);
}

File 7 of 13 : IFeeManager.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IFeeManager {
	function MAX_FEE() external view returns (uint256);

	function getVaultFee(address _vault) external view returns (uint256);

	function setVaultFee(address _vault, uint256 _fee) external;

	function getLendingFee(address _asset) external view returns (uint256);

	function setLendingFee(address _asset, uint256 _fee) external;
}

File 8 of 13 : IMemory.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IMemory {
	function getUint(uint256) external view returns (uint256);

	function setUint(uint256 id, uint256 value) external;

	function getAToken(address asset) external view returns (address);

	function setAToken(address asset, address _aToken) external;

	function getCrToken(address asset) external view returns (address);

	function setCrToken(address asset, address _crToken) external;
}

File 9 of 13 : IRegistry.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @title RegistryInterface Interface
 */
interface IRegistry {
	function logic(address logicAddr) external view returns (bool);

	function implementation(bytes32 key) external view returns (address);

	function notAllowed(address erc20) external view returns (bool);

	function deployWallet() external returns (address);

	function wallets(address user) external view returns (address);

	function getFee() external view returns (uint256);

	function getFeeManager() external view returns (address);

	function feeRecipient() external view returns (address);

	function memoryAddr() external view returns (address);

	function distributionContract(address token)
		external
		view
		returns (address);
}

File 10 of 13 : IVault.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

interface IERC20Detailed is IERC20 {
	function decimals() external view returns (uint8);
}

interface IVault {
	function totalSupply() external view returns (uint256);

	function harvest() external returns (uint256);

	function distribute(uint256 amount) external;

	function rewards() external view returns (IERC20);

	function underlying() external view returns (IERC20Detailed);

	function target() external view returns (IERC20);

	function harvester() external view returns (address);

	function owner() external view returns (address);

	function distribution() external view returns (address);

	function strat() external view returns (address);

	function timelock() external view returns (address payable);

	function claimOnBehalf(address recipient) external;

	function lastDistribution() external view returns (uint256);

	function performanceFee() external view returns (uint256);

	function balanceOf(address) external view returns (uint256);

	function totalYield() external returns (uint256);

	function calcTotalValue() external view returns (uint256);

	function deposit(uint256 amount) external;

	function depositAndWait(uint256 amount) external;

	function withdraw(uint256 amount) external;

	function withdrawPending(uint256 amount) external;

	function changePerformanceFee(uint256 fee) external;

	function claim() external returns (uint256 claimed);

	function unclaimedProfit(address user) external view returns (uint256);

	function pending(address user) external view returns (uint256);
}

File 11 of 13 : IWallet.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IWallet {
	event LogMint(address indexed erc20, uint256 tokenAmt);
	event LogRedeem(address indexed erc20, uint256 tokenAmt);
	event LogBorrow(address indexed erc20, uint256 tokenAmt);
	event LogPayback(address indexed erc20, uint256 tokenAmt);
	event LogDeposit(address indexed erc20, uint256 tokenAmt);
	event LogWithdraw(address indexed erc20, uint256 tokenAmt);
	event LogSwap(address indexed src, address indexed dest, uint256 amount);
	event LogLiquidityAdd(
		address indexed tokenA,
		address indexed tokenB,
		uint256 amountA,
		uint256 amountB
	);
	event LogLiquidityRemove(
		address indexed tokenA,
		address indexed tokenB,
		uint256 amountA,
		uint256 amountB
	);
	event VaultDeposit(address indexed erc20, uint256 tokenAmt);
	event VaultWithdraw(address indexed erc20, uint256 tokenAmt);
	event VaultClaim(address indexed erc20, uint256 tokenAmt);
	event DelegateAdded(address delegate);
	event DelegateRemoved(address delegate);
	event Claim(address indexed erc20, uint256 tokenAmt);

	function executeMetaTransaction(bytes memory sign, bytes memory data)
		external;

	function execute(address[] calldata targets, bytes[] calldata datas)
		external
		payable;

	function owner() external view returns (address);

	function registry() external view returns (address);

	function DELEGATE_ROLE() external view returns (bytes32);

	function hasRole(bytes32, address) external view returns (bool);
}

File 12 of 13 : UniversalERC20.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

library UniversalERC20 {
	using SafeMath for uint256;
	using SafeERC20 for IERC20;

	IERC20 private constant ZERO_ADDRESS =
		IERC20(0x0000000000000000000000000000000000000000);
	IERC20 private constant ETH_ADDRESS =
		IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);

	function universalTransfer(
		IERC20 token,
		address to,
		uint256 amount
	) internal returns (bool success) {
		if (amount == 0) {
			return true;
		}

		if (isETH(token)) {
			payable(to).transfer(amount);
		} else {
			token.safeTransfer(to, amount);
			return true;
		}
	}

	function universalTransferFrom(
		IERC20 token,
		address from,
		address to,
		uint256 amount
	) internal {
		if (amount == 0) {
			return;
		}

		if (isETH(token)) {
			require(
				from == msg.sender && msg.value >= amount,
				"Wrong useage of ETH.universalTransferFrom()"
			);
			if (to != address(this)) {
				payable(to).transfer(amount);
			}
			if (msg.value > amount) {
				payable(msg.sender).transfer(msg.value.sub(amount));
			}
		} else {
			token.safeTransferFrom(from, to, amount);
		}
	}

	function universalTransferFromSenderToThis(IERC20 token, uint256 amount)
		internal
	{
		if (amount == 0) {
			return;
		}

		if (isETH(token)) {
			if (msg.value > amount) {
				// Return remainder if exist
				payable(msg.sender).transfer(msg.value.sub(amount));
			}
		} else {
			token.safeTransferFrom(msg.sender, address(this), amount);
		}
	}

	function universalApprove(
		IERC20 token,
		address to,
		uint256 amount
	) internal {
		if (!isETH(token)) {
			if (amount == 0) {
				token.safeApprove(to, 0);
				return;
			}

			uint256 allowance = token.allowance(address(this), to);
			if (allowance < amount) {
				if (allowance > 0) {
					token.safeApprove(to, 0);
				}
				token.safeApprove(to, amount);
			}
		}
	}

	function universalBalanceOf(IERC20 token, address who)
		internal
		view
		returns (uint256)
	{
		if (isETH(token)) {
			return who.balance;
		} else {
			return token.balanceOf(who);
		}
	}

	function universalDecimals(IERC20 token) internal view returns (uint256) {
		if (isETH(token)) {
			return 18;
		}

		(bool success, bytes memory data) =
			address(token).staticcall{gas: 10000}(
				abi.encodeWithSignature("decimals()")
			);
		if (!success || data.length == 0) {
			(success, data) = address(token).staticcall{gas: 10000}(
				abi.encodeWithSignature("DECIMALS()")
			);
		}

		return (success && data.length > 0) ? abi.decode(data, (uint256)) : 18;
	}

	function isETH(IERC20 token) internal pure returns (bool) {
		return (address(token) == address(ZERO_ADDRESS) ||
			address(token) == address(ETH_ADDRESS));
	}
}

File 13 of 13 : Helpers.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "../interfaces/IMemory.sol";
import "../interfaces/IRegistry.sol";
import "../interfaces/IWallet.sol";
import "../interfaces/IFeeManager.sol";

contract Helpers {
	/**
	 * @dev Return Memory Variable Address
	 */
	function getMemoryAddr() public view returns (address) {
		return IRegistry(IWallet(address(this)).registry()).memoryAddr();
	}

	/**
	 * @dev Return Lending fee and recipient
	 */
	function getLendingFee(address erc20)
		public
		view
		returns (
			uint256 fee,
			uint256 maxFee,
			address recipient
		)
	{
		IRegistry registry = IRegistry(IWallet(address(this)).registry());
		IFeeManager feeManager = IFeeManager(registry.getFeeManager());

		fee = feeManager.getLendingFee(erc20);
		maxFee = feeManager.MAX_FEE();
		recipient = registry.feeRecipient();
	}

	/**
	 * @dev Return Vault fee and recipient
	 */
	function getVaultFee(address vault)
		public
		view
		returns (
			uint256 fee,
			uint256 maxFee,
			address recipient
		)
	{
		IRegistry registry = IRegistry(IWallet(address(this)).registry());
		IFeeManager feeManager = IFeeManager(registry.getFeeManager());

		fee = feeManager.getVaultFee(vault);
		maxFee = feeManager.MAX_FEE();
		recipient = registry.feeRecipient();
	}

	/**
	 * @dev Get Uint value from Memory Contract.
	 */
	function getUint(uint256 id) internal view returns (uint256) {
		return IMemory(getMemoryAddr()).getUint(id);
	}

	/**
	 * @dev Set Uint value in Memory Contract.
	 */
	function setUint(uint256 id, uint256 val) internal {
		IMemory(getMemoryAddr()).setUint(id, val);
	}

	/**
	 * @dev Get aToken address from Memory Contract.
	 */
	function getAToken(address asset) internal view returns (address) {
		return IMemory(getMemoryAddr()).getAToken(asset);
	}

	/**
	 * @dev Get crToken address from Memory Contract.
	 */
	function getCrToken(address asset) internal view returns (address) {
		return IMemory(getMemoryAddr()).getCrToken(asset);
	}
}

Settings
{
  "evmVersion": "istanbul",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc20","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmt","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc20","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmt","type":"uint256"}],"name":"VaultClaim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc20","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmt","type":"uint256"}],"name":"VaultDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc20","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmt","type":"uint256"}],"name":"VaultWithdraw","type":"event"},{"inputs":[{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"uint256","name":"setId","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"uint256","name":"tokenAmt","type":"uint256"},{"internalType":"uint256","name":"getId","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"erc20","type":"address"}],"name":"getLendingFee","outputs":[{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"maxFee","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMemoryAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"getVaultFee","outputs":[{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"maxFee","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"uint256","name":"tokenAmt","type":"uint256"},{"internalType":"uint256","name":"getId","type":"uint256"},{"internalType":"uint256","name":"setId","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b506117f7806100206000396000f3fe6080604052600436106100595760003560e01c80630efe6a8b146100655780634532d7761461007a578063553a89461461008d578063772b21fe146100d6578063aad3ec96146100f6578063fa821c9b1461011657600080fd5b3661006057005b600080fd5b61007861007336600461163c565b610143565b005b610078610088366004611670565b6102c9565b34801561009957600080fd5b506100ad6100a83660046115b9565b610713565b6040805193845260208401929092526001600160a01b0316908201526060015b60405180910390f35b3480156100e257600080fd5b506100ad6100f13660046115b9565b61096d565b34801561010257600080fd5b50610078610111366004611611565b610a8b565b34801561012257600080fd5b5061012b610db0565b6040516001600160a01b0390911681526020016100cd565b6000808211610152578261015b565b61015b82610e98565b90506000811161019c5760405162461bcd60e51b815260206004820152600760248201526608505353d5539560ca1b60448201526064015b60405180910390fd5b6000846001600160a01b0316636f307dc36040518163ffffffff1660e01b815260040160206040518083038186803b1580156101d757600080fd5b505afa1580156101eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020f91906115d5565b90506102256001600160a01b0382168684610f25565b60405163b6b55f2560e01b8152600481018390526001600160a01b0386169063b6b55f2590602401600060405180830381600087803b15801561026757600080fd5b505af115801561027b573d6000803e3d6000fd5b50505050806001600160a01b03167f89d28cf06bdb2ee1b92cd046d58450042ad113e9f4cdabfc4d43e7c5557758d7836040516102ba91815260200190565b60405180910390a25050505050565b60008083116102d857836102e1565b6102e183610e98565b6040516370a0823160e01b815230600482015290915081906001600160a01b038716906370a082319060240160206040518083038186803b15801561032557600080fd5b505afa158015610339573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035d91906116aa565b10156103965760405162461bcd60e51b81526020600482015260086024820152672142414c414e434560c01b6044820152606401610193565b6000856001600160a01b0316635ee58efc6040518163ffffffff1660e01b815260040160206040518083038186803b1580156103d157600080fd5b505afa1580156103e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061040991906115d5565b6001600160a01b031663d1af0c7d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561044157600080fd5b505afa158015610455573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047991906115d5565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a082319060240160206040518083038186803b1580156104be57600080fd5b505afa1580156104d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f691906116aa565b604051632e1a7d4d60e01b8152600481018590529091506001600160a01b03881690632e1a7d4d90602401600060405180830381600087803b15801561053b57600080fd5b505af115801561054f573d6000803e3d6000fd5b505050506000876001600160a01b0316636f307dc36040518163ffffffff1660e01b815260040160206040518083038186803b15801561058e57600080fd5b505afa1580156105a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c691906115d5565b9050806001600160a01b03167f0ac60fbf53b67f5a6a0c8031dd9d1610a06f01669b1a8b9af98f3a6a477e8d7c8560405161060391815260200190565b60405180910390a26000610618898387611013565b6040516370a0823160e01b81523060048201529091506000906106a29085906001600160a01b038816906370a08231906024015b60206040518083038186803b15801561066457600080fd5b505afa158015610678573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069c91906116aa565b906110a9565b905086156106bd576106bd876106b888856110a9565b6110bc565b801561070757846001600160a01b03167f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4826040516106fe91815260200190565b60405180910390a25b50505050505050505050565b600080600080306001600160a01b0316637b1039996040518163ffffffff1660e01b815260040160206040518083038186803b15801561075257600080fd5b505afa158015610766573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078a91906115d5565b90506000816001600160a01b031663f2d638266040518163ffffffff1660e01b815260040160206040518083038186803b1580156107c757600080fd5b505afa1580156107db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ff91906115d5565b604051632a9d44a360e11b81526001600160a01b0388811660048301529192509082169063553a8946906024015b60206040518083038186803b15801561084557600080fd5b505afa158015610859573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087d91906116aa565b9450806001600160a01b031663bc063e1a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108b857600080fd5b505afa1580156108cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f091906116aa565b9350816001600160a01b031663469048406040518163ffffffff1660e01b815260040160206040518083038186803b15801561092b57600080fd5b505afa15801561093f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096391906115d5565b9496939550505050565b600080600080306001600160a01b0316637b1039996040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ac57600080fd5b505afa1580156109c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e491906115d5565b90506000816001600160a01b031663f2d638266040518163ffffffff1660e01b815260040160206040518083038186803b158015610a2157600080fd5b505afa158015610a35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5991906115d5565b604051633b9590ff60e11b81526001600160a01b0388811660048301529192509082169063772b21fe9060240161082d565b6000826001600160a01b0316635ee58efc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ac657600080fd5b505afa158015610ada573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afe91906115d5565b6001600160a01b031663d1af0c7d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b3657600080fd5b505afa158015610b4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6e91906115d5565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a082319060240160206040518083038186803b158015610bb357600080fd5b505afa158015610bc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610beb91906116aa565b90506000846001600160a01b0316634e71d92d6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610c2a57600080fd5b505af1158015610c3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6291906116aa565b90508315610c7457610c7484826110bc565b846001600160a01b031663d4b839926040518163ffffffff1660e01b815260040160206040518083038186803b158015610cad57600080fd5b505afa158015610cc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce591906115d5565b6001600160a01b03167f3a04f95ac8882122d53cb83ec5d007730aa4abf7b33a87a8ba4faf64b0bba03082604051610d1f91815260200190565b60405180910390a26040516370a0823160e01b8152306004820152600090610d5c9084906001600160a01b038716906370a082319060240161064c565b90508015610da857836001600160a01b03167f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d482604051610d9f91815260200190565b60405180910390a25b505050505050565b6000306001600160a01b0316637b1039996040518163ffffffff1660e01b815260040160206040518083038186803b158015610deb57600080fd5b505afa158015610dff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2391906115d5565b6001600160a01b031663f54ad35f6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e5b57600080fd5b505afa158015610e6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9391906115d5565b905090565b6000610ea2610db0565b6001600160a01b031663a9c70eaa836040518263ffffffff1660e01b8152600401610ecf91815260200190565b60206040518083038186803b158015610ee757600080fd5b505afa158015610efb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1f91906116aa565b92915050565b610f2e83611123565b610f4c5780610f5157610f4c6001600160a01b03841683600061115c565b505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b158015610f9c57600080fd5b505afa158015610fb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd491906116aa565b90508181101561100d578015610ff957610ff96001600160a01b03851684600061115c565b61100d6001600160a01b038516848461115c565b50505050565b6000806000806110228761096d565b91945092509050821561109f576001600160a01b0381166110745760405162461bcd60e51b815260206004820152600c60248201526b5a45524f204144445245535360a01b6044820152606401610193565b61108761108186856112b3565b83611313565b935061109d6001600160a01b0387168286611335565b505b5050509392505050565b60006110b58284611750565b9392505050565b6110c4610db0565b604051631878f25160e21b815260048101849052602481018390526001600160a01b0391909116906361e3c94490604401600060405180830381600087803b15801561110f57600080fd5b505af1158015610da8573d6000803e3d6000fd5b60006001600160a01b0382161580610f1f57506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1492915050565b8015806111e55750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156111ab57600080fd5b505afa1580156111bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e391906116aa565b155b6112505760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610193565b6040516001600160a01b038316602482015260448101829052610f4c90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526113ac565b60008115806112d7575082826112c98183611731565b92506112d59083611711565b145b610f1f5760405162461bcd60e51b815260206004820152600d60248201526c6d6174682d6e6f742d7361666560981b6044820152606401610193565b600080821161132157600080fd5b600061132d8385611711565b949350505050565b600081611344575060016110b5565b61134d84611123565b1561138e576040516001600160a01b0384169083156108fc029084906000818181858888f19350505050158015611388573d6000803e3d6000fd5b506110b5565b6113a26001600160a01b038516848461147e565b5060019392505050565b6000611401826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114ae9092919063ffffffff16565b805190915015610f4c578080602001905181019061141f91906115f1565b610f4c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610193565b6040516001600160a01b038316602482015260448101829052610f4c90849063a9059cbb60e01b9060640161127c565b606061132d848460008585843b6115075760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610193565b600080866001600160a01b0316858760405161152391906116c2565b60006040518083038185875af1925050503d8060008114611560576040519150601f19603f3d011682016040523d82523d6000602084013e611565565b606091505b5091509150611575828286611580565b979650505050505050565b6060831561158f5750816110b5565b82511561159f5782518084602001fd5b8160405162461bcd60e51b815260040161019391906116de565b6000602082840312156115ca578081fd5b81356110b5816117a9565b6000602082840312156115e6578081fd5b81516110b5816117a9565b600060208284031215611602578081fd5b815180151581146110b5578182fd5b60008060408385031215611623578081fd5b823561162e816117a9565b946020939093013593505050565b600080600060608486031215611650578081fd5b833561165b816117a9565b95602085013595506040909401359392505050565b60008060008060808587031215611685578081fd5b8435611690816117a9565b966020860135965060408601359560600135945092505050565b6000602082840312156116bb578081fd5b5051919050565b600082516116d4818460208701611767565b9190910192915050565b60208152600082518060208401526116fd816040850160208701611767565b601f01601f19169190910160400192915050565b60008261172c57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561174b5761174b611793565b500290565b60008282101561176257611762611793565b500390565b60005b8381101561178257818101518382015260200161176a565b8381111561100d5750506000910152565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146117be57600080fd5b5056fea2646970667358221220af2edc333eeaf9343cf6426dd6a249b72dde75682c906aec67d6baa17bec216a64736f6c63430008040033

Deployed Bytecode

0x6080604052600436106100595760003560e01c80630efe6a8b146100655780634532d7761461007a578063553a89461461008d578063772b21fe146100d6578063aad3ec96146100f6578063fa821c9b1461011657600080fd5b3661006057005b600080fd5b61007861007336600461163c565b610143565b005b610078610088366004611670565b6102c9565b34801561009957600080fd5b506100ad6100a83660046115b9565b610713565b6040805193845260208401929092526001600160a01b0316908201526060015b60405180910390f35b3480156100e257600080fd5b506100ad6100f13660046115b9565b61096d565b34801561010257600080fd5b50610078610111366004611611565b610a8b565b34801561012257600080fd5b5061012b610db0565b6040516001600160a01b0390911681526020016100cd565b6000808211610152578261015b565b61015b82610e98565b90506000811161019c5760405162461bcd60e51b815260206004820152600760248201526608505353d5539560ca1b60448201526064015b60405180910390fd5b6000846001600160a01b0316636f307dc36040518163ffffffff1660e01b815260040160206040518083038186803b1580156101d757600080fd5b505afa1580156101eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020f91906115d5565b90506102256001600160a01b0382168684610f25565b60405163b6b55f2560e01b8152600481018390526001600160a01b0386169063b6b55f2590602401600060405180830381600087803b15801561026757600080fd5b505af115801561027b573d6000803e3d6000fd5b50505050806001600160a01b03167f89d28cf06bdb2ee1b92cd046d58450042ad113e9f4cdabfc4d43e7c5557758d7836040516102ba91815260200190565b60405180910390a25050505050565b60008083116102d857836102e1565b6102e183610e98565b6040516370a0823160e01b815230600482015290915081906001600160a01b038716906370a082319060240160206040518083038186803b15801561032557600080fd5b505afa158015610339573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035d91906116aa565b10156103965760405162461bcd60e51b81526020600482015260086024820152672142414c414e434560c01b6044820152606401610193565b6000856001600160a01b0316635ee58efc6040518163ffffffff1660e01b815260040160206040518083038186803b1580156103d157600080fd5b505afa1580156103e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061040991906115d5565b6001600160a01b031663d1af0c7d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561044157600080fd5b505afa158015610455573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047991906115d5565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a082319060240160206040518083038186803b1580156104be57600080fd5b505afa1580156104d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f691906116aa565b604051632e1a7d4d60e01b8152600481018590529091506001600160a01b03881690632e1a7d4d90602401600060405180830381600087803b15801561053b57600080fd5b505af115801561054f573d6000803e3d6000fd5b505050506000876001600160a01b0316636f307dc36040518163ffffffff1660e01b815260040160206040518083038186803b15801561058e57600080fd5b505afa1580156105a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c691906115d5565b9050806001600160a01b03167f0ac60fbf53b67f5a6a0c8031dd9d1610a06f01669b1a8b9af98f3a6a477e8d7c8560405161060391815260200190565b60405180910390a26000610618898387611013565b6040516370a0823160e01b81523060048201529091506000906106a29085906001600160a01b038816906370a08231906024015b60206040518083038186803b15801561066457600080fd5b505afa158015610678573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069c91906116aa565b906110a9565b905086156106bd576106bd876106b888856110a9565b6110bc565b801561070757846001600160a01b03167f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4826040516106fe91815260200190565b60405180910390a25b50505050505050505050565b600080600080306001600160a01b0316637b1039996040518163ffffffff1660e01b815260040160206040518083038186803b15801561075257600080fd5b505afa158015610766573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078a91906115d5565b90506000816001600160a01b031663f2d638266040518163ffffffff1660e01b815260040160206040518083038186803b1580156107c757600080fd5b505afa1580156107db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ff91906115d5565b604051632a9d44a360e11b81526001600160a01b0388811660048301529192509082169063553a8946906024015b60206040518083038186803b15801561084557600080fd5b505afa158015610859573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087d91906116aa565b9450806001600160a01b031663bc063e1a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108b857600080fd5b505afa1580156108cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f091906116aa565b9350816001600160a01b031663469048406040518163ffffffff1660e01b815260040160206040518083038186803b15801561092b57600080fd5b505afa15801561093f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096391906115d5565b9496939550505050565b600080600080306001600160a01b0316637b1039996040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ac57600080fd5b505afa1580156109c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e491906115d5565b90506000816001600160a01b031663f2d638266040518163ffffffff1660e01b815260040160206040518083038186803b158015610a2157600080fd5b505afa158015610a35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5991906115d5565b604051633b9590ff60e11b81526001600160a01b0388811660048301529192509082169063772b21fe9060240161082d565b6000826001600160a01b0316635ee58efc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ac657600080fd5b505afa158015610ada573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afe91906115d5565b6001600160a01b031663d1af0c7d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b3657600080fd5b505afa158015610b4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6e91906115d5565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a082319060240160206040518083038186803b158015610bb357600080fd5b505afa158015610bc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610beb91906116aa565b90506000846001600160a01b0316634e71d92d6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610c2a57600080fd5b505af1158015610c3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6291906116aa565b90508315610c7457610c7484826110bc565b846001600160a01b031663d4b839926040518163ffffffff1660e01b815260040160206040518083038186803b158015610cad57600080fd5b505afa158015610cc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce591906115d5565b6001600160a01b03167f3a04f95ac8882122d53cb83ec5d007730aa4abf7b33a87a8ba4faf64b0bba03082604051610d1f91815260200190565b60405180910390a26040516370a0823160e01b8152306004820152600090610d5c9084906001600160a01b038716906370a082319060240161064c565b90508015610da857836001600160a01b03167f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d482604051610d9f91815260200190565b60405180910390a25b505050505050565b6000306001600160a01b0316637b1039996040518163ffffffff1660e01b815260040160206040518083038186803b158015610deb57600080fd5b505afa158015610dff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2391906115d5565b6001600160a01b031663f54ad35f6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e5b57600080fd5b505afa158015610e6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9391906115d5565b905090565b6000610ea2610db0565b6001600160a01b031663a9c70eaa836040518263ffffffff1660e01b8152600401610ecf91815260200190565b60206040518083038186803b158015610ee757600080fd5b505afa158015610efb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1f91906116aa565b92915050565b610f2e83611123565b610f4c5780610f5157610f4c6001600160a01b03841683600061115c565b505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b158015610f9c57600080fd5b505afa158015610fb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd491906116aa565b90508181101561100d578015610ff957610ff96001600160a01b03851684600061115c565b61100d6001600160a01b038516848461115c565b50505050565b6000806000806110228761096d565b91945092509050821561109f576001600160a01b0381166110745760405162461bcd60e51b815260206004820152600c60248201526b5a45524f204144445245535360a01b6044820152606401610193565b61108761108186856112b3565b83611313565b935061109d6001600160a01b0387168286611335565b505b5050509392505050565b60006110b58284611750565b9392505050565b6110c4610db0565b604051631878f25160e21b815260048101849052602481018390526001600160a01b0391909116906361e3c94490604401600060405180830381600087803b15801561110f57600080fd5b505af1158015610da8573d6000803e3d6000fd5b60006001600160a01b0382161580610f1f57506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1492915050565b8015806111e55750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156111ab57600080fd5b505afa1580156111bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e391906116aa565b155b6112505760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610193565b6040516001600160a01b038316602482015260448101829052610f4c90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526113ac565b60008115806112d7575082826112c98183611731565b92506112d59083611711565b145b610f1f5760405162461bcd60e51b815260206004820152600d60248201526c6d6174682d6e6f742d7361666560981b6044820152606401610193565b600080821161132157600080fd5b600061132d8385611711565b949350505050565b600081611344575060016110b5565b61134d84611123565b1561138e576040516001600160a01b0384169083156108fc029084906000818181858888f19350505050158015611388573d6000803e3d6000fd5b506110b5565b6113a26001600160a01b038516848461147e565b5060019392505050565b6000611401826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114ae9092919063ffffffff16565b805190915015610f4c578080602001905181019061141f91906115f1565b610f4c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610193565b6040516001600160a01b038316602482015260448101829052610f4c90849063a9059cbb60e01b9060640161127c565b606061132d848460008585843b6115075760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610193565b600080866001600160a01b0316858760405161152391906116c2565b60006040518083038185875af1925050503d8060008114611560576040519150601f19603f3d011682016040523d82523d6000602084013e611565565b606091505b5091509150611575828286611580565b979650505050505050565b6060831561158f5750816110b5565b82511561159f5782518084602001fd5b8160405162461bcd60e51b815260040161019391906116de565b6000602082840312156115ca578081fd5b81356110b5816117a9565b6000602082840312156115e6578081fd5b81516110b5816117a9565b600060208284031215611602578081fd5b815180151581146110b5578182fd5b60008060408385031215611623578081fd5b823561162e816117a9565b946020939093013593505050565b600080600060608486031215611650578081fd5b833561165b816117a9565b95602085013595506040909401359392505050565b60008060008060808587031215611685578081fd5b8435611690816117a9565b966020860135965060408601359560600135945092505050565b6000602082840312156116bb578081fd5b5051919050565b600082516116d4818460208701611767565b9190910192915050565b60208152600082518060208401526116fd816040850160208701611767565b601f01601f19169190910160400192915050565b60008261172c57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561174b5761174b611793565b500290565b60008282101561176257611762611793565b500390565b60005b8381101561178257818101518382015260200161176a565b8381111561100d5750506000910152565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146117be57600080fd5b5056fea2646970667358221220af2edc333eeaf9343cf6426dd6a249b72dde75682c906aec67d6baa17bec216a64736f6c63430008040033

Block Transaction 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

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.