// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)pragmasolidity ^0.8.0;/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/interfaceIERC20{
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/eventTransfer(addressindexedfrom, addressindexed 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.
*/eventApproval(addressindexed owner, addressindexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/functiontotalSupply() externalviewreturns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/functionbalanceOf(address account) externalviewreturns (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.
*/functiontransfer(address to, uint256 amount) externalreturns (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.
*/functionallowance(address owner, address spender) externalviewreturns (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.
*/functionapprove(address spender, uint256 amount) externalreturns (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.
*/functiontransferFrom(addressfrom,
address to,
uint256 amount
) externalreturns (bool);
}
Contract Source Code
File 2 of 5: IGenericRewardDistributor.sol
// SPDX-License-Identifier: UNLICENSEDpragmasolidity >=0.5.0;import"@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IbSect, IveSect } from"./ITokens.sol";
interfaceIRewardDistributorEvents{
/// @dev Emits when a user claims tokenseventClaimed(addressindexed account, uint256 amount, boolindexed historic);
/// @dev Emits when the owner replaces the merkle rooteventRootUpdated(bytes32 oldRoot, bytes32indexed newRoot);
/// @dev Emitted from a special function after updating the root to index allocationseventTokenAllocated(addressindexed account, uint8indexed campaignId, uint256 amount);
}
interfaceIGenericRewardDistributorisIRewardDistributorEvents{
/// @dev Returns the token distributed by this contract.functiontoken() externalviewreturns (IERC20);
/// @dev Returns the current merkle root containing total claimable balancesfunctionmerkleRoot() externalviewreturns (bytes32);
/// @dev Returns the total amount of token claimed by the userfunctionclaimed(address user) externalviewreturns (uint256);
// Claim the given amount of the token to the given address. Reverts if the inputs are invalid./// @dev Claims the given amount of the token for the account. Reverts if the inputs are not a leaf in the tree/// or the total claimed amount for the account is more than the leaf amount.functionclaim(address account,
uint256 totalAmount,
bytes32[] calldata merkleProof
) external;
}
Contract Source Code
File 3 of 5: ITokens.sol
// SPDX-License-Identifier: MITpragmasolidity ^0.8.16;import { IERC20 } from"@openzeppelin/contracts/token/ERC20/IERC20.sol";
interfaceIbSectisIERC20{
// Sets the price of the lbTokens in underlying tokensfunctionsetPrice(uint256 price_) external;
// Mint new bTokens tokens to the specified addressfunctionmintTo(address to, uint256 amount) external;
// Convert bTokens to underlying tokensfunctionconvert(uint256 amount) external;
// Claim underlying tokens held by the contractfunctionclaimUnderlying(address to) external;
}
interfaceIveSectisIERC20{
functionsetVeToken(address veToken_) external;
functionmintTo(address to, uint256 amount) external;
functionconvertToLock(uint256 amount) external;
functionaddValueToLock(uint256 amount) external;
}
Contract Source Code
File 4 of 5: MerkleClaimer.sol
// SPDX-License-Identifier: MITpragmasolidity 0.8.16;import { IGenericRewardDistributor } from"./interfaces/IGenericRewardDistributor.sol";
import { OwnableWithTransfer } from"./utils/OwnableWithTransfer.sol";
// import "hardhat/console.sol";structRewardClaim {
address distributor;
uint256 amount;
bytes32[] proof;
}
/// @title MerkleClaimer/// @notice This contract claims rewards from multiple merkle distributorscontractMerkleClaimerisOwnableWithTransfer{
mapping(address=>bool) public whitelist;
/// @param merkleDistributors whitelisted reward distributorsconstructor(address[] memory merkleDistributors) OwnableWithTransfer(msg.sender) {
for (uint256 i =0; i < merkleDistributors.length; ++i) {
whitelist[merkleDistributors[i]] =true;
}
}
/// @notice whitelists a reward distributor/// @param _address the address to whitelistfunctionupdateWhitelist(address _address, bool status) externalonlyOwner{
whitelist[_address] = status;
emit UpdateWhitelist(_address, status);
}
/// @notice Claims rewards from multiple rewardDistributors./// @param account The account to claim for/// @param claims The claims to makefunctionclaim(address account, RewardClaim[] calldata claims) external{
for (uint256 i =0; i < claims.length; ++i) {
// only whitelisted distributors can be claimed fromif (!whitelist[claims[i].distributor]) revert NotWhitelisted();
IGenericRewardDistributor(claims[i].distributor).claim(
account,
claims[i].amount,
claims[i].proof
);
}
}
errorNotWhitelisted();
eventUpdateWhitelist(addressindexed _address, bool status);
}
Contract Source Code
File 5 of 5: OwnableWithTransfer.sol
// SPDX-License-Identifier: MITpragmasolidity 0.8.16;// loosely based on https://docs.synthetix.io/contracts/source/contracts/Owned/// @title OwnableWithTransfer/// @notice Contract module which provides a basic access control mechanism with/// safe ownership transfer.abstractcontractOwnableWithTransfer{
addresspublic owner;
addresspublic pendingOwner;
modifieronlyOwner() {
if (msg.sender!= owner) revert NotOwner();
_;
}
constructor(address _owner) {
if (_owner ==address(0)) revert OwnerCannotBeZero();
owner = _owner;
emit OwnershipTransferred(address(0), _owner);
}
/// @dev Init transfer of ownership of the contract to a new account (`_pendingOwner`)./// @param _pendingOwner pending owner of contract/// Can only be called by the current owner.functiontransferOwnership(address _pendingOwner) externalonlyOwner{
pendingOwner = _pendingOwner;
emit OwnershipTransferInitiated(owner, _pendingOwner);
}
/// @dev Accept transfer of ownership of the contract./// Can only be called by the pendingOwner.functionacceptOwnership() external{
if (msg.sender!= pendingOwner) revert OnlyPendingOwner();
pendingOwner =address(0);
owner = pendingOwner;
emit OwnershipTransferred(owner, pendingOwner);
}
eventOwnershipTransferInitiated(address owner, address pendingOwner);
eventOwnershipTransferred(address oldOwner, address newOwner);
errorOwnerCannotBeZero();
errorOnlyPendingOwner();
errorNotOwner();
}