Address Contract Partially Verified
Address
0x95Ae3ee164f76113ffAc5D62f74f7f6454a25a48
Balance
0 ETH
Nonce
1
Code Size
8698 bytes
Creator
0xd492F0eb...6ebE at tx 0xf5811413...007a29
Indexed Transactions
0
Contract Bytecode
8698 bytes
0x6080604052600436106101bd575f3560e01c806398fb60fe116100f2578063c939f30211610092578063e1730b4611610062578063e1730b4614610628578063e29eb8361461063d578063f39ede0314610652578063f4ff78bf14610671575f80fd5b8063c939f3021461056b578063cea9d26f146105cb578063ceb19ce0146105ea578063d32521a014610609575f80fd5b80639e6021a6116100cd5780639e6021a6146104fa578063a1371de214610519578063b06a64b11461052d578063c311d0491461054c575f80fd5b806398fb60fe1461047c57806399248ea71461049b5780639afd453c146104ce575f80fd5b806353136d7b1161015d5780637ef71fd0116101385780637ef71fd0146103af57806384ef71fb146103ce5780638699a65f1461042f57806392a42d1d14610443575f80fd5b806353136d7b1461035d5780635b6beeb91461037c5780637ac1ed9d1461039b575f80fd5b8063288166ac11610198578063288166ac146102ac5780632fc5c031146102cb57806334354068146102f757806345789bf71461030c575f80fd5b80630b4df9831461023857806312065fe0146102595780632658fd0a14610280575f80fd5b366102345760045460405173ffffffffffffffffffffffffffffffffffffffff909116903480156108fc02915f818181858888f19350505050158015610205573d5f803e3d5ffd5b50604051349033907fbbbf55a6f5ae8ee75e6fb8f92a93e32841ed3055bf2139469c60bbc79a455da7905f90a3005b5f80fd5b348015610243575f80fd5b506102576102523660046118e1565b610690565b005b348015610264575f80fd5b5061026d6106a5565b6040519081526020015b60405180910390f35b34801561028b575f80fd5b5061029f61029a36600461193d565b610758565b6040516102779190611954565b3480156102b7575f80fd5b5061026d6102c636600461193d565b6107ef565b3480156102d6575f80fd5b506102ea6102e53660046119cf565b610811565b6040516102779190611a1f565b348015610302575f80fd5b5061026d60015481565b348015610317575f80fd5b506005546103389073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610277565b348015610368575f80fd5b50610257610377366004611aa2565b6108ef565b348015610387575f80fd5b5061026d610396366004611af1565b610b00565b3480156103a6575f80fd5b5061026d610b32565b3480156103ba575f80fd5b506102576103c9366004611b30565b610b4d565b3480156103d9575f80fd5b5061041f6103e8366004611b50565b5f91825260086020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6040519015158152602001610277565b34801561043a575f80fd5b5061026d5f5481565b34801561044e575f80fd5b5061041f61045d366004611b50565b600860209081525f928352604080842090915290825290205460ff1681565b348015610487575f80fd5b50610257610496366004611b7a565b610c15565b3480156104a6575f80fd5b506103387f000000000000000000000000249ca82617ec3dfb2589c4c17ab7ec9765350a1881565b3480156104d9575f80fd5b506004546103389073ffffffffffffffffffffffffffffffffffffffff1681565b348015610505575f80fd5b50610257610514366004611bc2565b610d86565b348015610524575f80fd5b5061026d610e1d565b348015610538575f80fd5b5061026d61054736600461193d565b610e2e565b348015610557575f80fd5b5061025761056636600461193d565b610e50565b348015610576575f80fd5b506105ab61058536600461193d565b60076020525f908152604090208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610277565b3480156105d6575f80fd5b506102576105e5366004611c2e565b610f69565b3480156105f5575f80fd5b50610257610604366004611c67565b611086565b348015610614575f80fd5b5061025761062336600461193d565b611120565b348015610633575f80fd5b5061026d60035481565b348015610648575f80fd5b5061026d60025481565b34801561065d575f80fd5b5061025761066c366004611d22565b611246565b34801561067c575f80fd5b5061025761068b366004611b30565b611372565b61069e85858533868661143a565b5050505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f907f000000000000000000000000249ca82617ec3dfb2589c4c17ab7ec9765350a1873ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa15801561072f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107539190611e08565b905090565b60066020525f90815260409020805461077090611e1f565b80601f016020809104026020016040519081016040528092919081815260200182805461079c90611e1f565b80156107e75780601f106107be576101008083540402835291602001916107e7565b820191905f5260205f20905b8154815290600101906020018083116107ca57829003601f168201915b505050505081565b5f6107f982610e2e565b6108016106a5565b61080b9190611e9d565b92915050565b60605f83818167ffffffffffffffff81111561082f5761082f611ec3565b604051908082528060200260200182016040528015610858578160200160208202803683370190505b5090505b818310156108e5576108b887878581811061087957610879611ef0565b90506020020135865f91825260086020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b8184815181106108ca576108ca611ef0565b9115156020928302919091019091015260019092019161085c565b9695505050505050565b60045473ffffffffffffffffffffffffffffffffffffffff163314610975576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5665727365526577617264733a20494e56414c49445f4d41535445520000000060448201526064015b60405180910390fd5b825f036109ae576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6109b98383610b00565b5f8181526007602052604090206001015490915015610a04576040517f6b04142c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160808101825286815260208082018781525f8385018181524260608601908152878352600790945294812093518455905160018085019190915593516002840155905160039092019190915554610a5e91611f1d565b5f818155908152600660205260409020610a79838583611f79565b5083600154610a889190611f1d565b60015542600355604051610a9f908490849061208f565b604051908190038120600454868352909173ffffffffffffffffffffffffffffffffffffffff9091169087907f88d76c1aeef83d0bfdb70dfd58f6f075ebce6bc5920cad75bdf7b057200b16f1906020015b60405180910390a45050505050565b5f8282604051602001610b1492919061208f565b60405160208183030381529060405280519060200120905092915050565b5f610b3b610e1d565b610b436106a5565b6107539190611e9d565b60045473ffffffffffffffffffffffffffffffffffffffff163314610bce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5665727365526577617264733a20494e56414c49445f4d415354455200000000604482015260640161096c565b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60045473ffffffffffffffffffffffffffffffffffffffff163314610c96576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5665727365526577617264733a20494e56414c49445f4d415354455200000000604482015260640161096c565b5f610ca18383610b00565b5f818152600760205260409020600281015460018201549293509091610cc7919061209e565b600154610cd4919061209e565b6001555f858152600660205260408120610ced91611847565b5f82815260076020908152604080832083815560018101849055600281018490556003018390558783526006909152908190209051610d2c91906120b1565b60405190819003812060045460018401548352909173ffffffffffffffffffffffffffffffffffffffff9091169084907f7606640714fc488b1a59f92d275c66a7f084ec656a02157ae92bd8c36259d77c90602001610af1565b60055473ffffffffffffffffffffffffffffffffffffffff163314610e07576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5665727365526577617264733a20494e56414c49445f574f524b455200000000604482015260640161096c565b610e1586868686868661143a565b505050505050565b5f600254600154610753919061209e565b5f818152600760205260408120600281015460019091015461080b919061209e565b60045473ffffffffffffffffffffffffffffffffffffffff163314610ed1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5665727365526577617264733a20494e56414c49445f4d415354455200000000604482015260640161096c565b60045460405173ffffffffffffffffffffffffffffffffffffffff9091169082156108fc029083905f818181858888f19350505050158015610f15573d5f803e3d5ffd5b5060045460405182815273ffffffffffffffffffffffffffffffffffffffff909116907f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364906020015b60405180910390a250565b60045473ffffffffffffffffffffffffffffffffffffffff163314610fea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5665727365526577617264733a20494e56414c49445f4d415354455200000000604482015260640161096c565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301526024820183905284169063a9059cbb906044016020604051808303815f875af115801561105c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110809190612141565b50505050565b5f875b80821015611114576111098a8a848181106110a6576110a6611ef0565b905060200201358989858181106110bf576110bf611ef0565b905060200201358888868181106110d8576110d8611ef0565b90506020020135338888888181106110f2576110f2611ef0565b90506020028101906111049190612160565b61143a565b816001019150611089565b50505050505050505050565b805f03611159576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018290527f000000000000000000000000249ca82617ec3dfb2589c4c17ab7ec9765350a1873ffffffffffffffffffffffffffffffffffffffff16906323b872dd906064016020604051808303815f875af11580156111ef573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112139190612141565b5060405181815233907fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c90602001610f5e565b60055473ffffffffffffffffffffffffffffffffffffffff1633146112c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5665727365526577617264733a20494e56414c49445f574f524b455200000000604482015260640161096c565b5f895b80821015611364576113598c8c848181106112e7576112e7611ef0565b905060200201358b8b8581811061130057611300611ef0565b905060200201358a8a8681811061131957611319611ef0565b9050602002013589898781811061133257611332611ef0565b90506020020160208101906113479190611b30565b8888888181106110f2576110f2611ef0565b8160010191506112ca565b505050505050505050505050565b60045473ffffffffffffffffffffffffffffffffffffffff1633146113f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5665727365526577617264733a20494e56414c49445f4d415354455200000000604482015260640161096c565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b5f86815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915290205460ff1615156001036114a7576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051602081018790527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606086901b1691810191909152605481018590525f9060740160405160208183030381529060405280519060200120905061154e8383808060200260200160405190810160405280939291908181526020018383602002808284375f9201829052508c81526007602052604090205492508591506117999050565b6115b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f5665727365526577617264733a20494e56414c49445f50524f4f460000000000604482015260640161096c565b846002546115c29190611f1d565b60029081555f88815260076020526040902001546115e1908690611f1d565b5f88815260076020526040902060028101829055600101541015611631576040517fed3c247c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f87815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff88168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152602482018790527f000000000000000000000000249ca82617ec3dfb2589c4c17ab7ec9765350a18169063a9059cbb906044016020604051808303815f875af115801561171a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061173e9190612141565b508373ffffffffffffffffffffffffffffffffffffffff16867f4ec90e965519d92681267467f775ada5bd214aa92c0dc93d90a5e880ce9ed0268760405161178891815260200190565b60405180910390a350505050505050565b82515f908190835b8183101561183b575f8784815181106117bc576117bc611ef0565b60200260200101519050808211156118005760408051602081018390529081018390526060016040516020818303038152906040528051906020012091508161182e565b6040805160208101849052908101829052606001604051602081830303815290604052805190602001209150815b50836001019350506117a1565b90941495945050505050565b50805461185390611e1f565b5f825580601f10611862575050565b601f0160209004905f5260205f209081019061187e9190611881565b50565b5b80821115611895575f8155600101611882565b5090565b5f8083601f8401126118a9575f80fd5b50813567ffffffffffffffff8111156118c0575f80fd5b6020830191508360208260051b85010111156118da575f80fd5b9250929050565b5f805f805f608086880312156118f5575f80fd5b853594506020860135935060408601359250606086013567ffffffffffffffff811115611920575f80fd5b61192c88828901611899565b969995985093965092949392505050565b5f6020828403121561194d575f80fd5b5035919050565b602081525f82518060208401528060208501604085015e5f6040828501015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011684010191505092915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146119ca575f80fd5b919050565b5f805f604084860312156119e1575f80fd5b833567ffffffffffffffff8111156119f7575f80fd5b611a0386828701611899565b9094509250611a169050602085016119a7565b90509250925092565b602080825282518282018190525f9190848201906040850190845b81811015611a58578351151583529284019291840191600101611a3a565b50909695505050505050565b5f8083601f840112611a74575f80fd5b50813567ffffffffffffffff811115611a8b575f80fd5b6020830191508360208285010111156118da575f80fd5b5f805f8060608587031215611ab5575f80fd5b8435935060208501359250604085013567ffffffffffffffff811115611ad9575f80fd5b611ae587828801611a64565b95989497509550505050565b5f8060208385031215611b02575f80fd5b823567ffffffffffffffff811115611b18575f80fd5b611b2485828601611a64565b90969095509350505050565b5f60208284031215611b40575f80fd5b611b49826119a7565b9392505050565b5f8060408385031215611b61575f80fd5b82359150611b71602084016119a7565b90509250929050565b5f805f60408486031215611b8c575f80fd5b83359250602084013567ffffffffffffffff811115611ba9575f80fd5b611bb586828701611a64565b9497909650939450505050565b5f805f805f8060a08789031215611bd7575f80fd5b863595506020870135945060408701359350611bf5606088016119a7565b9250608087013567ffffffffffffffff811115611c10575f80fd5b611c1c89828a01611899565b979a9699509497509295939492505050565b5f805f60608486031215611c40575f80fd5b611c49846119a7565b9250611c57602085016119a7565b9150604084013590509250925092565b5f805f805f805f806080898b031215611c7e575f80fd5b883567ffffffffffffffff80821115611c95575f80fd5b611ca18c838d01611899565b909a50985060208b0135915080821115611cb9575f80fd5b611cc58c838d01611899565b909850965060408b0135915080821115611cdd575f80fd5b611ce98c838d01611899565b909650945060608b0135915080821115611d01575f80fd5b50611d0e8b828c01611899565b999c989b5096995094979396929594505050565b5f805f805f805f805f8060a08b8d031215611d3b575f80fd5b8a3567ffffffffffffffff80821115611d52575f80fd5b611d5e8e838f01611899565b909c509a5060208d0135915080821115611d76575f80fd5b611d828e838f01611899565b909a50985060408d0135915080821115611d9a575f80fd5b611da68e838f01611899565b909850965060608d0135915080821115611dbe575f80fd5b611dca8e838f01611899565b909650945060808d0135915080821115611de2575f80fd5b50611def8d828e01611899565b915080935050809150509295989b9194979a5092959850565b5f60208284031215611e18575f80fd5b5051919050565b600181811c90821680611e3357607f821691505b602082108103611e6a577f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b50919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8181035f831280158383131683831282161715611ebc57611ebc611e70565b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b8082018082111561080b5761080b611e70565b601f821115611f7457805f5260205f20601f840160051c81016020851015611f555750805b601f840160051c820191505b8181101561069e575f8155600101611f61565b505050565b67ffffffffffffffff831115611f9157611f91611ec3565b611fa583611f9f8354611e1f565b83611f30565b5f601f841160018114611ff5575f8515611fbf5750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b17835561069e565b5f838152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08716915b828110156120425786850135825560209485019460019092019101612022565b508682101561207d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555050505050565b818382375f9101908152919050565b8181038181111561080b5761080b611e70565b5f8083546120be81611e1f565b600182811680156120d6576001811461210957612135565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0084168752821515830287019450612135565b875f526020805f205f5b8581101561212c5781548a820152908401908201612113565b50505082870194505b50929695505050505050565b5f60208284031215612151575f80fd5b81518015158114611b49575f80fd5b5f8083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112612193575f80fd5b83018035915067ffffffffffffffff8211156121ad575f80fd5b6020019150600581901b36038213156118da575f80fdfea2646970667358221220941c87af718e4f2ac880c0bdc19c2356f72228bf94a9a2e08d2523b47f7bf39b64736f6c63430008190033
Verified Source Code Partial Match
Compiler: v0.8.25+commit.b61c2a91
EVM: cancun
Optimization: Yes (99999 runs)
IERC20.sol 28 lines
// SPDX-License-Identifier: -- BCOM --
pragma solidity =0.8.25;
interface IERC20 {
function transfer(
address _recipient,
uint256 _amount
)
external
returns (bool);
function transferFrom(
address _sender,
address _recipient,
uint256 _amount
)
external
returns (bool);
function balanceOf(
address _account
)
external
view
returns (uint256);
}
MerkleProof.sol 35 lines
// SPDX-License-Identifier: -- BCOM --
pragma solidity =0.8.25;
library MerkleProof {
function verify(
bytes32[] memory _proof,
bytes32 _root,
bytes32 _leaf
)
internal
pure
returns (bool)
{
uint256 i;
uint256 l = _proof.length;
bytes32 computedHash = _leaf;
while (i < l) {
bytes32 proofElement = _proof[i];
computedHash <= proofElement
? computedHash = keccak256(abi.encodePacked(computedHash, proofElement))
: computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
unchecked {
++i;
}
}
return computedHash == _root;
}
}
VerseAirdrop.sol 522 lines
// SPDX-License-Identifier: -- BCOM --
pragma solidity =0.8.25;
import "./IERC20.sol";
import "./MerkleProof.sol";
error InvalidClaim();
error InvalidAmount();
error AlreadyCreated();
error AlreadyClaimed();
/**
* @title Verse Merkle Airdrop
* @author Vitally Marinchenko
*/
contract VerseAirdrop {
uint256 public rewardsCount;
uint256 public totalRequired;
uint256 public totalCollected;
uint256 public latestRootAdded;
address public masterAccount;
address public workerAccount;
struct Reward {
bytes32 root;
uint256 total;
uint256 claimed;
uint256 created;
}
IERC20 public immutable REWARD_TOKEN;
mapping(uint256 => string) public ipfsData;
mapping(bytes32 => Reward) public rewardsData;
mapping(bytes32 => mapping(address => bool)) public hasClaimed;
modifier onlyMaster() {
require(
msg.sender == masterAccount,
"VerseRewards: INVALID_MASTER"
);
_;
}
modifier onlyWorker() {
require(
msg.sender == workerAccount,
"VerseRewards: INVALID_WORKER"
);
_;
}
event Deposit(
address indexed account,
uint256 amount
);
event Withdraw(
address indexed account,
uint256 amount
);
event NewRewards(
bytes32 indexed hash,
address indexed master,
string indexed ipfsAddress,
uint256 total
);
event Claimed(
uint256 indexed index,
address indexed account,
uint256 amount
);
event Thanks(
address indexed account,
uint256 indexed amount
);
event DestroyedRewards(
bytes32 indexed hash,
address indexed master,
string indexed ipfsAddress,
uint256 total
);
receive()
external
payable
{
payable(masterAccount).transfer(
msg.value
);
emit Thanks(
msg.sender,
msg.value
);
}
constructor(
address _rewardToken,
address _masterAccount,
address _workerAccount
) {
REWARD_TOKEN = IERC20(
_rewardToken
);
masterAccount = _masterAccount;
workerAccount = _workerAccount;
}
function createRewards(
bytes32 _root,
uint256 _total,
string calldata _ipfsAddress
)
external
onlyMaster
{
if (_total == 0) {
revert InvalidAmount();
}
bytes32 ipfsHash = getHash(
_ipfsAddress
);
if (rewardsData[ipfsHash].total > 0) {
revert AlreadyCreated();
}
rewardsData[ipfsHash] = Reward({
root: _root,
total: _total,
created: block.timestamp,
claimed: 0
});
rewardsCount =
rewardsCount + 1;
ipfsData[rewardsCount] = _ipfsAddress;
totalRequired =
totalRequired + _total;
latestRootAdded = block.timestamp;
emit NewRewards(
_root,
masterAccount,
_ipfsAddress,
_total
);
}
function destroyRewards(
uint256 _index,
string calldata ipfsAddress
)
external
onlyMaster
{
bytes32 ipfsHash = getHash(
ipfsAddress
);
Reward storage reward = rewardsData[
ipfsHash
];
totalRequired =
totalRequired - (reward.total - reward.claimed);
delete ipfsData[
_index
];
delete rewardsData[
ipfsHash
];
emit DestroyedRewards(
ipfsHash,
masterAccount,
ipfsData[_index],
reward.total
);
}
function getHash(
string calldata _ipfsAddress
)
public
pure
returns (bytes32)
{
return keccak256(
abi.encodePacked(
_ipfsAddress
)
);
}
function isClaimed(
bytes32 _hash,
address _account
)
public
view
returns (bool)
{
return hasClaimed[_hash][_account];
}
function isClaimedBulk(
bytes32[] calldata _hash,
address _account
)
external
view
returns (bool[] memory)
{
uint256 i;
uint256 l = _hash.length;
bool[] memory result = new bool[](l);
while (i < l) {
result[i] = isClaimed(
_hash[i],
_account
);
unchecked {
++i;
}
}
return result;
}
function getClaim(
bytes32 _hash,
uint256 _index,
uint256 _amount,
bytes32[] calldata _merkleProof
)
external
{
_doClaim(
_hash,
_index,
_amount,
msg.sender,
_merkleProof
);
}
function getClaimBulk(
bytes32[] calldata _hash,
uint256[] calldata _index,
uint256[] calldata _amount,
bytes32[][] calldata _merkleProof
)
external
{
uint256 i;
uint256 l = _hash.length;
while (i < l) {
_doClaim(
_hash[i],
_index[i],
_amount[i],
msg.sender,
_merkleProof[i]
);
unchecked {
++i;
}
}
}
function giveClaim(
bytes32 _hash,
uint256 _index,
uint256 _amount,
address _account,
bytes32[] calldata _merkleProof
)
external
onlyWorker
{
_doClaim(
_hash,
_index,
_amount,
_account,
_merkleProof
);
}
function giveClaimBulk(
bytes32[] calldata _hash,
uint256[] calldata _index,
uint256[] calldata _amount,
address[] calldata _account,
bytes32[][] calldata _merkleProof
)
external
onlyWorker
{
uint256 i;
uint256 l = _hash.length;
while (i < l) {
_doClaim(
_hash[i],
_index[i],
_amount[i],
_account[i],
_merkleProof[i]
);
unchecked {
++i;
}
}
}
function _doClaim(
bytes32 _hash,
uint256 _index,
uint256 _amount,
address _account,
bytes32[] calldata _merkleProof
)
private
{
if (isClaimed(_hash, _account) == true) {
revert AlreadyClaimed();
}
bytes32 node = keccak256(
abi.encodePacked(
_index,
_account,
_amount
)
);
require(
MerkleProof.verify(
_merkleProof,
rewardsData[_hash].root,
node
),
"VerseRewards: INVALID_PROOF"
);
totalCollected =
totalCollected + _amount;
rewardsData[_hash].claimed =
rewardsData[_hash].claimed + _amount;
if (rewardsData[_hash].claimed > rewardsData[_hash].total) {
revert InvalidClaim();
}
_setClaimed(
_hash,
_account
);
REWARD_TOKEN.transfer(
_account,
_amount
);
emit Claimed(
_index,
_account,
_amount
);
}
function _setClaimed(
bytes32 _hash,
address _account
)
private
{
hasClaimed[_hash][_account] = true;
}
function donateFunds(
uint256 _donationAmount
)
external
{
if (_donationAmount == 0) {
revert InvalidAmount();
}
REWARD_TOKEN.transferFrom(
msg.sender,
address(this),
_donationAmount
);
emit Deposit(
msg.sender,
_donationAmount
);
}
function withdrawEth(
uint256 _amount
)
external
onlyMaster
{
payable(
masterAccount
).transfer(
_amount
);
emit Withdraw(
masterAccount,
_amount
);
}
function changeMaster(
address _newMaster
)
external
onlyMaster
{
masterAccount = _newMaster;
}
function changeWorker(
address _newWorker
)
external
onlyMaster
{
workerAccount = _newWorker;
}
function getBalance()
public
view
returns (uint256)
{
return REWARD_TOKEN.balanceOf(
address(this)
);
}
function showRemaining(
bytes32 _hash
)
public
view
returns (uint256)
{
return rewardsData[_hash].total - rewardsData[_hash].claimed;
}
function showExcess(
bytes32 _hash
)
external
view
returns (int256)
{
return int256(getBalance()) - int256(showRemaining(_hash));
}
function showRemaining()
public
view
returns (uint256)
{
return totalRequired - totalCollected;
}
function showExcess()
external
view
returns (int256)
{
return int256(getBalance()) - int256(showRemaining());
}
function rescueTokens(
address _token,
address _target,
uint256 _amount
)
external
onlyMaster
{
IERC20(_token).transfer(
_target,
_amount
);
}
}
Read Contract
REWARD_TOKEN 0x99248ea7 → address
getBalance 0x12065fe0 → uint256
getHash 0x5b6beeb9 → bytes32
hasClaimed 0x92a42d1d → bool
ipfsData 0x2658fd0a → string
isClaimed 0x84ef71fb → bool
isClaimedBulk 0x2fc5c031 → bool[]
latestRootAdded 0xe1730b46 → uint256
masterAccount 0x9afd453c → address
rewardsCount 0x8699a65f → uint256
rewardsData 0xc939f302 → bytes32, uint256, uint256, uint256
showExcess 0x288166ac → int256
showExcess 0x7ac1ed9d → int256
showRemaining 0xa1371de2 → uint256
showRemaining 0xb06a64b1 → uint256
totalCollected 0xe29eb836 → uint256
totalRequired 0x34354068 → uint256
workerAccount 0x45789bf7 → address
Write Contract 11 functions
These functions modify contract state and require a wallet transaction to execute.
changeMaster 0xf4ff78bf
address _newMaster
changeWorker 0x7ef71fd0
address _newWorker
createRewards 0x53136d7b
bytes32 _root
uint256 _total
string _ipfsAddress
destroyRewards 0x98fb60fe
uint256 _index
string ipfsAddress
donateFunds 0xd32521a0
uint256 _donationAmount
getClaim 0x0b4df983
bytes32 _hash
uint256 _index
uint256 _amount
bytes32[] _merkleProof
getClaimBulk 0xceb19ce0
bytes32[] _hash
uint256[] _index
uint256[] _amount
bytes32[][] _merkleProof
giveClaim 0x9e6021a6
bytes32 _hash
uint256 _index
uint256 _amount
address _account
bytes32[] _merkleProof
giveClaimBulk 0xf39ede03
bytes32[] _hash
uint256[] _index
uint256[] _amount
address[] _account
bytes32[][] _merkleProof
rescueTokens 0xcea9d26f
address _token
address _target
uint256 _amount
withdrawEth 0xc311d049
uint256 _amount
Recent Transactions
No transactions found for this address