Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
StakingRewardDistributor
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.28;
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IStakingRewardDistributor} from "./interfaces/IStakingRewardDistributor.sol";
import {RegularDistributor} from "./RegularDistributor.sol";
/**
* @title StakingRewardDistributor
* @notice Contract for distributing rewards to stakers using Merkle proofs
*/
contract StakingRewardDistributor is
IStakingRewardDistributor,
RegularDistributor
{
using SafeERC20 for IERC20;
// Reward token
IERC20 public immutable REWARD_TOKEN;
/**
* @notice Constructor for the StakingRewardDistributor contract
* @param defaultAdmin Address that will receive the DEFAULT_ADMIN_ROLE
* @param rewardToken Address of the ERC20 token used to distribute rewards to stakers
*/
constructor(address defaultAdmin, address rewardToken) {
require(defaultAdmin != address(0), TokiZeroAddress("defaultAdmin"));
require(rewardToken != address(0), TokiZeroAddress("rewardToken"));
// Set reward token
REWARD_TOKEN = IERC20(rewardToken);
// Set up roles
_grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin);
}
function _getRewardToken() internal view override returns (IERC20) {
return REWARD_TOKEN;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
mapping(bytes32 role => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
return _roles[role].hasRole[account];
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
if (!hasRole(role, account)) {
_roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
if (hasRole(role, account)) {
_roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC-165 detection.
*/
interface IAccessControl {
/**
* @dev The `account` is missing a role.
*/
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
/**
* @dev The caller of a function is not the expected one.
*
* NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
*/
error AccessControlBadConfirmation();
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).
* Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
import {Address} from "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 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 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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).
*
* This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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).
*
* This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Address.sol)
pragma solidity ^0.8.20;
import {Errors} from "./Errors.sol";
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert Errors.InsufficientBalance(address(this).balance, amount);
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert Errors.FailedCall();
}
}
/**
* @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 or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {Errors.FailedCall} error.
*
* 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.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @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`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert Errors.InsufficientBalance(address(this).balance, value);
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
* of an unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {Errors.FailedCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
*/
function _revert(bytes memory returndata) private pure {
// 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 ("memory-safe") {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert Errors.FailedCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/Hashes.sol)
pragma solidity ^0.8.20;
/**
* @dev Library of standard hash functions.
*
* _Available since v5.1._
*/
library Hashes {
/**
* @dev Commutative Keccak256 hash of a sorted pair of bytes32. Frequently used when working with merkle proofs.
*
* NOTE: Equivalent to the `standardNodeHash` in our https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
*/
function commutativeKeccak256(bytes32 a, bytes32 b) internal pure returns (bytes32) {
return a < b ? _efficientKeccak256(a, b) : _efficientKeccak256(b, a);
}
/**
* @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory.
*/
function _efficientKeccak256(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly ("memory-safe") {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/MerkleProof.sol)
// This file was procedurally generated from scripts/generate/templates/MerkleProof.js.
pragma solidity ^0.8.20;
import {Hashes} from "./Hashes.sol";
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The tree and the proofs can be generated using our
* https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
* You will find a quickstart guide in the readme.
*
* 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.
* OpenZeppelin's JavaScript library generates Merkle trees that are safe
* against this attack out of the box.
*
* IMPORTANT: Consider memory side-effects when using custom hashing functions
* that access memory in an unsafe way.
*
* NOTE: This library supports proof verification for merkle trees built using
* custom _commutative_ hashing functions (i.e. `H(a, b) == H(b, a)`). Proving
* leaf inclusion in trees built using non-commutative hashing functions requires
* additional logic that is not supported by this library.
*/
library MerkleProof {
/**
*@dev The multiproof provided is not valid.
*/
error MerkleProofInvalidMultiproof();
/**
* @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.
*
* This version handles proofs in memory with the default hashing function.
*/
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 leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in memory with the default hashing function.
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]);
}
return computedHash;
}
/**
* @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.
*
* This version handles proofs in memory with a custom hashing function.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processProof(proof, leaf, hasher) == 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 leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in memory with a custom hashing function.
*/
function processProof(
bytes32[] memory proof,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = hasher(computedHash, proof[i]);
}
return computedHash;
}
/**
* @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.
*
* This version handles proofs in calldata with the default hashing function.
*/
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProofCalldata(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 leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in calldata with the default hashing function.
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]);
}
return computedHash;
}
/**
* @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.
*
* This version handles proofs in calldata with a custom hashing function.
*/
function verifyCalldata(
bytes32[] calldata proof,
bytes32 root,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processProofCalldata(proof, leaf, hasher) == 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 leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in calldata with a custom hashing function.
*/
function processProofCalldata(
bytes32[] calldata proof,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = hasher(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* This version handles multiproofs in memory with the default hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProof}.
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* This version handles multiproofs in memory with the default hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](proofFlagsLen);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = Hashes.commutativeKeccak256(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* This version handles multiproofs in memory with a custom hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProof}.
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processMultiProof(proof, proofFlags, leaves, hasher) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* This version handles multiproofs in memory with a custom hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](proofFlagsLen);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = hasher(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* This version handles multiproofs in calldata with the default hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProofCalldata}.
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* This version handles multiproofs in calldata with the default hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](proofFlagsLen);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = Hashes.commutativeKeccak256(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* This version handles multiproofs in calldata with a custom hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProofCalldata}.
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves, hasher) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* This version handles multiproofs in calldata with a custom hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](proofFlagsLen);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = hasher(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of common custom errors used in multiple contracts
*
* IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
* It is recommended to avoid relying on the error API for critical functionality.
*
* _Available since v5.1._
*/
library Errors {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error InsufficientBalance(uint256 balance, uint256 needed);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedCall();
/**
* @dev The deployment failed.
*/
error FailedDeployment();
/**
* @dev A necessary precompile is missing.
*/
error MissingPrecompile(address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// 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: BUSL-1.1
pragma solidity 0.8.28;
/**
* @title IRegularDistributor
* @notice Interface for the RegularDistributor abstract contract that handles distribution of rewards
* using Merkle proofs.
*/
interface IRegularDistributor {
/**
* @notice Claim struct defining the data needed to verify and process a claim
* @param account Address of the account claiming rewards
* @param amount Amount of tokens to claim
* @param merkleProof Merkle proof verifying the claim
*/
struct Claim {
address account;
uint256 amount;
bytes32[] merkleProof;
}
/**
* @notice Event emitted when the Merkle root is set or updated
*/
event MerkleRootSet(
address indexed setter,
bytes32 merkleRoot,
uint256 totalRewards
);
/**
* @notice Event emitted when a user claims rewards
*/
event Claimed(address indexed caller, uint256 amount);
/**
* @notice Set or update the Merkle root for reward distribution
* @param newMerkleRoot Merkle root containing all claim data
* @param totalRewards Total cumulative amount of rewards (in smallest token units). An incorrect value may cause distribution failures.
*/
function setMerkleRoot(
bytes32 newMerkleRoot,
uint256 totalRewards
) external;
/**
* @notice Process a reward claim
* @param claim_ Claim data containing all information needed to verify and process the claim
*/
function claim(Claim calldata claim_) external;
/**
* @notice Get the amount that has already been claimed by a user
* @param account The address of the user
* @return claimedAmount The amount that has already been claimed by the user
*/
function getAlreadyClaimed(
address account
) external view returns (uint256 claimedAmount);
/**
* @notice Verify if a claim is valid
* @param claim_ Claim data to verify
* @return valid True if the claim is valid, false otherwise
*/
function verifyClaim(
Claim calldata claim_
) external view returns (bool valid);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.28;
import {IRegularDistributor} from "./IRegularDistributor.sol";
/**
* @title IStakingRewardDistributor
* @notice Interface for the StakingRewardDistributor contract that handles distribution of staking rewards
* using Merkle proofs.
*/
interface IStakingRewardDistributor is IRegularDistributor {}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.28;
interface ITokiErrors {
error TokiZeroAddress(string message);
error TokiZeroAmount(string message);
error TokiZeroValue(string message);
// user error
error TokiInsufficientAmount(string name, uint256 value, uint256 needed);
// pool does not have enough liquidity
error TokiInsufficientPoolLiquidity(uint256 value, uint256 needed);
// insufficient allowance for transfer
error TokiInsufficientAllowance(
string name,
uint256 allowance,
uint256 needed
);
error TokiExceed(string name, uint256 value, uint256 limit);
error TokiExceedAdd(
string name,
uint256 current,
uint256 add,
uint256 limit
);
// only used in PseudoToken, which is just for Testnet
error TokiContractNotAllowed(string name, address addr);
error TokiCannotCloseChannel();
error TokiCannotTimeoutPacket();
error TokiRequireOrderedChannel();
error TokiDstOuterGasShouldBeZero();
error TokiInvalidPacketType(uint8);
error TokiInvalidRetryType(uint8);
error TokiInvalidRecipientBytes();
error TokiNoRevertReceive();
error TokiRetryExpired(uint256 expiryBlock);
error TokiInvalidAppVersion(uint256 expected, uint256 actual);
error TokiNotEnoughNativeFee(uint256 value, uint256 limit);
error TokiFailToRefund();
error TokiNoFee();
error TokiInvalidBalanceDeficitFeeZone();
error TokiInvalidSafeZoneRange(uint256 min, uint256 max);
error TokiDepeg(uint256 poolId);
error TokiUnregisteredChainId(string channel);
error TokiUnregisteredPoolId(uint256 poolId);
error TokiSamePool(uint256 poolId, address pool);
error TokiNoPool(uint256 poolId);
error TokiPoolRecvIsFailed(uint256 poolId);
error TokiPoolWithdrawConfirmIsFailed(uint256 poolId);
error TokiPriceIsNotPositive(int256 value);
error TokiPriceIsExpired(uint256 updatedAt);
error TokiDstChainIdNotAccepted(uint256 dstChainId);
error TokiTransferIsStop();
error TokiTransferIsFailed(address token, address to, uint256 value);
error TokiNativeTransferIsFailed(address to, uint256 value);
error TokiPeerPoolIsNotReady(uint256 peerChainId, uint256 peerPoolId);
error TokiSlippageTooHigh(
uint256 amountGD,
uint256 eqReward,
uint256 eqFee,
uint256 minAmountGD
);
error TokiPeerPoolIsRegistered(uint256 chainId, uint256 poolId);
error TokiPeerPoolIsAlreadyActive(uint256 chainId, uint256 poolId);
error TokiNoPeerPoolInfo();
error TokiPeerPoolInfoNotFound(uint256 chainId, uint256 poolId);
error TokiFlowRateLimitExceed(uint256 current, uint256 add, uint256 limit);
error TokiFallbackUnauthorized(address caller);
// used in mocks
error TokiMock(string message);
// channel upgrade
error TokiInvalidProposedVersion(string version);
error TokiChannelNotFound(string portId, string channelId);
// TokiToken specific errors
error TokiNotPrimaryChain();
// merkle proof verification
error TokiSaleEnded();
error TokiInvalidRound(uint256 currentRoundId);
error TokiInvalidMerkleProof();
error TokiAlreadyClaimed(uint256 windowIndex, address account);
error TokiInvalidSignature();
error TokiNonceAlreadyUsed();
error TokiUnauthorizedAccess(string message, address caller);
error TokiCooldownActive(uint256 endTime);
error TokiNotUnlocked();
error TokiAlreadyUnlocked();
error TokiInvalidRecipient(string message);
error TokiInvalidRole(string message);
error TokiNotMatch(string message, uint256 actual, uint256 expected);
error TokiNotStarted();
error TokiAlreadyStarted();
error TokiInvalidCliff();
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.28;
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {IRegularDistributor} from "./interfaces/IRegularDistributor.sol";
import {ITokiErrors} from "./interfaces/ITokiErrors.sol";
/**
* @title RegularDistributor
* @notice Abstract contract for distributing cumulative rewards using Merkle proofs
*/
abstract contract RegularDistributor is
IRegularDistributor,
ITokiErrors,
Context,
AccessControl,
ReentrancyGuard
{
using SafeERC20 for IERC20;
// Access control roles
bytes32 public constant MERKLE_ROOT_SETTER_ROLE =
keccak256("MERKLE_ROOT_SETTER_ROLE");
// Current Merkle root
// slither-disable-next-line constable-states
bytes32 public merkleRoot;
// Total claimed amount
// slither-disable-next-line constable-states
uint256 public totalClaimedAmount = 0;
// Amount claimed by each account
mapping(address => uint256) public claimedAmountByAccount;
/**
* @notice Set the merkle root for cumulative reward distributions
* @param newMerkleRoot Merkle root representing cumulative rewards for all users
* @param totalRewards Total cumulative amount of rewards (in smallest token units). An incorrect value may cause distribution failures.
*/
function setMerkleRoot(
bytes32 newMerkleRoot,
uint256 totalRewards
) external virtual onlyRole(MERKLE_ROOT_SETTER_ROLE) {
require(newMerkleRoot != bytes32(0), TokiZeroValue("newMerkleRoot"));
require(
totalRewards > totalClaimedAmount,
TokiExceed("totalClaimedAmount", totalClaimedAmount, totalRewards)
);
IERC20 token = _getRewardToken();
uint256 balance = token.balanceOf(address(this));
require(
balance >= totalRewards - totalClaimedAmount,
TokiInsufficientAmount(
"balance",
balance,
totalRewards - totalClaimedAmount
)
);
merkleRoot = newMerkleRoot;
emit MerkleRootSet(_msgSender(), merkleRoot, totalRewards);
}
/**
* @notice Get the amount that has already been claimed by a user
* @param account The address of the user
* @return claimedAmount The amount that has already been claimed by the user
*/
function getAlreadyClaimed(
address account
) external view virtual returns (uint256 claimedAmount) {
return claimedAmountByAccount[account];
}
/**
* @notice Verifies if a claim is valid according to the merkle proof
* @param claim_ Claim object to verify
* @return valid True if the claim is valid
*/
function verifyClaim(
Claim calldata claim_
) external view virtual returns (bool valid) {
return _verifyClaim(claim_);
}
/**
* @notice Process a reward claim
* @param claim_ Claim object with amount, account, and merkle proof
*/
function claim(Claim calldata claim_) public virtual nonReentrant {
uint256 claimableAmount = _claim(claim_);
// Transfer tokens
IERC20 token = _getRewardToken();
token.safeTransfer(claim_.account, claimableAmount);
emit Claimed(claim_.account, claimableAmount);
}
/**
* @notice Internal function to process claim validation and state updates
* @param claim_ Claim object with amount, account, and merkle proof
* @return claimableAmount The amount of tokens that can be claimed
*/
function _claim(Claim calldata claim_) internal virtual returns (uint256) {
// Verify claim and calculate amount
if (!_verifyClaim(claim_)) {
revert TokiInvalidMerkleProof();
}
uint256 claimableAmount = _calculateClaimableAmount(claim_);
// Verify that there is still something to claim
require(claimableAmount != 0, TokiZeroAmount("claimableAmount"));
// Check if distributor has enough balance
IERC20 token = _getRewardToken();
uint256 currentBalance = token.balanceOf(address(this));
require(
currentBalance >= claimableAmount,
TokiInsufficientAmount(
"distributor",
currentBalance,
claimableAmount
)
);
// Mark as claimed by updating the claimed amount
totalClaimedAmount += claimableAmount;
claimedAmountByAccount[claim_.account] += claimableAmount;
return claimableAmount;
}
/**
* @notice Calculate the claimable amount for a given claim
* @dev This function calculates the difference between the total claimable amount specified in the claim
* and what has already been claimed by the account. It ensures that users cannot claim more than
* their allocated amount and prevents double-claiming.
* @param claim_ Claim object with account address, total reward amount, and merkle proof
* @return The amount of tokens that can still be claimed by the account
*/
function _calculateClaimableAmount(
Claim calldata claim_
) internal view virtual returns (uint256) {
// Calculate the remaining amount based on what has already been claimed
uint256 alreadyClaimed = claimedAmountByAccount[claim_.account];
// If they've claimed more than the total amount, revert
require(
alreadyClaimed <= claim_.amount,
TokiExceed("claimedAmount", alreadyClaimed, claim_.amount)
);
// Return the difference between the total and what's been claimed
return claim_.amount - alreadyClaimed;
}
/**
* @notice Verify that a claim is valid and meets all requirements
* @param claim_ Claim object to verify
* @return valid True if the claim is valid
*/
function _verifyClaim(
Claim calldata claim_
) internal view virtual returns (bool) {
require(merkleRoot != bytes32(0), TokiZeroValue("merkleRoot"));
require(claim_.amount != 0, TokiZeroAmount("amount"));
require(claim_.account != address(0), TokiZeroAddress("account"));
// Verify merkle proof
bytes32 leaf = keccak256(
bytes.concat(keccak256(abi.encode(claim_.account, claim_.amount)))
);
return MerkleProof.verify(claim_.merkleProof, merkleRoot, leaf);
}
/**
* @notice Get the reward token used by this distributor
* @return The reward token
*/
function _getRewardToken() internal view virtual returns (IERC20);
}{
"evmVersion": "cancun",
"viaIR": true,
"optimizer": {
"enabled": true,
"runs": 1000000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"defaultAdmin","type":"address"},{"internalType":"address","name":"rewardToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"uint256","name":"windowIndex","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"TokiAlreadyClaimed","type":"error"},{"inputs":[],"name":"TokiAlreadyStarted","type":"error"},{"inputs":[],"name":"TokiAlreadyUnlocked","type":"error"},{"inputs":[],"name":"TokiCannotCloseChannel","type":"error"},{"inputs":[],"name":"TokiCannotTimeoutPacket","type":"error"},{"inputs":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"}],"name":"TokiChannelNotFound","type":"error"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"address","name":"addr","type":"address"}],"name":"TokiContractNotAllowed","type":"error"},{"inputs":[{"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"TokiCooldownActive","type":"error"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"TokiDepeg","type":"error"},{"inputs":[{"internalType":"uint256","name":"dstChainId","type":"uint256"}],"name":"TokiDstChainIdNotAccepted","type":"error"},{"inputs":[],"name":"TokiDstOuterGasShouldBeZero","type":"error"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"TokiExceed","type":"error"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"current","type":"uint256"},{"internalType":"uint256","name":"add","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"TokiExceedAdd","type":"error"},{"inputs":[],"name":"TokiFailToRefund","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"TokiFallbackUnauthorized","type":"error"},{"inputs":[{"internalType":"uint256","name":"current","type":"uint256"},{"internalType":"uint256","name":"add","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"TokiFlowRateLimitExceed","type":"error"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"TokiInsufficientAllowance","type":"error"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"TokiInsufficientAmount","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"TokiInsufficientPoolLiquidity","type":"error"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"actual","type":"uint256"}],"name":"TokiInvalidAppVersion","type":"error"},{"inputs":[],"name":"TokiInvalidBalanceDeficitFeeZone","type":"error"},{"inputs":[],"name":"TokiInvalidCliff","type":"error"},{"inputs":[],"name":"TokiInvalidMerkleProof","type":"error"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"TokiInvalidPacketType","type":"error"},{"inputs":[{"internalType":"string","name":"version","type":"string"}],"name":"TokiInvalidProposedVersion","type":"error"},{"inputs":[{"internalType":"string","name":"message","type":"string"}],"name":"TokiInvalidRecipient","type":"error"},{"inputs":[],"name":"TokiInvalidRecipientBytes","type":"error"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"TokiInvalidRetryType","type":"error"},{"inputs":[{"internalType":"string","name":"message","type":"string"}],"name":"TokiInvalidRole","type":"error"},{"inputs":[{"internalType":"uint256","name":"currentRoundId","type":"uint256"}],"name":"TokiInvalidRound","type":"error"},{"inputs":[{"internalType":"uint256","name":"min","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"TokiInvalidSafeZoneRange","type":"error"},{"inputs":[],"name":"TokiInvalidSignature","type":"error"},{"inputs":[{"internalType":"string","name":"message","type":"string"}],"name":"TokiMock","type":"error"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"TokiNativeTransferIsFailed","type":"error"},{"inputs":[],"name":"TokiNoFee","type":"error"},{"inputs":[],"name":"TokiNoPeerPoolInfo","type":"error"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"TokiNoPool","type":"error"},{"inputs":[],"name":"TokiNoRevertReceive","type":"error"},{"inputs":[],"name":"TokiNonceAlreadyUsed","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"TokiNotEnoughNativeFee","type":"error"},{"inputs":[{"internalType":"string","name":"message","type":"string"},{"internalType":"uint256","name":"actual","type":"uint256"},{"internalType":"uint256","name":"expected","type":"uint256"}],"name":"TokiNotMatch","type":"error"},{"inputs":[],"name":"TokiNotPrimaryChain","type":"error"},{"inputs":[],"name":"TokiNotStarted","type":"error"},{"inputs":[],"name":"TokiNotUnlocked","type":"error"},{"inputs":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"TokiPeerPoolInfoNotFound","type":"error"},{"inputs":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"TokiPeerPoolIsAlreadyActive","type":"error"},{"inputs":[{"internalType":"uint256","name":"peerChainId","type":"uint256"},{"internalType":"uint256","name":"peerPoolId","type":"uint256"}],"name":"TokiPeerPoolIsNotReady","type":"error"},{"inputs":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"TokiPeerPoolIsRegistered","type":"error"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"TokiPoolRecvIsFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"TokiPoolWithdrawConfirmIsFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"updatedAt","type":"uint256"}],"name":"TokiPriceIsExpired","type":"error"},{"inputs":[{"internalType":"int256","name":"value","type":"int256"}],"name":"TokiPriceIsNotPositive","type":"error"},{"inputs":[],"name":"TokiRequireOrderedChannel","type":"error"},{"inputs":[{"internalType":"uint256","name":"expiryBlock","type":"uint256"}],"name":"TokiRetryExpired","type":"error"},{"inputs":[],"name":"TokiSaleEnded","type":"error"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"address","name":"pool","type":"address"}],"name":"TokiSamePool","type":"error"},{"inputs":[{"internalType":"uint256","name":"amountGD","type":"uint256"},{"internalType":"uint256","name":"eqReward","type":"uint256"},{"internalType":"uint256","name":"eqFee","type":"uint256"},{"internalType":"uint256","name":"minAmountGD","type":"uint256"}],"name":"TokiSlippageTooHigh","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"TokiTransferIsFailed","type":"error"},{"inputs":[],"name":"TokiTransferIsStop","type":"error"},{"inputs":[{"internalType":"string","name":"message","type":"string"},{"internalType":"address","name":"caller","type":"address"}],"name":"TokiUnauthorizedAccess","type":"error"},{"inputs":[{"internalType":"string","name":"channel","type":"string"}],"name":"TokiUnregisteredChainId","type":"error"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"TokiUnregisteredPoolId","type":"error"},{"inputs":[{"internalType":"string","name":"message","type":"string"}],"name":"TokiZeroAddress","type":"error"},{"inputs":[{"internalType":"string","name":"message","type":"string"}],"name":"TokiZeroAmount","type":"error"},{"inputs":[{"internalType":"string","name":"message","type":"string"}],"name":"TokiZeroValue","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"setter","type":"address"},{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"totalRewards","type":"uint256"}],"name":"MerkleRootSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MERKLE_ROOT_SETTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REWARD_TOKEN","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"internalType":"struct IRegularDistributor.Claim","name":"claim_","type":"tuple"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimedAmountByAccount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAlreadyClaimed","outputs":[{"internalType":"uint256","name":"claimedAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"newMerkleRoot","type":"bytes32"},{"internalType":"uint256","name":"totalRewards","type":"uint256"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalClaimedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"internalType":"struct IRegularDistributor.Claim","name":"claim_","type":"tuple"}],"name":"verifyClaim","outputs":[{"internalType":"bool","name":"valid","type":"bool"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60a03461011557601f61150938819003918201601f19168301916001600160401b0383118484101761011957808492604094855283398101031261011557610052602061004b8361012d565b920161012d565b600180555f6003556001600160a01b038216156100e0576001600160a01b03169081156100ac5761008591608052610141565b5060405161131e90816101cb823960805181818161014101528181610604015261079f0152f35b604051636bc37c5f60e11b815260206004820152600b60248201526a3932bbb0b9322a37b5b2b760a91b6044820152606490fd5b604051636bc37c5f60e11b815260206004820152600c60248201526b3232b330bab63a20b236b4b760a11b6044820152606490fd5b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b038216820361011557565b6001600160a01b0381165f9081525f5160206114e95f395f51905f52602052604090205460ff166101c5576001600160a01b03165f8181525f5160206114e95f395f51905f5260205260408120805460ff191660011790553391907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4600190565b505f9056fe6080806040526004361015610012575f80fd5b5f3560e01c90816301ffc9a714610c04575080631abc1ef1146109db578063248a9ca314610bb45780632eb4a7ab14610b795780632f2ff15d14610b1e5780633627214714610ac657806336568abe14610a3e578063515ef6bd146109db5780637c382d0b146106d757806391d14854146106635780639661cb0d1461062857806399248ea7146105ba578063a217fddf14610582578063d547741f14610520578063daab641d146104fe5763e8e519dd146100cc575f80fd5b346103d9576100da36610d06565b6002600154146104d65760026001556100f28161103e565b156104ae5773ffffffffffffffffffffffffffffffffffffffff61011582610e1d565b165f52600460205260405f20546020820135808211610443579061013891610de3565b9081156103e5577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff8116906040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152602081602481865afa908115610339575f916103af575b5084811061034457505f6020916101d4866003546112db565b60035573ffffffffffffffffffffffffffffffffffffffff6101f586610e1d565b168252600483526040822061020b8782546112db565b905561021685610e1d565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000085820190815273ffffffffffffffffffffffffffffffffffffffff909216602482015260448101889052839061029b81606481015b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610d75565b51925af115610339575f513d6103305750803b155b6103055750602073ffffffffffffffffffffffffffffffffffffffff6102f67fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a93610e1d565b1692604051908152a260018055005b7f5274afe7000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b600114156102b0565b6040513d5f823e3d90fd5b60a49085604051917f581bd8e400000000000000000000000000000000000000000000000000000000835260606004840152600b60648401527f6469737472696275746f72000000000000000000000000000000000000000000608484015260248301526044820152fd5b90506020813d6020116103dd575b816103ca60209383610d75565b810103126103d957515f6101bb565b5f80fd5b3d91506103bd565b60646040517f92a4f38a00000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f636c61696d61626c65416d6f756e7400000000000000000000000000000000006044820152fd5b60a49250604051917f38d06e1d00000000000000000000000000000000000000000000000000000000835260606004840152600d60648401527f636c61696d6564416d6f756e7400000000000000000000000000000000000000608484015260248301526044820152fd5b7f872fa04e000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f3ee5aeb5000000000000000000000000000000000000000000000000000000005f5260045ffd5b346103d957602061051661051136610d06565b61103e565b6040519015158152f35b346103d95760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d95761058060043561055d610ce3565b9061057b610576825f525f602052600160405f20015490565b610e3e565b610f76565b005b346103d9575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d95760206040515f8152f35b346103d9575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d957602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b346103d9575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d9576020600354604051908152f35b346103d95760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d95761069a610ce3565b6004355f525f60205273ffffffffffffffffffffffffffffffffffffffff60405f2091165f52602052602060ff60405f2054166040519015158152f35b346103d95760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d957335f9081527fac74d1aa04007b5a73edd45b05c6529a2d9bf12674cd26ec26d82cd2e68254236020526040902054600435906024359060ff161561098b57811561092d57600354808211156108c357604051907f70a0823100000000000000000000000000000000000000000000000000000000825230600483015260208260248173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa918215610339575f9261088f575b506107e66107dd8285610de3565b83109184610de3565b906108245750508160025560405191825260208201527f39b2983f20f457969eb261d75e3d8fa0340b4bc5d0f68f05d75a8d262342026560403392a2005b60a49250604051917f581bd8e400000000000000000000000000000000000000000000000000000000835260606004840152600760648401527f62616c616e636500000000000000000000000000000000000000000000000000608484015260248301526044820152fd5b9091506020813d6020116108bb575b816108ab60209383610d75565b810103126103d9575190846107cf565b3d915061089e565b60a491604051917f38d06e1d00000000000000000000000000000000000000000000000000000000835260606004840152601260648401527f746f74616c436c61696d6564416d6f756e740000000000000000000000000000608484015260248301526044820152fd5b60646040517f4612b38f00000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f6e65774d65726b6c65526f6f74000000000000000000000000000000000000006044820152fd5b7fe2517d3f000000000000000000000000000000000000000000000000000000005f52336004527fc0bf15dbb0f0734a6d6a9d4c228810b2546966255459f10a1ac1b4ceed09047460245260445ffd5b346103d95760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d95773ffffffffffffffffffffffffffffffffffffffff610a27610cc0565b165f526004602052602060405f2054604051908152f35b346103d95760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d957610a75610ce3565b3373ffffffffffffffffffffffffffffffffffffffff821603610a9e5761058090600435610f76565b7f6697b232000000000000000000000000000000000000000000000000000000005f5260045ffd5b346103d9575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d95760206040517fc0bf15dbb0f0734a6d6a9d4c228810b2546966255459f10a1ac1b4ceed0904748152f35b346103d95760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d957610580600435610b5b610ce3565b90610b74610576825f525f602052600160405f20015490565b610ea4565b346103d9575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d9576020600254604051908152f35b346103d95760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d9576020610bfc6004355f525f602052600160405f20015490565b604051908152f35b346103d95760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d957600435907fffffffff0000000000000000000000000000000000000000000000000000000082168092036103d957817f7965db0b0000000000000000000000000000000000000000000000000000000060209314908115610c96575b5015158152f35b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501483610c8f565b6004359073ffffffffffffffffffffffffffffffffffffffff821682036103d957565b6024359073ffffffffffffffffffffffffffffffffffffffff821682036103d957565b60207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc8201126103d9576004359067ffffffffffffffff82116103d9577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc826060920301126103d95760040190565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610db657604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b91908203918211610df057565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b3573ffffffffffffffffffffffffffffffffffffffff811681036103d95790565b805f525f60205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f5260205260ff60405f20541615610e755750565b7fe2517d3f000000000000000000000000000000000000000000000000000000005f523360045260245260445ffd5b805f525f60205260405f2073ffffffffffffffffffffffffffffffffffffffff83165f5260205260ff60405f205416155f14610f7057805f525f60205260405f2073ffffffffffffffffffffffffffffffffffffffff83165f5260205260405f2060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0082541617905573ffffffffffffffffffffffffffffffffffffffff339216907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d5f80a4600190565b50505f90565b805f525f60205260405f2073ffffffffffffffffffffffffffffffffffffffff83165f5260205260ff60405f2054165f14610f7057805f525f60205260405f2073ffffffffffffffffffffffffffffffffffffffff83165f5260205260405f207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00815416905573ffffffffffffffffffffffffffffffffffffffff339216907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b5f80a4600190565b9060025490811561127d576020830135801561121f5773ffffffffffffffffffffffffffffffffffffffff61107285610e1d565b16156111c15761026f6110bc61108786610e1d565b926040519283916020830195866020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b51902060405160208101918252602081526110d8604082610d75565b519020926040810135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1813603018212156103d957019283359367ffffffffffffffff85116103d95760208101908560051b80360383136103d957602090604051976111478383018a610d75565b8852818801920101913683116103d957905b8282106111b157505050905f915b84518310156111a95760208360051b86010151908181105f14611198575f52602052600160405f205b920191611167565b905f52602052600160405f20611190565b915092501490565b8135815260209182019101611159565b60646040517fd786f8be00000000000000000000000000000000000000000000000000000000815260206004820152600760248201527f6163636f756e74000000000000000000000000000000000000000000000000006044820152fd5b60646040517f92a4f38a00000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f616d6f756e7400000000000000000000000000000000000000000000000000006044820152fd5b60646040517f4612b38f00000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f6d65726b6c65526f6f74000000000000000000000000000000000000000000006044820152fd5b91908201809211610df05756fea26469706673582212203d3d55a454082e81d528bb8d1932a43ae8ea4702dee8b47550f070b44efbe0e564736f6c634300081c0033ad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb50000000000000000000000007f8bb658fe789dbd09b2c38e752ad24297ec0ebd000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7
Deployed Bytecode
0x6080806040526004361015610012575f80fd5b5f3560e01c90816301ffc9a714610c04575080631abc1ef1146109db578063248a9ca314610bb45780632eb4a7ab14610b795780632f2ff15d14610b1e5780633627214714610ac657806336568abe14610a3e578063515ef6bd146109db5780637c382d0b146106d757806391d14854146106635780639661cb0d1461062857806399248ea7146105ba578063a217fddf14610582578063d547741f14610520578063daab641d146104fe5763e8e519dd146100cc575f80fd5b346103d9576100da36610d06565b6002600154146104d65760026001556100f28161103e565b156104ae5773ffffffffffffffffffffffffffffffffffffffff61011582610e1d565b165f52600460205260405f20546020820135808211610443579061013891610de3565b9081156103e5577f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec773ffffffffffffffffffffffffffffffffffffffff8116906040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152602081602481865afa908115610339575f916103af575b5084811061034457505f6020916101d4866003546112db565b60035573ffffffffffffffffffffffffffffffffffffffff6101f586610e1d565b168252600483526040822061020b8782546112db565b905561021685610e1d565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000085820190815273ffffffffffffffffffffffffffffffffffffffff909216602482015260448101889052839061029b81606481015b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610d75565b51925af115610339575f513d6103305750803b155b6103055750602073ffffffffffffffffffffffffffffffffffffffff6102f67fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a93610e1d565b1692604051908152a260018055005b7f5274afe7000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b600114156102b0565b6040513d5f823e3d90fd5b60a49085604051917f581bd8e400000000000000000000000000000000000000000000000000000000835260606004840152600b60648401527f6469737472696275746f72000000000000000000000000000000000000000000608484015260248301526044820152fd5b90506020813d6020116103dd575b816103ca60209383610d75565b810103126103d957515f6101bb565b5f80fd5b3d91506103bd565b60646040517f92a4f38a00000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f636c61696d61626c65416d6f756e7400000000000000000000000000000000006044820152fd5b60a49250604051917f38d06e1d00000000000000000000000000000000000000000000000000000000835260606004840152600d60648401527f636c61696d6564416d6f756e7400000000000000000000000000000000000000608484015260248301526044820152fd5b7f872fa04e000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f3ee5aeb5000000000000000000000000000000000000000000000000000000005f5260045ffd5b346103d957602061051661051136610d06565b61103e565b6040519015158152f35b346103d95760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d95761058060043561055d610ce3565b9061057b610576825f525f602052600160405f20015490565b610e3e565b610f76565b005b346103d9575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d95760206040515f8152f35b346103d9575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d957602060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7168152f35b346103d9575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d9576020600354604051908152f35b346103d95760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d95761069a610ce3565b6004355f525f60205273ffffffffffffffffffffffffffffffffffffffff60405f2091165f52602052602060ff60405f2054166040519015158152f35b346103d95760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d957335f9081527fac74d1aa04007b5a73edd45b05c6529a2d9bf12674cd26ec26d82cd2e68254236020526040902054600435906024359060ff161561098b57811561092d57600354808211156108c357604051907f70a0823100000000000000000000000000000000000000000000000000000000825230600483015260208260248173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7165afa918215610339575f9261088f575b506107e66107dd8285610de3565b83109184610de3565b906108245750508160025560405191825260208201527f39b2983f20f457969eb261d75e3d8fa0340b4bc5d0f68f05d75a8d262342026560403392a2005b60a49250604051917f581bd8e400000000000000000000000000000000000000000000000000000000835260606004840152600760648401527f62616c616e636500000000000000000000000000000000000000000000000000608484015260248301526044820152fd5b9091506020813d6020116108bb575b816108ab60209383610d75565b810103126103d9575190846107cf565b3d915061089e565b60a491604051917f38d06e1d00000000000000000000000000000000000000000000000000000000835260606004840152601260648401527f746f74616c436c61696d6564416d6f756e740000000000000000000000000000608484015260248301526044820152fd5b60646040517f4612b38f00000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f6e65774d65726b6c65526f6f74000000000000000000000000000000000000006044820152fd5b7fe2517d3f000000000000000000000000000000000000000000000000000000005f52336004527fc0bf15dbb0f0734a6d6a9d4c228810b2546966255459f10a1ac1b4ceed09047460245260445ffd5b346103d95760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d95773ffffffffffffffffffffffffffffffffffffffff610a27610cc0565b165f526004602052602060405f2054604051908152f35b346103d95760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d957610a75610ce3565b3373ffffffffffffffffffffffffffffffffffffffff821603610a9e5761058090600435610f76565b7f6697b232000000000000000000000000000000000000000000000000000000005f5260045ffd5b346103d9575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d95760206040517fc0bf15dbb0f0734a6d6a9d4c228810b2546966255459f10a1ac1b4ceed0904748152f35b346103d95760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d957610580600435610b5b610ce3565b90610b74610576825f525f602052600160405f20015490565b610ea4565b346103d9575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d9576020600254604051908152f35b346103d95760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d9576020610bfc6004355f525f602052600160405f20015490565b604051908152f35b346103d95760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103d957600435907fffffffff0000000000000000000000000000000000000000000000000000000082168092036103d957817f7965db0b0000000000000000000000000000000000000000000000000000000060209314908115610c96575b5015158152f35b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501483610c8f565b6004359073ffffffffffffffffffffffffffffffffffffffff821682036103d957565b6024359073ffffffffffffffffffffffffffffffffffffffff821682036103d957565b60207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc8201126103d9576004359067ffffffffffffffff82116103d9577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc826060920301126103d95760040190565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610db657604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b91908203918211610df057565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b3573ffffffffffffffffffffffffffffffffffffffff811681036103d95790565b805f525f60205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f5260205260ff60405f20541615610e755750565b7fe2517d3f000000000000000000000000000000000000000000000000000000005f523360045260245260445ffd5b805f525f60205260405f2073ffffffffffffffffffffffffffffffffffffffff83165f5260205260ff60405f205416155f14610f7057805f525f60205260405f2073ffffffffffffffffffffffffffffffffffffffff83165f5260205260405f2060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0082541617905573ffffffffffffffffffffffffffffffffffffffff339216907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d5f80a4600190565b50505f90565b805f525f60205260405f2073ffffffffffffffffffffffffffffffffffffffff83165f5260205260ff60405f2054165f14610f7057805f525f60205260405f2073ffffffffffffffffffffffffffffffffffffffff83165f5260205260405f207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00815416905573ffffffffffffffffffffffffffffffffffffffff339216907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b5f80a4600190565b9060025490811561127d576020830135801561121f5773ffffffffffffffffffffffffffffffffffffffff61107285610e1d565b16156111c15761026f6110bc61108786610e1d565b926040519283916020830195866020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b51902060405160208101918252602081526110d8604082610d75565b519020926040810135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1813603018212156103d957019283359367ffffffffffffffff85116103d95760208101908560051b80360383136103d957602090604051976111478383018a610d75565b8852818801920101913683116103d957905b8282106111b157505050905f915b84518310156111a95760208360051b86010151908181105f14611198575f52602052600160405f205b920191611167565b905f52602052600160405f20611190565b915092501490565b8135815260209182019101611159565b60646040517fd786f8be00000000000000000000000000000000000000000000000000000000815260206004820152600760248201527f6163636f756e74000000000000000000000000000000000000000000000000006044820152fd5b60646040517f92a4f38a00000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f616d6f756e7400000000000000000000000000000000000000000000000000006044820152fd5b60646040517f4612b38f00000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f6d65726b6c65526f6f74000000000000000000000000000000000000000000006044820152fd5b91908201809211610df05756fea26469706673582212203d3d55a454082e81d528bb8d1932a43ae8ea4702dee8b47550f070b44efbe0e564736f6c634300081c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000007f8bb658fe789dbd09b2c38e752ad24297ec0ebd000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7
-----Decoded View---------------
Arg [0] : defaultAdmin (address): 0x7F8BB658FE789DbD09B2c38E752Ad24297Ec0eBD
Arg [1] : rewardToken (address): 0xdAC17F958D2ee523a2206206994597C13D831ec7
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000007f8bb658fe789dbd09b2c38e752ad24297ec0ebd
Arg [1] : 000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
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.