POL Price: $0.620789 (-0.56%)
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Payment Meth...423373132023-05-05 14:18:58588 days ago1683296338IN
0x6712D2ce...eC282044F
0 POL0.01542289313.53722202
Set Item Config423372332023-05-05 14:16:08588 days ago1683296168IN
0x6712D2ce...eC282044F
0 POL0.01869606367.62759445

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

Contract Source Code Verified (Exact Match)

Contract Name:
PaymentTracker

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
File 1 of 9 : PaymentTracker.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '../utilities/Sweepable.sol';

interface IPaymentHandler {
	function buy(
		address buyer,
		bytes32 item,
		uint256 quantity,
		bytes calldata metadata,
		IERC20 paymentMethodConfig
	) external;
}

contract PaymentTracker is Sweepable {
  using SafeERC20 for IERC20;

  // Struct to represent a payment token
  struct PaymentMethodConfig {
    AggregatorV3Interface priceOracle;
    uint8 decimals;
  }

	struct ItemConfig {
		// 8 decimals, same as chainlink price oracles
		uint256 price;
		// call this contract when a purchase occurs
		IPaymentHandler handler;
	}

  event Payment(
    address indexed buyer,
    bytes32 item,
    uint256 itemQuantity,
    uint256 paymentMethodQuantity,
    bytes metadata,
    IERC20 paymentMethod
  );

	event SetPaymentMethodConfig(
		IERC20 indexed token,
		PaymentMethodConfig config
	);

	event SetItemConfig(
		bytes32 indexed item,
		ItemConfig config
	);

  // Mapping of item id to price and config
  mapping(bytes32 => ItemConfig) public items;

	// how many items has this address purchased? item -> buyer -> quantity
	mapping(bytes32 => mapping(address => uint256)) public count;

	// Mapping of address to payment token config
	mapping(IERC20 => PaymentMethodConfig) paymentMethods;

  constructor(address payable recipient) Sweepable(recipient) {}

  function pay(
		address _buyer,
    bytes32 _item,
    uint256 _quantity,
    bytes calldata _metadata,
    IERC20 _paymentMethod
  ) external {
		// checks
		ItemConfig memory item = items[_item];

		// effects
    // Update the total quantity purchased for the item and address
    count[_item][_buyer] += _quantity;

    // Calculate the total price of the purchase
    uint256 total = getPaymentTokenQuantity(_item, _paymentMethod) * _quantity;

    // Transfer the payment token from the buyer to this contract
		_paymentMethod.safeTransferFrom(_buyer, address(this), total);

    // interactions
		if (address(item.handler) != address(0)) {
			item.handler.buy(_buyer, _item, _quantity, _metadata, _paymentMethod);
		}

    // Emit a purchase event
    emit Payment(_buyer, _item, _quantity, total, _metadata, _paymentMethod);
  }

  function setPaymentMethodConfig(IERC20 token, PaymentMethodConfig calldata _paymentMethodConfig) public onlyOwner {
    paymentMethods[token] = _paymentMethodConfig;
		emit SetPaymentMethodConfig(token, _paymentMethodConfig);
  }

  function setItemConfig(bytes32 _item, ItemConfig calldata _itemConfig) public onlyOwner {
    items[_item] = _itemConfig;
		emit SetItemConfig(_item, _itemConfig);
  }

	function getPaymentTokenQuantity(bytes32 _item, IERC20 _paymentMethod) public view returns (uint256) {

		ItemConfig memory item = items[_item];
		require(item.price > 0, "invalid item");

		require(address(_paymentMethod) != address(0), "payment token is zero address");

    PaymentMethodConfig memory paymentMethodConfig = paymentMethods[_paymentMethod];
		require(address(paymentMethodConfig.priceOracle) != address(0), "payment token config not set");
	
    uint256 paymentTokenPrice = getPaymentTokenPrice(paymentMethodConfig.priceOracle);

		return (item.price * 10 ** paymentMethodConfig.decimals) /
      paymentTokenPrice;
	}

  function getPaymentTokenPrice(AggregatorV3Interface _priceOracle) internal view returns (uint256) {
		(
			uint80 roundID,
			int256 price,
			, // uint256 startedAt
			uint256 timeStamp,
			uint80 answeredInRound
		) = _priceOracle.latestRoundData();
    require(price > 0, 'price == 0');
		require(timeStamp > 0, "round not complete");
		require(block.timestamp - timeStamp < 86400, "timestamp > 1 day old");
		require(answeredInRound >= roundID, "stale price");
    return uint256(price);
  }
}

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

interface AggregatorV3Interface {
  function decimals() external view returns (uint8);

  function description() external view returns (string memory);

  function version() external view returns (uint256);

  // getRoundData and latestRoundData should both raise "No data present"
  // if they do not have data to report, instead of returning unset values
  // which could be misinterpreted as actual reported values.
  function getRoundData(uint80 _roundId)
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

  function latestRoundData()
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );
}

File 3 of 9 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

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

File 4 of 9 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 5 of 9 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 6 of 9 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

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

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

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

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

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

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

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

File 7 of 9 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 9 of 9 : Sweepable.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

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

abstract contract Sweepable is Ownable {
    using SafeERC20 for IERC20;

    event SetSweepRecipient(address recipient);
    event SweepToken(address indexed token, uint256 amount);
    event SweepNative(uint256 amount);

    address payable private recipient;

    constructor(address payable _recipient) {
        _setSweepRecipient(_recipient);
    }

    // Sweep an ERC20 token to the recipient (public function)
    function sweepToken(IERC20 token) external {
        uint256 amount = token.balanceOf(address(this));
        token.safeTransfer(recipient, amount);
        emit SweepToken(address(token), amount);
    }

    function sweepToken(IERC20 token, uint256 amount) external {
        token.safeTransfer(recipient, amount);
        emit SweepToken(address(token), amount);
    }

    // sweep native token to the recipient (public function)
    function sweepNative() external {
        uint256 amount = address(this).balance;
        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Transfer failed.");
        emit SweepNative(amount);
    }

    function sweepNative(uint256 amount) external {
        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Transfer failed.");
        emit SweepNative(amount);
    }

    function getSweepRecipient() public view returns (address payable) {
        return recipient;
    }

    function _setSweepRecipient(address payable _recipient) internal {
        recipient = _recipient;
        emit SetSweepRecipient(recipient);
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address payable","name":"recipient","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"bytes32","name":"item","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"itemQuantity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paymentMethodQuantity","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"metadata","type":"bytes"},{"indexed":false,"internalType":"contract IERC20","name":"paymentMethod","type":"address"}],"name":"Payment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"item","type":"bytes32"},{"components":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"contract IPaymentHandler","name":"handler","type":"address"}],"indexed":false,"internalType":"struct PaymentTracker.ItemConfig","name":"config","type":"tuple"}],"name":"SetItemConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"components":[{"internalType":"contract AggregatorV3Interface","name":"priceOracle","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"indexed":false,"internalType":"struct PaymentTracker.PaymentMethodConfig","name":"config","type":"tuple"}],"name":"SetPaymentMethodConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"}],"name":"SetSweepRecipient","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SweepNative","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SweepToken","type":"event"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"address","name":"","type":"address"}],"name":"count","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_item","type":"bytes32"},{"internalType":"contract IERC20","name":"_paymentMethod","type":"address"}],"name":"getPaymentTokenQuantity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSweepRecipient","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"items","outputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"contract IPaymentHandler","name":"handler","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_buyer","type":"address"},{"internalType":"bytes32","name":"_item","type":"bytes32"},{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"bytes","name":"_metadata","type":"bytes"},{"internalType":"contract IERC20","name":"_paymentMethod","type":"address"}],"name":"pay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_item","type":"bytes32"},{"components":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"contract IPaymentHandler","name":"handler","type":"address"}],"internalType":"struct PaymentTracker.ItemConfig","name":"_itemConfig","type":"tuple"}],"name":"setItemConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"components":[{"internalType":"contract AggregatorV3Interface","name":"priceOracle","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct PaymentTracker.PaymentMethodConfig","name":"_paymentMethodConfig","type":"tuple"}],"name":"setPaymentMethodConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"sweepNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sweepNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"sweepToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"sweepToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5060405161151838038061151883398101604081905261002f916100ed565b8061003933610049565b61004281610099565b505061011d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527fccdd1baf560d2682736fa25752c8ccc0c5fc4079b245b0acf7389776308d5b1f9060200160405180910390a150565b6000602082840312156100ff57600080fd5b81516001600160a01b038116811461011657600080fd5b9392505050565b6113ec8061012c6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063985f05a01161008c578063c17133b711610066578063c17133b714610210578063c78d598514610223578063e90a182f14610234578063f2fde38b1461024757600080fd5b8063985f05a0146101ca578063ab803a76146101dd578063b7388062146101e557600080fd5b806348f343f3116100c857806348f343f31461013d57806361f4ca371461018a578063715018a61461019d5780638da5cb5b146101a557600080fd5b8063115c90f4146100ef5780631be19560146101155780633cf3a0251461012a575b600080fd5b6101026100fd366004610dd7565b61025a565b6040519081526020015b60405180910390f35b610128610123366004610e07565b6103f2565b005b610128610138366004610e24565b6104c1565b61016d61014b366004610e24565b600260205260009081526040902080546001909101546001600160a01b031682565b604080519283526001600160a01b0390911660208301520161010c565b610128610198366004610e3d565b610594565b6101286106f3565b6000546001600160a01b03165b6040516001600160a01b03909116815260200161010c565b6101286101d8366004610f01565b610707565b61012861075c565b6101026101f3366004610dd7565b600360209081526000928352604080842090915290825290205481565b61012861021e366004610f2e565b61077a565b6001546001600160a01b03166101b2565b610128610242366004610f5b565b6107e2565b610128610255366004610e07565b6107fc565b6000828152600260209081526040808320815180830190925280548083526001909101546001600160a01b031692820192909252906102cf5760405162461bcd60e51b815260206004820152600c60248201526b696e76616c6964206974656d60a01b60448201526064015b60405180910390fd5b6001600160a01b0383166103255760405162461bcd60e51b815260206004820152601d60248201527f7061796d656e7420746f6b656e206973207a65726f206164647265737300000060448201526064016102c6565b6001600160a01b03838116600090815260046020908152604091829020825180840190935254928316808352600160a01b90930460ff1690820152906103ad5760405162461bcd60e51b815260206004820152601c60248201527f7061796d656e7420746f6b656e20636f6e666967206e6f74207365740000000060448201526064016102c6565b60006103bc8260000151610875565b9050808260200151600a6103d09190611081565b84516103dc9190611090565b6103e691906110af565b93505050505b92915050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610439573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045d91906110d1565b60015490915061047a906001600160a01b03848116911683610a1d565b816001600160a01b03167ff4a44a7f605c4971a27bcecb448108e6328b7fad34fab5bff4f69377294b826d826040516104b591815260200190565b60405180910390a25050565b6001546040516000916001600160a01b03169083905b60006040518083038185875af1925050503d8060008114610514576040519150601f19603f3d011682016040523d82523d6000602084013e610519565b606091505b505090508061055d5760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b60448201526064016102c6565b6040518281527f3b381fdfc0e2729a70e8b26ae2397e9014f703a8235b557f5581c4ed47280fd29060200160405180910390a15050565b600085815260026020908152604080832081518083018352815481526001909101546001600160a01b039081168285015289855260038452828520908b16855290925282208054919287926105ea9084906110ea565b9091555060009050856105fd888561025a565b6106079190611090565b905061061e6001600160a01b038416893084610a85565b60208201516001600160a01b03161561069e5781602001516001600160a01b0316635313097a8989898989896040518763ffffffff1660e01b815260040161066b96959493929190611126565b600060405180830381600087803b15801561068557600080fd5b505af1158015610699573d6000803e3d6000fd5b505050505b876001600160a01b03167f84e727ebb9f8c2b5ae78a3b3b3327c0febc03e865b44e0c351b22eff00f2a2c28888848989896040516106e19695949392919061116b565b60405180910390a25050505050505050565b6106fb610ac3565b6107056000610b1d565b565b61070f610ac3565b6000828152600260205260409020819061072982826111cc565b905050817ff4088b3252d3b0303c48a1ba3cb90145c2a3f776fbcbb61b645e0bb6a39a3b90826040516104b591906111eb565b60015460405147916000916001600160a01b039091169083906104d7565b610782610ac3565b6001600160a01b038216600090815260046020526040902081906107a68282611228565b905050816001600160a01b03167fb7a4acba41feba4f72fd8f8f20efd32c24f8b57829e27b55b90a2e2033b2c8e8826040516104b59190611267565b60015461047a906001600160a01b03848116911683610a1d565b610804610ac3565b6001600160a01b0381166108695760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102c6565b61087281610b1d565b50565b6000806000806000856001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156108bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108df91906112be565b945094505093509350600083136109255760405162461bcd60e51b815260206004820152600a60248201526907072696365203d3d20360b41b60448201526064016102c6565b6000821161096a5760405162461bcd60e51b8152602060048201526012602482015271726f756e64206e6f7420636f6d706c65746560701b60448201526064016102c6565b62015180610978834261130e565b106109bd5760405162461bcd60e51b81526020600482015260156024820152741d1a5b595cdd185b5c080f880c4819185e481bdb19605a1b60448201526064016102c6565b8369ffffffffffffffffffff168169ffffffffffffffffffff161015610a135760405162461bcd60e51b815260206004820152600b60248201526a7374616c6520707269636560a81b60448201526064016102c6565b5090949350505050565b6040516001600160a01b038316602482015260448101829052610a8090849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b6d565b505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610abd9085906323b872dd60e01b90608401610a49565b50505050565b6000546001600160a01b031633146107055760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102c6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610bc2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c3f9092919063ffffffff16565b805190915015610a805780806020019051810190610be09190611321565b610a805760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016102c6565b6060610c4e8484600085610c58565b90505b9392505050565b606082471015610cb95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016102c6565b6001600160a01b0385163b610d105760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102c6565b600080866001600160a01b03168587604051610d2c9190611367565b60006040518083038185875af1925050503d8060008114610d69576040519150601f19603f3d011682016040523d82523d6000602084013e610d6e565b606091505b5091509150610d7e828286610d89565b979650505050505050565b60608315610d98575081610c51565b825115610da85782518084602001fd5b8160405162461bcd60e51b81526004016102c69190611383565b6001600160a01b038116811461087257600080fd5b60008060408385031215610dea57600080fd5b823591506020830135610dfc81610dc2565b809150509250929050565b600060208284031215610e1957600080fd5b8135610c5181610dc2565b600060208284031215610e3657600080fd5b5035919050565b60008060008060008060a08789031215610e5657600080fd5b8635610e6181610dc2565b95506020870135945060408701359350606087013567ffffffffffffffff80821115610e8c57600080fd5b818901915089601f830112610ea057600080fd5b813581811115610eaf57600080fd5b8a6020828501011115610ec157600080fd5b6020830195508094505050506080870135610edb81610dc2565b809150509295509295509295565b600060408284031215610efb57600080fd5b50919050565b60008060608385031215610f1457600080fd5b82359150610f258460208501610ee9565b90509250929050565b60008060608385031215610f4157600080fd5b8235610f4c81610dc2565b9150610f258460208501610ee9565b60008060408385031215610f6e57600080fd5b8235610f7981610dc2565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115610fd8578160001904821115610fbe57610fbe610f87565b80851615610fcb57918102915b93841c9390800290610fa2565b509250929050565b600082610fef575060016103ec565b81610ffc575060006103ec565b8160018114611012576002811461101c57611038565b60019150506103ec565b60ff84111561102d5761102d610f87565b50506001821b6103ec565b5060208310610133831016604e8410600b841016171561105b575081810a6103ec565b6110658383610f9d565b806000190482111561107957611079610f87565b029392505050565b6000610c5160ff841683610fe0565b60008160001904831182151516156110aa576110aa610f87565b500290565b6000826110cc57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156110e357600080fd5b5051919050565b808201808211156103ec576103ec610f87565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b600060018060a01b03808916835287602084015286604084015260a0606084015261115560a0840186886110fd565b9150808416608084015250979650505050505050565b86815285602082015284604082015260a06060820152600061119160a0830185876110fd565b905060018060a01b0383166080830152979650505050505050565b80546001600160a01b0319166001600160a01b0392909216919091179055565b8135815560208201356111de81610dc2565b610a8081600184016111ac565b8135815260408101602083013561120181610dc2565b6001600160a01b031660209290920191909152919050565b60ff8116811461087257600080fd5b813561123381610dc2565b61123d81836111ac565b50602082013561124c81611219565b815460ff60a01b191660a09190911b60ff60a01b1617905550565b60408101823561127681610dc2565b6001600160a01b03168252602083013561128f81611219565b60ff811660208401525092915050565b805169ffffffffffffffffffff811681146112b957600080fd5b919050565b600080600080600060a086880312156112d657600080fd5b6112df8661129f565b94506020860151935060408601519250606086015191506113026080870161129f565b90509295509295909350565b818103818111156103ec576103ec610f87565b60006020828403121561133357600080fd5b81518015158114610c5157600080fd5b60005b8381101561135e578181015183820152602001611346565b50506000910152565b60008251611379818460208701611343565b9190910192915050565b60208152600082518060208401526113a2816040850160208701611343565b601f01601f1916919091016040019291505056fea264697066735822122031e47a69bf324f7bd6ad40963bc9b8852ab3547450b38e5e8896909764c5ce3064736f6c63430008100033000000000000000000000000132c50a3d9439a21cc8bfadeeac06045db3a29a7

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063985f05a01161008c578063c17133b711610066578063c17133b714610210578063c78d598514610223578063e90a182f14610234578063f2fde38b1461024757600080fd5b8063985f05a0146101ca578063ab803a76146101dd578063b7388062146101e557600080fd5b806348f343f3116100c857806348f343f31461013d57806361f4ca371461018a578063715018a61461019d5780638da5cb5b146101a557600080fd5b8063115c90f4146100ef5780631be19560146101155780633cf3a0251461012a575b600080fd5b6101026100fd366004610dd7565b61025a565b6040519081526020015b60405180910390f35b610128610123366004610e07565b6103f2565b005b610128610138366004610e24565b6104c1565b61016d61014b366004610e24565b600260205260009081526040902080546001909101546001600160a01b031682565b604080519283526001600160a01b0390911660208301520161010c565b610128610198366004610e3d565b610594565b6101286106f3565b6000546001600160a01b03165b6040516001600160a01b03909116815260200161010c565b6101286101d8366004610f01565b610707565b61012861075c565b6101026101f3366004610dd7565b600360209081526000928352604080842090915290825290205481565b61012861021e366004610f2e565b61077a565b6001546001600160a01b03166101b2565b610128610242366004610f5b565b6107e2565b610128610255366004610e07565b6107fc565b6000828152600260209081526040808320815180830190925280548083526001909101546001600160a01b031692820192909252906102cf5760405162461bcd60e51b815260206004820152600c60248201526b696e76616c6964206974656d60a01b60448201526064015b60405180910390fd5b6001600160a01b0383166103255760405162461bcd60e51b815260206004820152601d60248201527f7061796d656e7420746f6b656e206973207a65726f206164647265737300000060448201526064016102c6565b6001600160a01b03838116600090815260046020908152604091829020825180840190935254928316808352600160a01b90930460ff1690820152906103ad5760405162461bcd60e51b815260206004820152601c60248201527f7061796d656e7420746f6b656e20636f6e666967206e6f74207365740000000060448201526064016102c6565b60006103bc8260000151610875565b9050808260200151600a6103d09190611081565b84516103dc9190611090565b6103e691906110af565b93505050505b92915050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610439573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045d91906110d1565b60015490915061047a906001600160a01b03848116911683610a1d565b816001600160a01b03167ff4a44a7f605c4971a27bcecb448108e6328b7fad34fab5bff4f69377294b826d826040516104b591815260200190565b60405180910390a25050565b6001546040516000916001600160a01b03169083905b60006040518083038185875af1925050503d8060008114610514576040519150601f19603f3d011682016040523d82523d6000602084013e610519565b606091505b505090508061055d5760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b60448201526064016102c6565b6040518281527f3b381fdfc0e2729a70e8b26ae2397e9014f703a8235b557f5581c4ed47280fd29060200160405180910390a15050565b600085815260026020908152604080832081518083018352815481526001909101546001600160a01b039081168285015289855260038452828520908b16855290925282208054919287926105ea9084906110ea565b9091555060009050856105fd888561025a565b6106079190611090565b905061061e6001600160a01b038416893084610a85565b60208201516001600160a01b03161561069e5781602001516001600160a01b0316635313097a8989898989896040518763ffffffff1660e01b815260040161066b96959493929190611126565b600060405180830381600087803b15801561068557600080fd5b505af1158015610699573d6000803e3d6000fd5b505050505b876001600160a01b03167f84e727ebb9f8c2b5ae78a3b3b3327c0febc03e865b44e0c351b22eff00f2a2c28888848989896040516106e19695949392919061116b565b60405180910390a25050505050505050565b6106fb610ac3565b6107056000610b1d565b565b61070f610ac3565b6000828152600260205260409020819061072982826111cc565b905050817ff4088b3252d3b0303c48a1ba3cb90145c2a3f776fbcbb61b645e0bb6a39a3b90826040516104b591906111eb565b60015460405147916000916001600160a01b039091169083906104d7565b610782610ac3565b6001600160a01b038216600090815260046020526040902081906107a68282611228565b905050816001600160a01b03167fb7a4acba41feba4f72fd8f8f20efd32c24f8b57829e27b55b90a2e2033b2c8e8826040516104b59190611267565b60015461047a906001600160a01b03848116911683610a1d565b610804610ac3565b6001600160a01b0381166108695760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102c6565b61087281610b1d565b50565b6000806000806000856001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156108bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108df91906112be565b945094505093509350600083136109255760405162461bcd60e51b815260206004820152600a60248201526907072696365203d3d20360b41b60448201526064016102c6565b6000821161096a5760405162461bcd60e51b8152602060048201526012602482015271726f756e64206e6f7420636f6d706c65746560701b60448201526064016102c6565b62015180610978834261130e565b106109bd5760405162461bcd60e51b81526020600482015260156024820152741d1a5b595cdd185b5c080f880c4819185e481bdb19605a1b60448201526064016102c6565b8369ffffffffffffffffffff168169ffffffffffffffffffff161015610a135760405162461bcd60e51b815260206004820152600b60248201526a7374616c6520707269636560a81b60448201526064016102c6565b5090949350505050565b6040516001600160a01b038316602482015260448101829052610a8090849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b6d565b505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610abd9085906323b872dd60e01b90608401610a49565b50505050565b6000546001600160a01b031633146107055760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102c6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610bc2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c3f9092919063ffffffff16565b805190915015610a805780806020019051810190610be09190611321565b610a805760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016102c6565b6060610c4e8484600085610c58565b90505b9392505050565b606082471015610cb95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016102c6565b6001600160a01b0385163b610d105760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102c6565b600080866001600160a01b03168587604051610d2c9190611367565b60006040518083038185875af1925050503d8060008114610d69576040519150601f19603f3d011682016040523d82523d6000602084013e610d6e565b606091505b5091509150610d7e828286610d89565b979650505050505050565b60608315610d98575081610c51565b825115610da85782518084602001fd5b8160405162461bcd60e51b81526004016102c69190611383565b6001600160a01b038116811461087257600080fd5b60008060408385031215610dea57600080fd5b823591506020830135610dfc81610dc2565b809150509250929050565b600060208284031215610e1957600080fd5b8135610c5181610dc2565b600060208284031215610e3657600080fd5b5035919050565b60008060008060008060a08789031215610e5657600080fd5b8635610e6181610dc2565b95506020870135945060408701359350606087013567ffffffffffffffff80821115610e8c57600080fd5b818901915089601f830112610ea057600080fd5b813581811115610eaf57600080fd5b8a6020828501011115610ec157600080fd5b6020830195508094505050506080870135610edb81610dc2565b809150509295509295509295565b600060408284031215610efb57600080fd5b50919050565b60008060608385031215610f1457600080fd5b82359150610f258460208501610ee9565b90509250929050565b60008060608385031215610f4157600080fd5b8235610f4c81610dc2565b9150610f258460208501610ee9565b60008060408385031215610f6e57600080fd5b8235610f7981610dc2565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115610fd8578160001904821115610fbe57610fbe610f87565b80851615610fcb57918102915b93841c9390800290610fa2565b509250929050565b600082610fef575060016103ec565b81610ffc575060006103ec565b8160018114611012576002811461101c57611038565b60019150506103ec565b60ff84111561102d5761102d610f87565b50506001821b6103ec565b5060208310610133831016604e8410600b841016171561105b575081810a6103ec565b6110658383610f9d565b806000190482111561107957611079610f87565b029392505050565b6000610c5160ff841683610fe0565b60008160001904831182151516156110aa576110aa610f87565b500290565b6000826110cc57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156110e357600080fd5b5051919050565b808201808211156103ec576103ec610f87565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b600060018060a01b03808916835287602084015286604084015260a0606084015261115560a0840186886110fd565b9150808416608084015250979650505050505050565b86815285602082015284604082015260a06060820152600061119160a0830185876110fd565b905060018060a01b0383166080830152979650505050505050565b80546001600160a01b0319166001600160a01b0392909216919091179055565b8135815560208201356111de81610dc2565b610a8081600184016111ac565b8135815260408101602083013561120181610dc2565b6001600160a01b031660209290920191909152919050565b60ff8116811461087257600080fd5b813561123381610dc2565b61123d81836111ac565b50602082013561124c81611219565b815460ff60a01b191660a09190911b60ff60a01b1617905550565b60408101823561127681610dc2565b6001600160a01b03168252602083013561128f81611219565b60ff811660208401525092915050565b805169ffffffffffffffffffff811681146112b957600080fd5b919050565b600080600080600060a086880312156112d657600080fd5b6112df8661129f565b94506020860151935060408601519250606086015191506113026080870161129f565b90509295509295909350565b818103818111156103ec576103ec610f87565b60006020828403121561133357600080fd5b81518015158114610c5157600080fd5b60005b8381101561135e578181015183820152602001611346565b50506000910152565b60008251611379818460208701611343565b9190910192915050565b60208152600082518060208401526113a2816040850160208701611343565b601f01601f1916919091016040019291505056fea264697066735822122031e47a69bf324f7bd6ad40963bc9b8852ab3547450b38e5e8896909764c5ce3064736f6c63430008100033

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

000000000000000000000000132c50a3d9439a21cc8bfadeeac06045db3a29a7

-----Decoded View---------------
Arg [0] : recipient (address): 0x132c50A3D9439A21Cc8BfAdEEac06045DB3a29a7

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000132c50a3d9439a21cc8bfadeeac06045db3a29a7


Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.