Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x03E34b085C52985F6a5D27243F20C84bDdc01Db4
Balance 0 ETH
Nonce 1
Code Size 7230 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

7230 bytes
0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063715018a611610066578063715018a6146101305780638da5cb5b1461013a578063e211158614610158578063e786818e14610188578063f2fde38b146101a457610093565b806312d18ed6146100985780631c1b8772146100b457806320ce64de146100e4578063562beba814610100575b600080fd5b6100b260048036038101906100ad919061123a565b6101c0565b005b6100ce60048036038101906100c99190611141565b61046d565b6040516100db91906116d1565b60405180910390f35b6100fe60048036038101906100f9919061116a565b610485565b005b61011a600480360381019061011591906111fe565b610608565b6040516101279190611579565b60405180910390f35b6101386106ec565b005b610142610774565b60405161014f9190611535565b60405180910390f35b610172600480360381019061016d9190611141565b61079d565b60405161017f9190611594565b60405180910390f35b6101a2600480360381019061019d91906111c2565b6107b5565b005b6101be60048036038101906101b99190611141565b610954565b005b6000801b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610245576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023c90611671565b60405180910390fd5b61024f8686610608565b1561028f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610286906115f1565b60405180910390fd5b60008585856040516020016102a6939291906114f8565b604051602081830303815290604052805190602001209050610349838380806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610a4c565b610388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037f90611691565b60405180910390fd5b6103928787610a63565b6103bd85858973ffffffffffffffffffffffffffffffffffffffff16610bd89092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548573ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f4766921f5c59646d22d7d266a29164c8e9623684d8dfdbd931731dfdca025238898860405161045c9291906116ec565b60405180910390a450505050505050565b60026020528060005260406000206000915090505481565b60005b82829050811015610602576105f18383838181106104cf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020028101906104e1919061176c565b60000160208101906104f39190611141565b84848481811061052c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060200281019061053e919061176c565b602001358686868681811061057c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060200281019061058e919061176c565b604001358787878181106105cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020028101906105dd919061176c565b80606001906105ec9190611715565b6101c0565b806105fb906118ce565b9050610488565b50505050565b600080610100836106199190611818565b905060006101008461062b9190611945565b90506000600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054815260200190815260200160002060008481526020019081526020016000205490506000826001901b9050808183161494505050505092915050565b6106f4610c5e565b73ffffffffffffffffffffffffffffffffffffffff16610712610774565b73ffffffffffffffffffffffffffffffffffffffff1614610768576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075f90611631565b60405180910390fd5b6107726000610c66565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60016020528060005260406000206000915090505481565b6107bd610c5e565b73ffffffffffffffffffffffffffffffffffffffff166107db610774565b73ffffffffffffffffffffffffffffffffffffffff1614610831576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082890611631565b60405180910390fd5b6001600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461088191906117c2565b9250508190555080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054818373ffffffffffffffffffffffffffffffffffffffff167fbdc375de8a677af383c6ee6f8b2027dbd231c3c47453ce81d1ce8f1bcdb722dc60405160405180910390a45050565b61095c610c5e565b73ffffffffffffffffffffffffffffffffffffffff1661097a610774565b73ffffffffffffffffffffffffffffffffffffffff16146109d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109c790611631565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a37906115d1565b60405180910390fd5b610a4981610c66565b50565b600082610a598584610d2a565b1490509392505050565b600061010082610a739190611818565b9050600061010083610a859190611945565b9050806001901b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054815260200190815260200160002060008481526020019081526020016000205417600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054815260200190815260200160002060008481526020019081526020016000208190555050505050565b610c598363a9059cbb60e01b8484604051602401610bf7929190611550565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610dc5565b505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60008082905060005b8451811015610dba576000858281518110610d77577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050808311610d9957610d928382610e8c565b9250610da6565b610da38184610e8c565b92505b508080610db2906118ce565b915050610d33565b508091505092915050565b6000610e27826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610ea39092919063ffffffff16565b9050600081511115610e875780806020019051810190610e4791906112cc565b610e86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7d906116b1565b60405180910390fd5b5b505050565b600082600052816020526040600020905092915050565b6060610eb28484600085610ebb565b90509392505050565b606082471015610f00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef790611611565b60405180910390fd5b610f0985610fcf565b610f48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3f90611651565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610f7191906114e1565b60006040518083038185875af1925050503d8060008114610fae576040519150601f19603f3d011682016040523d82523d6000602084013e610fb3565b606091505b5091509150610fc3828286610ff2565b92505050949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6060831561100257829050611052565b6000835111156110155782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104991906115af565b60405180910390fd5b9392505050565b60008135905061106881611bac565b92915050565b60008083601f84011261108057600080fd5b8235905067ffffffffffffffff81111561109957600080fd5b6020830191508360208202830111156110b157600080fd5b9250929050565b60008083601f8401126110ca57600080fd5b8235905067ffffffffffffffff8111156110e357600080fd5b6020830191508360208202830111156110fb57600080fd5b9250929050565b60008151905061111181611bc3565b92915050565b60008135905061112681611bda565b92915050565b60008135905061113b81611bf1565b92915050565b60006020828403121561115357600080fd5b600061116184828501611059565b91505092915050565b60008060006040848603121561117f57600080fd5b600061118d86828701611059565b935050602084013567ffffffffffffffff8111156111aa57600080fd5b6111b6868287016110b8565b92509250509250925092565b600080604083850312156111d557600080fd5b60006111e385828601611059565b92505060206111f485828601611117565b9150509250929050565b6000806040838503121561121157600080fd5b600061121f85828601611059565b92505060206112308582860161112c565b9150509250929050565b60008060008060008060a0878903121561125357600080fd5b600061126189828a01611059565b965050602061127289828a0161112c565b955050604061128389828a01611059565b945050606061129489828a0161112c565b935050608087013567ffffffffffffffff8111156112b157600080fd5b6112bd89828a0161106e565b92509250509295509295509295565b6000602082840312156112de57600080fd5b60006112ec84828501611102565b91505092915050565b6112fe81611849565b82525050565b61131561131082611849565b611917565b82525050565b6113248161185b565b82525050565b61133381611867565b82525050565b600061134482611790565b61134e81856117a6565b935061135e81856020860161189b565b80840191505092915050565b60006113758261179b565b61137f81856117b1565b935061138f81856020860161189b565b611398816119d4565b840191505092915050565b60006113b06026836117b1565b91506113bb826119f2565b604082019050919050565b60006113d36015836117b1565b91506113de82611a41565b602082019050919050565b60006113f66026836117b1565b915061140182611a6a565b604082019050919050565b60006114196020836117b1565b915061142482611ab9565b602082019050919050565b600061143c601d836117b1565b915061144782611ae2565b602082019050919050565b600061145f6006836117b1565b915061146a82611b0b565b602082019050919050565b6000611482600e836117b1565b915061148d82611b34565b602082019050919050565b60006114a5602a836117b1565b91506114b082611b5d565b604082019050919050565b6114c481611891565b82525050565b6114db6114d682611891565b61193b565b82525050565b60006114ed8284611339565b915081905092915050565b600061150482866114ca565b6020820191506115148285611304565b60148201915061152482846114ca565b602082019150819050949350505050565b600060208201905061154a60008301846112f5565b92915050565b600060408201905061156560008301856112f5565b61157260208301846114bb565b9392505050565b600060208201905061158e600083018461131b565b92915050565b60006020820190506115a9600083018461132a565b92915050565b600060208201905081810360008301526115c9818461136a565b905092915050565b600060208201905081810360008301526115ea816113a3565b9050919050565b6000602082019050818103600083015261160a816113c6565b9050919050565b6000602082019050818103600083015261162a816113e9565b9050919050565b6000602082019050818103600083015261164a8161140c565b9050919050565b6000602082019050818103600083015261166a8161142f565b9050919050565b6000602082019050818103600083015261168a81611452565b9050919050565b600060208201905081810360008301526116aa81611475565b9050919050565b600060208201905081810360008301526116ca81611498565b9050919050565b60006020820190506116e660008301846114bb565b92915050565b600060408201905061170160008301856114bb565b61170e60208301846114bb565b9392505050565b6000808335600160200384360303811261172e57600080fd5b80840192508235915067ffffffffffffffff82111561174c57600080fd5b60208301925060208202360383131561176457600080fd5b509250929050565b60008235600160800383360303811261178457600080fd5b80830191505092915050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b60006117cd82611891565b91506117d883611891565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561180d5761180c611976565b5b828201905092915050565b600061182382611891565b915061182e83611891565b92508261183e5761183d6119a5565b5b828204905092915050565b600061185482611871565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b838110156118b957808201518184015260208101905061189e565b838111156118c8576000848401525b50505050565b60006118d982611891565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561190c5761190b611976565b5b600182019050919050565b600061192282611929565b9050919050565b6000611934826119e5565b9050919050565b6000819050919050565b600061195082611891565b915061195b83611891565b92508261196b5761196a6119a5565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f44726f7020616c726561647920636c61696d65642e0000000000000000000000600082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f66726f7a656e0000000000000000000000000000000000000000000000000000600082015250565b7f496e76616c69642070726f6f662e000000000000000000000000000000000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b611bb581611849565b8114611bc057600080fd5b50565b611bcc8161185b565b8114611bd757600080fd5b50565b611be381611867565b8114611bee57600080fd5b50565b611bfa81611891565b8114611c0557600080fd5b5056fea264697066735822122061c87fcb96c932f911c372eb1ed402a8f94c772d72b4feecc8f92c07d89256bd64736f6c63430008040033

Verified Source Code Full Match

Compiler: v0.8.4+commit.c7e474f2 EVM: istanbul Optimization: No
Ownable.sol 68 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/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 = 0xF930EBBd05eF8b25B1797b9b2109DDC9B0d43063; // Stake DAO multisig

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

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

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

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

pragma solidity ^0.8.0;

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


contract MultiMerkleStash is Ownable {
  using SafeERC20 for IERC20;

  struct claimParam {
      address token;
      uint256 index;
      uint256 amount;
      bytes32[] merkleProof;
  }

  // environment variables for updateable merkle
  mapping(address => bytes32) public merkleRoot;
  mapping(address => uint256) public update;

  // This is a packed array of booleans.
  mapping(address => mapping(uint256 => mapping(uint256 => uint256))) private claimedBitMap;

  function isClaimed(address token, uint256 index) public view returns (bool) {
    uint256 claimedWordIndex = index / 256;
    uint256 claimedBitIndex = index % 256;
    uint256 claimedWord = claimedBitMap[token][update[token]][claimedWordIndex];
    uint256 mask = (1 << claimedBitIndex);
    return claimedWord & mask == mask;
  }

  function _setClaimed(address token, uint256 index) private {
    uint256 claimedWordIndex = index / 256;
    uint256 claimedBitIndex = index % 256;
    claimedBitMap[token][update[token]][claimedWordIndex] = claimedBitMap[token][update[token]][claimedWordIndex] | (1 << claimedBitIndex);
  }

  function claim(address token, uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) public {
    require(merkleRoot[token] != 0, 'frozen');
    require(!isClaimed(token, index), 'Drop already claimed.');

    // Verify the merkle proof.
    bytes32 node = keccak256(abi.encodePacked(index, account, amount));
    require(MerkleProof.verify(merkleProof, merkleRoot[token], node), 'Invalid proof.');

    _setClaimed(token, index);
    IERC20(token).safeTransfer(account, amount);

    emit Claimed(token, index, amount, account, update[token]);
  }

  function claimMulti(address account, claimParam[] calldata claims) external {
    for(uint256 i=0;i<claims.length;++i) {
      claim(claims[i].token, claims[i].index, account, claims[i].amount, claims[i].merkleProof);
    }
  }

  // MULTI SIG FUNCTIONS //

  function updateMerkleRoot(address token, bytes32 _merkleRoot) public onlyOwner {

    // Increment the update (simulates the clearing of the claimedBitMap)
    update[token] += 1;
    // Set the new merkle root
    merkleRoot[token] = _merkleRoot;

    emit MerkleRootUpdated(token, _merkleRoot, update[token]);
  }

  // EVENTS //
  event Claimed(address indexed token, uint256 index, uint256 amount, address indexed account, uint256 indexed update);
  event MerkleRootUpdated(address indexed token, bytes32 indexed merkleRoot, uint256 indexed update);
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
Context.sol 24 lines
// 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;
    }
}
IERC20.sol 82 lines
// 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);
}
SafeERC20.sol 99 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
MerkleProof.sol 65 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];
            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = _efficientHash(computedHash, proofElement);
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = _efficientHash(proofElement, computedHash);
            }
        }
        return computedHash;
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

Read Contract

isClaimed 0x562beba8 → bool
merkleRoot 0xe2111586 → bytes32
owner 0x8da5cb5b → address
update 0x1c1b8772 → uint256

Write Contract 5 functions

These functions modify contract state and require a wallet transaction to execute.

claim 0x12d18ed6
address token
uint256 index
address account
uint256 amount
bytes32[] merkleProof
claimMulti 0xa833da5a
address account
tuple[] claims
renounceOwnership 0x715018a6
No parameters
transferOwnership 0xf2fde38b
address newOwner
updateMerkleRoot 0xe786818e
address token
bytes32 _merkleRoot

Recent Transactions

No transactions found for this address