ETH Price: $2,102.13 (-10.35%)

Contract

0xD2a2708D9B5496d0D00dA92b9dE905a9Af576dEC
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Random151050872022-07-09 0:02:25969 days ago1657324945IN
0xD2a2708D...9Af576dEC
0 ETH0.0052520516.5045666
Random143871632022-03-14 21:27:211085 days ago1647293241IN
0xD2a2708D...9Af576dEC
0 ETH0.0233488978.79675846
Random143867242022-03-14 19:51:461085 days ago1647287506IN
0xD2a2708D...9Af576dEC
0 ETH0.016127250.67973571
Random141092952022-01-30 20:19:011128 days ago1643573941IN
0xD2a2708D...9Af576dEC
0 ETH0.04375691139.61733381
Random140642372022-01-23 21:03:461135 days ago1642971826IN
0xD2a2708D...9Af576dEC
0 ETH0.03198754107.95443768
Random132803612021-09-23 6:28:311258 days ago1632378511IN
0xD2a2708D...9Af576dEC
0 ETH0.0168266352.90364723
Random130850072021-08-24 1:12:221288 days ago1629767542IN
0xD2a2708D...9Af576dEC
0 ETH0.0252128783.73420298
Random130850072021-08-24 1:12:221288 days ago1629767542IN
0xD2a2708D...9Af576dEC
0 ETH0.0252128783.73420298
Random130518492021-08-18 22:14:241293 days ago1629324864IN
0xD2a2708D...9Af576dEC
0 ETH0.0133852742.06638746
Random129058722021-07-27 3:52:231316 days ago1627357943IN
0xD2a2708D...9Af576dEC
0 ETH0.008431328
Random129006522021-07-26 8:01:291317 days ago1627286489IN
0xD2a2708D...9Af576dEC
0 ETH0.0105613830

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Random

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 0 runs

Other Settings:
default evmVersion
File 1 of 15 : Random.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

import "@chainlink/contracts/src/v0.7/VRFConsumerBase.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";

import "./base/Named.sol";
import "./base/Sweepable.sol";

/**
  @title A contract to retrieve secure on-chain randomness from Chainlink.
  @author Tim Clancy

  This contract is a portal for on-chain random data. It allows any caller to
  pay the appropriate amount of LINK and retrieve a source of secure randomness
  from Chainlink. The contract supports both the direct retrieval of Chainlink's
  trusted randomness and helper functions to retrieve random values within a
  specific range.

  July 26th, 2021.
*/
contract Random is Named, Sweepable, VRFConsumerBase {
  using SafeERC20 for IERC20;
  using SafeMath for uint256;

  /// The public identifier for the right to adjust the Chainlink connection.
  bytes32 public constant SET_CHAINLINK = keccak256("SET_CHAINLINK");

  /**
    This struct defines the parameters needed to communicate with a Chainlink
    VRF coordinator.

    @param coordinator The address of the Chainlink VRF coordinator.
    @param link The address of Chainlink's LINK token.
    @param keyHash The key hash of the Chainlink VRF coordinator.
    @param fee The fee in LINK required to utilize Chainlink's VRF service.
  */
  struct Chainlink {
    address coordinator;
    address link;
    bytes32 keyHash;
    uint256 fee;
  }

  /// The current data governing this portal's connection to Chainlink's VRF.
  Chainlink public chainlink;

  /**
    This struct defines the response that Chainlink returns to us for a given
    call out to `requestRandomness`.

    @param requester The caller who requested this Chainlink response.
    @param requestId The ID of the request to the Chainlink VRF coordinator.
    @param pending Whether or not the request to Chainlink is still pending.
    @param result The resulting value of secure randomness returned by
      Chainlink.
  */
  struct ChainlinkResponse {
    address requester;
    bytes32 requestId;
    bool pending;
    uint256 result;
  }

  /// A mapping from caller-specified randomness IDs to Chainlink responses.
  mapping (bytes32 => ChainlinkResponse) public chainlinkResponses;

  /// A reverse mapping from Chainlink request IDs to caller-specified IDs.
  mapping (bytes32 => bytes32) public callerIds;

  /**
    A mapping from caller addresses to the number of Chainlink VRF secure
    randomness responses that the caller has requested. This is used to index
    into the `callerRequests` mapping.
  */
  mapping (address => uint256) public callerRequestCounts;

  /// A mapping from callers to the Chainlink response data they've asked for.
  mapping (address => mapping (uint256 => ChainlinkResponse))
    public callerRequests;

  /**
    An event emitted when the Chainlink connection  of this contract is updated.

    @param updater The address which updated the Chainlink connection.
    @param oldChainlink The old Chainlink details.
    @param newChainlink The new Chainlink details.
  */
  event ChainlinkUpdated(address indexed updater,
    Chainlink indexed oldChainlink, Chainlink indexed newChainlink);

  /**
    An event emitted when a caller requests secure randomness from Chainlink.

    @param requester The caller requesting the secure randomness.
    @param id The caller-specified ID for the randomness.
    @param chainlinkRequestId The Chainlink-generated request ID.
  */
  event RequestCreated(address indexed requester, bytes32 indexed id,
    bytes32 indexed chainlinkRequestId);

  /**
    An event emitted when Chainlink fulfills a request for randomness.

    @param chainlinkRequestId The request ID being fulfilled by Chainlink.
    @param result The resulting secure randomness.
  */
  event RequestFulfilled(bytes32 indexed chainlinkRequestId,
    uint256 indexed result);

  /**
    Construct a new portal to retrieve randomness from Chainlink.

    @param _owner The address of the administrator governing this portal.
    @param _name The name to assign to this random portal.
    @param _chainlink The Chainlink data to use for connecting to a VRF
      coordinator.
  */
  constructor(address _owner, string memory _name,
    Chainlink memory _chainlink) public Named(_name)
    VRFConsumerBase(_chainlink.coordinator, _chainlink.link) {

    // Do not perform a redundant ownership transfer if the deployer should
    // remain as the owner of the collection.
    if (_owner != owner()) {
      transferOwnership(_owner);
    }

    // Continue initialization.
    chainlink = _chainlink;
  }

  /**
    Return a version number for this contract's interface.
  */
  function version() external virtual override(Named, Sweepable) pure returns
    (uint256) {
    return 1;
  }

  /**
    Allow those with permission to set Chainlink VRF connection details.

    @param _chainlink The new Chainlink data to use for connecting to a VRF
      coordinator.
  */
  function setChainlink(Chainlink calldata _chainlink) external
    hasValidPermit(UNIVERSAL, SET_CHAINLINK) {
    Chainlink memory oldChainlink = chainlink;
    chainlink = _chainlink;
    emit ChainlinkUpdated(_msgSender(), oldChainlink, _chainlink);
  }

  /**
    Create and store a source of secure randomness from Chainlink. The caller
    pays the LINK fee required to utilize Chainlink's VRF coordinator.

    Chainlink warns us that it is important to avoid calling `requestRandomness`
    repeatedly if the response from the VRF coordinator is delayed. Doing so
    would leak data to VRF operators about the potential ordering of VRF calls.

    @param _id A unique ID to assign to the requested randomness.
    @return The randomness request ID generated by Chainlink's VRF coordinator.
  */
  function random(bytes32 _id) external returns (bytes32) {
    require(chainlinkResponses[_id].requester == address(0),
      "Random: randomness has already been generated for the specified ID");

    // Attempt to transfer enough LINK from the caller to cover Chainlink's fee.
    IERC20 link = IERC20(chainlink.link);
    require(link.balanceOf(_msgSender()) >= chainlink.fee,
      "Random: you do not have enough LINK to request randomness");
    link.safeTransferFrom(_msgSender(), address(this), chainlink.fee);

    // Request the secure source of randomness from Chainlink.
    bytes32 chainlinkRequestId = requestRandomness(chainlink.keyHash,
      chainlink.fee);

    // Update all storage mappings with the pending Chainlink response.
    ChainlinkResponse memory chainlinkResponse = ChainlinkResponse({
      requester: _msgSender(),
      requestId: chainlinkRequestId,
      pending: true,
      result: 0
    });
    chainlinkResponses[_id] = chainlinkResponse;
    callerIds[chainlinkRequestId] = _id;
    uint256 responseIndex = callerRequestCounts[_msgSender()];
    callerRequests[_msgSender()][responseIndex] = chainlinkResponse;
    callerRequestCounts[_msgSender()] = responseIndex + 1;

    // Emit an event denoting the request to Chainlink.
    emit RequestCreated(_msgSender(), _id, chainlinkRequestId);
    return chainlinkRequestId;
  }

  /**
    This is a callback function used by Chainlink's VRF coordinator to return
    the source of randomness to this contract.

    Chainlink warns us that we should not have multiple VRF requests in flight
    at once if their order would result in different contract states. Otherwise,
    Chainlink VRF coordinators could manipulate our contract by controlling the
    order in which randomness returns.

    @param _requestId The ID of the randomness request which is being answered
      by Chainlink's VRF coordinator.
    @param _randomness The resulting randomness.
  */
  function fulfillRandomness(bytes32 _requestId, uint256 _randomness) internal
    override {
    bytes32 callerId = callerIds[_requestId];
    chainlinkResponses[callerId].pending = false;
    chainlinkResponses[callerId].result = _randomness;
    emit RequestFulfilled(_requestId, _randomness);
  }

  /**
    Interpret the randomness response from Chainlink as an integer within some
    range from `_origin` (inclusive) to `_bound` (exclusive). For example, the
    results of rolling 1d20 would be specified as `asRange(..., 1, 21)`.

    @param _source The caller-specified ID for a source of Chainlink randomness.
    @param _origin The first value to include in the range.
    @param _bound The end of the range; this value is excluded from the range.
  */
  function asRange(bytes32 _source, uint256 _origin, uint256 _bound) external
    view returns (uint256) {
    require (_bound > _origin,
      "Random: there must be at least one possible value in range");
    require(chainlinkResponses[_source].requester != address(0)
      && !chainlinkResponses[_source].pending,
      "Random: you may only interpret the results of a fulfilled request");

    // Return the interpreted result.
    return chainlinkResponses[_source].result
      .mod(_bound.sub(_origin)).add(_origin);
  }
}

File 2 of 15 : VRFConsumerBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;

import "./vendor/SafeMathChainlink.sol";

import "./interfaces/LinkTokenInterface.sol";

import "./VRFRequestIDBase.sol";

/** ****************************************************************************
 * @notice Interface for contracts using VRF randomness
 * *****************************************************************************
 * @dev PURPOSE
 *
 * @dev Reggie the Random Oracle (not his real job) wants to provide randomness
 * @dev to Vera the verifier in such a way that Vera can be sure he's not
 * @dev making his output up to suit himself. Reggie provides Vera a public key
 * @dev to which he knows the secret key. Each time Vera provides a seed to
 * @dev Reggie, he gives back a value which is computed completely
 * @dev deterministically from the seed and the secret key.
 *
 * @dev Reggie provides a proof by which Vera can verify that the output was
 * @dev correctly computed once Reggie tells it to her, but without that proof,
 * @dev the output is indistinguishable to her from a uniform random sample
 * @dev from the output space.
 *
 * @dev The purpose of this contract is to make it easy for unrelated contracts
 * @dev to talk to Vera the verifier about the work Reggie is doing, to provide
 * @dev simple access to a verifiable source of randomness.
 * *****************************************************************************
 * @dev USAGE
 *
 * @dev Calling contracts must inherit from VRFConsumerBase, and can
 * @dev initialize VRFConsumerBase's attributes in their constructor as
 * @dev shown:
 *
 * @dev   contract VRFConsumer {
 * @dev     constuctor(<other arguments>, address _vrfCoordinator, address _link)
 * @dev       VRFConsumerBase(_vrfCoordinator, _link) public {
 * @dev         <initialization with other arguments goes here>
 * @dev       }
 * @dev   }
 *
 * @dev The oracle will have given you an ID for the VRF keypair they have
 * @dev committed to (let's call it keyHash), and have told you the minimum LINK
 * @dev price for VRF service. Make sure your contract has sufficient LINK, and
 * @dev call requestRandomness(keyHash, fee, seed), where seed is the input you
 * @dev want to generate randomness from.
 *
 * @dev Once the VRFCoordinator has received and validated the oracle's response
 * @dev to your request, it will call your contract's fulfillRandomness method.
 *
 * @dev The randomness argument to fulfillRandomness is the actual random value
 * @dev generated from your seed.
 *
 * @dev The requestId argument is generated from the keyHash and the seed by
 * @dev makeRequestId(keyHash, seed). If your contract could have concurrent
 * @dev requests open, you can use the requestId to track which seed is
 * @dev associated with which randomness. See VRFRequestIDBase.sol for more
 * @dev details. (See "SECURITY CONSIDERATIONS" for principles to keep in mind,
 * @dev if your contract could have multiple requests in flight simultaneously.)
 *
 * @dev Colliding `requestId`s are cryptographically impossible as long as seeds
 * @dev differ. (Which is critical to making unpredictable randomness! See the
 * @dev next section.)
 *
 * *****************************************************************************
 * @dev SECURITY CONSIDERATIONS
 *
 * @dev A method with the ability to call your fulfillRandomness method directly
 * @dev could spoof a VRF response with any random value, so it's critical that
 * @dev it cannot be directly called by anything other than this base contract
 * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method).
 *
 * @dev For your users to trust that your contract's random behavior is free
 * @dev from malicious interference, it's best if you can write it so that all
 * @dev behaviors implied by a VRF response are executed *during* your
 * @dev fulfillRandomness method. If your contract must store the response (or
 * @dev anything derived from it) and use it later, you must ensure that any
 * @dev user-significant behavior which depends on that stored value cannot be
 * @dev manipulated by a subsequent VRF request.
 *
 * @dev Similarly, both miners and the VRF oracle itself have some influence
 * @dev over the order in which VRF responses appear on the blockchain, so if
 * @dev your contract could have multiple VRF requests in flight simultaneously,
 * @dev you must ensure that the order in which the VRF responses arrive cannot
 * @dev be used to manipulate your contract's user-significant behavior.
 *
 * @dev Since the ultimate input to the VRF is mixed with the block hash of the
 * @dev block in which the request is made, user-provided seeds have no impact
 * @dev on its economic security properties. They are only included for API
 * @dev compatability with previous versions of this contract.
 *
 * @dev Since the block hash of the block which contains the requestRandomness
 * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful
 * @dev miner could, in principle, fork the blockchain to evict the block
 * @dev containing the request, forcing the request to be included in a
 * @dev different block with a different hash, and therefore a different input
 * @dev to the VRF. However, such an attack would incur a substantial economic
 * @dev cost. This cost scales with the number of blocks the VRF oracle waits
 * @dev until it calls responds to a request.
 */
abstract contract VRFConsumerBase is VRFRequestIDBase {

  using SafeMathChainlink for uint256;

  /**
   * @notice fulfillRandomness handles the VRF response. Your contract must
   * @notice implement it. See "SECURITY CONSIDERATIONS" above for important
   * @notice principles to keep in mind when implementing your fulfillRandomness
   * @notice method.
   *
   * @dev VRFConsumerBase expects its subcontracts to have a method with this
   * @dev signature, and will call it once it has verified the proof
   * @dev associated with the randomness. (It is triggered via a call to
   * @dev rawFulfillRandomness, below.)
   *
   * @param requestId The Id initially returned by requestRandomness
   * @param randomness the VRF output
   */
  function fulfillRandomness(
    bytes32 requestId,
    uint256 randomness
  )
    internal
    virtual;

  /**
   * @dev In order to keep backwards compatibility we have kept the user
   * seed field around. We remove the use of it because given that the blockhash
   * enters later, it overrides whatever randomness the used seed provides.
   * Given that it adds no security, and can easily lead to misunderstandings,
   * we have removed it from usage and can now provide a simpler API.
   */
  uint256 constant private USER_SEED_PLACEHOLDER = 0;

  /**
   * @notice requestRandomness initiates a request for VRF output given _seed
   *
   * @dev The fulfillRandomness method receives the output, once it's provided
   * @dev by the Oracle, and verified by the vrfCoordinator.
   *
   * @dev The _keyHash must already be registered with the VRFCoordinator, and
   * @dev the _fee must exceed the fee specified during registration of the
   * @dev _keyHash.
   *
   * @dev The _seed parameter is vestigial, and is kept only for API
   * @dev compatibility with older versions. It can't *hurt* to mix in some of
   * @dev your own randomness, here, but it's not necessary because the VRF
   * @dev oracle will mix the hash of the block containing your request into the
   * @dev VRF seed it ultimately uses.
   *
   * @param _keyHash ID of public key against which randomness is generated
   * @param _fee The amount of LINK to send with the request
   *
   * @return requestId unique ID for this request
   *
   * @dev The returned requestId can be used to distinguish responses to
   * @dev concurrent requests. It is passed as the first argument to
   * @dev fulfillRandomness.
   */
  function requestRandomness(
    bytes32 _keyHash,
    uint256 _fee
  )
    internal
    returns (
      bytes32 requestId
    )
  {
    LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, USER_SEED_PLACEHOLDER));
    // This is the seed passed to VRFCoordinator. The oracle will mix this with
    // the hash of the block containing this request to obtain the seed/input
    // which is finally passed to the VRF cryptographic machinery.
    uint256 vRFSeed  = makeVRFInputSeed(_keyHash, USER_SEED_PLACEHOLDER, address(this), nonces[_keyHash]);
    // nonces[_keyHash] must stay in sync with
    // VRFCoordinator.nonces[_keyHash][this], which was incremented by the above
    // successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest).
    // This provides protection against the user repeating their input seed,
    // which would result in a predictable/duplicate output, if multiple such
    // requests appeared in the same block.
    nonces[_keyHash] = nonces[_keyHash].add(1);
    return makeRequestId(_keyHash, vRFSeed);
  }

  LinkTokenInterface immutable internal LINK;
  address immutable private vrfCoordinator;

  // Nonces for each VRF key from which randomness has been requested.
  //
  // Must stay in sync with VRFCoordinator[_keyHash][this]
  mapping(bytes32 /* keyHash */ => uint256 /* nonce */) private nonces;

  /**
   * @param _vrfCoordinator address of VRFCoordinator contract
   * @param _link address of LINK token contract
   *
   * @dev https://docs.chain.link/docs/link-token-contracts
   */
  constructor(
    address _vrfCoordinator,
    address _link
  ) {
    vrfCoordinator = _vrfCoordinator;
    LINK = LinkTokenInterface(_link);
  }

  // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
  // proof. rawFulfillRandomness then calls fulfillRandomness, after validating
  // the origin of the call
  function rawFulfillRandomness(
    bytes32 requestId,
    uint256 randomness
  )
    external
  {
    require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
    fulfillRandomness(requestId, randomness);
  }
}

File 3 of 15 : IERC20.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 IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

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

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

File 4 of 15 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 5 of 15 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.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 6 of 15 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.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, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

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

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

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

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

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        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) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        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, reverting 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) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

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

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

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * 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);
        return a / b;
    }

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

File 7 of 15 : Named.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/utils/Context.sol";

import "../access/PermitControl.sol";

/**
  @title A contract with a name.
  @author Tim Clancy

  This basic contract has a name which can be edited by those with permission.
*/
contract Named is PermitControl {

  /// The public name of this contract.
  string public name;

  /// The public identifier for the right to edit this contract's name.
  bytes32 public constant UPDATE_NAME = keccak256("UPDATE_NAME");

  /**
    An event emitted when the name of this contract is updated.

    @param updater The address which updated this contract's name.
    @param oldName The old name of this contract.
    @param newName The new name of this contract.
  */
  event NameUpdated(address indexed updater, string indexed oldName,
    string indexed newName);

  /**
    Construct a new contract with a specified name.

    @param _name The name to assign to this contract.
  */
  constructor(string memory _name) public {
    name = _name;
    emit NameUpdated(_msgSender(), "", _name);
  }

  /**
    Return a version number for this contract's interface.
  */
  function version() external virtual override pure returns (uint256) {
    return 1;
  }

  /**
    Allow those with permission to set the name of this contract to `_name`.

    @param _name The new name of this contract.
  */
  function setName(string calldata _name) external virtual
    hasValidPermit(UNIVERSAL, UPDATE_NAME) {
    string memory oldName = name;
    name = _name;
    emit NameUpdated(_msgSender(), oldName, _name);
  }
}

File 8 of 15 : Sweepable.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

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

import "../access/PermitControl.sol";

/**
  @title A base contract which supports an administrative sweep function wherein
    authorized callers may transfer ERC-20 tokens out of this contract.
  @author Tim Clancy

  This is a base contract designed with the intent to support rescuing ERC-20
  tokens which users might have wrongly sent to a contract.
*/
contract Sweepable is PermitControl {
  using SafeERC20 for IERC20;

  /// The public identifier for the right to sweep tokens.
  bytes32 public constant SWEEP = keccak256("SWEEP");

  /// The public identifier for the right to lock token sweeps.
  bytes32 public constant LOCK_SWEEP = keccak256("LOCK_SWEEP");

  /// A flag determining whether or not the `sweep` function may be used.
  bool public sweepLocked;

  /**
    An event to track a token sweep event.

    @param sweeper The calling address which triggered the sweeep.
    @param token The specific ERC-20 token being swept.
    @param amount The amount of the ERC-20 token being swept.
    @param recipient The recipient of the swept tokens.
  */
  event TokenSweep(address indexed sweeper, IERC20 indexed token,
    uint256 amount, address indexed recipient);

  /**
    An event to track future use of the `sweep` function being locked.

    @param locker The calling address which locked down sweeping.
  */
  event SweepLocked(address indexed locker);

  /**
    Return a version number for this contract's interface.
  */
  function version() external virtual override pure returns (uint256) {
    return 1;
  }

  /**
    Allow the owner or an approved manager to sweep all of a particular ERC-20
    token from the contract and send it to another address. This function exists
    to allow the shop owner to recover tokens that are otherwise sent directly
    to this contract and get stuck. Provided that sweeping is not locked, this
    is a useful tool to help buyers recover otherwise-lost funds.

    @param _token The token to sweep the balance from.
    @param _amount The amount of token to sweep.
    @param _address The address to send the swept tokens to.
  */
  function sweep(IERC20 _token, uint256 _amount, address _address) external
    hasValidPermit(UNIVERSAL, SWEEP) {
    require(!sweepLocked,
      "MintShop1155: the sweep function is locked");
    _token.safeTransferFrom(address(this), _address, _amount);
    emit TokenSweep(_msgSender(), _token, _amount, _address);
  }

  /**
    Allow the shop owner or an approved manager to lock the contract against any
    future token sweeps.
  */
  function lockSweep() external hasValidPermit(UNIVERSAL, LOCK_SWEEP) {
    sweepLocked = true;
    emit SweepLocked(_msgSender());
  }
}

File 9 of 15 : SafeMathChainlink.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.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 SafeMathChainlink {
  /**
    * @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
    )
  {
    require(b <= a, "SafeMath: subtraction overflow");
    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-solidity/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
    )
  {
    // Solidity only automatically asserts when dividing by 0
    require(b > 0, "SafeMath: division by zero");
    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
    )
  {
    require(b != 0, "SafeMath: modulo by zero");
    return a % b;
  }
}

File 10 of 15 : LinkTokenInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;

interface LinkTokenInterface {

  function allowance(
    address owner,
    address spender
  )
    external
    view
    returns (
      uint256 remaining
    );

  function approve(
    address spender,
    uint256 value
  )
    external
    returns (
      bool success
    );

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

  function decimals()
    external
    view
    returns (
      uint8 decimalPlaces
    );

  function decreaseApproval(
    address spender,
    uint256 addedValue
  )
    external
    returns (
      bool success
    );

  function increaseApproval(
    address spender,
    uint256 subtractedValue
  ) external;

  function name()
    external
    view
    returns (
      string memory tokenName
    );

  function symbol()
    external
    view
    returns (
      string memory tokenSymbol
    );

  function totalSupply()
    external
    view
    returns (
      uint256 totalTokensIssued
    );

  function transfer(
    address to,
    uint256 value
  )
    external
    returns (
      bool success
    );

  function transferAndCall(
    address to,
    uint256 value,
    bytes calldata data
  )
    external
    returns (
      bool success
    );

  function transferFrom(
    address from,
    address to,
    uint256 value
  )
    external
    returns (
      bool success
    );

}

File 11 of 15 : VRFRequestIDBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;

contract VRFRequestIDBase {

  /**
   * @notice returns the seed which is actually input to the VRF coordinator
   *
   * @dev To prevent repetition of VRF output due to repetition of the
   * @dev user-supplied seed, that seed is combined in a hash with the
   * @dev user-specific nonce, and the address of the consuming contract. The
   * @dev risk of repetition is mostly mitigated by inclusion of a blockhash in
   * @dev the final seed, but the nonce does protect against repetition in
   * @dev requests which are included in a single block.
   *
   * @param _userSeed VRF seed input provided by user
   * @param _requester Address of the requesting contract
   * @param _nonce User-specific nonce at the time of the request
   */
  function makeVRFInputSeed(
    bytes32 _keyHash,
    uint256 _userSeed,
    address _requester,
    uint256 _nonce
  )
    internal
    pure
    returns (
      uint256
    )
  {
    return uint256(keccak256(abi.encode(_keyHash, _userSeed, _requester, _nonce)));
  }

  /**
   * @notice Returns the id for this request
   * @param _keyHash The serviceAgreement ID to be used for this request
   * @param _vRFInputSeed The seed to be passed directly to the VRF
   * @return The id for this request
   *
   * @dev Note that _vRFInputSeed is not the seed passed by the consuming
   * @dev contract, but the one generated by makeVRFInputSeed
   */
  function makeRequestId(
    bytes32 _keyHash,
    uint256 _vRFInputSeed
  )
    internal
    pure
    returns (
      bytes32
    )
  {
    return keccak256(abi.encodePacked(_keyHash, _vRFInputSeed));
  }
}

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

pragma solidity >=0.6.2 <0.8.0;

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

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

        // 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");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

File 13 of 15 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with 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 14 of 15 : PermitControl.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";

/**
  @title An advanced permission-management contract.
  @author Tim Clancy

  This contract allows for a contract owner to delegate specific rights to
  external addresses. Additionally, these rights can be gated behind certain
  sets of circumstances and granted expiration times. This is useful for some
  more finely-grained access control in contracts.

  The owner of this contract is always a fully-permissioned super-administrator.
*/
abstract contract PermitControl is Ownable {
  using SafeMath for uint256;
  using Address for address;

  /// A special reserved constant for representing no rights.
  bytes32 public constant ZERO_RIGHT = hex"00000000000000000000000000000000";

  /// A special constant specifying the unique, universal-rights circumstance.
  bytes32 public constant UNIVERSAL = hex"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF";

  /*
    A special constant specifying the unique manager right. This right allows an
    address to freely-manipulate the `managedRight` mapping.
  **/
  bytes32 public constant MANAGER = hex"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF";

  /**
    A mapping of per-address permissions to the circumstances, represented as
    an additional layer of generic bytes32 data, under which the addresses have
    various permits. A permit in this sense is represented by a per-circumstance
    mapping which couples some right, represented as a generic bytes32, to an
    expiration time wherein the right may no longer be exercised. An expiration
    time of 0 indicates that there is in fact no permit for the specified
    address to exercise the specified right under the specified circumstance.

    @dev Universal rights MUST be stored under the 0xFFFFFFFFFFFFFFFFFFFFFFFF...
    max-integer circumstance. Perpetual rights may be given an expiry time of
    max-integer.
  */
  mapping (address => mapping (bytes32 => mapping (bytes32 => uint256))) public
    permissions;

  /**
    An additional mapping of managed rights to manager rights. This mapping
    represents the administrator relationship that various rights have with one
    another. An address with a manager right may freely set permits for that
    manager right's managed rights. Each right may be managed by only one other
    right.
  */
  mapping (bytes32 => bytes32) public managerRight;

  /**
    An event emitted when an address has a permit updated. This event captures,
    through its various parameter combinations, the cases of granting a permit,
    updating the expiration time of a permit, or revoking a permit.

    @param updator The address which has updated the permit.
    @param updatee The address whose permit was updated.
    @param circumstance The circumstance wherein the permit was updated.
    @param role The role which was updated.
    @param expirationTime The time when the permit expires.
  */
  event PermitUpdated(address indexed updator, address indexed updatee,
    bytes32 circumstance, bytes32 indexed role, uint256 expirationTime);

  /**
    An event emitted when a management relationship in `managerRight` is
    updated. This event captures adding and revoking management permissions via
    observing the update history of the `managerRight` value.

    @param manager The address of the manager performing this update.
    @param managedRight The right which had its manager updated.
    @param managerRight The new manager right which was updated to.
  */
  event ManagementUpdated(address indexed manager, bytes32 indexed managedRight,
    bytes32 indexed managerRight);

  /**
    A modifier which allows only the super-administrative owner or addresses
    with a specified valid right to perform a call.

    @param _circumstance The circumstance under which to check for the validity
      of the specified `right`.
    @param _right The right to validate for the calling address. It must be
      non-expired and exist within the specified `_circumstance`.
  */
  modifier hasValidPermit(bytes32 _circumstance, bytes32 _right) {
    require(_msgSender() == owner()
      || hasRightUntil(_msgSender(), _circumstance, _right) > block.timestamp,
      "PermitControl: sender does not have a valid permit");
    _;
  }

  /**
    Return a version number for this contract's interface.
  */
  function version() external virtual pure returns (uint256) {
    return 1;
  }

  /**
    Determine whether or not an address has some rights under the given
    circumstance, and if they do have the right, until when.

    @param _address The address to check for the specified `_right`.
    @param _circumstance The circumstance to check the specified `_right` for.
    @param _right The right to check for validity.
    @return The timestamp in seconds when the `_right` expires. If the timestamp
      is zero, we can assume that the user never had the right.
  */
  function hasRightUntil(address _address, bytes32 _circumstance,
    bytes32 _right) public view returns (uint256) {
    return permissions[_address][_circumstance][_right];
  }

  /**
    Set the permit to a specific address under some circumstances. A permit may
    only be set by the super-administrative contract owner or an address holding
    some delegated management permit.

    @param _address The address to assign the specified `_right` to.
    @param _circumstance The circumstance in which the `_right` is valid.
    @param _right The specific right to assign.
    @param _expirationTime The time when the `_right` expires for the provided
      `_circumstance`.
  */
  function setPermit(address _address, bytes32 _circumstance, bytes32 _right,
    uint256 _expirationTime) external virtual hasValidPermit(UNIVERSAL,
    managerRight[_right]) {
    require(_right != ZERO_RIGHT,
      "PermitControl: you may not grant the zero right");
    permissions[_address][_circumstance][_right] = _expirationTime;
    emit PermitUpdated(_msgSender(), _address, _circumstance, _right,
      _expirationTime);
  }

  /**
    Set the `_managerRight` whose `UNIVERSAL` holders may freely manage the
    specified `_managedRight`.

    @param _managedRight The right which is to have its manager set to
      `_managerRight`.
    @param _managerRight The right whose `UNIVERSAL` holders may manage
      `_managedRight`.
  */
  function setManagerRight(bytes32 _managedRight, bytes32 _managerRight)
    external virtual hasValidPermit(UNIVERSAL, MANAGER) {
    require(_managedRight != ZERO_RIGHT,
      "PermitControl: you may not specify a manager for the zero right");
    managerRight[_managedRight] = _managerRight;
    emit ManagementUpdated(_msgSender(), _managedRight, _managerRight);
  }
}

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

pragma solidity >=0.6.0 <0.8.0;

import "../utils/Context.sol";
/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        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;
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"components":[{"internalType":"address","name":"coordinator","type":"address"},{"internalType":"address","name":"link","type":"address"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"uint256","name":"fee","type":"uint256"}],"internalType":"struct Random.Chainlink","name":"_chainlink","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"updater","type":"address"},{"components":[{"internalType":"address","name":"coordinator","type":"address"},{"internalType":"address","name":"link","type":"address"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"uint256","name":"fee","type":"uint256"}],"indexed":true,"internalType":"struct Random.Chainlink","name":"oldChainlink","type":"tuple"},{"components":[{"internalType":"address","name":"coordinator","type":"address"},{"internalType":"address","name":"link","type":"address"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"uint256","name":"fee","type":"uint256"}],"indexed":true,"internalType":"struct Random.Chainlink","name":"newChainlink","type":"tuple"}],"name":"ChainlinkUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"manager","type":"address"},{"indexed":true,"internalType":"bytes32","name":"managedRight","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"managerRight","type":"bytes32"}],"name":"ManagementUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"updater","type":"address"},{"indexed":true,"internalType":"string","name":"oldName","type":"string"},{"indexed":true,"internalType":"string","name":"newName","type":"string"}],"name":"NameUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"updator","type":"address"},{"indexed":true,"internalType":"address","name":"updatee","type":"address"},{"indexed":false,"internalType":"bytes32","name":"circumstance","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"expirationTime","type":"uint256"}],"name":"PermitUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"requester","type":"address"},{"indexed":true,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"chainlinkRequestId","type":"bytes32"}],"name":"RequestCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"chainlinkRequestId","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"result","type":"uint256"}],"name":"RequestFulfilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"locker","type":"address"}],"name":"SweepLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sweeper","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"TokenSweep","type":"event"},{"inputs":[],"name":"LOCK_SWEEP","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SET_CHAINLINK","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SWEEP","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNIVERSAL","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPDATE_NAME","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ZERO_RIGHT","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_source","type":"bytes32"},{"internalType":"uint256","name":"_origin","type":"uint256"},{"internalType":"uint256","name":"_bound","type":"uint256"}],"name":"asRange","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"callerIds","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"callerRequestCounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"callerRequests","outputs":[{"internalType":"address","name":"requester","type":"address"},{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"bool","name":"pending","type":"bool"},{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainlink","outputs":[{"internalType":"address","name":"coordinator","type":"address"},{"internalType":"address","name":"link","type":"address"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"chainlinkResponses","outputs":[{"internalType":"address","name":"requester","type":"address"},{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"bool","name":"pending","type":"bool"},{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bytes32","name":"_circumstance","type":"bytes32"},{"internalType":"bytes32","name":"_right","type":"bytes32"}],"name":"hasRightUntil","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockSweep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"managerRight","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"permissions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"}],"name":"random","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"uint256","name":"randomness","type":"uint256"}],"name":"rawFulfillRandomness","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"coordinator","type":"address"},{"internalType":"address","name":"link","type":"address"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"uint256","name":"fee","type":"uint256"}],"internalType":"struct Random.Chainlink","name":"_chainlink","type":"tuple"}],"name":"setChainlink","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_managedRight","type":"bytes32"},{"internalType":"bytes32","name":"_managerRight","type":"bytes32"}],"name":"setManagerRight","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"}],"name":"setName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bytes32","name":"_circumstance","type":"bytes32"},{"internalType":"bytes32","name":"_right","type":"bytes32"},{"internalType":"uint256","name":"_expirationTime","type":"uint256"}],"name":"setPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_address","type":"address"}],"name":"sweep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sweepLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"}]

60c06040523480156200001157600080fd5b5060405162002644380380620026448339810160408190526200003491620003ee565b805160208201518360006200004862000198565b600080546001600160a01b0319166001600160a01b03831690811782556040519293509160008051602062002624833981519152908290a350805162000096906003906020840190620002b5565b5080604051620000a79190620004a8565b6040518091039020604051620000bd90620004c6565b604051908190039020620000d062000198565b6001600160a01b03167f46fc935c3fa417ca2b48f402b8c148aca59d0380ae964496652bd20b0a322b1260405160405180910390a4506001600160601b0319606092831b811660a052911b16608052620001296200019c565b6001600160a01b0316836001600160a01b0316146200014d576200014d83620001ab565b8051600680546001600160a01b039283166001600160a01b03199182161790915560208301516007805491909316911617905560408101516008556060015160095550620005209050565b3390565b6000546001600160a01b031690565b620001b562000198565b6001600160a01b0316620001c86200019c565b6001600160a01b03161462000224576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166200026b5760405162461bcd60e51b8152600401808060200182810382526026815260200180620025fe6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216916000805160206200262483398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620002ed576000855562000338565b82601f106200030857805160ff191683800117855562000338565b8280016001018555821562000338579182015b82811115620003385782518255916020019190600101906200031b565b50620003469291506200034a565b5090565b5b808211156200034657600081556001016200034b565b80516001600160a01b03811681146200037957600080fd5b919050565b60006080828403121562000390578081fd5b604051608081016001600160401b0381118282101715620003ad57fe5b604052905080620003be8362000361565b8152620003ce6020840162000361565b602082015260408301516040820152606083015160608201525092915050565b600080600060c0848603121562000403578283fd5b6200040e8462000361565b60208501519093506001600160401b03808211156200042b578384fd5b818601915086601f8301126200043f578384fd5b8151818111156200044c57fe5b62000461601f8201601f1916602001620004c9565b915080825287602082850101111562000478578485fd5b6200048b816020840160208601620004ed565b5092506200049f905085604086016200037e565b90509250925092565b60008251620004bc818460208701620004ed565b9190910192915050565b90565b6040518181016001600160401b0381118282101715620004e557fe5b604052919050565b60005b838110156200050a578181015183820152602001620004f0565b838111156200051a576000848401525b50505050565b60805160601c60a05160601c6120af6200054f600039806107c0528061137752508061134852506120af6000f3fe608060405234801561001057600080fd5b506004361061016a5760003560e01c806306fdde031461016f57806317f5ebb41461018d5780631abd5b7d146101a25780631b2df8501461018d5780632ed83f78146101b7578063483ba44e146101cc5780634b96f25e146101df57806354fd4d50146101f257806366a0e54d146101fa578063715018a61461020d57806375cc557a146102155780638b6a3cfc1461021d5780638da5cb5b1461022557806394985ddd1461023a5780639c3feeb71461024d5780639d57137f14610265578063a625776e1461026d578063af2fd15f14610275578063c47f002714610288578063c5b16c591461029b578063c7da8558146102ae578063cc2af308146102d1578063cc8e8204146102e4578063cf64d4c2146102f7578063d069a7ea1461030a578063d4ce545a14610312578063dc2c256f14610325578063e581cd7f14610338578063f2fde38b14610340578063f70dd8f814610353575b600080fd5b610177610366565b6040516101849190611bbe565b60405180910390f35b6101956103f4565b6040516101849190611ba7565b6101b56101b0366004611a56565b610400565b005b6101bf61052f565b6040516101849190611b9c565b6101956101da3660046118ac565b610538565b6101956101ed36600461197e565b61055b565b610195610609565b6101956102083660046118ac565b61060e565b6101b5610641565b6101b56106db565b610195610794565b61022d6107a6565b6040516101849190611b37565b6101b561024836600461195d565b6107b5565b610255610840565b6040516101849493929190611b4b565b61019561085f565b610195610871565b610195610283366004611945565b610876565b6101b56102963660046119ea565b610888565b6101956102a9366004611945565b610a0a565b6102c16102bc36600461191a565b610a1c565b6040516101849493929190611b74565b6101b56102df36600461195d565b610a5e565b6101956102f2366004611890565b610b2e565b6101b56103053660046118e0565b610b40565b610195610c4b565b610195610320366004611945565b610c5d565b6101b56103333660046119a9565b610f2c565b610195611032565b6101b561034e366004611890565b611044565b6102c1610361366004611945565b611134565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103ec5780601f106103c1576101008083540402835291602001916103ec565b820191906000526020600020905b8154815290600101906020018083116103cf57829003601f168201915b505050505081565b6001600160801b031981565b6001600160801b031960008051602061205a8339815191526104206107a6565b6001600160a01b031661043161116b565b6001600160a01b0316148061045657504261045461044d61116b565b848461060e565b115b61047b5760405162461bcd60e51b815260040161047290611c94565b60405180910390fd5b60408051608081018252600680546001600160a01b0390811683526007541660208301526008549282019290925260095460608201529084906104be8282611f07565b50506040516104ce908590611ab1565b6040518091039020816040516104e49190611afe565b60405180910390206104f461116b565b6001600160a01b03167f4e5f4f61c46c4bae5e64c04dcb520822f1d5e9b2f0bd8748026781edad03a55e60405160405180910390a450505050565b60045460ff1681565b600160209081526000938452604080852082529284528284209052825290205481565b600082821161057c5760405162461bcd60e51b815260040161047290611e61565b6000848152600a60205260409020546001600160a01b0316158015906105b457506000848152600a602052604090206002015460ff16155b6105d05760405162461bcd60e51b815260040161047290611ce6565b6105ff836105f96105e1858361116f565b6000888152600a6020526040902060030154906111cc565b9061122e565b90505b9392505050565b600190565b6001600160a01b038316600090815260016020908152604080832085845282528083208484529091529020549392505050565b61064961116b565b6001600160a01b031661065a6107a6565b6001600160a01b0316146106a3576040805162461bcd60e51b81526020600482018190526024820152600080516020611fb0833981519152604482015290519081900360640190fd5b600080546040516001600160a01b0390911690600080516020611fd0833981519152908390a3600080546001600160a01b0319169055565b6001600160801b0319600080516020611f908339815191526106fb6107a6565b6001600160a01b031661070c61116b565b6001600160a01b0316148061072a57504261072861044d61116b565b115b6107465760405162461bcd60e51b815260040161047290611c94565b6004805460ff1916600117905561075b61116b565b6001600160a01b03167f566bf2f7f55514125b614cf69d186b37b3f88823adabb810d2b8164544fb3cfb60405160405180910390a25050565b600080516020611f9083398151915281565b6000546001600160a01b031690565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610832576040805162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c00604482015290519081900360640190fd5b61083c8282611286565b5050565b6006546007546008546009546001600160a01b03938416939092169184565b600080516020611ff083398151915281565b600081565b600b6020526000908152604090205481565b6001600160801b03196000805160206120108339815191526108a86107a6565b6001600160a01b03166108b961116b565b6001600160a01b031614806108d75750426108d561044d61116b565b115b6108f35760405162461bcd60e51b815260040161047290611c94565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526000939092909183018282801561097f5780601f106109545761010080835404028352916020019161097f565b820191906000526020600020905b81548152906001019060200180831161096257829003601f168201915b505050505090508484600391906109979291906117ef565b5084846040516109a8929190611a85565b6040518091039020816040516109be9190611a95565b60405180910390206109ce61116b565b6001600160a01b03167f46fc935c3fa417ca2b48f402b8c148aca59d0380ae964496652bd20b0a322b1260405160405180910390a45050505050565b60026020526000908152604090205481565b600d60209081526000928352604080842090915290825290208054600182015460028301546003909301546001600160a01b0390921692909160ff9091169084565b6001600160801b031980610a706107a6565b6001600160a01b0316610a8161116b565b6001600160a01b03161480610a9f575042610a9d61044d61116b565b115b610abb5760405162461bcd60e51b815260040161047290611c94565b83610ad85760405162461bcd60e51b815260040161047290611e04565b60008481526002602052604090208390558284610af361116b565b6001600160a01b03167fad26b90be8a18bd2262e914f6fd4919c42f9dd6a0d07a15fa728ec603a836a8860405160405180910390a450505050565b600c6020526000908152604090205481565b6000828152600260205260409020546001600160801b031990610b616107a6565b6001600160a01b0316610b7261116b565b6001600160a01b03161480610b90575042610b8e61044d61116b565b115b610bac5760405162461bcd60e51b815260040161047290611c94565b83610bc95760405162461bcd60e51b815260040161047290611d4d565b6001600160a01b0386166000818152600160209081526040808320898452825280832088845290915290208490558490610c0161116b565b6001600160a01b03167f71b8ef6d2e182fa6ca30442059cc10398330b3e0561fd4ecc7232b62a8678cb68887604051610c3b929190611bb0565b60405180910390a4505050505050565b60008051602061201083398151915281565b6000818152600a60205260408120546001600160a01b031615610c925760405162461bcd60e51b815260040161047290611d9c565b6007546009546001600160a01b0390911690816370a08231610cb261116b565b6040518263ffffffff1660e01b8152600401610cce9190611b37565b60206040518083038186803b158015610ce657600080fd5b505afa158015610cfa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1e9190611a6d565b1015610d3c5760405162461bcd60e51b815260040161047290611bf1565b610d5d610d4761116b565b6009546001600160a01b038416919030906112e4565b600854600954600091610d6f91611344565b905060006040518060800160405280610d8661116b565b6001600160a01b039081168252602080830186905260016040808501829052600060609586018190528b8152600a8452818120875181546001600160a01b031916961695909517855586840151928501929092558581015160028501805460ff191691151591909117905593850151600390930192909255858252600b9052908120879055909150600c81610e1961116b565b6001600160a01b03166001600160a01b0316815260200190815260200160002054905081600d6000610e4961116b565b6001600160a01b039081168252602080830193909352604091820160009081208682528452828120855181546001600160a01b0319169316929092178255928401516001808301919091559184015160028201805460ff191691151591909117905560609093015160039093019290925590820190600c90610ec961116b565b6001600160a01b031681526020810191909152604001600020558286610eed61116b565b6001600160a01b03167fb362cc0e2f621ec1777c2f3d974afa045aea3c7b4bc0f4e2118af466260ccab560405160405180910390a45090949350505050565b6001600160801b0319600080516020611ff0833981519152610f4c6107a6565b6001600160a01b0316610f5d61116b565b6001600160a01b03161480610f7b575042610f7961044d61116b565b115b610f975760405162461bcd60e51b815260040161047290611c94565b60045460ff1615610fba5760405162461bcd60e51b815260040161047290611c4a565b610fcf6001600160a01b0386163085876112e4565b826001600160a01b0316856001600160a01b0316610feb61116b565b6001600160a01b03167f9ccf4a542a203e3a302cfbe38c13fdcc934a9882f80039c23c65dd5f1ee74cf2876040516110239190611ba7565b60405180910390a45050505050565b60008051602061205a83398151915281565b61104c61116b565b6001600160a01b031661105d6107a6565b6001600160a01b0316146110a6576040805162461bcd60e51b81526020600482018190526024820152600080516020611fb0833981519152604482015290519081900360640190fd5b6001600160a01b0381166110eb5760405162461bcd60e51b8152600401808060200182810382526026815260200180611f6a6026913960400191505060405180910390fd5b600080546040516001600160a01b0380851693921691600080516020611fd083398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600a6020526000908152604090208054600182015460028301546003909301546001600160a01b0390921692909160ff9091169084565b3390565b6000828211156111c6576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600080821161121d576040805162461bcd60e51b8152602060048201526018602482015277536166654d6174683a206d6f64756c6f206279207a65726f60401b604482015290519081900360640190fd5b81838161122657fe5b069392505050565b600082820183811015610602576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b6000828152600b6020908152604080832054808452600a90925280832060028101805460ff19169055600301849055519091839185917f1ca8663227a7fe9919713a01d344afbb434e234f35a3e540a6ad924f88771f3891a3505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261133e9085906114f7565b50505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f00000000000000000000000000000000000000000000000000000000000000008486600060405160200180838152602001828152602001925050506040516020818303038152906040526040518463ffffffff1660e01b815260040180846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611421578181015183820152602001611409565b50505050905090810190601f16801561144e5780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b15801561146f57600080fd5b505af1158015611483573d6000803e3d6000fd5b505050506040513d602081101561149957600080fd5b50506000838152600560205260408120546114b9908590839030906115ad565b6000858152600560205260409020549091506114d690600161122e565b6000858152600560205260409020556114ef84826115f4565b949350505050565b600061154c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116209092919063ffffffff16565b8051909150156115a85780806020019051602081101561156b57600080fd5b50516115a85760405162461bcd60e51b815260040180806020018281038252602a815260200180612030602a913960400191505060405180910390fd5b505050565b60408051602080820196909652808201949094526001600160a01b039290921660608401526080808401919091528151808403909101815260a09092019052805191012090565b604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b60606105ff84846000858561163485611745565b611685576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106116c35780518252601f1990920191602091820191016116a4565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611725576040519150601f19603f3d011682016040523d82523d6000602084013e61172a565b606091505b509150915061173a82828661174b565b979650505050505050565b3b151590565b6060831561175a575081610602565b82511561176a5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156117b457818101518382015260200161179c565b50505050905090810190601f1680156117e15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b828054600181600116156101000203166002900490600052602060002090601f016020900481019282611825576000855561186b565b82601f1061183e5782800160ff1982351617855561186b565b8280016001018555821561186b579182015b8281111561186b578235825591602001919060010190611850565b5061187792915061187b565b5090565b5b80821115611877576000815560010161187c565b6000602082840312156118a1578081fd5b813561060281611f51565b6000806000606084860312156118c0578182fd5b83356118cb81611f51565b95602085013595506040909401359392505050565b600080600080608085870312156118f5578081fd5b843561190081611f51565b966020860135965060408601359560600135945092505050565b6000806040838503121561192c578182fd5b823561193781611f51565b946020939093013593505050565b600060208284031215611956578081fd5b5035919050565b6000806040838503121561196f578182fd5b50508035926020909101359150565b600080600060608486031215611992578283fd5b505081359360208301359350604090920135919050565b6000806000606084860312156119bd578283fd5b83356119c881611f51565b92506020840135915060408401356119df81611f51565b809150509250925092565b600080602083850312156119fc578182fd5b82356001600160401b0380821115611a12578384fd5b818501915085601f830112611a25578384fd5b813581811115611a33578485fd5b866020828501011115611a44578485fd5b60209290920196919550909350505050565b600060808284031215611a67578081fd5b50919050565b600060208284031215611a7e578081fd5b5051919050565b6000828483379101908152919050565b60008251611aa7818460208701611ebb565b9190910192915050565b60008235611abe81611f51565b6001600160a01b039081168352602084013590611ada82611f51565b16602083015250604082810135908201526060918201359181019190915260800190565b81516001600160a01b03908116825260208084015190911690820152604080830151908201526060918201519181019190915260800190565b6001600160a01b0391909116815260200190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260800190565b6001600160a01b03949094168452602084019290925215156040830152606082015260800190565b901515815260200190565b90815260200190565b918252602082015260400190565b6000602082528251806020840152611bdd816040850160208701611ebb565b601f01601f19169190910160400192915050565b60208082526039908201527f52616e646f6d3a20796f7520646f206e6f74206861766520656e6f756768204c604082015278494e4b20746f20726571756573742072616e646f6d6e65737360381b606082015260800190565b6020808252602a908201527f4d696e7453686f70313135353a207468652073776565702066756e6374696f6e604082015269081a5cc81b1bd8dad95960b21b606082015260800190565b60208082526032908201527f5065726d6974436f6e74726f6c3a2073656e64657220646f6573206e6f742068604082015271185d994818481d985b1a59081c195c9b5a5d60721b606082015260800190565b60208082526041908201527f52616e646f6d3a20796f75206d6179206f6e6c7920696e74657270726574207460408201527f686520726573756c7473206f6620612066756c66696c6c6564207265717565736060820152601d60fa1b608082015260a00190565b6020808252602f908201527f5065726d6974436f6e74726f6c3a20796f75206d6179206e6f74206772616e7460408201526e081d1a19481e995c9bc81c9a59da1d608a1b606082015260800190565b60208082526042908201527f52616e646f6d3a2072616e646f6d6e6573732068617320616c7265616479206260408201527f65656e2067656e65726174656420666f72207468652073706563696669656420606082015261125160f21b608082015260a00190565b6020808252603f908201527f5065726d6974436f6e74726f6c3a20796f75206d6179206e6f7420737065636960408201527f66792061206d616e6167657220666f7220746865207a65726f20726967687400606082015260800190565b6020808252603a908201527f52616e646f6d3a207468657265206d757374206265206174206c65617374206f6040820152796e6520706f737369626c652076616c756520696e2072616e676560301b606082015260800190565b60005b83811015611ed6578181015183820152602001611ebe565b8381111561133e5750506000910152565b80546001600160a01b0319166001600160a01b0392909216919091179055565b8135611f1281611f51565b611f1c8183611ee7565b506020820135611f2b81611f51565b611f388160018401611ee7565b5060408201356002820155606082013560038201555050565b6001600160a01b0381168114611f6657600080fd5b5056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373efa425e0e493cbbeeed2833ecbc426ad9e567110edb11951c74d293f99a420164f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0305f9d04da14abed356cd8eddf1c22de3798f6aa89fa84e82f3bcb1ba154e2d834f20e6ae6d069bcc92958b85b3aa1b02bea14493f076a8fed65b8fead1ac4305361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565646625e2f374c647f88374842c743f0477afa0fbc30859239546e538a6f21d9fc5a26469706673582212204c7cc3229f188302fe5cc8cc1f4c2bafc914b348a965fb772a2490833d050bf264736f6c634300070600334f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573738be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e00000000000000000000000004237c8ae1b27581e86c809093c6e39c664b9beef00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952000000000000000000000000514910771af9ca656af840dff83e8264ecf986caaa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af4450000000000000000000000000000000000000000000000001bc16d674ec80000000000000000000000000000000000000000000000000000000000000000000652616e646f6d0000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061016a5760003560e01c806306fdde031461016f57806317f5ebb41461018d5780631abd5b7d146101a25780631b2df8501461018d5780632ed83f78146101b7578063483ba44e146101cc5780634b96f25e146101df57806354fd4d50146101f257806366a0e54d146101fa578063715018a61461020d57806375cc557a146102155780638b6a3cfc1461021d5780638da5cb5b1461022557806394985ddd1461023a5780639c3feeb71461024d5780639d57137f14610265578063a625776e1461026d578063af2fd15f14610275578063c47f002714610288578063c5b16c591461029b578063c7da8558146102ae578063cc2af308146102d1578063cc8e8204146102e4578063cf64d4c2146102f7578063d069a7ea1461030a578063d4ce545a14610312578063dc2c256f14610325578063e581cd7f14610338578063f2fde38b14610340578063f70dd8f814610353575b600080fd5b610177610366565b6040516101849190611bbe565b60405180910390f35b6101956103f4565b6040516101849190611ba7565b6101b56101b0366004611a56565b610400565b005b6101bf61052f565b6040516101849190611b9c565b6101956101da3660046118ac565b610538565b6101956101ed36600461197e565b61055b565b610195610609565b6101956102083660046118ac565b61060e565b6101b5610641565b6101b56106db565b610195610794565b61022d6107a6565b6040516101849190611b37565b6101b561024836600461195d565b6107b5565b610255610840565b6040516101849493929190611b4b565b61019561085f565b610195610871565b610195610283366004611945565b610876565b6101b56102963660046119ea565b610888565b6101956102a9366004611945565b610a0a565b6102c16102bc36600461191a565b610a1c565b6040516101849493929190611b74565b6101b56102df36600461195d565b610a5e565b6101956102f2366004611890565b610b2e565b6101b56103053660046118e0565b610b40565b610195610c4b565b610195610320366004611945565b610c5d565b6101b56103333660046119a9565b610f2c565b610195611032565b6101b561034e366004611890565b611044565b6102c1610361366004611945565b611134565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103ec5780601f106103c1576101008083540402835291602001916103ec565b820191906000526020600020905b8154815290600101906020018083116103cf57829003601f168201915b505050505081565b6001600160801b031981565b6001600160801b031960008051602061205a8339815191526104206107a6565b6001600160a01b031661043161116b565b6001600160a01b0316148061045657504261045461044d61116b565b848461060e565b115b61047b5760405162461bcd60e51b815260040161047290611c94565b60405180910390fd5b60408051608081018252600680546001600160a01b0390811683526007541660208301526008549282019290925260095460608201529084906104be8282611f07565b50506040516104ce908590611ab1565b6040518091039020816040516104e49190611afe565b60405180910390206104f461116b565b6001600160a01b03167f4e5f4f61c46c4bae5e64c04dcb520822f1d5e9b2f0bd8748026781edad03a55e60405160405180910390a450505050565b60045460ff1681565b600160209081526000938452604080852082529284528284209052825290205481565b600082821161057c5760405162461bcd60e51b815260040161047290611e61565b6000848152600a60205260409020546001600160a01b0316158015906105b457506000848152600a602052604090206002015460ff16155b6105d05760405162461bcd60e51b815260040161047290611ce6565b6105ff836105f96105e1858361116f565b6000888152600a6020526040902060030154906111cc565b9061122e565b90505b9392505050565b600190565b6001600160a01b038316600090815260016020908152604080832085845282528083208484529091529020549392505050565b61064961116b565b6001600160a01b031661065a6107a6565b6001600160a01b0316146106a3576040805162461bcd60e51b81526020600482018190526024820152600080516020611fb0833981519152604482015290519081900360640190fd5b600080546040516001600160a01b0390911690600080516020611fd0833981519152908390a3600080546001600160a01b0319169055565b6001600160801b0319600080516020611f908339815191526106fb6107a6565b6001600160a01b031661070c61116b565b6001600160a01b0316148061072a57504261072861044d61116b565b115b6107465760405162461bcd60e51b815260040161047290611c94565b6004805460ff1916600117905561075b61116b565b6001600160a01b03167f566bf2f7f55514125b614cf69d186b37b3f88823adabb810d2b8164544fb3cfb60405160405180910390a25050565b600080516020611f9083398151915281565b6000546001600160a01b031690565b336001600160a01b037f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb79521614610832576040805162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c00604482015290519081900360640190fd5b61083c8282611286565b5050565b6006546007546008546009546001600160a01b03938416939092169184565b600080516020611ff083398151915281565b600081565b600b6020526000908152604090205481565b6001600160801b03196000805160206120108339815191526108a86107a6565b6001600160a01b03166108b961116b565b6001600160a01b031614806108d75750426108d561044d61116b565b115b6108f35760405162461bcd60e51b815260040161047290611c94565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526000939092909183018282801561097f5780601f106109545761010080835404028352916020019161097f565b820191906000526020600020905b81548152906001019060200180831161096257829003601f168201915b505050505090508484600391906109979291906117ef565b5084846040516109a8929190611a85565b6040518091039020816040516109be9190611a95565b60405180910390206109ce61116b565b6001600160a01b03167f46fc935c3fa417ca2b48f402b8c148aca59d0380ae964496652bd20b0a322b1260405160405180910390a45050505050565b60026020526000908152604090205481565b600d60209081526000928352604080842090915290825290208054600182015460028301546003909301546001600160a01b0390921692909160ff9091169084565b6001600160801b031980610a706107a6565b6001600160a01b0316610a8161116b565b6001600160a01b03161480610a9f575042610a9d61044d61116b565b115b610abb5760405162461bcd60e51b815260040161047290611c94565b83610ad85760405162461bcd60e51b815260040161047290611e04565b60008481526002602052604090208390558284610af361116b565b6001600160a01b03167fad26b90be8a18bd2262e914f6fd4919c42f9dd6a0d07a15fa728ec603a836a8860405160405180910390a450505050565b600c6020526000908152604090205481565b6000828152600260205260409020546001600160801b031990610b616107a6565b6001600160a01b0316610b7261116b565b6001600160a01b03161480610b90575042610b8e61044d61116b565b115b610bac5760405162461bcd60e51b815260040161047290611c94565b83610bc95760405162461bcd60e51b815260040161047290611d4d565b6001600160a01b0386166000818152600160209081526040808320898452825280832088845290915290208490558490610c0161116b565b6001600160a01b03167f71b8ef6d2e182fa6ca30442059cc10398330b3e0561fd4ecc7232b62a8678cb68887604051610c3b929190611bb0565b60405180910390a4505050505050565b60008051602061201083398151915281565b6000818152600a60205260408120546001600160a01b031615610c925760405162461bcd60e51b815260040161047290611d9c565b6007546009546001600160a01b0390911690816370a08231610cb261116b565b6040518263ffffffff1660e01b8152600401610cce9190611b37565b60206040518083038186803b158015610ce657600080fd5b505afa158015610cfa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1e9190611a6d565b1015610d3c5760405162461bcd60e51b815260040161047290611bf1565b610d5d610d4761116b565b6009546001600160a01b038416919030906112e4565b600854600954600091610d6f91611344565b905060006040518060800160405280610d8661116b565b6001600160a01b039081168252602080830186905260016040808501829052600060609586018190528b8152600a8452818120875181546001600160a01b031916961695909517855586840151928501929092558581015160028501805460ff191691151591909117905593850151600390930192909255858252600b9052908120879055909150600c81610e1961116b565b6001600160a01b03166001600160a01b0316815260200190815260200160002054905081600d6000610e4961116b565b6001600160a01b039081168252602080830193909352604091820160009081208682528452828120855181546001600160a01b0319169316929092178255928401516001808301919091559184015160028201805460ff191691151591909117905560609093015160039093019290925590820190600c90610ec961116b565b6001600160a01b031681526020810191909152604001600020558286610eed61116b565b6001600160a01b03167fb362cc0e2f621ec1777c2f3d974afa045aea3c7b4bc0f4e2118af466260ccab560405160405180910390a45090949350505050565b6001600160801b0319600080516020611ff0833981519152610f4c6107a6565b6001600160a01b0316610f5d61116b565b6001600160a01b03161480610f7b575042610f7961044d61116b565b115b610f975760405162461bcd60e51b815260040161047290611c94565b60045460ff1615610fba5760405162461bcd60e51b815260040161047290611c4a565b610fcf6001600160a01b0386163085876112e4565b826001600160a01b0316856001600160a01b0316610feb61116b565b6001600160a01b03167f9ccf4a542a203e3a302cfbe38c13fdcc934a9882f80039c23c65dd5f1ee74cf2876040516110239190611ba7565b60405180910390a45050505050565b60008051602061205a83398151915281565b61104c61116b565b6001600160a01b031661105d6107a6565b6001600160a01b0316146110a6576040805162461bcd60e51b81526020600482018190526024820152600080516020611fb0833981519152604482015290519081900360640190fd5b6001600160a01b0381166110eb5760405162461bcd60e51b8152600401808060200182810382526026815260200180611f6a6026913960400191505060405180910390fd5b600080546040516001600160a01b0380851693921691600080516020611fd083398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600a6020526000908152604090208054600182015460028301546003909301546001600160a01b0390921692909160ff9091169084565b3390565b6000828211156111c6576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600080821161121d576040805162461bcd60e51b8152602060048201526018602482015277536166654d6174683a206d6f64756c6f206279207a65726f60401b604482015290519081900360640190fd5b81838161122657fe5b069392505050565b600082820183811015610602576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b6000828152600b6020908152604080832054808452600a90925280832060028101805460ff19169055600301849055519091839185917f1ca8663227a7fe9919713a01d344afbb434e234f35a3e540a6ad924f88771f3891a3505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261133e9085906114f7565b50505050565b60007f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316634000aea07f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb79528486600060405160200180838152602001828152602001925050506040516020818303038152906040526040518463ffffffff1660e01b815260040180846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611421578181015183820152602001611409565b50505050905090810190601f16801561144e5780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b15801561146f57600080fd5b505af1158015611483573d6000803e3d6000fd5b505050506040513d602081101561149957600080fd5b50506000838152600560205260408120546114b9908590839030906115ad565b6000858152600560205260409020549091506114d690600161122e565b6000858152600560205260409020556114ef84826115f4565b949350505050565b600061154c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116209092919063ffffffff16565b8051909150156115a85780806020019051602081101561156b57600080fd5b50516115a85760405162461bcd60e51b815260040180806020018281038252602a815260200180612030602a913960400191505060405180910390fd5b505050565b60408051602080820196909652808201949094526001600160a01b039290921660608401526080808401919091528151808403909101815260a09092019052805191012090565b604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b60606105ff84846000858561163485611745565b611685576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106116c35780518252601f1990920191602091820191016116a4565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611725576040519150601f19603f3d011682016040523d82523d6000602084013e61172a565b606091505b509150915061173a82828661174b565b979650505050505050565b3b151590565b6060831561175a575081610602565b82511561176a5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156117b457818101518382015260200161179c565b50505050905090810190601f1680156117e15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b828054600181600116156101000203166002900490600052602060002090601f016020900481019282611825576000855561186b565b82601f1061183e5782800160ff1982351617855561186b565b8280016001018555821561186b579182015b8281111561186b578235825591602001919060010190611850565b5061187792915061187b565b5090565b5b80821115611877576000815560010161187c565b6000602082840312156118a1578081fd5b813561060281611f51565b6000806000606084860312156118c0578182fd5b83356118cb81611f51565b95602085013595506040909401359392505050565b600080600080608085870312156118f5578081fd5b843561190081611f51565b966020860135965060408601359560600135945092505050565b6000806040838503121561192c578182fd5b823561193781611f51565b946020939093013593505050565b600060208284031215611956578081fd5b5035919050565b6000806040838503121561196f578182fd5b50508035926020909101359150565b600080600060608486031215611992578283fd5b505081359360208301359350604090920135919050565b6000806000606084860312156119bd578283fd5b83356119c881611f51565b92506020840135915060408401356119df81611f51565b809150509250925092565b600080602083850312156119fc578182fd5b82356001600160401b0380821115611a12578384fd5b818501915085601f830112611a25578384fd5b813581811115611a33578485fd5b866020828501011115611a44578485fd5b60209290920196919550909350505050565b600060808284031215611a67578081fd5b50919050565b600060208284031215611a7e578081fd5b5051919050565b6000828483379101908152919050565b60008251611aa7818460208701611ebb565b9190910192915050565b60008235611abe81611f51565b6001600160a01b039081168352602084013590611ada82611f51565b16602083015250604082810135908201526060918201359181019190915260800190565b81516001600160a01b03908116825260208084015190911690820152604080830151908201526060918201519181019190915260800190565b6001600160a01b0391909116815260200190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260800190565b6001600160a01b03949094168452602084019290925215156040830152606082015260800190565b901515815260200190565b90815260200190565b918252602082015260400190565b6000602082528251806020840152611bdd816040850160208701611ebb565b601f01601f19169190910160400192915050565b60208082526039908201527f52616e646f6d3a20796f7520646f206e6f74206861766520656e6f756768204c604082015278494e4b20746f20726571756573742072616e646f6d6e65737360381b606082015260800190565b6020808252602a908201527f4d696e7453686f70313135353a207468652073776565702066756e6374696f6e604082015269081a5cc81b1bd8dad95960b21b606082015260800190565b60208082526032908201527f5065726d6974436f6e74726f6c3a2073656e64657220646f6573206e6f742068604082015271185d994818481d985b1a59081c195c9b5a5d60721b606082015260800190565b60208082526041908201527f52616e646f6d3a20796f75206d6179206f6e6c7920696e74657270726574207460408201527f686520726573756c7473206f6620612066756c66696c6c6564207265717565736060820152601d60fa1b608082015260a00190565b6020808252602f908201527f5065726d6974436f6e74726f6c3a20796f75206d6179206e6f74206772616e7460408201526e081d1a19481e995c9bc81c9a59da1d608a1b606082015260800190565b60208082526042908201527f52616e646f6d3a2072616e646f6d6e6573732068617320616c7265616479206260408201527f65656e2067656e65726174656420666f72207468652073706563696669656420606082015261125160f21b608082015260a00190565b6020808252603f908201527f5065726d6974436f6e74726f6c3a20796f75206d6179206e6f7420737065636960408201527f66792061206d616e6167657220666f7220746865207a65726f20726967687400606082015260800190565b6020808252603a908201527f52616e646f6d3a207468657265206d757374206265206174206c65617374206f6040820152796e6520706f737369626c652076616c756520696e2072616e676560301b606082015260800190565b60005b83811015611ed6578181015183820152602001611ebe565b8381111561133e5750506000910152565b80546001600160a01b0319166001600160a01b0392909216919091179055565b8135611f1281611f51565b611f1c8183611ee7565b506020820135611f2b81611f51565b611f388160018401611ee7565b5060408201356002820155606082013560038201555050565b6001600160a01b0381168114611f6657600080fd5b5056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373efa425e0e493cbbeeed2833ecbc426ad9e567110edb11951c74d293f99a420164f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0305f9d04da14abed356cd8eddf1c22de3798f6aa89fa84e82f3bcb1ba154e2d834f20e6ae6d069bcc92958b85b3aa1b02bea14493f076a8fed65b8fead1ac4305361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565646625e2f374c647f88374842c743f0477afa0fbc30859239546e538a6f21d9fc5a26469706673582212204c7cc3229f188302fe5cc8cc1f4c2bafc914b348a965fb772a2490833d050bf264736f6c63430007060033

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

0000000000000000000000004237c8ae1b27581e86c809093c6e39c664b9beef00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952000000000000000000000000514910771af9ca656af840dff83e8264ecf986caaa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af4450000000000000000000000000000000000000000000000001bc16d674ec80000000000000000000000000000000000000000000000000000000000000000000652616e646f6d0000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _owner (address): 0x4237c8Ae1B27581e86c809093C6E39C664B9BEEF
Arg [1] : _name (string): Random
Arg [2] : _chainlink (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000004237c8ae1b27581e86c809093c6e39c664b9beef
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952
Arg [3] : 000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
Arg [4] : aa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af445
Arg [5] : 0000000000000000000000000000000000000000000000001bc16d674ec80000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [7] : 52616e646f6d0000000000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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