Source Code
Latest 25 from a total of 128,218 transactions
(More than 25 Pending Txns)
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
BatchDistributor
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "../interfaces/IDistributor.sol"; import "../Errors.sol"; /** * @title BatchDistributor * @author @trmaphi * @notice This contract is used to claim airdrops for multiple users in one call. */ contract BatchDistributor is ReentrancyGuard { struct BatchClaimParams { address distributorContract; bool isInit; bytes32 userVestingId; bytes proof; } event BatchClaimed(address indexed caller, address[] distributors, address recipient); constructor() { } /** * Claim for multiple airdrops * @param params BatchClaimParams[] * @param recipient address */ function batchClaim(BatchClaimParams[] calldata params, address recipient) external nonReentrant { if (params.length == 0) revert EmptyArray(); if (recipient != msg.sender) revert InvalidRecipient(); address[] memory distributors = new address[](params.length); for (uint256 i = 0; i < params.length; i++) { BatchClaimParams memory param = params[i]; distributors[i] = param.distributorContract; IDistributor distributor = IDistributor(param.distributorContract); if (param.isInit) { if (param.proof.length == 0) revert InvalidProofs(); distributor.initClaim( msg.sender, param.proof, recipient ); } else { distributor.claim( msg.sender, param.userVestingId, recipient ); } } emit BatchClaimed(msg.sender, distributors, recipient); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at, * consider using {ReentrancyGuardTransient} instead. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; error InvalidSignature(); error AlreadyClaimed(); error ZeroAddress(); error DeadlinePassed(); error InvalidProofs(); error RootHashAlreadySet(); error SlotExists(); error InvalidRecipient(); error InvalidCaller(); error VestingConfigNotSet(); error InvalidVestingConfig(); error EmptyArray(); error InvalidUserVestingId();
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; import "../Errors.sol"; interface IDistributor { function initClaim(address caller, bytes calldata proofs, address recipient) external; function claim(address caller, bytes32 userVestingId, address recipient) external; }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"EmptyArray","type":"error"},{"inputs":[],"name":"InvalidProofs","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address[]","name":"distributors","type":"address[]"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"}],"name":"BatchClaimed","type":"event"},{"inputs":[{"components":[{"internalType":"address","name":"distributorContract","type":"address"},{"internalType":"bool","name":"isInit","type":"bool"},{"internalType":"bytes32","name":"userVestingId","type":"bytes32"},{"internalType":"bytes","name":"proof","type":"bytes"}],"internalType":"struct BatchDistributor.BatchClaimParams[]","name":"params","type":"tuple[]"},{"internalType":"address","name":"recipient","type":"address"}],"name":"batchClaim","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50600160005561061e806100256000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063e55b649214610030575b600080fd5b61004361003e366004610302565b610045565b005b61004d6102bc565b600082900361006f5760405163521299a960e01b815260040160405180910390fd5b6001600160a01b038116331461009857604051634e46966960e11b815260040160405180910390fd5b60008267ffffffffffffffff8111156100b3576100b3610386565b6040519080825280602002602001820160405280156100dc578160200160208202803683370190505b50905060005b838110156102685760008585838181106100fe576100fe61039c565b905060200281019061011091906103b2565b6101199061042c565b905080600001518383815181106101325761013261039c565b6001600160a01b03909216602092830291909101820152815190820151156101e45781606001515160000361017a57604051630a57491d60e11b815260040160405180910390fd5b6060820151604051634be6737b60e11b81526001600160a01b038316916397cce6f6916101ad9133918a906004016104fb565b600060405180830381600087803b1580156101c757600080fd5b505af11580156101db573d6000803e3d6000fd5b50505050610253565b60408281015190516352f5903760e11b815233600482015260248101919091526001600160a01b03868116604483015282169063a5eb206e90606401600060405180830381600087803b15801561023a57600080fd5b505af115801561024e573d6000803e3d6000fd5b505050505b5050808061026090610564565b9150506100e2565b50336001600160a01b03167f39c2dfaead820875d25e5e9d6f3c0814a506ae1ec0594e6550567845ec502cd482846040516102a492919061058b565b60405180910390a2506102b76001600055565b505050565b6002600054036102df57604051633ee5aeb560e01b815260040160405180910390fd5b6002600055565b80356001600160a01b03811681146102fd57600080fd5b919050565b60008060006040848603121561031757600080fd5b833567ffffffffffffffff8082111561032f57600080fd5b818601915086601f83011261034357600080fd5b81358181111561035257600080fd5b8760208260051b850101111561036757600080fd5b60209283019550935061037d91860190506102e6565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60008235607e198336030181126103c857600080fd5b9190910192915050565b6040516080810167ffffffffffffffff811182821017156103f5576103f5610386565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561042457610424610386565b604052919050565b60006080823603121561043e57600080fd5b6104466103d2565b61044f836102e6565b8152602080840135801515811461046557600080fd5b8282015260408481013590830152606084013567ffffffffffffffff8082111561048e57600080fd5b9085019036601f8301126104a157600080fd5b8135818111156104b3576104b3610386565b6104c5601f8201601f191685016103fb565b915080825236848285010111156104db57600080fd5b808484018584013760009082019093019290925250606082015292915050565b600060018060a01b0380861683526020606081850152855180606086015260005b818110156105385787810183015186820160800152820161051c565b506000608082870101526080601f19601f83011686010193505050808416604084015250949350505050565b60006001820161058457634e487b7160e01b600052601160045260246000fd5b5060010190565b604080825283519082018190526000906020906060840190828701845b828110156105cd5781516001600160a01b0316845292840192908401906001016105a8565b5050506001600160a01b03949094169201919091525091905056fea26469706673582212209368bb952ddd3a3f08c9fa386315a536c44baa662609b83c4aa91ef2652a673f64736f6c63430008140033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063e55b649214610030575b600080fd5b61004361003e366004610302565b610045565b005b61004d6102bc565b600082900361006f5760405163521299a960e01b815260040160405180910390fd5b6001600160a01b038116331461009857604051634e46966960e11b815260040160405180910390fd5b60008267ffffffffffffffff8111156100b3576100b3610386565b6040519080825280602002602001820160405280156100dc578160200160208202803683370190505b50905060005b838110156102685760008585838181106100fe576100fe61039c565b905060200281019061011091906103b2565b6101199061042c565b905080600001518383815181106101325761013261039c565b6001600160a01b03909216602092830291909101820152815190820151156101e45781606001515160000361017a57604051630a57491d60e11b815260040160405180910390fd5b6060820151604051634be6737b60e11b81526001600160a01b038316916397cce6f6916101ad9133918a906004016104fb565b600060405180830381600087803b1580156101c757600080fd5b505af11580156101db573d6000803e3d6000fd5b50505050610253565b60408281015190516352f5903760e11b815233600482015260248101919091526001600160a01b03868116604483015282169063a5eb206e90606401600060405180830381600087803b15801561023a57600080fd5b505af115801561024e573d6000803e3d6000fd5b505050505b5050808061026090610564565b9150506100e2565b50336001600160a01b03167f39c2dfaead820875d25e5e9d6f3c0814a506ae1ec0594e6550567845ec502cd482846040516102a492919061058b565b60405180910390a2506102b76001600055565b505050565b6002600054036102df57604051633ee5aeb560e01b815260040160405180910390fd5b6002600055565b80356001600160a01b03811681146102fd57600080fd5b919050565b60008060006040848603121561031757600080fd5b833567ffffffffffffffff8082111561032f57600080fd5b818601915086601f83011261034357600080fd5b81358181111561035257600080fd5b8760208260051b850101111561036757600080fd5b60209283019550935061037d91860190506102e6565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60008235607e198336030181126103c857600080fd5b9190910192915050565b6040516080810167ffffffffffffffff811182821017156103f5576103f5610386565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561042457610424610386565b604052919050565b60006080823603121561043e57600080fd5b6104466103d2565b61044f836102e6565b8152602080840135801515811461046557600080fd5b8282015260408481013590830152606084013567ffffffffffffffff8082111561048e57600080fd5b9085019036601f8301126104a157600080fd5b8135818111156104b3576104b3610386565b6104c5601f8201601f191685016103fb565b915080825236848285010111156104db57600080fd5b808484018584013760009082019093019290925250606082015292915050565b600060018060a01b0380861683526020606081850152855180606086015260005b818110156105385787810183015186820160800152820161051c565b506000608082870101526080601f19601f83011686010193505050808416604084015250949350505050565b60006001820161058457634e487b7160e01b600052601160045260246000fd5b5060010190565b604080825283519082018190526000906020906060840190828701845b828110156105cd5781516001600160a01b0316845292840192908401906001016105a8565b5050506001600160a01b03949094169201919091525091905056fea26469706673582212209368bb952ddd3a3f08c9fa386315a536c44baa662609b83c4aa91ef2652a673f64736f6c63430008140033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 100.00% | $0.00135 | 1,011.5 | $1.37 |
Loading...
Loading
Loading...
Loading
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.