ETH Price: $3,272.08 (+0.37%)
Gas: 3 Gwei

Contract

0x3342E3737732D879743f2682A3953a730ae4F47C
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Claim Match Payo...144385542022-03-22 21:31:53857 days ago1647984713IN
0x3342E373...30ae4F47C
0 ETH0.0020355452
Claim Match Payo...144361452022-03-22 12:34:05858 days ago1647952445IN
0x3342E373...30ae4F47C
0 ETH0.0009368523.9403001
Claim Match Payo...144127452022-03-18 21:04:21861 days ago1647637461IN
0x3342E373...30ae4F47C
0 ETH0.0021580960.7127082
Claim Match Payo...144109892022-03-18 14:29:38862 days ago1647613778IN
0x3342E373...30ae4F47C
0 ETH0.0024822663.41203277
Claim Match Payo...143927502022-03-15 18:17:25865 days ago1647368245IN
0x3342E373...30ae4F47C
0 ETH0.0035380190.38241737
Claim Match Payo...143759462022-03-13 3:23:40867 days ago1647141820IN
0x3342E373...30ae4F47C
0 ETH0.0013407834.25178641
Claim Match Payo...143563852022-03-10 2:29:20870 days ago1646879360IN
0x3342E373...30ae4F47C
0 ETH0.0016778242.86182959
Claim Match Payo...143547342022-03-09 20:31:43870 days ago1646857903IN
0x3342E373...30ae4F47C
0 ETH0.001627541.57622731
Claim Match Payo...143516302022-03-09 8:52:37871 days ago1646815957IN
0x3342E373...30ae4F47C
0 ETH0.0014316336.57256386
Claim Match Payo...143516202022-03-09 8:49:55871 days ago1646815795IN
0x3342E373...30ae4F47C
0 ETH0.0015665240.01843466
Claim Match Payo...143211472022-03-04 14:57:19876 days ago1646405839IN
0x3342E373...30ae4F47C
0 ETH0.0018321946.80537638
Claim Match Payo...143101412022-03-02 21:56:09877 days ago1646258169IN
0x3342E373...30ae4F47C
0 ETH0.0024887658.22349147
Claim Match Payo...142986512022-03-01 3:20:11879 days ago1646104811IN
0x3342E373...30ae4F47C
0 ETH0.0025882866.12045716
Claim Match Payo...142962102022-02-28 18:21:48880 days ago1646072508IN
0x3342E373...30ae4F47C
0 ETH0.0034897789.14996108
Claim Match Payo...142948752022-02-28 13:20:40880 days ago1646054440IN
0x3342E373...30ae4F47C
0 ETH0.001952745.68256581
Claim Match Payo...142943332022-02-28 11:21:36880 days ago1646047296IN
0x3342E373...30ae4F47C
0 ETH0.0017213543.97385521
Claim Match Payo...142943142022-02-28 11:18:15880 days ago1646047095IN
0x3342E373...30ae4F47C
0 ETH0.0015162638.7344696
Claim Match Payo...142942692022-02-28 11:06:51880 days ago1646046411IN
0x3342E373...30ae4F47C
0 ETH0.0009344823.87247291
Claim Match Payo...142939462022-02-28 9:59:00880 days ago1646042340IN
0x3342E373...30ae4F47C
0 ETH0.0014906538.08023298
Claim Match Payo...142939092022-02-28 9:50:25880 days ago1646041825IN
0x3342E373...30ae4F47C
0 ETH0.002221656.75333721
Claim Match Payo...142784472022-02-26 0:13:51882 days ago1645834431IN
0x3342E373...30ae4F47C
0 ETH0.002136654.58177067
Claim Match Payo...142778942022-02-25 22:09:07882 days ago1645826947IN
0x3342E373...30ae4F47C
0 ETH0.0028425572.61611417
Claim Match Payo...142772792022-02-25 19:56:56882 days ago1645819016IN
0x3342E373...30ae4F47C
0 ETH0.0029126874.40749536
Claim Match Payo...142769932022-02-25 18:54:02882 days ago1645815242IN
0x3342E373...30ae4F47C
0 ETH0.0024384662.29303355
Claim Match Payo...142768652022-02-25 18:26:47882 days ago1645813607IN
0x3342E373...30ae4F47C
0 ETH0.0022173451.8738416
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MatchPayouts

Compiler Version
v0.7.5+commit.eb77ed08

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 5 : MatchPayouts.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.7.5;
pragma abicoder v2;

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

/**
 * @dev This contract allows for non-custodial Gitcoin Grants match payouts. It works as follows:
 *  1. During a matching round, deploy a new instance of this contract
 *  2. Once the round is complete, Gitcoin computes the final match amounts earned by each grant
 *  3. Over the course of multiple transactions, the contract owner will set the payout mapping
 *     stored in the `payouts` variable. This maps each grant receiving address to the match amount
 *     owed, in DAI
 *  4. Once this mapping has been set for each grant, the contract owner calls `finalize()`. This
 *     sets `finalized` to `true`, and at this point the payout mapping can no longer be updated.
 *  5. Funders review the payout mapping, and if they approve they transfer their funds to this
 *     contract. This can be done with an ordinary transfer to this contract address.
 *  6. Once all funds have been transferred, the contract owner calls `enablePayouts` which lets
 *     grant owners withdraw their match payments
 *  6. Grant owners can now call `withdraw()` to have their match payout sent to their address.
 *     Anyone can call this method on behalf of a grant owner, which is useful if your Gitcoin
 *     grants address cannot call contract methods.
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *        WARNING: DO NOT SEND ANYTHING EXCEPT FOR DAI TO THIS CONTRACT OR IT WILL BE LOST!        *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 */
contract MatchPayouts {
  using SafeERC20 for IERC20;

  // ======================================= STATE VARIABLES =======================================

  /// @dev Address that can modify contract state
  address public immutable owner;

  /// @dev Address where funding comes from (Gitcoin Grants multisig)
  address public immutable funder;

  /// @dev Token used for match payouts
  IERC20 public immutable dai;

  /// @dev Convenience type used for setting inputs
  struct PayoutFields {
    address recipient; // grant receiving address
    uint256 amount; // match amount for that grant
  }

  /// @dev Maps a grant's receiving address their match amount
  mapping(address => uint256) public payouts;

  /// @dev `Waiting` for payment mapping to be set, then mapping is `Finalized`, and lastly the
  /// contract is `Funded`
  enum State {Waiting, Finalized, Funded}
  State public state = State.Waiting;

  // =========================================== EVENTS ============================================

  /// @dev Emitted when state is set to `Finalized`
  event Finalized();

  /// @dev Emitted when state is set to `Funded`
  event Funded();

  /// @dev Emitted when the funder reclaims the funds in this contract
  event FundingWithdrawn(IERC20 token, uint256 amount);

  /// @dev Emitted when a payout `amount` is added to the `recipient`'s payout total
  event PayoutAdded(address recipient, uint256 amount);

  /// @dev Emitted when a `recipient` withdraws their payout
  event PayoutClaimed(address recipient, uint256 amount);

  // ================================== CONSTRUCTOR AND MODIFIERS ==================================

  /**
   * @param _owner Address of contract owner
   * @param _funder Address of funder
   * @param _dai DAI address
   */
  constructor(
    address _owner,
    address _funder,
    IERC20 _dai
  ) {
    owner = _owner;
    funder = _funder;
    dai = _dai;
  }

  /// @dev Requires caller to be the owner
  modifier onlyOwner() {
    require(msg.sender == owner, "MatchPayouts: caller is not the owner");
    _;
  }

  /// @dev Prevents method from being called unless contract is in the specified state
  modifier requireState(State _state) {
    require(state == _state, "MatchPayouts: Not in required state");
    _;
  }

  // ======================================= PRIMARY METHODS =======================================
  // Functions are laid out in the order they will be called over the lifetime of the contract

  /**
   * @notice Set's the mapping of addresses to their match amount
   * @dev This will need to be called multiple times to prevent exceeding the block gas limit, based
   * on the number of grants
   * @param _payouts Array of `Payout`s to set
   */
  function setPayouts(PayoutFields[] calldata _payouts) external onlyOwner requireState(State.Waiting) {
    // Set each payout amount. We allow amount to be overriden in subsequent calls because this lets
    // us fix mistakes before finalizing the payout mapping
    for (uint256 i = 0; i < _payouts.length; i += 1) {
      payouts[_payouts[i].recipient] = _payouts[i].amount;
      emit PayoutAdded(_payouts[i].recipient, _payouts[i].amount);
    }
  }

  /**
   * @notice Called by the owner to signal that the payout mapping is finalized
   * @dev Once called, this cannot be reversed!
   * @dev We use an explicit method here instead of doing this as part of the `setPayouts()` method
   * to reduce the chance of accidentally setting this flag
   */
  function finalize() external onlyOwner requireState(State.Waiting) {
    state = State.Finalized;
    emit Finalized();
  }

  /**
   * @notice Enables funder to withdraw all funds
   * @dev Escape hatch, intended to be used if the payout mapping is finalized incorrectly. In this
   * case a new MatchPayouts contract can be deployed and that one will be used instead
   * @dev We trust the funder, which is why they are allowed to withdraw funds at any time
   * @param _token Address of token to withdraw from this contract
   */
  function withdrawFunding(IERC20 _token) external {
    require(msg.sender == funder, "MatchPayouts: caller is not the funder");
    uint256 _balance = _token.balanceOf(address(this));
    _token.safeTransfer(funder, _balance);
    emit FundingWithdrawn(_token, _balance);
  }

  /**
   * @notice Called by the owner to enable withdrawals of match payouts
   * @dev Once called, this cannot be reversed!
   */
  function enablePayouts() external onlyOwner requireState(State.Finalized) {
    state = State.Funded;
    emit Funded();
  }

  /**
   * @notice Withdraws funds owed to `_recipient`
   * @param _recipient Address to withdraw for
   */
  function claimMatchPayout(address _recipient) external requireState(State.Funded) {
    uint256 _amount = payouts[_recipient]; // save off amount owed
    payouts[_recipient] = 0; // clear storage to mitigate reentrancy (not likely anyway since we trust Dai)
    dai.safeTransfer(_recipient, _amount);
    emit PayoutClaimed(_recipient, _amount);
  }
}

File 2 of 5 : 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 3 of 5 : 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 5 : 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, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

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

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

        return c;
    }

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

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

        return c;
    }

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

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

        return c;
    }

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

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

File 5 of 5 : 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);
    }

    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);
            }
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_funder","type":"address"},{"internalType":"contract IERC20","name":"_dai","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[],"name":"Finalized","type":"event"},{"anonymous":false,"inputs":[],"name":"Funded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FundingWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PayoutAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PayoutClaimed","type":"event"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"claimMatchPayout","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dai","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enablePayouts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"finalize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"funder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"payouts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct MatchPayouts.PayoutFields[]","name":"_payouts","type":"tuple[]"}],"name":"setPayouts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"state","outputs":[{"internalType":"enum MatchPayouts.State","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"}],"name":"withdrawFunding","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e06040526001805460ff1916905534801561001a57600080fd5b50604051610d27380380610d2783398101604081905261003991610060565b6001600160601b0319606093841b811660805291831b821660a05290911b1660c0526100c4565b600080600060608486031215610074578283fd5b835161007f816100ac565b6020850151909350610090816100ac565b60408501519092506100a1816100ac565b809150509250925092565b6001600160a01b03811681146100c157600080fd5b50565b60805160601c60a05160601c60c05160601c610c10610117600039806103d1528061066d525080610153528061018052806102565250806102c35280610438528061046552806105205250610c106000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80638da5cb5b116100665780638da5cb5b14610111578063b038d93414610119578063c19d93fb14610121578063c1bebdf514610136578063f4b9fa75146101495761009e565b8063041ae880146100a3578063314d35c3146100c15780634bb278f3146100d657806365bcfbe7146100de5780638658b340146100fe575b600080fd5b6100ab610151565b6040516100b89190610a5a565b60405180910390f35b6100d46100cf3660046109b6565b610175565b005b6100d46102b8565b6100f16100ec3660046109b6565b610369565b6040516100b89190610b69565b6100d461010c3660046109b6565b61037b565b6100ab610436565b6100d461045a565b61012961050c565b6040516100b89190610a87565b6100d46101443660046109d2565b610515565b6100ab61066b565b7f000000000000000000000000000000000000000000000000000000000000000081565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146101c65760405162461bcd60e51b81526004016101bd90610a9b565b60405180910390fd5b6040516370a0823160e01b81526000906001600160a01b038316906370a08231906101f5903090600401610a5a565b60206040518083038186803b15801561020d57600080fd5b505afa158015610221573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102459190610a42565b905061027b6001600160a01b0383167f00000000000000000000000000000000000000000000000000000000000000008361068f565b7f4cd5d77630469c8bf31f4f713e8d3486394a520a59fb307e64509ff32008683582826040516102ac929190610a6e565b60405180910390a15050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103005760405162461bcd60e51b81526004016101bd90610ae1565b60008060015460ff16600281111561031457fe5b146103315760405162461bcd60e51b81526004016101bd90610b26565b6001805460ff1916811790556040517f6823b073d48d6e3a7d385eeb601452d680e74bb46afe3255a7d778f3a9b1768190600090a150565b60006020819052908152604090205481565b60028060015460ff16600281111561038f57fe5b146103ac5760405162461bcd60e51b81526004016101bd90610b26565b6001600160a01b0380831660009081526020819052604081208054919055906103f8907f000000000000000000000000000000000000000000000000000000000000000016848361068f565b7fec68461f5d4cc45c89e914cb8826a966c73dd35e5f97815ece0a01ffa4a025a68382604051610429929190610a6e565b60405180910390a1505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104a25760405162461bcd60e51b81526004016101bd90610ae1565b60018060015460ff1660028111156104b657fe5b146104d35760405162461bcd60e51b81526004016101bd90610b26565b6001805460ff191660021790556040517f302777af5d26fab9dd5120c5f1307c65193ebc51daf33244ada4365fab10602c90600090a150565b60015460ff1681565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461055d5760405162461bcd60e51b81526004016101bd90610ae1565b60008060015460ff16600281111561057157fe5b1461058e5760405162461bcd60e51b81526004016101bd90610b26565b60005b82811015610665578383828181106105a557fe5b905060400201602001356000808686858181106105be57fe5b6105d492602060409092020190810191506109b6565b6001600160a01b031681526020810191909152604001600020557f55dbe92aa12ba19144cfcbafdabdae28d2aab73d08354910d9edc2882aad769a84848381811061061b57fe5b61063192602060409092020190810191506109b6565b85858481811061063d57fe5b90506040020160200135604051610655929190610a6e565b60405180910390a1600101610591565b50505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526106e19084906106e6565b505050565b606061073b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166107979092919063ffffffff16565b8051909150156106e15780806020019051602081101561075a57600080fd5b50516106e15760405162461bcd60e51b815260040180806020018281038252602a815260200180610bb1602a913960400191505060405180910390fd5b60606107a684846000856107b0565b90505b9392505050565b6060824710156107f15760405162461bcd60e51b8152600401808060200182810382526026815260200180610b8b6026913960400191505060405180910390fd5b6107fa8561090c565b61084b576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061088a5780518252601f19909201916020918201910161086b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146108ec576040519150601f19603f3d011682016040523d82523d6000602084013e6108f1565b606091505b5091509150610901828286610912565b979650505050505050565b3b151590565b606083156109215750816107a9565b8251156109315782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561097b578181015183820152602001610963565b50505050905090810190601f1680156109a85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6000602082840312156109c7578081fd5b81356107a981610b72565b600080602083850312156109e4578081fd5b823567ffffffffffffffff808211156109fb578283fd5b818501915085601f830112610a0e578283fd5b813581811115610a1c578384fd5b866020604083028501011115610a30578384fd5b60209290920196919550909350505050565b600060208284031215610a53578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020810160038310610a9557fe5b91905290565b60208082526026908201527f4d617463685061796f7574733a2063616c6c6572206973206e6f742074686520604082015265333ab73232b960d11b606082015260800190565b60208082526025908201527f4d617463685061796f7574733a2063616c6c6572206973206e6f74207468652060408201526437bbb732b960d91b606082015260800190565b60208082526023908201527f4d617463685061796f7574733a204e6f7420696e20726571756972656420737460408201526261746560e81b606082015260800190565b90815260200190565b6001600160a01b0381168114610b8757600080fd5b5056fe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220e56ed6493a8e46c56fb4bbd702977a07ed0f9bc5b545ecc04a3d4e94f453cf5264736f6c63430007050033000000000000000000000000e8c904dc650e6fcb3fe39cc82b40bd897c83d8fa000000000000000000000000de21f729137c5af1b01d73af1dc21effa2b8a0d60000000000000000000000006b175474e89094c44da98b954eedeac495271d0f

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061009e5760003560e01c80638da5cb5b116100665780638da5cb5b14610111578063b038d93414610119578063c19d93fb14610121578063c1bebdf514610136578063f4b9fa75146101495761009e565b8063041ae880146100a3578063314d35c3146100c15780634bb278f3146100d657806365bcfbe7146100de5780638658b340146100fe575b600080fd5b6100ab610151565b6040516100b89190610a5a565b60405180910390f35b6100d46100cf3660046109b6565b610175565b005b6100d46102b8565b6100f16100ec3660046109b6565b610369565b6040516100b89190610b69565b6100d461010c3660046109b6565b61037b565b6100ab610436565b6100d461045a565b61012961050c565b6040516100b89190610a87565b6100d46101443660046109d2565b610515565b6100ab61066b565b7f000000000000000000000000de21f729137c5af1b01d73af1dc21effa2b8a0d681565b336001600160a01b037f000000000000000000000000de21f729137c5af1b01d73af1dc21effa2b8a0d616146101c65760405162461bcd60e51b81526004016101bd90610a9b565b60405180910390fd5b6040516370a0823160e01b81526000906001600160a01b038316906370a08231906101f5903090600401610a5a565b60206040518083038186803b15801561020d57600080fd5b505afa158015610221573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102459190610a42565b905061027b6001600160a01b0383167f000000000000000000000000de21f729137c5af1b01d73af1dc21effa2b8a0d68361068f565b7f4cd5d77630469c8bf31f4f713e8d3486394a520a59fb307e64509ff32008683582826040516102ac929190610a6e565b60405180910390a15050565b336001600160a01b037f000000000000000000000000e8c904dc650e6fcb3fe39cc82b40bd897c83d8fa16146103005760405162461bcd60e51b81526004016101bd90610ae1565b60008060015460ff16600281111561031457fe5b146103315760405162461bcd60e51b81526004016101bd90610b26565b6001805460ff1916811790556040517f6823b073d48d6e3a7d385eeb601452d680e74bb46afe3255a7d778f3a9b1768190600090a150565b60006020819052908152604090205481565b60028060015460ff16600281111561038f57fe5b146103ac5760405162461bcd60e51b81526004016101bd90610b26565b6001600160a01b0380831660009081526020819052604081208054919055906103f8907f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f16848361068f565b7fec68461f5d4cc45c89e914cb8826a966c73dd35e5f97815ece0a01ffa4a025a68382604051610429929190610a6e565b60405180910390a1505050565b7f000000000000000000000000e8c904dc650e6fcb3fe39cc82b40bd897c83d8fa81565b336001600160a01b037f000000000000000000000000e8c904dc650e6fcb3fe39cc82b40bd897c83d8fa16146104a25760405162461bcd60e51b81526004016101bd90610ae1565b60018060015460ff1660028111156104b657fe5b146104d35760405162461bcd60e51b81526004016101bd90610b26565b6001805460ff191660021790556040517f302777af5d26fab9dd5120c5f1307c65193ebc51daf33244ada4365fab10602c90600090a150565b60015460ff1681565b336001600160a01b037f000000000000000000000000e8c904dc650e6fcb3fe39cc82b40bd897c83d8fa161461055d5760405162461bcd60e51b81526004016101bd90610ae1565b60008060015460ff16600281111561057157fe5b1461058e5760405162461bcd60e51b81526004016101bd90610b26565b60005b82811015610665578383828181106105a557fe5b905060400201602001356000808686858181106105be57fe5b6105d492602060409092020190810191506109b6565b6001600160a01b031681526020810191909152604001600020557f55dbe92aa12ba19144cfcbafdabdae28d2aab73d08354910d9edc2882aad769a84848381811061061b57fe5b61063192602060409092020190810191506109b6565b85858481811061063d57fe5b90506040020160200135604051610655929190610a6e565b60405180910390a1600101610591565b50505050565b7f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f81565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526106e19084906106e6565b505050565b606061073b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166107979092919063ffffffff16565b8051909150156106e15780806020019051602081101561075a57600080fd5b50516106e15760405162461bcd60e51b815260040180806020018281038252602a815260200180610bb1602a913960400191505060405180910390fd5b60606107a684846000856107b0565b90505b9392505050565b6060824710156107f15760405162461bcd60e51b8152600401808060200182810382526026815260200180610b8b6026913960400191505060405180910390fd5b6107fa8561090c565b61084b576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061088a5780518252601f19909201916020918201910161086b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146108ec576040519150601f19603f3d011682016040523d82523d6000602084013e6108f1565b606091505b5091509150610901828286610912565b979650505050505050565b3b151590565b606083156109215750816107a9565b8251156109315782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561097b578181015183820152602001610963565b50505050905090810190601f1680156109a85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6000602082840312156109c7578081fd5b81356107a981610b72565b600080602083850312156109e4578081fd5b823567ffffffffffffffff808211156109fb578283fd5b818501915085601f830112610a0e578283fd5b813581811115610a1c578384fd5b866020604083028501011115610a30578384fd5b60209290920196919550909350505050565b600060208284031215610a53578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020810160038310610a9557fe5b91905290565b60208082526026908201527f4d617463685061796f7574733a2063616c6c6572206973206e6f742074686520604082015265333ab73232b960d11b606082015260800190565b60208082526025908201527f4d617463685061796f7574733a2063616c6c6572206973206e6f74207468652060408201526437bbb732b960d91b606082015260800190565b60208082526023908201527f4d617463685061796f7574733a204e6f7420696e20726571756972656420737460408201526261746560e81b606082015260800190565b90815260200190565b6001600160a01b0381168114610b8757600080fd5b5056fe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220e56ed6493a8e46c56fb4bbd702977a07ed0f9bc5b545ecc04a3d4e94f453cf5264736f6c63430007050033

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

000000000000000000000000e8c904dc650e6fcb3fe39cc82b40bd897c83d8fa000000000000000000000000de21f729137c5af1b01d73af1dc21effa2b8a0d60000000000000000000000006b175474e89094c44da98b954eedeac495271d0f

-----Decoded View---------------
Arg [0] : _owner (address): 0xe8c904DC650E6fCB3Fe39CC82b40bD897C83D8fa
Arg [1] : _funder (address): 0xde21F729137C5Af1b01d73aF1dC21eFfa2B8a0d6
Arg [2] : _dai (address): 0x6B175474E89094C44Da98b954EedeAC495271d0F

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000e8c904dc650e6fcb3fe39cc82b40bd897c83d8fa
Arg [1] : 000000000000000000000000de21f729137c5af1b01d73af1dc21effa2b8a0d6
Arg [2] : 0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f


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.