Address Contract Partially Verified
Address
0x0c8160dB95e31292522aDB1AD1958eA1dbCf2b19
Balance
0 ETH
Nonce
1
Code Size
2038 bytes
Creator
0x69539C1c...4768 at tx 0xd72a5f3a...16bde6
Indexed Transactions
0
Contract Bytecode
2038 bytes
0x608060405234801561000f575f80fd5b506004361061009b575f3560e01c80637cb64759116100635780637cb6475914610140578063c884ef8314610153578063d4e8be8314610172578063f84b903e14610185578063fc0c546a1461018e575f80fd5b80632eb4a7ab1461009f5780633d13f874146100bb5780634cf088d9146100d05780636b8357ac146100fb5780636bb6126e1461010e575b5f80fd5b6100a860025481565b6040519081526020015b60405180910390f35b6100ce6100c9366004610644565b6101a0565b005b6001546100e3906001600160a01b031681565b6040516001600160a01b0390911681526020016100b2565b6100ce6101093660046106ca565b6103a0565b61013061011c3660046106f2565b60056020525f908152604090205460ff1681565b60405190151581526020016100b2565b6100ce61014e36600461070b565b610441565b6100a86101613660046106f2565b60046020525f908152604090205481565b6100ce610180366004610722565b6104aa565b6100a860035481565b5f546100e3906001600160a01b031681565b6040516bffffffffffffffffffffffff19606086901b166020820152603481018490525f906054016040516020818303038152906040528051906020012090506101ee83836002548461056d565b61022e5760405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b210383937b7b360991b604482015260640160405180910390fd5b6001600160a01b0385165f90815260046020526040812054610251908690610610565b61025b9086610760565b6001600160a01b0387165f90815260046020526040812087905560038054929350839290919061028c908490610773565b90915550505f5460015460405163095ea7b360e01b81526001600160a01b0391821660048201526024810184905291169063095ea7b3906044015f604051808303815f87803b1580156102dd575f80fd5b505af11580156102ef573d5f803e3d5ffd5b5050600154604051636e553f6560e01b8152600481018590526001600160a01b038a811660248301529091169250636e553f6591506044015f604051808303815f87803b15801561033e575f80fd5b505af1158015610350573d5f803e3d5ffd5b505060408051848152602081018590526001600160a01b038a1693507f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf792500160405180910390a2505050505050565b335f9081526005602052604090205460ff166103ce576040516282b42960e81b815260040160405180910390fd5b60405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0383169063a9059cbb906044016020604051808303815f875af1158015610418573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061043c9190610786565b505050565b335f9081526005602052604090205460ff1661046f576040516282b42960e81b815260040160405180910390fd5b60028190556040518181527f914960aef5e033ce5cae8a7992d4b7a6f0f9741227b66acb67c605b7019f8a469060200160405180910390a150565b335f9081526005602052604090205460ff166104d8576040516282b42960e81b815260040160405180910390fd5b81636578656360e01b03610512576001600160a01b0381165f908152600560205260409020805460ff19811660ff9091161517905561052b565b6040516302bfa98160e41b815260040160405180910390fd5b6040516001600160a01b038216815282907f8fef588b5fc1afbf5b2f06c1a435d513f208da2e6704c3d8f0e0ec91167066ba9060200160405180910390a25050565b5f81815b85811015610604575f87878381811061058c5761058c6107ac565b905060200201359050808310156105ce5760408051602081018590529081018290526060016040516020818303038152906040528051906020012092506105fb565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b50600101610571565b50909214949350505050565b5f81831061061e5781610620565b825b90505b92915050565b80356001600160a01b038116811461063f575f80fd5b919050565b5f805f8060608587031215610657575f80fd5b61066085610629565b935060208501359250604085013567ffffffffffffffff811115610682575f80fd5b8501601f81018713610692575f80fd5b803567ffffffffffffffff8111156106a8575f80fd5b8760208260051b84010111156106bc575f80fd5b949793965060200194505050565b5f80604083850312156106db575f80fd5b6106e483610629565b946020939093013593505050565b5f60208284031215610702575f80fd5b61062082610629565b5f6020828403121561071b575f80fd5b5035919050565b5f8060408385031215610733575f80fd5b8235915061074360208401610629565b90509250929050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156106235761062361074c565b808201808211156106235761062361074c565b5f60208284031215610796575f80fd5b815180151581146107a5575f80fd5b9392505050565b634e487b7160e01b5f52603260045260245ffdfea2646970667358221220ffe361e27edf9c7a364d8300b54b3bed937da68cf195946ced278cc1da59d3e764736f6c634300081a0033
Verified Source Code Partial Match
Compiler: v0.8.26+commit.8a97fa7a
EVM: cancun
Optimization: Yes (200 runs)
MerkleClaimer.sol 85 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;
contract MerkleClaimer {
IERC20 public token;
IStaking public staking;
bytes32 public merkleRoot;
uint256 public distributed;
mapping(address => uint256) public claimed;
mapping(address => bool) public exec;
event File(bytes32 indexed what, address data);
event SetMerkleRoot(bytes32 root);
event Claim(address indexed user, uint256 amount, uint256 total);
error InvalidFile();
error Unauthorized();
error TransferFailed();
constructor(address _token, address _staking) {
token = IERC20(_token);
staking = IStaking(_staking);
exec[msg.sender] = true;
}
modifier auth() {
if (!exec[msg.sender]) revert Unauthorized();
_;
}
function file(bytes32 what, address data) external auth {
if (what == "exec") {
exec[data] = !exec[data];
} else {
revert InvalidFile();
}
emit File(what, data);
}
function setMerkleRoot(bytes32 root) external auth {
merkleRoot = root;
emit SetMerkleRoot(root);
}
function collect(address _token, uint256 amount) external auth {
IERC20(_token).transfer(msg.sender, amount);
}
function claim(address user, uint256 total, bytes32[] calldata proof) external {
bytes32 leaf = keccak256(abi.encodePacked(user, total));
require(verify(proof, merkleRoot, leaf), "invalid proof");
uint256 amount = total - min(total, claimed[user]);
claimed[user] = total;
distributed += amount;
token.approve(address(staking), amount);
staking.deposit(amount, user);
emit Claim(user, amount, amount);
}
function verify(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash < proofElement) {
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
}
return computedHash == root;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
interface IERC20 {
function approve(address, uint256) external;
function transfer(address, uint256) external returns (bool);
}
interface IStaking {
function deposit(uint256 amount, address to) external;
}
Read Contract
claimed 0xc884ef83 → uint256
distributed 0xf84b903e → uint256
exec 0x6bb6126e → bool
merkleRoot 0x2eb4a7ab → bytes32
staking 0x4cf088d9 → address
token 0xfc0c546a → address
Write Contract 4 functions
These functions modify contract state and require a wallet transaction to execute.
claim 0x3d13f874
address user
uint256 total
bytes32[] proof
collect 0x6b8357ac
address _token
uint256 amount
file 0xd4e8be83
bytes32 what
address data
setMerkleRoot 0x7cb64759
bytes32 root
Recent Transactions
No transactions found for this address