Contract 0x54b32b288d7904d5d98be1910975a80e45da5e8d 1

 

Contract Overview

Balance:
0 MATIC

MATIC Value:
$0.00

Token:
Ad
Ad
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x20417a13c5a960951ffc1b5823bae7a242ae8cbbeb4cea260541a85629c8a1d5Set Controller160357082021-06-23 0:04:58164 days 23 hrs ago0xb8d175f16742395f530e0b3bc1d30bd06b78cda9 IN  0x54b32b288d7904d5d98be1910975a80e45da5e8d0 MATIC0.00070818
0x1808c898d0905b753979268493687c74c482166bb2acc5b535173166198b3c680x60806040160350422021-06-22 23:42:02164 days 23 hrs ago0xb8d175f16742395f530e0b3bc1d30bd06b78cda9 IN  Contract Creation0 MATIC0.054177075
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xe447654e750c8c6cd702d5d18bbf381702e3d53c14fd415c77aa066ec58a2903220916552021-12-03 15:00:501 day 8 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0xc129e867a7bb0bfedfccd2dde590f30c9cf8131523cbb01eca3945fc2415e304218810102021-11-28 1:20:596 days 21 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0xbd8536839590c2bf228673a6914e7f0d8ce781b5375c7e287375bbad29fdc69e218258502021-11-26 15:07:378 days 8 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0xf5c40b6f5c7de7986ddd2c265d28d24a6efd6b02b564d28ad83f6e97a8635d21218256142021-11-26 14:59:338 days 8 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0xd4fd74bd4ab38ae00603d8dc9554fcf4ec57967fd17e8c6664ecc9e415525ca5215657132021-11-19 19:16:5015 days 3 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0xaff037f7af1eda37af31f2ce2a2125fbc9d8192d4ccbd45c2888830f314c61c9214900432021-11-17 21:00:1817 days 2 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0x64386e5ed1e70bc9a3932a2705e78ed6bf6205b3dab89a3aee1fb4bb0b3d4814214899912021-11-17 20:58:3417 days 2 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0x7b4607bdb313f3fa3bbc02c477ef5a641fec538e2af5f613b7e36216184e85b4214899282021-11-17 20:56:2417 days 2 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0x82ea13693c64aa321a965d83c17b1fc950f650abbbcc6786fd24f4f68709c3e6210247072021-11-05 20:38:5229 days 2 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0xde1eff831612e57dba3c76743c6d8ca9d6e84e5d9d62905051c70f279f7dde20209752622021-11-04 14:41:0430 days 8 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0x10381705a0a63492a0ab8f70f627829119746d604bb787c81394cd4985f091d2208426752021-11-01 3:33:0933 days 19 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0x1c0749be71446251dbeea3215b6b09b393aae24db742622ec27fc2f812febb85202983522021-10-17 3:06:2548 days 20 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0xb4b8e2be686a6b5e0537efa124f2c6efda48981301996930a8db83b1ac0a7469202803642021-10-16 14:49:0849 days 8 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0x280ed9ccb8c7ae9ae397795ceea1c771897ebda3fe562acb029981535848e76c201025962021-10-11 15:05:0354 days 8 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0x8c05f549848224f6077c99ad9b14555ee828a83daec2b700bde9c48bd3ab7d67197428142021-10-02 3:18:4963 days 19 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0x1f41c5172011689b6a39a21ccc070cf3cbbeb29182c0c415b40c5bb25dd8d284197006782021-10-01 1:34:3264 days 21 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0x1eca05ecd19991c44cd227a48736a43c7daa71892df4e6c8ee60b65496f437c1196997502021-10-01 1:01:2164 days 22 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0x0e1083b84bfb25dc99641e4175e03fdb4949d7d80226eb0a9c6d11b917b60a20196614582021-09-30 0:33:2765 days 22 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0xe2a2ae6699f3f58b979776489fbbd129ee10a323aa4dc26b55cd53226d714143196606582021-09-29 23:56:0765 days 23 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0xc36b1966ed667eefd470265a2554541dc322d9172c7fa49a90bb7e32d79f7fbb196411882021-09-29 9:48:0266 days 13 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0x858d166d031f984e68c424c009e7d8a0692792fb84bbdc97342c1cce46ec4a51196407262021-09-29 9:30:5666 days 13 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0x6f5f005e3571f3cec91b318121e883c7adb68a36b36a8da599e4d7b8ea099c66196405082021-09-29 9:16:4066 days 13 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0x6e59a2b0991880eb08107d025897d0758ef748df05869838a1b936fb40d17627196302092021-09-29 1:04:4066 days 22 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0x6c856d7a2636bfe5e7b2e4e4e4dca696a3bd4ff6853027509ebdc9a07096477e195240222021-09-26 5:23:4469 days 17 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
0xc74ae7365142f4d58e8bc38a12abc39179982dfcb00246245cbf2d9bc4dc114c195188622021-09-26 2:02:4569 days 21 hrs ago 0x54b32b288d7904d5d98be1910975a80e45da5e8d  Contract Creation0 MATIC
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
GenericWalletManager

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 20 : GenericWalletManager.sol
// SPDX-License-Identifier: MIT

// GenericWalletManager.sol -- Part of the Charged Particles Protocol
// Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

pragma solidity 0.6.12;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "../../../lib/WalletManagerBase.sol";
import "./GenericSmartWallet.sol";

/**
 * @notice Generic ERC20 Wallet Manager
 * @dev Non-upgradeable Contract
 */
contract GenericWalletManager is WalletManagerBase {
  using SafeMath for uint256;

  /***********************************|
  |          Initialization           |
  |__________________________________*/

  constructor () public {
    _walletTemplate = address(new GenericSmartWallet());
  }

  /***********************************|
  |              Public               |
  |__________________________________*/

  function isReserveActive(address contractAddress, uint256 tokenId, address assetToken)
    external
    override
    view
    returns (bool)
  {
    uint256 uuid = contractAddress.getTokenUUID(tokenId);
    if (_wallets[uuid] == address(0x0)) { return false; }
    return GenericSmartWallet(_wallets[uuid]).isReserveActive(assetToken);
  }

  function getReserveInterestToken(address contractAddress, uint256 tokenId, address assetToken)
    external
    override
    view
    returns (address)
  {
    uint256 uuid = contractAddress.getTokenUUID(tokenId);
    if (_wallets[uuid] == address(0x0)) { return address(0x0); }
    return GenericSmartWallet(_wallets[uuid]).getReserveInterestToken(assetToken);
  }

  /**
    * @notice Gets the Available Balance of Assets held in the Token
    * @param contractAddress The Address to the External Contract of the Token
    * @param tokenId The ID of the Token within the External Contract
    * @return  The Available Balance of the Token
    */
  function getTotal(address contractAddress, uint256 tokenId, address assetToken)
    external
    override
    returns (uint256)
  {
    uint256 uuid = contractAddress.getTokenUUID(tokenId);
    if (_wallets[uuid] == address(0x0)) { return 0; }
    return GenericSmartWallet(_wallets[uuid]).getTotal(assetToken);
  }

  /**
    * @notice Gets the Principal-Amount of Assets held in the Smart-Wallet
    * @param contractAddress The Address to the External Contract of the Token
    * @param tokenId The ID of the Token within the External Contract
    * @return  The Principal-Balance of the Smart-Wallet
    */
  function getPrincipal(address contractAddress, uint256 tokenId, address assetToken)
    external
    override
    returns (uint256)
  {
    uint256 uuid = contractAddress.getTokenUUID(tokenId);
    if (_wallets[uuid] == address(0x0)) { return 0; }
    return GenericSmartWallet(_wallets[uuid]).getPrincipal(assetToken);
  }

  /**
    * @notice Gets the Interest-Amount that the Token has generated
    * @param contractAddress The Address to the External Contract of the Token
    * @param tokenId The ID of the Token within the External Contract
    * @return creatorInterest The NFT Creator's portion of the Interest
    * @return ownerInterest The NFT Owner's portion of the Interest
    */
  function getInterest(address contractAddress, uint256 tokenId, address assetToken)
    external
    override
    returns (uint256 creatorInterest, uint256 ownerInterest)
  {
    uint256 uuid = contractAddress.getTokenUUID(tokenId);
    if (_wallets[uuid] != address(0x0)) {
    return GenericSmartWallet(_wallets[uuid]).getInterest(assetToken);
    }
  }

  function getRewards(address contractAddress, uint256 tokenId, address rewardToken)
    external
    override
    returns (uint256)
  {
    uint256 uuid = contractAddress.getTokenUUID(tokenId);
    if (_wallets[uuid] == address(0x0)) { return 0; }
    return GenericSmartWallet(_wallets[uuid]).getRewards(rewardToken);
  }

  function energize(address contractAddress, uint256 tokenId, address assetToken, uint256 assetAmount)
    external
    override
    onlyController
    returns (uint256 yieldTokensAmount)
  {
    uint256 uuid = contractAddress.getTokenUUID(tokenId);
    address wallet = _wallets[uuid];

    // Deposit into Smart-Wallet
    yieldTokensAmount = GenericSmartWallet(wallet).deposit(assetToken, assetAmount, 0);

    // Log Event
    emit WalletEnergized(contractAddress, tokenId, assetToken, assetAmount, yieldTokensAmount);
  }

  function discharge(address /* receiver */, address /* contractAddress */, uint256 /* tokenId */, address /* assetToken */, address /* creatorRedirect */)
    external
    override
    onlyController
    returns (uint256 creatorAmount, uint256 receiverAmount)
  {
    return (0, 0);
  }

  function dischargeAmount(address /* receiver */, address /* contractAddress */, uint256 /* tokenId */, address /* assetToken */, uint256 /* assetAmount */, address /* creatorRedirect */)
    external
    override
    onlyController
    returns (uint256 creatorAmount, uint256 receiverAmount)
  {
    return (0, 0);
  }

  function dischargeAmountForCreator(
    address /* receiver */,
    address /* contractAddress */,
    uint256 /* tokenId */,
    address /* creator */,
    address /* assetToken */,
    uint256 /* assetAmount */
  )
    external
    override
    onlyController
    returns (uint256 receiverAmount)
  {
    return 0;
  }

  function release(
    address receiver,
    address contractAddress,
    uint256 tokenId,
    address assetToken,
    address creatorRedirect
  )
    external
    override
    onlyController
    returns (uint256 principalAmount, uint256 creatorAmount, uint256 receiverAmount)
  {
    uint256 uuid = contractAddress.getTokenUUID(tokenId);
    address wallet = _wallets[uuid];
    require(wallet != address(0x0), "GWM:E-403");

    // Release Principal + Interest
    principalAmount = GenericSmartWallet(wallet).getPrincipal(assetToken);
    (creatorAmount, receiverAmount) = GenericSmartWallet(wallet).withdraw(receiver, creatorRedirect, assetToken);

    // Log Event
    emit WalletReleased(contractAddress, tokenId, receiver, assetToken, principalAmount, creatorAmount, receiverAmount);
  }

  function releaseAmount(
    address receiver,
    address contractAddress,
    uint256 tokenId,
    address assetToken,
    uint256 assetAmount,
    address creatorRedirect
  )
    external
    override
    onlyController
    returns (uint256 principalAmount, uint256 creatorAmount, uint256 receiverAmount)
  {
    uint256 uuid = contractAddress.getTokenUUID(tokenId);
    address wallet = _wallets[uuid];
    require(wallet != address(0x0), "GWM:E-403");

    // Release from interest first + principal if needed
    principalAmount = GenericSmartWallet(wallet).getPrincipal(assetToken);
    (creatorAmount, receiverAmount) = GenericSmartWallet(wallet).withdrawAmount(receiver, creatorRedirect, assetToken, assetAmount);

    // Log Event
    emit WalletReleased(contractAddress, tokenId, receiver, assetToken, principalAmount, creatorAmount, receiverAmount);
  }

  function withdrawRewards(address receiver, address contractAddress, uint256 tokenId, address rewardsToken, uint256 rewardsAmount)
    external
    override
    onlyController
    returns (uint256 amount)
  {
    uint256 uuid = contractAddress.getTokenUUID(tokenId);
    address wallet = _wallets[uuid];
    require(wallet != address(0x0), "genericERC20WalletManager:E-403");

    // Withdraw Rewards to Receiver
    amount = GenericSmartWallet(wallet).withdrawRewards(receiver, rewardsToken, rewardsAmount);

    // Log Event
    emit WalletRewarded(contractAddress, tokenId, receiver, rewardsToken, amount);
  }

  function executeForAccount(address contractAddress, uint256 tokenId, address externalAddress, uint256 ethValue, bytes memory encodedParams)
    external
    override
    onlyController
    returns (bytes memory)
  {
    uint256 uuid = contractAddress.getTokenUUID(tokenId);
    address wallet = _wallets[uuid];
    return GenericSmartWallet(wallet).executeForAccount(externalAddress, ethValue, encodedParams);
  }

  function getWalletAddressById(address contractAddress, uint256 tokenId, address creator, uint256 annuityPct)
    external
    override
    onlyController
    returns (address)
  {
    uint256 uuid = contractAddress.getTokenUUID(tokenId);
    address wallet = _wallets[uuid];

    // Create Smart-Wallet if none exists
    if (wallet == address(0x0)) {
      wallet = _createWallet();
      _wallets[uuid] = wallet;

      if (creator != address(0x0)) {
        GenericSmartWallet(wallet).setNftCreator(creator, annuityPct);
      }

      emit NewSmartWallet(contractAddress, tokenId, wallet, creator, annuityPct);
    }

    return wallet;
  }

  /***********************************|
  |         Private Functions         |
  |__________________________________*/

  function _createWallet()
    internal
    returns (address)
  {
    address newWallet = _createClone(_walletTemplate);
    GenericSmartWallet(newWallet).initialize();
    return newWallet;
  }

}

File 2 of 20 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

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

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

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

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

        return c;
    }

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

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

File 3 of 20 : WalletManagerBase.sol
// SPDX-License-Identifier: MIT

// WalletManagerBase.sol -- Part of the Charged Particles Protocol
// Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

pragma solidity >=0.6.0;

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

import "../interfaces/IWalletManager.sol";
import "../interfaces/ISmartWallet.sol";
import "../lib/TokenInfo.sol";
import "./BlackholePrevention.sol";


/**
 * @notice Wallet-Manager Base Contract
 * @dev Non-upgradeable Contract
 */
abstract contract WalletManagerBase is Ownable, BlackholePrevention, IWalletManager {
  using TokenInfo for address;

  // The Controller Contract Address
  address internal _controller;

  // Template Contract for creating Token Smart-Wallet Bridges
  address internal _walletTemplate;

  //       TokenID => Token Smart-Wallet Address
  mapping (uint256 => address) internal _wallets;

  // State of Wallet Manager
  bool internal _paused;


  /***********************************|
  |              Public               |
  |__________________________________*/

  function isPaused() external view override returns (bool) {
    return _paused;
  }

  /***********************************|
  |          Only Admin/DAO           |
  |__________________________________*/

  /**
    * @dev Sets the Paused-state of the Wallet Manager
    */
  function setPausedState(bool paused) external onlyOwner {
    _paused = paused;
    emit PausedStateSet(paused);
  }

  /**
    * @dev Connects to the Charged Particles Controller
    */
  function setController(address controller) external onlyOwner {
    _controller = controller;
    emit ControllerSet(controller);
  }

  function withdrawEther(address contractAddress, uint256 tokenId, address payable receiver, uint256 amount)
    external
    virtual
    override
    onlyOwner
  {
    uint256 uuid = contractAddress.getTokenUUID(tokenId);
    address wallet = _wallets[uuid];
    _withdrawEther(receiver, amount);
    return ISmartWallet(wallet).withdrawEther(receiver, amount);
  }

  function withdrawERC20(address contractAddress, uint256 tokenId, address payable receiver, address tokenAddress, uint256 amount)
    external
    virtual
    override
    onlyOwner
  {
    uint256 uuid = contractAddress.getTokenUUID(tokenId);
    address wallet = _wallets[uuid];
    _withdrawERC20(receiver, tokenAddress, amount);
    return ISmartWallet(wallet).withdrawERC20(receiver, tokenAddress, amount);
  }

  function withdrawERC721(address contractAddress, uint256 tokenId, address payable receiver, address nftTokenAddress, uint256 nftTokenId)
    external
    virtual
    override
    onlyOwner
  {
    uint256 uuid = contractAddress.getTokenUUID(tokenId);
    address wallet = _wallets[uuid];
    _withdrawERC721(receiver, nftTokenAddress, nftTokenId);
    return ISmartWallet(wallet).withdrawERC721(receiver, nftTokenAddress, nftTokenId);
  }


  /***********************************|
  |         Private Functions         |
  |__________________________________*/

  function _getTokenUUID(address contractAddress, uint256 tokenId) internal pure returns (uint256) {
    return uint256(keccak256(abi.encodePacked(contractAddress, tokenId)));
  }

  /**
    * @dev Creates Contracts from a Template via Cloning
    * see: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1167.md
    */
  function _createClone(address target) internal returns (address result) {
    bytes20 targetBytes = bytes20(target);
    assembly {
      let clone := mload(0x40)
      mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
      mstore(add(clone, 0x14), targetBytes)
      mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
      result := create(0, clone, 0x37)
    }
  }


  /***********************************|
  |             Modifiers             |
  |__________________________________*/

  /// @dev Throws if called by any account other than the Controller contract
  modifier onlyController() {
    require(_controller == msg.sender, "WMB:E-108");
    _;
  }

  // Throws if called by any account other than the Charged Particles Escrow Controller.
  modifier whenNotPaused() {
    require(_paused != true, "WMB:E-101");
    _;
  }

}

File 4 of 20 : GenericSmartWallet.sol
// SPDX-License-Identifier: MIT

// GenericSmartWallet.sol -- Part of the Charged Particles Protocol
// Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

pragma solidity 0.6.12;

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


/**
 * @notice Generic ERC20-Token Smart-Wallet Bridge
 * @dev Non-upgradeable Contract
 */
contract GenericSmartWallet is SmartWalletBase {
  using SafeMath for uint256;
  using SafeERC20 for IERC20;

  /***********************************|
  |          Initialization           |
  |__________________________________*/

  function initialize()
    public
  {
    SmartWalletBase.initializeBase();
  }

  function isReserveActive(address assetToken)
    external
    override
    view
    returns (bool)
  {
    return _getPrincipal(assetToken) == 0;
  }

  function getReserveInterestToken(address assetToken)
    external
    override
    view
    returns (address)
  {
    return assetToken;
  }

  function getPrincipal(address assetToken)
    external
    override
    returns (uint256)
  {
    return _getPrincipal(assetToken);
  }

  function getInterest(address /* assetToken */)
    external
    override
    returns (uint256 creatorInterest, uint256 ownerInterest)
  {
    return (0, 0);
  }

  function getTotal(address assetToken)
    external
    override
    returns (uint256)
  {
    return _getPrincipal(assetToken);
  }

  function getRewards(address assetToken)
    external
    override
    returns (uint256)
  {
    return IERC20(assetToken).balanceOf(address(this));
  }

  function deposit(address assetToken, uint256 assetAmount, uint256 /* referralCode */)
    external
    override
    onlyWalletManager
    returns (uint256)
  {
    // Track Principal
    _trackAssetToken(assetToken);
    _assetPrincipalBalance[assetToken] = _assetPrincipalBalance[assetToken].add(assetAmount);
  }

  function withdraw(address receiver, address /* creatorRedirect */, address assetToken)
    external
    override
    onlyWalletManager
    returns (uint256 creatorAmount, uint256 receiverAmount)
  {
    creatorAmount = 0;
    receiverAmount = _getPrincipal(assetToken);
    // Track Principal
    _assetPrincipalBalance[assetToken] = _assetPrincipalBalance[assetToken].sub(receiverAmount);
    IERC20(assetToken).safeTransfer(receiver, receiverAmount);
  }

  function withdrawAmount(address receiver, address /* creatorRedirect */, address assetToken, uint256 assetAmount)
    external
    override
    onlyWalletManager
    returns (uint256 creatorAmount, uint256 receiverAmount)
  {
    creatorAmount = 0;
    receiverAmount = _getPrincipal(assetToken);
    if (receiverAmount >= assetAmount) {
      receiverAmount = assetAmount;
    }
    // Track Principal
    _assetPrincipalBalance[assetToken] = _assetPrincipalBalance[assetToken].sub(receiverAmount);
    IERC20(assetToken).safeTransfer(receiver, receiverAmount);
  }

  function withdrawAmountForCreator(
    address /* receiver */,
    address /* assetToken */,
    uint256 /* assetID */
  )
    external
    override
    onlyWalletManager
    returns (uint256 receiverAmount)
  {
    return 0;
  }

  function withdrawRewards(address receiver, address rewardsTokenAddress, uint256 rewardsAmount)
    external
    override
    onlyWalletManager
    returns (uint256)
  {
    address self = address(this);
    IERC20 rewardsToken = IERC20(rewardsTokenAddress);

    uint256 walletBalance = rewardsToken.balanceOf(self);
    require(walletBalance >= rewardsAmount, "GSW:E-411");

    // Transfer Rewards to Receiver
    rewardsToken.safeTransfer(receiver, rewardsAmount);
    return rewardsAmount;
  }

}

File 5 of 20 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../GSN/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.
 */
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 () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view 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 {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 6 of 20 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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 7 of 20 : IWalletManager.sol
// SPDX-License-Identifier: MIT

// IWalletManager.sol -- Part of the Charged Particles Protocol
// Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

pragma solidity >=0.6.0;

/**
 * @title Particle Wallet Manager interface
 * @dev The wallet-manager for underlying assets attached to Charged Particles
 * @dev Manages the link between NFTs and their respective Smart-Wallets
 */
interface IWalletManager {

  event ControllerSet(address indexed controller);
  event PausedStateSet(bool isPaused);
  event NewSmartWallet(address indexed contractAddress, uint256 indexed tokenId, address indexed smartWallet, address creator, uint256 annuityPct);
  event WalletEnergized(address indexed contractAddress, uint256 indexed tokenId, address indexed assetToken, uint256 assetAmount, uint256 yieldTokensAmount);
  event WalletDischarged(address indexed contractAddress, uint256 indexed tokenId, address indexed assetToken, uint256 creatorAmount, uint256 receiverAmount);
  event WalletDischargedForCreator(address indexed contractAddress, uint256 indexed tokenId, address indexed assetToken, address creator, uint256 receiverAmount);
  event WalletReleased(address indexed contractAddress, uint256 indexed tokenId, address indexed receiver, address assetToken, uint256 principalAmount, uint256 creatorAmount, uint256 receiverAmount);
  event WalletRewarded(address indexed contractAddress, uint256 indexed tokenId, address indexed receiver, address rewardsToken, uint256 rewardsAmount);

  function isPaused() external view returns (bool);

  function isReserveActive(address contractAddress, uint256 tokenId, address assetToken) external view returns (bool);
  function getReserveInterestToken(address contractAddress, uint256 tokenId, address assetToken) external view returns (address);

  function getTotal(address contractAddress, uint256 tokenId, address assetToken) external returns (uint256);
  function getPrincipal(address contractAddress, uint256 tokenId, address assetToken) external returns (uint256);
  function getInterest(address contractAddress, uint256 tokenId, address assetToken) external returns (uint256 creatorInterest, uint256 ownerInterest);
  function getRewards(address contractAddress, uint256 tokenId, address rewardToken) external returns (uint256);

  function energize(address contractAddress, uint256 tokenId, address assetToken, uint256 assetAmount) external returns (uint256 yieldTokensAmount);
  function discharge(address receiver, address contractAddress, uint256 tokenId, address assetToken, address creatorRedirect) external returns (uint256 creatorAmount, uint256 receiverAmount);
  function dischargeAmount(address receiver, address contractAddress, uint256 tokenId, address assetToken, uint256 assetAmount, address creatorRedirect) external returns (uint256 creatorAmount, uint256 receiverAmount);
  function dischargeAmountForCreator(address receiver, address contractAddress, uint256 tokenId, address creator, address assetToken, uint256 assetAmount) external returns (uint256 receiverAmount);
  function release(address receiver, address contractAddress, uint256 tokenId, address assetToken, address creatorRedirect) external returns (uint256 principalAmount, uint256 creatorAmount, uint256 receiverAmount);
  function releaseAmount(address receiver, address contractAddress, uint256 tokenId, address assetToken, uint256 assetAmount, address creatorRedirect) external returns (uint256 principalAmount, uint256 creatorAmount, uint256 receiverAmount);
  function withdrawRewards(address receiver, address contractAddress, uint256 tokenId, address rewardsToken, uint256 rewardsAmount) external returns (uint256 amount);
  function executeForAccount(address contractAddress, uint256 tokenId, address externalAddress, uint256 ethValue, bytes memory encodedParams) external returns (bytes memory);
  function getWalletAddressById(address contractAddress, uint256 tokenId, address creator, uint256 annuityPct) external returns (address);

  function withdrawEther(address contractAddress, uint256 tokenId, address payable receiver, uint256 amount) external;
  function withdrawERC20(address contractAddress, uint256 tokenId, address payable receiver, address tokenAddress, uint256 amount) external;
  function withdrawERC721(address contractAddress, uint256 tokenId, address payable receiver, address nftTokenAddress, uint256 nftTokenId) external;
}

File 8 of 20 : ISmartWallet.sol
// SPDX-License-Identifier: MIT

// ISmartWallet.sol -- Part of the Charged Particles Protocol
// Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

pragma solidity >=0.6.0;

/**
 * @title Charged Particles Smart Wallet
 * @dev Manages holding and transferring assets of an NFT to a specific LP for Yield (if any),
 */
interface ISmartWallet {
  function getAssetTokenCount() external view returns (uint256);
  function getAssetTokenByIndex(uint256 index) external view returns (address);

  function setNftCreator(address creator, uint256 annuityPct) external;

  function isReserveActive(address assetToken) external view returns (bool);
  function getReserveInterestToken(address assetToken) external view returns (address);

  function getPrincipal(address assetToken) external returns (uint256);
  function getInterest(address assetToken) external returns (uint256 creatorInterest, uint256 ownerInterest);
  function getTotal(address assetToken) external returns (uint256);
  function getRewards(address assetToken) external returns (uint256);

  function deposit(address assetToken, uint256 assetAmount, uint256 referralCode) external returns (uint256);
  function withdraw(address receiver, address creatorRedirect, address assetToken) external returns (uint256 creatorAmount, uint256 receiverAmount);
  function withdrawAmount(address receiver, address creatorRedirect, address assetToken, uint256 assetAmount) external returns (uint256 creatorAmount, uint256 receiverAmount);
  function withdrawAmountForCreator(address receiver, address assetToken, uint256 assetAmount) external returns (uint256 receiverAmount);
  function withdrawRewards(address receiver, address rewardsToken, uint256 rewardsAmount) external returns (uint256);
  function executeForAccount(address contractAddress, uint256 ethValue, bytes memory encodedParams) external returns (bytes memory);

  function withdrawEther(address payable receiver, uint256 amount) external;
  function withdrawERC20(address payable receiver, address tokenAddress, uint256 amount) external;
  function withdrawERC721(address payable receiver, address tokenAddress, uint256 tokenId) external;
}

File 9 of 20 : TokenInfo.sol
// SPDX-License-Identifier: MIT

// TokenInfo.sol -- Part of the Charged Particles Protocol
// Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

pragma solidity 0.6.12;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "../interfaces/IERC721Chargeable.sol";

library TokenInfo {
  function getTokenUUID(address contractAddress, uint256 tokenId) internal pure virtual returns (uint256) {
    return uint256(keccak256(abi.encodePacked(contractAddress, tokenId)));
  }

  function getTokenOwner(address contractAddress, uint256 tokenId) internal view virtual returns (address) {
    IERC721Chargeable tokenInterface = IERC721Chargeable(contractAddress);
    return tokenInterface.ownerOf(tokenId);
  }

  function getTokenCreator(address contractAddress, uint256 tokenId) internal view virtual returns (address) {
    IERC721Chargeable tokenInterface = IERC721Chargeable(contractAddress);
    return tokenInterface.creatorOf(tokenId);
  }

  /// @dev Checks if an account is the Owner of an External NFT contract
  /// @param contractAddress  The Address to the Contract of the NFT to check
  /// @param account          The Address of the Account to check
  /// @return True if the account owns the contract
  function isContractOwner(address contractAddress, address account) internal view virtual returns (bool) {
    address contractOwner = IERC721Chargeable(contractAddress).owner();
    return contractOwner != address(0x0) && contractOwner == account;
  }

  /// @dev Checks if an account is the Creator of a Proton-based NFT
  /// @param contractAddress  The Address to the Contract of the Proton-based NFT to check
  /// @param tokenId          The Token ID of the Proton-based NFT to check
  /// @param sender           The Address of the Account to check
  /// @return True if the account is the creator of the Proton-based NFT
  function isTokenCreator(address contractAddress, uint256 tokenId, address sender) internal view virtual returns (bool) {
    IERC721Chargeable tokenInterface = IERC721Chargeable(contractAddress);
    address tokenCreator = tokenInterface.creatorOf(tokenId);
    return (sender == tokenCreator);
  }

  /// @dev Checks if an account is the Creator of a Proton-based NFT or the Contract itself
  /// @param contractAddress  The Address to the Contract of the Proton-based NFT to check
  /// @param tokenId          The Token ID of the Proton-based NFT to check
  /// @param sender           The Address of the Account to check
  /// @return True if the account is the creator of the Proton-based NFT or the Contract itself
  function isTokenContractOrCreator(address contractAddress, uint256 tokenId, address creator, address sender) internal view virtual returns (bool) {
    IERC721Chargeable tokenInterface = IERC721Chargeable(contractAddress);
    address tokenCreator = tokenInterface.creatorOf(tokenId);
    if (sender == contractAddress && creator == tokenCreator) { return true; }
    return (sender == tokenCreator);
  }

  /// @dev Checks if an account is the Owner or Operator of an External NFT
  /// @param contractAddress  The Address to the Contract of the External NFT to check
  /// @param tokenId          The Token ID of the External NFT to check
  /// @param sender           The Address of the Account to check
  /// @return True if the account is the Owner or Operator of the External NFT
  function isErc721OwnerOrOperator(address contractAddress, uint256 tokenId, address sender) internal view virtual returns (bool) {
    IERC721Chargeable tokenInterface = IERC721Chargeable(contractAddress);
    address tokenOwner = tokenInterface.ownerOf(tokenId);
    return (sender == tokenOwner || tokenInterface.isApprovedForAll(tokenOwner, sender));
  }

  /**
    * @dev Returns true if `account` is a contract.
    * @dev Taken from OpenZeppelin library
    *
    * [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) {
    // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
    // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
    // for accounts without code, i.e. `keccak256('')`
    bytes32 codehash;
    bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
    // solhint-disable-next-line no-inline-assembly
    assembly { codehash := extcodehash(account) }
    return (codehash != accountHash && codehash != 0x0);
  }

  /**
    * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
    * `recipient`, forwarding all available gas and reverting on errors.
    * @dev Taken from OpenZeppelin library
    *
    * 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, "TokenInfo: insufficient balance");

    // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
    (bool success, ) = recipient.call{ value: amount }("");
    require(success, "TokenInfo: unable to send value, recipient may have reverted");
  }
}

File 10 of 20 : BlackholePrevention.sol
// SPDX-License-Identifier: MIT

// BlackholePrevention.sol -- Part of the Charged Particles Protocol
// Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

pragma solidity >=0.6.0;

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

/**
 * @notice Prevents ETH or Tokens from getting stuck in a contract by allowing
 *  the Owner/DAO to pull them out on behalf of a user
 * This is only meant to contracts that are not expected to hold tokens, but do handle transferring them.
 */
contract BlackholePrevention {
  using Address for address payable;
  using SafeERC20 for IERC20;

  event WithdrawStuckEther(address indexed receiver, uint256 amount);
  event WithdrawStuckERC20(address indexed receiver, address indexed tokenAddress, uint256 amount);
  event WithdrawStuckERC721(address indexed receiver, address indexed tokenAddress, uint256 indexed tokenId);

  function _withdrawEther(address payable receiver, uint256 amount) internal virtual {
    require(receiver != address(0x0), "BHP:E-403");
    if (address(this).balance >= amount) {
      receiver.sendValue(amount);
      emit WithdrawStuckEther(receiver, amount);
    }
  }

  function _withdrawERC20(address payable receiver, address tokenAddress, uint256 amount) internal virtual {
    require(receiver != address(0x0), "BHP:E-403");
    if (IERC20(tokenAddress).balanceOf(address(this)) >= amount) {
      IERC20(tokenAddress).safeTransfer(receiver, amount);
      emit WithdrawStuckERC20(receiver, tokenAddress, amount);
    }
  }

  function _withdrawERC721(address payable receiver, address tokenAddress, uint256 tokenId) internal virtual {
    require(receiver != address(0x0), "BHP:E-403");
    if (IERC721(tokenAddress).ownerOf(tokenId) == address(this)) {
      IERC721(tokenAddress).transferFrom(address(this), receiver, tokenId);
      emit WithdrawStuckERC721(receiver, tokenAddress, tokenId);
    }
  }
}

File 11 of 20 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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 GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 12 of 20 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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 13 of 20 : IERC721Chargeable.sol
// SPDX-License-Identifier: MIT

// IERC721Chargeable.sol -- Part of the Charged Particles Protocol
// Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

pragma solidity >=0.6.0;

import "@openzeppelin/contracts-upgradeable/introspection/IERC165Upgradeable.sol";

interface IERC721Chargeable is IERC165Upgradeable {
    function owner() external view returns (address);
    function creatorOf(uint256 tokenId) external view returns (address);
    function balanceOf(address tokenOwner) external view returns (uint256 balance);
    function ownerOf(uint256 tokenId) external view returns (address tokenOwner);
    function safeTransferFrom(address from, address to, uint256 tokenId) external;
    function transferFrom(address from, address to, uint256 tokenId) external;
    function approve(address to, uint256 tokenId) external;
    function getApproved(uint256 tokenId) external view returns (address operator);
    function setApprovalForAll(address operator, bool _approved) external;
    function isApprovedForAll(address tokenOwner, address operator) external view returns (bool);
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}

File 14 of 20 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165Upgradeable {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 15 of 20 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.2;

/**
 * @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) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != accountHash && codehash != 0x0);
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

    function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 16 of 20 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

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

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

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

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

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

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

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

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

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

File 17 of 20 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.2;

import "../../introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transfered from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
      * @dev Safely transfers `tokenId` token from `from` to `to`.
      *
      * Requirements:
      *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
      * - `tokenId` token must exist and be owned by `from`.
      * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
      * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
      *
      * Emits a {Transfer} event.
      */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}

File 18 of 20 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 19 of 20 : SmartWalletBase.sol
// SPDX-License-Identifier: MIT

// SmartWalletBase.sol -- Part of the Charged Particles Protocol
// Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

pragma solidity >=0.6.0;

import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "../interfaces/ISmartWallet.sol";
import "./BlackholePrevention.sol";

/**
 * @notice ERC20-Token Smart-Wallet Base Contract
 * @dev Non-upgradeable Contract
 */
abstract contract SmartWalletBase is ISmartWallet, BlackholePrevention {
  using EnumerableSet for EnumerableSet.AddressSet;

  uint256 constant internal PERCENTAGE_SCALE = 1e4;  // 10000  (100%)

  address internal _walletManager;

  address internal nftCreator;
  uint256 internal nftCreatorAnnuityPct;
  uint256 internal nftCreatorAmountDischarged;

  EnumerableSet.AddressSet internal _assetTokens;

  //   Asset Token => Principal Balance
  mapping (address => uint256) internal _assetPrincipalBalance;

  /***********************************|
  |          Initialization           |
  |__________________________________*/

  function initializeBase() public {
    require(_walletManager == address(0x0), "SWB:E-002");
    _walletManager = msg.sender;
  }


  /***********************************|
  |              Public               |
  |__________________________________*/

  function getAssetTokenCount() external view virtual override returns (uint256) {
    return _assetTokens.length();
  }

  function getAssetTokenByIndex(uint256 index) external view virtual override returns (address) {
    if (index >= _assetTokens.length()) {
      return address(0);
    }
    return _assetTokens.at(index);
  }

  function setNftCreator(address creator, uint256 annuityPct) external virtual override onlyWalletManager {
    nftCreator = creator;
    nftCreatorAnnuityPct = annuityPct;
  }

  function executeForAccount(
    address contractAddress,
    uint256 ethValue,
    bytes memory encodedParams
  )
    external
    override
    onlyWalletManager
    returns (bytes memory)
  {
    (bool success, bytes memory result) = contractAddress.call{value: ethValue}(encodedParams);
    require(success, string(result));
    return result;
  }


  /***********************************|
  |          Only Admin/DAO           |
  |      (blackhole prevention)       |
  |__________________________________*/

  function withdrawEther(address payable receiver, uint256 amount) external virtual override onlyWalletManager {
    _withdrawEther(receiver, amount);
  }

  function withdrawERC20(address payable receiver, address tokenAddress, uint256 amount) external virtual override onlyWalletManager {
    _withdrawERC20(receiver, tokenAddress, amount);
  }

  function withdrawERC721(address payable receiver, address tokenAddress, uint256 tokenId) external virtual override onlyWalletManager {
    _withdrawERC721(receiver, tokenAddress, tokenId);
  }


  /***********************************|
  |         Private Functions         |
  |__________________________________*/

  function _getPrincipal(address assetToken) internal view virtual returns (uint256) {
    return _assetPrincipalBalance[assetToken];
  }

  function _trackAssetToken(address assetToken) internal virtual {
    if (!_assetTokens.contains(assetToken)) {
      _assetTokens.add(assetToken);
    }
  }

  /***********************************|
  |             Modifiers             |
  |__________________________________*/

  /// @dev Throws if called by any account other than the wallet manager
  modifier onlyWalletManager() {
    require(_walletManager == msg.sender, "SWB:E-109");
    _;
  }
}

File 20 of 20 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
 * (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint256(_at(set._inner, index)));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"controller","type":"address"}],"name":"ControllerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contractAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"smartWallet","type":"address"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"uint256","name":"annuityPct","type":"uint256"}],"name":"NewSmartWallet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isPaused","type":"bool"}],"name":"PausedStateSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contractAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"assetToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"creatorAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"receiverAmount","type":"uint256"}],"name":"WalletDischarged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contractAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"assetToken","type":"address"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"uint256","name":"receiverAmount","type":"uint256"}],"name":"WalletDischargedForCreator","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contractAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"assetToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"assetAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"yieldTokensAmount","type":"uint256"}],"name":"WalletEnergized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contractAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"address","name":"assetToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"principalAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"creatorAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"receiverAmount","type":"uint256"}],"name":"WalletReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contractAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"address","name":"rewardsToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardsAmount","type":"uint256"}],"name":"WalletRewarded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawStuckERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"WithdrawStuckERC721","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawStuckEther","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"discharge","outputs":[{"internalType":"uint256","name":"creatorAmount","type":"uint256"},{"internalType":"uint256","name":"receiverAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"dischargeAmount","outputs":[{"internalType":"uint256","name":"creatorAmount","type":"uint256"},{"internalType":"uint256","name":"receiverAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"dischargeAmountForCreator","outputs":[{"internalType":"uint256","name":"receiverAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"assetToken","type":"address"},{"internalType":"uint256","name":"assetAmount","type":"uint256"}],"name":"energize","outputs":[{"internalType":"uint256","name":"yieldTokensAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"externalAddress","type":"address"},{"internalType":"uint256","name":"ethValue","type":"uint256"},{"internalType":"bytes","name":"encodedParams","type":"bytes"}],"name":"executeForAccount","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"assetToken","type":"address"}],"name":"getInterest","outputs":[{"internalType":"uint256","name":"creatorInterest","type":"uint256"},{"internalType":"uint256","name":"ownerInterest","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"assetToken","type":"address"}],"name":"getPrincipal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"assetToken","type":"address"}],"name":"getReserveInterestToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"rewardToken","type":"address"}],"name":"getRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"assetToken","type":"address"}],"name":"getTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"uint256","name":"annuityPct","type":"uint256"}],"name":"getWalletAddressById","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"assetToken","type":"address"}],"name":"isReserveActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"assetToken","type":"address"},{"internalType":"address","name":"creatorRedirect","type":"address"}],"name":"release","outputs":[{"internalType":"uint256","name":"principalAmount","type":"uint256"},{"internalType":"uint256","name":"creatorAmount","type":"uint256"},{"internalType":"uint256","name":"receiverAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"assetToken","type":"address"},{"internalType":"uint256","name":"assetAmount","type":"uint256"},{"internalType":"address","name":"creatorRedirect","type":"address"}],"name":"releaseAmount","outputs":[{"internalType":"uint256","name":"principalAmount","type":"uint256"},{"internalType":"uint256","name":"creatorAmount","type":"uint256"},{"internalType":"uint256","name":"receiverAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"controller","type":"address"}],"name":"setController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"paused","type":"bool"}],"name":"setPausedState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address payable","name":"receiver","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address payable","name":"receiver","type":"address"},{"internalType":"address","name":"nftTokenAddress","type":"address"},{"internalType":"uint256","name":"nftTokenId","type":"uint256"}],"name":"withdrawERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address payable","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"rewardsToken","type":"address"},{"internalType":"uint256","name":"rewardsAmount","type":"uint256"}],"name":"withdrawRewards","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060006200001e620000ba565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506040516200007690620000be565b604051809103906000f08015801562000093573d6000803e3d6000fd5b50600280546001600160a01b0319166001600160a01b0392909216919091179055620000cc565b3390565b611776806200286b83390190565b61278f80620000dc6000396000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c806389a5799d116100c3578063c968b0271161007c578063c968b0271461057a578063db9f60ff146106bb578063ed452778146106da578063f2fde38b1461071e578063fb3642d614610744578063fe34cc3f1461078a57610158565b806389a5799d1461047a5780638b8d9a16146104c45780638da5cb5b146104fe57806392eefe9b14610506578063a9d16f3b1461052c578063b187bd261461057257610158565b80634737c0c3116101155780634737c0c3146102e55780634ff836181461033b578063512adb1314610385578063711ad4ec146103d4578063715018a61461043c578063897f4ecb1461044457610158565b8063157c5a421461015d578063235dd200146101a3578063238f1b98146101eb5780632be89305146102355780632da9ef811461026b5780633d76f93e146102a1575b600080fd5b6101a1600480360360a081101561017357600080fd5b506001600160a01b0381358116916020810135916040820135811691606081013590911690608001356107c4565b005b6101d9600480360360608110156101b957600080fd5b506001600160a01b038135811691602081013591604090910135166108e0565b60408051918252519081900360200190f35b6102216004803603606081101561020157600080fd5b506001600160a01b038135811691602081013591604090910135166109b2565b604080519115158252519081900360200190f35b6101d96004803603606081101561024b57600080fd5b506001600160a01b03813581169160208101359160409091013516610a5e565b6101d96004803603606081101561028157600080fd5b506001600160a01b03813581169160208101359160409091013516610af9565b6101a1600480360360a08110156102b757600080fd5b506001600160a01b038135811691602081013591604082013581169160608101359091169060800135610b94565b61031f600480360360808110156102fb57600080fd5b506001600160a01b0381358116916020810135916040820135169060600135610c8f565b604080516001600160a01b039092168252519081900360200190f35b6101d9600480360360c081101561035157600080fd5b506001600160a01b038135811691602081013582169160408201359160608101358216916080820135169060a00135610e2a565b6103bb6004803603606081101561039b57600080fd5b506001600160a01b03813581169160208101359160409091013516610e85565b6040805192835260208301919091528051918290030190f35b61041e600480360360c08110156103ea57600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013582169160808201359160a0013516610f5d565b60408051938452602084019290925282820152519081900360600190f35b6101a161119f565b61031f6004803603606081101561045a57600080fd5b506001600160a01b03813581169160208101359160409091013516611241565b6103bb600480360360c081101561049057600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013582169160808201359160a00135166112d9565b6101d9600480360360808110156104da57600080fd5b506001600160a01b0381358116916020810135916040820135169060600135611339565b61031f61148c565b6101a16004803603602081101561051c57600080fd5b50356001600160a01b031661149b565b61041e600480360360a081101561054257600080fd5b506001600160a01b038135811691602081013582169160408201359160608101358216916080909101351661153d565b610221611777565b610646600480360360a081101561059057600080fd5b6001600160a01b0382358116926020810135926040820135909216916060820135919081019060a0810160808201356401000000008111156105d157600080fd5b8201836020820111156105e357600080fd5b8035906020019184600183028401116401000000008311171561060557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611780945050505050565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610680578181015183820152602001610668565b50505050905090810190601f1680156106ad5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a1600480360360208110156106d157600080fd5b503515156119b7565b6101d9600480360360a08110156106f057600080fd5b506001600160a01b038135811691602081013582169160408201359160608101359091169060800135611a56565b6101a16004803603602081101561073457600080fd5b50356001600160a01b0316611c15565b6103bb600480360360a081101561075a57600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013582169160809091013516611d0d565b6101a1600480360360808110156107a057600080fd5b506001600160a01b0381358116916020810135916040820135169060600135611d6c565b6107cc611e75565b6000546001600160a01b0390811691161461081c576040805162461bcd60e51b81526020600482018190526024820152600080516020612710833981519152604482015290519081900360640190fd5b60006108316001600160a01b03871686611e79565b6000818152600360205260409020549091506001600160a01b0316610857858585611ebd565b806001600160a01b0316634025feb28686866040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b1580156108bf57600080fd5b505af11580156108d3573d6000803e3d6000fd5b5050505050505050505050565b6000806108f66001600160a01b03861685611e79565b6000818152600360205260409020549091506001600160a01b031661091f5760009150506109ab565b60008181526003602090815260408083205481516379ee54f760e01b81526001600160a01b038881166004830152925192909116936379ee54f79360248084019491939192918390030190829087803b15801561097b57600080fd5b505af115801561098f573d6000803e3d6000fd5b505050506040513d60208110156109a557600080fd5b50519150505b9392505050565b6000806109c86001600160a01b03861685611e79565b6000818152600360205260409020549091506001600160a01b03166109f15760009150506109ab565b60008181526003602090815260409182902054825163883c042b60e01b81526001600160a01b0387811660048301529351939091169263883c042b92602480840193919291829003018186803b158015610a4a57600080fd5b505afa15801561098f573d6000803e3d6000fd5b600080610a746001600160a01b03861685611e79565b6000818152600360205260409020549091506001600160a01b0316610a9d5760009150506109ab565b6000818152600360209081526040808320548151631d76db5b60e31b81526001600160a01b0388811660048301529251929091169363ebb6dad89360248084019491939192918390030190829087803b15801561097b57600080fd5b600080610b0f6001600160a01b03861685611e79565b6000818152600360205260409020549091506001600160a01b0316610b385760009150506109ab565b6000818152600360209081526040808320548151637abdd2d160e01b81526001600160a01b03888116600483015292519290911693637abdd2d19360248084019491939192918390030190829087803b15801561097b57600080fd5b610b9c611e75565b6000546001600160a01b03908116911614610bec576040805162461bcd60e51b81526020600482018190526024820152600080516020612710833981519152604482015290519081900360640190fd5b6000610c016001600160a01b03871686611e79565b6000818152600360205260409020549091506001600160a01b0316610c27858585612044565b806001600160a01b03166344004cc18686866040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b1580156108bf57600080fd5b6001546000906001600160a01b03163314610cdd576040805162461bcd60e51b81526020600482015260096024820152680ae9a84748a5a6260760bb1b604482015290519081900360640190fd5b6000610cf26001600160a01b03871686611e79565b6000818152600360205260409020549091506001600160a01b031680610e1e57610d1a61216e565b600083815260036020526040902080546001600160a01b0319166001600160a01b0383811691909117909155909150851615610dc057806001600160a01b0316636edfab6b86866040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015610da757600080fd5b505af1158015610dbb573d6000803e3d6000fd5b505050505b806001600160a01b031686886001600160a01b03167f1cda30153ed04b1a2d5be381fcc3b30f512c22c6f3cbd755b87ad945660a2708888860405180836001600160a01b031681526020018281526020019250505060405180910390a45b9150505b949350505050565b6001546000906001600160a01b03163314610e78576040805162461bcd60e51b81526020600482015260096024820152680ae9a84748a5a6260760bb1b604482015290519081900360640190fd5b5060009695505050505050565b60008080610e9c6001600160a01b03871686611e79565b6000818152600360205260409020549091506001600160a01b031615610f53576000818152600360205260408082205481516307aaa34760e41b81526001600160a01b0388811660048301528351921693637aaa34709360248084019491939192918390030190829087803b158015610f1457600080fd5b505af1158015610f28573d6000803e3d6000fd5b505050506040513d6040811015610f3e57600080fd5b5080516020909101519093509150610f559050565b505b935093915050565b600154600090819081906001600160a01b03163314610faf576040805162461bcd60e51b81526020600482015260096024820152680ae9a84748a5a6260760bb1b604482015290519081900360640190fd5b6000610fc46001600160a01b038a1689611e79565b6000818152600360205260409020549091506001600160a01b03168061101d576040805162461bcd60e51b815260206004820152600960248201526847574d3a452d34303360b81b604482015290519081900360640190fd5b806001600160a01b0316637abdd2d1896040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050602060405180830381600087803b15801561106c57600080fd5b505af1158015611080573d6000803e3d6000fd5b505050506040513d602081101561109657600080fd5b505160408051600162e0d48b60e01b031981526001600160a01b038e8116600483015289811660248301528b81166044830152606482018b9052825193985084169263ff1f2b75926084808401939192918290030181600087803b1580156110fd57600080fd5b505af1158015611111573d6000803e3d6000fd5b505050506040513d604081101561112757600080fd5b508051602091820151604080516001600160a01b038d811682529481018a9052808201849052606081018390529051929750909550828e16928c92908e16917f9cddee57762ce56bd97afc79f9c6bcd7946b3fe3b43b58b4f944e3190111f423919081900360800190a4505096509650969350505050565b6111a7611e75565b6000546001600160a01b039081169116146111f7576040805162461bcd60e51b81526020600482018190526024820152600080516020612710833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000806112576001600160a01b03861685611e79565b6000818152600360205260409020549091506001600160a01b03166112805760009150506109ab565b600081815260036020908152604091829020548251630506601760e51b81526001600160a01b0387811660048301529351939091169263a0cc02e092602480840193919291829003018186803b158015610a4a57600080fd5b60015460009081906001600160a01b03163314611329576040805162461bcd60e51b81526020600482015260096024820152680ae9a84748a5a6260760bb1b604482015290519081900360640190fd5b5060009788975095505050505050565b6001546000906001600160a01b03163314611387576040805162461bcd60e51b81526020600482015260096024820152680ae9a84748a5a6260760bb1b604482015290519081900360640190fd5b600061139c6001600160a01b03871686611e79565b6000818152600360209081526040808320548151630efe6a8b60e01b81526001600160a01b038a81166004830152602482018a90526044820186905292519596509116938493630efe6a8b93606480850194919392918390030190829087803b15801561140857600080fd5b505af115801561141c573d6000803e3d6000fd5b505050506040513d602081101561143257600080fd5b5051604080518681526020810183905281519295506001600160a01b03808916938a93918c16927f888889d6224fdc21d2a6f20b0f8a25cc561b82d8f051c7b471e65903d4d1654d92908290030190a45050949350505050565b6000546001600160a01b031690565b6114a3611e75565b6000546001600160a01b039081169116146114f3576040805162461bcd60e51b81526020600482018190526024820152600080516020612710833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517f79f74fd5964b6943d8a1865abfb7f668c92fa3f32c0a2e3195da7d0946703ad790600090a250565b600154600090819081906001600160a01b0316331461158f576040805162461bcd60e51b81526020600482015260096024820152680ae9a84748a5a6260760bb1b604482015290519081900360640190fd5b60006115a46001600160a01b03891688611e79565b6000818152600360205260409020549091506001600160a01b0316806115fd576040805162461bcd60e51b815260206004820152600960248201526847574d3a452d34303360b81b604482015290519081900360640190fd5b806001600160a01b0316637abdd2d1886040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050602060405180830381600087803b15801561164c57600080fd5b505af1158015611660573d6000803e3d6000fd5b505050506040513d602081101561167657600080fd5b50516040805160016210ef4360e31b031981526001600160a01b038d8116600483015289811660248301528a81166044830152825193985084169263ff7885e8926064808401939192918290030181600087803b1580156116d657600080fd5b505af11580156116ea573d6000803e3d6000fd5b505050506040513d604081101561170057600080fd5b508051602091820151604080516001600160a01b038c811682529481018a9052808201849052606081018390529051929750909550828d16928b92908d16917f9cddee57762ce56bd97afc79f9c6bcd7946b3fe3b43b58b4f944e3190111f423919081900360800190a45050955095509592505050565b60045460ff1690565b6001546060906001600160a01b031633146117ce576040805162461bcd60e51b81526020600482015260096024820152680ae9a84748a5a6260760bb1b604482015290519081900360640190fd5b60006117e36001600160a01b03881687611e79565b600081815260036020908152604080832054905163a18ea08f60e01b81526001600160a01b038a811660048301908152602483018b90526060604484019081528a5160648501528a519798509190931695869563a18ea08f958d958d958d9591949193608490910192860191908190849084905b8381101561186f578181015183820152602001611857565b50505050905090810190601f16801561189c5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156118bd57600080fd5b505af11580156118d1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156118fa57600080fd5b810190808051604051939291908464010000000082111561191a57600080fd5b90830190602082018581111561192f57600080fd5b825164010000000081118282018810171561194957600080fd5b82525081516020918201929091019080838360005b8381101561197657818101518382015260200161195e565b50505050905090810190601f1680156119a35780820380516001836020036101000a031916815260200191505b506040525050509250505095945050505050565b6119bf611e75565b6000546001600160a01b03908116911614611a0f576040805162461bcd60e51b81526020600482018190526024820152600080516020612710833981519152604482015290519081900360640190fd5b6004805482151560ff19909116811790915560408051918252517fa9bfed3d98385b3777389e321dbde773cf7d335fa604fefbae3dca93564f55869181900360200190a150565b6001546000906001600160a01b03163314611aa4576040805162461bcd60e51b81526020600482015260096024820152680ae9a84748a5a6260760bb1b604482015290519081900360640190fd5b6000611ab96001600160a01b03871686611e79565b6000818152600360205260409020549091506001600160a01b031680611b26576040805162461bcd60e51b815260206004820152601f60248201527f67656e65726963455243323057616c6c65744d616e616765723a452d34303300604482015290519081900360640190fd5b806001600160a01b03166374ee6b628987876040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050602060405180830381600087803b158015611b8e57600080fd5b505af1158015611ba2573d6000803e3d6000fd5b505050506040513d6020811015611bb857600080fd5b5051604080516001600160a01b038881168252602082018490528251939650808c16938a93918c16927f06f54f96ef088b89e726f3399f067502f7f3ab4864f09ba0fd5448eb9d450d3b92908290030190a4505095945050505050565b611c1d611e75565b6000546001600160a01b03908116911614611c6d576040805162461bcd60e51b81526020600482018190526024820152600080516020612710833981519152604482015290519081900360640190fd5b6001600160a01b038116611cb25760405162461bcd60e51b81526004018080602001828103825260268152602001806126b06026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60015460009081906001600160a01b03163314611d5d576040805162461bcd60e51b81526020600482015260096024820152680ae9a84748a5a6260760bb1b604482015290519081900360640190fd5b50600096879650945050505050565b611d74611e75565b6000546001600160a01b03908116911614611dc4576040805162461bcd60e51b81526020600482018190526024820152600080516020612710833981519152604482015290519081900360640190fd5b6000611dd96001600160a01b03861685611e79565b6000818152600360205260409020549091506001600160a01b0316611dfe84846121e3565b806001600160a01b031663522f681585856040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611e5557600080fd5b505af1158015611e69573d6000803e3d6000fd5b50505050505050505050565b3390565b6040805160609390931b6bffffffffffffffffffffffff19166020808501919091526034808501939093528151808503909301835260549093019052805191012090565b6001600160a01b038316611f04576040805162461bcd60e51b81526020600482015260096024820152684248503a452d34303360b81b604482015290519081900360640190fd5b306001600160a01b0316826001600160a01b0316636352211e836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015611f5257600080fd5b505afa158015611f66573d6000803e3d6000fd5b505050506040513d6020811015611f7c57600080fd5b50516001600160a01b0316141561203f57604080516323b872dd60e01b81523060048201526001600160a01b038581166024830152604482018490529151918416916323b872dd9160648082019260009290919082900301818387803b158015611fe557600080fd5b505af1158015611ff9573d6000803e3d6000fd5b5050505080826001600160a01b0316846001600160a01b03167ffefe036cac4ee3a4aca074a81cbcc4376e1484693289078dbec149c890101d5b60405160405180910390a45b505050565b6001600160a01b03831661208b576040805162461bcd60e51b81526020600482015260096024820152684248503a452d34303360b81b604482015290519081900360640190fd5b80826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156120d957600080fd5b505afa1580156120ed573d6000803e3d6000fd5b505050506040513d602081101561210357600080fd5b50511061203f5761211e6001600160a01b0383168483612287565b816001600160a01b0316836001600160a01b03167f6c9d637297625e945b296ff73a71fcfbd0a9e062652b6491a921c4c60194176b836040518082815260200191505060405180910390a3505050565b6002546000908190612188906001600160a01b03166122d9565b9050806001600160a01b0316638129fc1c6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156121c557600080fd5b505af11580156121d9573d6000803e3d6000fd5b5092935050505090565b6001600160a01b03821661222a576040805162461bcd60e51b81526020600482015260096024820152684248503a452d34303360b81b604482015290519081900360640190fd5b804710612283576122446001600160a01b0383168261232b565b6040805182815290516001600160a01b038416917eddb683bb45cd5d0ad8a200c6fae7152b1c236ee90a4a37db692407f5cc38bd919081900360200190a25b5050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261203f908490612410565b6000808260601b9050604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528160148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f0949350505050565b80471015612380576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d80600081146123cb576040519150601f19603f3d011682016040523d82523d6000602084013e6123d0565b606091505b505090508061203f5760405162461bcd60e51b815260040180806020018281038252603a8152602001806126d6603a913960400191505060405180910390fd5b6060612465826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166124c19092919063ffffffff16565b80519091501561203f5780806020019051602081101561248457600080fd5b505161203f5760405162461bcd60e51b815260040180806020018281038252602a815260200180612730602a913960400191505060405180910390fd5b6060610e22848460008560606124d685612676565b612527576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106125665780518252601f199092019160209182019101612547565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146125c8576040519150601f19603f3d011682016040523d82523d6000602084013e6125cd565b606091505b509150915081156125e1579150610e229050565b8051156125f15780518082602001fd5b8360405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561263b578181015183820152602001612623565b50505050905090810190601f1680156126685780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590610e2257505015159291505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d617920686176652072657665727465644f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220cd7cffecc31ccf9b7e52c17079085027ec46f24e31a11728ab17774d82bd335b64736f6c634300060c0033608060405234801561001057600080fd5b50611756806100206000396000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c80637abdd2d1116100ad578063b744a85011610071578063b744a850146104ee578063c87f3c031461050b578063ebb6dad814610314578063ff1f2b7514610513578063ff7885e81461054f5761012c565b80637abdd2d1146103145780638129fc1c1461033a578063883c042b14610342578063a0cc02e01461037c578063a18ea08f146103be5761012c565b8063522f6815116100f4578063522f6815146102215780636edfab6b1461024d57806374ee6b621461027957806379ee54f7146102af5780637aaa3470146102d55761012c565b80630efe6a8b146101315780631071dd991461017557806334115f651461017d5780634025feb2146101b357806344004cc1146101eb575b600080fd5b6101636004803603606081101561014757600080fd5b506001600160a01b038135169060208101359060400135610587565b60408051918252519081900360200190f35b610163610623565b6101636004803603606081101561019357600080fd5b506001600160a01b03813581169160208101359091169060400135610634565b6101e9600480360360608110156101c957600080fd5b506001600160a01b0381358116916020810135909116906040013561068a565b005b6101e96004803603606081101561020157600080fd5b506001600160a01b038135811691602081013590911690604001356106e5565b6101e96004803603604081101561023757600080fd5b506001600160a01b03813516906020013561073b565b6101e96004803603604081101561026357600080fd5b506001600160a01b038135169060200135610794565b6101636004803603606081101561028f57600080fd5b506001600160a01b03813581169160208101359091169060400135610805565b610163600480360360208110156102c557600080fd5b50356001600160a01b031661092c565b6102fb600480360360208110156102eb57600080fd5b50356001600160a01b03166109af565b6040805192835260208301919091528051918290030190f35b6101636004803603602081101561032a57600080fd5b50356001600160a01b03166109b7565b6101e96109c8565b6103686004803603602081101561035857600080fd5b50356001600160a01b03166109d2565b604080519115158252519081900360200190f35b6103a26004803603602081101561039257600080fd5b50356001600160a01b03166109e4565b604080516001600160a01b039092168252519081900360200190f35b610479600480360360608110156103d457600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561040457600080fd5b82018360208201111561041657600080fd5b8035906020019184600183028401116401000000008311171561043857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506109e7945050505050565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104b357818101518382015260200161049b565b50505050905090810190601f1680156104e05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103a26004803603602081101561050457600080fd5b5035610b75565b6101e9610b9a565b6102fb6004803603608081101561052957600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135610bf8565b6102fb6004803603606081101561056557600080fd5b506001600160a01b038135811691602081013582169160409091013516610cb2565b600080546001600160a01b031633146105d3576040805162461bcd60e51b81526020600482015260096024820152685357423a452d31303960b81b604482015290519081900360640190fd5b6105dc84610d62565b6001600160a01b0384166000908152600660205260409020546105ff9084610d7f565b6001600160a01b039094166000908152600660205260409020939093555090919050565b600061062f6004610de0565b905090565b600080546001600160a01b03163314610680576040805162461bcd60e51b81526020600482015260096024820152685357423a452d31303960b81b604482015290519081900360640190fd5b5060009392505050565b6000546001600160a01b031633146106d5576040805162461bcd60e51b81526020600482015260096024820152685357423a452d31303960b81b604482015290519081900360640190fd5b6106e0838383610deb565b505050565b6000546001600160a01b03163314610730576040805162461bcd60e51b81526020600482015260096024820152685357423a452d31303960b81b604482015290519081900360640190fd5b6106e0838383610f71565b6000546001600160a01b03163314610786576040805162461bcd60e51b81526020600482015260096024820152685357423a452d31303960b81b604482015290519081900360640190fd5b610790828261109b565b5050565b6000546001600160a01b031633146107df576040805162461bcd60e51b81526020600482015260096024820152685357423a452d31303960b81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b039390931692909217909155600255565b600080546001600160a01b03163314610851576040805162461bcd60e51b81526020600482015260096024820152685357423a452d31303960b81b604482015290519081900360640190fd5b604080516370a0823160e01b81523060048201819052915185916000916001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561089e57600080fd5b505afa1580156108b2573d6000803e3d6000fd5b505050506040513d60208110156108c857600080fd5b505190508481101561090d576040805162461bcd60e51b81526020600482015260096024820152684753573a452d34313160b81b604482015290519081900360640190fd5b6109216001600160a01b038316888761113e565b509295945050505050565b6000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561097b57600080fd5b505afa15801561098f573d6000803e3d6000fd5b505050506040513d60208110156109a557600080fd5b505190505b919050565b600080915091565b60006109c282611190565b92915050565b6109d0610b9a565b565b60006109dd82611190565b1592915050565b90565b6000546060906001600160a01b03163314610a35576040805162461bcd60e51b81526020600482015260096024820152685357423a452d31303960b81b604482015290519081900360640190fd5b60006060856001600160a01b031685856040518082805190602001908083835b60208310610a745780518252601f199092019160209182019101610a55565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610ad6576040519150601f19603f3d011682016040523d82523d6000602084013e610adb565b606091505b5091509150818190610b6b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610b30578181015183820152602001610b18565b50505050905090810190601f168015610b5d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5095945050505050565b6000610b816004610de0565b8210610b8f575060006109aa565b6109c26004836111ab565b6000546001600160a01b031615610be4576040805162461bcd60e51b815260206004820152600960248201526829aba11d229698181960b91b604482015290519081900360640190fd5b600080546001600160a01b03191633179055565b6000805481906001600160a01b03163314610c46576040805162461bcd60e51b81526020600482015260096024820152685357423a452d31303960b81b604482015290519081900360640190fd5b60009150610c5384611190565b9050828110610c5f5750815b6001600160a01b038416600090815260066020526040902054610c8290826111b7565b6001600160a01b038516600081815260066020526040902091909155610ca990878361113e565b94509492505050565b6000805481906001600160a01b03163314610d00576040805162461bcd60e51b81526020600482015260096024820152685357423a452d31303960b81b604482015290519081900360640190fd5b60009150610d0d83611190565b6001600160a01b038416600090815260066020526040902054909150610d3390826111b7565b6001600160a01b038416600081815260066020526040902091909155610d5a90868361113e565b935093915050565b610d6d6004826111f9565b610d7c5761079060048261120e565b50565b600082820183811015610dd9576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b60006109c282611223565b6001600160a01b038316610e32576040805162461bcd60e51b81526020600482015260096024820152684248503a452d34303360b81b604482015290519081900360640190fd5b306001600160a01b0316826001600160a01b0316636352211e836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610e8057600080fd5b505afa158015610e94573d6000803e3d6000fd5b505050506040513d6020811015610eaa57600080fd5b50516001600160a01b031614156106e057604080516323b872dd60e01b81523060048201526001600160a01b038581166024830152604482018490529151918416916323b872dd9160648082019260009290919082900301818387803b158015610f1357600080fd5b505af1158015610f27573d6000803e3d6000fd5b5050505080826001600160a01b0316846001600160a01b03167ffefe036cac4ee3a4aca074a81cbcc4376e1484693289078dbec149c890101d5b60405160405180910390a4505050565b6001600160a01b038316610fb8576040805162461bcd60e51b81526020600482015260096024820152684248503a452d34303360b81b604482015290519081900360640190fd5b80826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561100657600080fd5b505afa15801561101a573d6000803e3d6000fd5b505050506040513d602081101561103057600080fd5b5051106106e05761104b6001600160a01b038316848361113e565b816001600160a01b0316836001600160a01b03167f6c9d637297625e945b296ff73a71fcfbd0a9e062652b6491a921c4c60194176b836040518082815260200191505060405180910390a3505050565b6001600160a01b0382166110e2576040805162461bcd60e51b81526020600482015260096024820152684248503a452d34303360b81b604482015290519081900360640190fd5b804710610790576110fc6001600160a01b03831682611227565b6040805182815290516001600160a01b038416917eddb683bb45cd5d0ad8a200c6fae7152b1c236ee90a4a37db692407f5cc38bd919081900360200190a25050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526106e090849061130c565b6001600160a01b031660009081526006602052604090205490565b6000610dd983836113bd565b6000610dd983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611421565b6000610dd9836001600160a01b03841661147b565b6000610dd9836001600160a01b038416611493565b5490565b8047101561127c576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d80600081146112c7576040519150601f19603f3d011682016040523d82523d6000602084013e6112cc565b606091505b50509050806106e05760405162461bcd60e51b815260040180806020018281038252603a8152602001806116bd603a913960400191505060405180910390fd5b6060611361826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114dd9092919063ffffffff16565b8051909150156106e05780806020019051602081101561138057600080fd5b50516106e05760405162461bcd60e51b815260040180806020018281038252602a8152602001806116f7602a913960400191505060405180910390fd5b815460009082106113ff5760405162461bcd60e51b815260040180806020018281038252602281526020018061169b6022913960400191505060405180910390fd5b82600001828154811061140e57fe5b9060005260206000200154905092915050565b600081848411156114735760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610b30578181015183820152602001610b18565b505050900390565b60009081526001919091016020526040902054151590565b600061149f838361147b565b6114d5575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556109c2565b5060006109c2565b60606114ec84846000856114f4565b949350505050565b60606114ff85611661565b611550576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061158f5780518252601f199092019160209182019101611570565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146115f1576040519150601f19603f3d011682016040523d82523d6000602084013e6115f6565b606091505b5091509150811561160a5791506114ec9050565b80511561161a5780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315610b30578181015183820152602001610b18565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906114ec57505015159291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d617920686176652072657665727465645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220a4e7102c2500cd6b693b33f3fb05a72a1c665725b222cb123c8a6c73dbd471a864736f6c634300060c0033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.