Source Code
Latest 25 from a total of 4,369 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Deposit | 41215589 | 2 days ago | IN | 0.0004 ETH | 0.00000011 | ||||
| Withdraw | 40909432 | 9 days ago | IN | 0 ETH | 0.00000016 | ||||
| Withdraw | 40805984 | 11 days ago | IN | 0 ETH | 0.00000068 | ||||
| Deposit | 40577968 | 16 days ago | IN | 0.0004 ETH | 0.00000009 | ||||
| Withdraw | 40577606 | 16 days ago | IN | 0 ETH | 0.00000017 | ||||
| Deposit | 40533451 | 17 days ago | IN | 0.0004 ETH | 0.00000024 | ||||
| Deposit | 40483081 | 19 days ago | IN | 0.0004 ETH | 0.00000019 | ||||
| Deposit | 40356531 | 21 days ago | IN | 0.01 ETH | 0.0000001 | ||||
| Deposit | 40149537 | 26 days ago | IN | 0.0005 ETH | 0.00000007 | ||||
| Deposit | 40105170 | 27 days ago | IN | 0.0005 ETH | 0.00000025 | ||||
| Withdraw | 39801703 | 34 days ago | IN | 0 ETH | 0.00000009 | ||||
| Deposit | 39798484 | 34 days ago | IN | 0.00041 ETH | 0.00000002 | ||||
| Withdraw | 39758790 | 35 days ago | IN | 0 ETH | 0.00000008 | ||||
| Deposit | 39755177 | 35 days ago | IN | 0.00014806 ETH | 0.00000006 | ||||
| Withdraw | 39405678 | 44 days ago | IN | 0 ETH | 0.00000006 | ||||
| Withdraw | 39338129 | 45 days ago | IN | 0 ETH | 0.00000033 | ||||
| Deposit | 39338081 | 45 days ago | IN | 0.0005 ETH | 0.00000023 | ||||
| Withdraw | 39335172 | 45 days ago | IN | 0 ETH | 0.00000008 | ||||
| Deposit | 39335086 | 45 days ago | IN | 0.001 ETH | 0.00000002 | ||||
| Withdraw | 39309507 | 46 days ago | IN | 0 ETH | 0.00000008 | ||||
| Deposit | 39309444 | 46 days ago | IN | 0.001 ETH | 0.00000007 | ||||
| Withdraw | 39181336 | 49 days ago | IN | 0 ETH | 0.0000001 | ||||
| Deposit | 39181281 | 49 days ago | IN | 0.0002 ETH | 0.00000003 | ||||
| Withdraw | 39141796 | 50 days ago | IN | 0 ETH | 0.00000006 | ||||
| Deposit | 38912903 | 55 days ago | IN | 0.000001 ETH | 0.00000009 |
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 40909432 | 9 days ago | 0.00099 ETH | ||||
| 40805984 | 11 days ago | 0.00119 ETH | ||||
| 40577606 | 16 days ago | 0.01 ETH | ||||
| 39801703 | 34 days ago | 0.00041 ETH | ||||
| 39758790 | 35 days ago | 0.00013806 ETH | ||||
| 39405678 | 44 days ago | 0.00009 ETH | ||||
| 39338129 | 45 days ago | 0.0005 ETH | ||||
| 39335172 | 45 days ago | 0.001 ETH | ||||
| 39309507 | 46 days ago | 0.001 ETH | ||||
| 39181336 | 49 days ago | 0.0001 ETH | ||||
| 39141796 | 50 days ago | 0.00009 ETH | ||||
| 38843397 | 57 days ago | 0.00045 ETH | ||||
| 38463610 | 65 days ago | 0.00076596 ETH | ||||
| 38290767 | 69 days ago | 0.00004 ETH | ||||
| 38238534 | 71 days ago | 0.00001 ETH | ||||
| 38229897 | 71 days ago | 0.00109 ETH | ||||
| 38229895 | 71 days ago | 0.00106 ETH | ||||
| 38229894 | 71 days ago | 0.00049 ETH | ||||
| 38229876 | 71 days ago | 0.16599 ETH | ||||
| 38229871 | 71 days ago | 0.001944 ETH | ||||
| 38229859 | 71 days ago | 0.001559 ETH | ||||
| 38229856 | 71 days ago | 0.00049 ETH | ||||
| 38229851 | 71 days ago | 0.001075 ETH | ||||
| 38229832 | 71 days ago | 0.000642 ETH | ||||
| 38229784 | 71 days ago | 0.06482 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Rubyscore_Deposit
Compiler Version
v0.8.21+commit.d9974bed
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;
import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IRubyscore_Deposit} from "./interfaces/IRubyscore_Deposit.sol";
contract Rubyscore_Deposit is EIP712, AccessControl, ReentrancyGuard, IRubyscore_Deposit {
bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
string public constant NAME = "Rubyscore_Deposit";
string public constant VERSION = "0.0.1";
mapping(address => uint256) private depositStorage;
mapping(address => uint256) private userNonce;
function getUserNonce(address userAddress) external view returns (uint256) {
return userNonce[userAddress];
}
function getUserDeposit(address userAddress) external view returns (uint256) {
return depositStorage[userAddress];
}
constructor(address admin, address operator) EIP712(NAME, VERSION){
require(admin != address(0), "Zero address check");
require(operator != address(0), "Zero address check");
_grantRole(DEFAULT_ADMIN_ROLE, admin);
_grantRole(OPERATOR_ROLE, operator);
}
function deposit() external payable {
require(msg.value > 0, "Value should equal highest zero");
uint256 amount = msg.value;
uint256 currentDeposit = depositStorage[msg.sender];
currentDeposit += amount;
depositStorage[msg.sender] = currentDeposit;
emit Deposit(msg.sender, amount);
}
function deposit(address recipient) external payable nonReentrant {
require(msg.value > 0, "Value should equal highest zero");
uint256 amount = msg.value;
uint256 currentDeposit = depositStorage[recipient];
currentDeposit += amount;
depositStorage[recipient] = currentDeposit;
emit Deposit(recipient, amount);
}
function withdraw(address from, address payable to, uint256 amount, uint256 tax) external onlyRole(OPERATOR_ROLE) {
uint256 currentDeposit = depositStorage[from];
require(currentDeposit >= amount, "Insufficient funds");
uint256 finalAmount = amount - tax;
(bool success,) = to.call{value: finalAmount}("");
require(success, "Failed to send Ether");
depositStorage[from] -= amount;
emit Withdrawal(to, finalAmount, tax);
}
function withdrawBatch(address[] calldata from, address payable[] calldata to, uint256[] calldata amounts, uint256[] calldata taxes) external onlyRole(OPERATOR_ROLE) {
for(uint256 i = 0; i < from.length; i++) {
address sender = from[i];
uint256 amount = amounts[i];
uint256 tax = taxes[i];
address payable recipient = to[i];
require(depositStorage[sender] >= amount, "Insufficient funds");
uint256 finalAmount = amount - tax;
(bool success,) = recipient.call{value: finalAmount}("");
require(success, "Failed to send Ether");
depositStorage[sender] -= amount;
emit Withdrawal(recipient, finalAmount, tax);
}
}
function claimProfit(ClaimParams memory claimParams, bytes calldata operatorSignature) external nonReentrant {
require(claimParams.amount > 0, "Zero amount to claim");
require(claimParams.userNonce == userNonce[claimParams.recipient], "Nonce is invalid");
bytes32 digest = _hashTypedDataV4(
keccak256(
abi.encode(
keccak256("ClaimParams(address recipient,uint256 amount,uint256 userNonce)"),
claimParams.recipient,
claimParams.amount,
claimParams.userNonce
)
)
);
_checkRole(OPERATOR_ROLE, ECDSA.recover(digest, operatorSignature));
userNonce[claimParams.recipient] += 1;
(bool success,) = payable(claimParams.recipient).call{value: claimParams.amount}("");
require(success, "Failed to send Ether");
emit Claimed(claimParams.recipient, claimParams.amount);
}
function addFunds() external payable onlyRole(DEFAULT_ADMIN_ROLE) {}
function removeFunds(address payable to, uint256 amount) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(address(this).balance >= amount, "INSUFFICIENT_BALANCE");
to.call{value: amount}("");
}
}// 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.0.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC165 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, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
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.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol)
pragma solidity ^0.8.20;
interface IERC5267 {
/**
* @dev MAY be emitted to signal that the domain could have changed.
*/
event EIP712DomainChanged();
/**
* @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
* signature.
*/
function eip712Domain()
external
view
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
);
}// 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.0.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.20;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS
}
/**
* @dev The signature derives the `address(0)`.
*/
error ECDSAInvalidSignature();
/**
* @dev The signature has an invalid length.
*/
error ECDSAInvalidSignatureLength(uint256 length);
/**
* @dev The signature has an S value that is in the upper half order.
*/
error ECDSAInvalidSignatureS(bytes32 s);
/**
* @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
* return address(0) without also returning an error description. Errors are documented using an enum (error type)
* and a bytes32 providing additional information about the error.
*
* If no error is returned, then the address can be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
unchecked {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
// We do not check for an overflow here since the shift operation results in 0 or 1.
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError, bytes32) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS, s);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature, bytes32(0));
}
return (signer, RecoverError.NoError, bytes32(0));
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
*/
function _throwError(RecoverError error, bytes32 errorArg) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert ECDSAInvalidSignature();
} else if (error == RecoverError.InvalidSignatureLength) {
revert ECDSAInvalidSignatureLength(uint256(errorArg));
} else if (error == RecoverError.InvalidSignatureS) {
revert ECDSAInvalidSignatureS(errorArg);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol)
pragma solidity ^0.8.20;
import {MessageHashUtils} from "./MessageHashUtils.sol";
import {ShortStrings, ShortString} from "../ShortStrings.sol";
import {IERC5267} from "../../interfaces/IERC5267.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose
* encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract
* does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to
* produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
* separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the
* separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
*
* @custom:oz-upgrades-unsafe-allow state-variable-immutable
*/
abstract contract EIP712 is IERC5267 {
using ShortStrings for *;
bytes32 private constant TYPE_HASH =
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
// invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _cachedDomainSeparator;
uint256 private immutable _cachedChainId;
address private immutable _cachedThis;
bytes32 private immutable _hashedName;
bytes32 private immutable _hashedVersion;
ShortString private immutable _name;
ShortString private immutable _version;
string private _nameFallback;
string private _versionFallback;
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
constructor(string memory name, string memory version) {
_name = name.toShortStringWithFallback(_nameFallback);
_version = version.toShortStringWithFallback(_versionFallback);
_hashedName = keccak256(bytes(name));
_hashedVersion = keccak256(bytes(version));
_cachedChainId = block.chainid;
_cachedDomainSeparator = _buildDomainSeparator();
_cachedThis = address(this);
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
return _cachedDomainSeparator;
} else {
return _buildDomainSeparator();
}
}
function _buildDomainSeparator() private view returns (bytes32) {
return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);
}
/**
* @dev See {IERC-5267}.
*/
function eip712Domain()
public
view
virtual
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
)
{
return (
hex"0f", // 01111
_EIP712Name(),
_EIP712Version(),
block.chainid,
address(this),
bytes32(0),
new uint256[](0)
);
}
/**
* @dev The name parameter for the EIP712 domain.
*
* NOTE: By default this function reads _name which is an immutable value.
* It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
*/
// solhint-disable-next-line func-name-mixedcase
function _EIP712Name() internal view returns (string memory) {
return _name.toStringWithFallback(_nameFallback);
}
/**
* @dev The version parameter for the EIP712 domain.
*
* NOTE: By default this function reads _version which is an immutable value.
* It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
*/
// solhint-disable-next-line func-name-mixedcase
function _EIP712Version() internal view returns (string memory) {
return _version.toStringWithFallback(_versionFallback);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)
pragma solidity ^0.8.20;
import {Strings} from "../Strings.sol";
/**
* @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
*
* The library provides methods for generating a hash of a message that conforms to the
* https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
* specifications.
*/
library MessageHashUtils {
/**
* @dev Returns the keccak256 digest of an EIP-191 signed data with version
* `0x45` (`personal_sign` messages).
*
* The digest is calculated by prefixing a bytes32 `messageHash` with
* `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the
* hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
*
* NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with
* keccak256, although any bytes32 value can be safely used because the final digest will
* be re-hashed.
*
* See {ECDSA-recover}.
*/
function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash
mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix
digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)
}
}
/**
* @dev Returns the keccak256 digest of an EIP-191 signed data with version
* `0x45` (`personal_sign` messages).
*
* The digest is calculated by prefixing an arbitrary `message` with
* `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the
* hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
*
* See {ECDSA-recover}.
*/
function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {
return
keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message));
}
/**
* @dev Returns the keccak256 digest of an EIP-191 signed data with version
* `0x00` (data with intended validator).
*
* The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended
* `validator` address. Then hashing the result.
*
* See {ECDSA-recover}.
*/
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(hex"19_00", validator, data));
}
/**
* @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
*
* The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
* `\x19\x01` and hashing the result. It corresponds to the hash signed by the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
*
* See {ECDSA-recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, hex"19_01")
mstore(add(ptr, 0x02), domainSeparator)
mstore(add(ptr, 0x22), structHash)
digest := keccak256(ptr, 0x42)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.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 ERC165 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.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* 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[EIP 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.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
* Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator.
// Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
uint256 twos = denominator & (0 - denominator);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
// works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.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 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: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ShortStrings.sol)
pragma solidity ^0.8.20;
import {StorageSlot} from "./StorageSlot.sol";
// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
// | length | 0x BB |
type ShortString is bytes32;
/**
* @dev This library provides functions to convert short memory strings
* into a `ShortString` type that can be used as an immutable variable.
*
* Strings of arbitrary length can be optimized using this library if
* they are short enough (up to 31 bytes) by packing them with their
* length (1 byte) in a single EVM word (32 bytes). Additionally, a
* fallback mechanism can be used for every other case.
*
* Usage example:
*
* ```solidity
* contract Named {
* using ShortStrings for *;
*
* ShortString private immutable _name;
* string private _nameFallback;
*
* constructor(string memory contractName) {
* _name = contractName.toShortStringWithFallback(_nameFallback);
* }
*
* function name() external view returns (string memory) {
* return _name.toStringWithFallback(_nameFallback);
* }
* }
* ```
*/
library ShortStrings {
// Used as an identifier for strings longer than 31 bytes.
bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;
error StringTooLong(string str);
error InvalidShortString();
/**
* @dev Encode a string of at most 31 chars into a `ShortString`.
*
* This will trigger a `StringTooLong` error is the input string is too long.
*/
function toShortString(string memory str) internal pure returns (ShortString) {
bytes memory bstr = bytes(str);
if (bstr.length > 31) {
revert StringTooLong(str);
}
return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
}
/**
* @dev Decode a `ShortString` back to a "normal" string.
*/
function toString(ShortString sstr) internal pure returns (string memory) {
uint256 len = byteLength(sstr);
// using `new string(len)` would work locally but is not memory safe.
string memory str = new string(32);
/// @solidity memory-safe-assembly
assembly {
mstore(str, len)
mstore(add(str, 0x20), sstr)
}
return str;
}
/**
* @dev Return the length of a `ShortString`.
*/
function byteLength(ShortString sstr) internal pure returns (uint256) {
uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
if (result > 31) {
revert InvalidShortString();
}
return result;
}
/**
* @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
*/
function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
if (bytes(value).length < 32) {
return toShortString(value);
} else {
StorageSlot.getStringSlot(store).value = value;
return ShortString.wrap(FALLBACK_SENTINEL);
}
}
/**
* @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
*/
function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
return toString(value);
} else {
return store;
}
}
/**
* @dev Return the length of a string that was encoded to `ShortString` or written to storage using
* {setWithFallback}.
*
* WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
* actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
*/
function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
return byteLength(value);
} else {
return bytes(store).length;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
/**
* @dev The `value` string doesn't fit in the specified `length`.
*/
error StringsInsufficientHexLength(uint256 value, uint256 length);
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = HEX_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
* representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.8.21;
/**
* @title IRubyscore_Deposit
* @dev IRubyscore_Deposit is an interface for IRubyscore_Deposit contract
*/
interface IRubyscore_Deposit {
struct ClaimParams {
address payable recipient;
uint256 amount;
uint256 userNonce;
}
/**
* @notice Emitted when a user makes a deposit.
* @param user - The user who made the deposit.
* @param amount - Amount deposited.
*/
event Deposit(address indexed user, uint256 indexed amount);
/**
* @notice Emitted when a user withdraws a deposit.
* @param user - User where the deposit was withdrawn.
* @param amount - Withdrawal amount.
* @param tax - Withdrawal fee.
*/
event Withdrawal(address indexed user, uint256 indexed amount, uint256 indexed tax);
/**
* @notice Emitted when a user comes for profit from the referral system.
* @param recipient - The address that receives the profit for the referral system.
* @param amount - The address that receives the profit for the referral system.
*/
event Claimed(address indexed recipient, uint256 indexed amount);
/**
* @notice Get the user's nonce associated with their address.
* @param userAddress - The address of the user.
* @return The user's nonce.
*/
function getUserNonce(address userAddress) external view returns (uint256);
/**
* @notice Returns the user's stored deposit.
* @param userAddress - Address to get deposit amount.
* @return User deposit amount.
*/
function getUserDeposit(address userAddress) external view returns (uint256);
/**
* @notice Accepts the user's deposit and writes it to the user's account.
* @dev The ETH sent must be greater than zero.
*/
function deposit() external payable;
/**
* @notice Accepts the user's deposit and writes it to the user's account.
* @param recipient - The address to which the deposit is to be credited.
* @dev The ETH sent must be greater than zero.
*/
function deposit(address recipient) external payable;
/**
* @notice Withdraws the deposit to the specified address, used exclusively by the operator.
* @dev Can only be used by the operator role.
* @param from - Address from which to withdraw deposit.
* @param to - Address where to send the deposit.
* @param amount - Withdrawal amount.
* @param tax - Withdrawal fee.
*/
function withdraw(address from, address payable to, uint256 amount, uint256 tax) external;
/**
* @notice Batch withdraws the deposits to the specified addresses, used exclusively by the operator.
* @dev Can only be used by the operator role.
* @param from - Addresses from which to withdraw deposit.
* @param to - Addresses where to send the deposits.
* @param amounts - Withdrawal amounts.
* @param taxes - Withdrawal fees.
*/
function withdrawBatch(address[] calldata from, address payable[] calldata to, uint256[] calldata amounts, uint256[] calldata taxes) external;
/**
* @notice Withdraws the profit generated for the referral system. Only works if the notice is correct and the operator's signature is valid.
* @param claimParams - Object with information about the output profit.
* @param operatorSignature - Signature message.
*/
function claimProfit(ClaimParams memory claimParams, bytes calldata operatorSignature) external;
/**
* @notice Contributes free funds to the contract.
* @dev Can only be used by the operator role.
*/
function addFunds() external payable;
/**
* @notice Withdraws funds from the contract.
* @dev Can only be used by the operator role.
*/
function removeFunds(address payable to, uint256 amount) external;
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"operator","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":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tax","type":"uint256"}],"name":"Withdrawal","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addFunds","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"userNonce","type":"uint256"}],"internalType":"struct IRubyscore_Deposit.ClaimParams","name":"claimParams","type":"tuple"},{"internalType":"bytes","name":"operatorSignature","type":"bytes"}],"name":"claimProfit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","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":"address","name":"userAddress","type":"address"}],"name":"getUserDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"}],"name":"getUserNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"removeFunds","outputs":[],"stateMutability":"nonpayable","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":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"tax","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"from","type":"address[]"},{"internalType":"address payable[]","name":"to","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256[]","name":"taxes","type":"uint256[]"}],"name":"withdrawBatch","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
6101606040523480156200001257600080fd5b5060405162001ec838038062001ec8833981016040819052620000359162000360565b6040805180820182526011815270149d589e5cd8dbdc9957d1195c1bdcda5d607a1b60208083019190915282518084019093526005835264302e302e3160d81b90830152906200008782600062000215565b610120526200009881600162000215565b61014052815160208084019190912060e052815190820120610100524660a0526200012660e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c05260016003556001600160a01b038216620001855760405162461bcd60e51b81526020600482015260126024820152715a65726f206164647265737320636865636b60701b60448201526064015b60405180910390fd5b6001600160a01b038116620001d25760405162461bcd60e51b81526020600482015260126024820152715a65726f206164647265737320636865636b60701b60448201526064016200017c565b620001df6000836200024e565b506200020c7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929826200024e565b5050506200057e565b600060208351101562000235576200022d8362000300565b905062000248565b816200024284826200043d565b5060ff90505b92915050565b60008281526002602090815260408083206001600160a01b038516845290915281205460ff16620002f75760008381526002602090815260408083206001600160a01b03861684529091529020805460ff19166001179055620002ae3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000248565b50600062000248565b600080829050601f815111156200032e578260405163305a27a960e01b81526004016200017c919062000509565b80516200033b8262000559565b179392505050565b80516001600160a01b03811681146200035b57600080fd5b919050565b600080604083850312156200037457600080fd5b6200037f8362000343565b91506200038f6020840162000343565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620003c357607f821691505b602082108103620003e457634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200043857600081815260208120601f850160051c81016020861015620004135750805b601f850160051c820191505b8181101562000434578281556001016200041f565b5050505b505050565b81516001600160401b0381111562000459576200045962000398565b62000471816200046a8454620003ae565b84620003ea565b602080601f831160018114620004a95760008415620004905750858301515b600019600386901b1c1916600185901b17855562000434565b600085815260208120601f198616915b82811015620004da57888601518255948401946001909101908401620004b9565b5085821015620004f95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208083528351808285015260005b8181101562000538578581018301518582016040015282016200051a565b506000604082860101526040601f19601f8301168501019250505092915050565b80516020808301519190811015620003e45760001960209190910360031b1b16919050565b60805160a05160c05160e0516101005161012051610140516118ef620005d96000396000610f6801526000610f36015260006110680152600061104001526000610f9b01526000610fc501526000610fef01526118ef6000f3fe60806040526004361061011f5760003560e01c806391d14854116100a0578063d0e30db011610064578063d0e30db014610374578063d547741f1461037c578063f340fa011461039c578063f5b541a6146103af578063ffa1ad74146103d157600080fd5b806391d14854146102b7578063a217fddf146102d7578063a26759cb146102ec578063a3f4df7e146102f4578063c084b10b1461033e57600080fd5b80633dd744bc116100e75780633dd744bc146101f957806350d6368c146102195780636834e3a8146102395780637bfe950c1461026f57806384b0196e1461028f57600080fd5b806301ffc9a714610124578063248a9ca3146101595780632b571420146101975780632f2ff15d146101b957806336568abe146101d9575b600080fd5b34801561013057600080fd5b5061014461013f3660046113a0565b610402565b60405190151581526020015b60405180910390f35b34801561016557600080fd5b506101896101743660046113d1565b60009081526002602052604090206001015490565b604051908152602001610150565b3480156101a357600080fd5b506101b76101b2366004611448565b610439565b005b3480156101c557600080fd5b506101b76101d43660046114f9565b6106be565b3480156101e557600080fd5b506101b76101f43660046114f9565b6106e9565b34801561020557600080fd5b506101b761021436600461156e565b61071c565b34801561022557600080fd5b506101b7610234366004611632565b610938565b34801561024557600080fd5b5061018961025436600461165e565b6001600160a01b031660009081526005602052604090205490565b34801561027b57600080fd5b506101b761028a36600461167b565b6109e0565b34801561029b57600080fd5b506102a4610b46565b6040516101509796959493929190611707565b3480156102c357600080fd5b506101446102d23660046114f9565b610b8c565b3480156102e357600080fd5b50610189600081565b6101b7610bb7565b34801561030057600080fd5b5061033160405180604001604052806011815260200170149d589e5cd8dbdc9957d1195c1bdcda5d607a1b81525081565b604051610150919061179d565b34801561034a57600080fd5b5061018961035936600461165e565b6001600160a01b031660009081526004602052604090205490565b6101b7610bc5565b34801561038857600080fd5b506101b76103973660046114f9565b610c72565b6101b76103aa36600461165e565b610c97565b3480156103bb57600080fd5b5061018960008051602061189a83398151915281565b3480156103dd57600080fd5b5061033160405180604001604052806005815260200164302e302e3160d81b81525081565b60006001600160e01b03198216637965db0b60e01b148061043357506301ffc9a760e01b6001600160e01b03198316145b92915050565b610441610d66565b60008360200151116104915760405162461bcd60e51b81526020600482015260146024820152735a65726f20616d6f756e7420746f20636c61696d60601b60448201526064015b60405180910390fd5b82516001600160a01b0316600090815260056020526040908190205490840151146104f15760405162461bcd60e51b815260206004820152601060248201526f139bdb98d9481a5cc81a5b9d985b1a5960821b6044820152606401610488565b60006105737f8b351c81dc4dffd686ef891d4e3d63ac440147e1ab6ed7a39c6d33d187188d4285600001518660200151876040015160405160200161055894939291909384526001600160a01b039290921660208401526040830152606082015260800190565b60405160208183030381529060405280519060200120610d90565b90506105cc60008051602061189a8339815191526105c78386868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610dbd92505050565b610de7565b83516001600160a01b031660009081526005602052604081208054600192906105f69084906117c6565b9091555050835160208501516040516000926001600160a01b031691908381818185875af1925050503d806000811461064b576040519150601f19603f3d011682016040523d82523d6000602084013e610650565b606091505b50509050806106715760405162461bcd60e51b8152600401610488906117d9565b602085015185516040516001600160a01b03909116907fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a90600090a350506106b96001600355565b505050565b6000828152600260205260409020600101546106d981610e24565b6106e38383610e2e565b50505050565b6001600160a01b03811633146107125760405163334bd91960e11b815260040160405180910390fd5b6106b98282610ec2565b60008051602061189a83398151915261073481610e24565b60005b8881101561092c5760008a8a8381811061075357610753611807565b9050602002016020810190610768919061165e565b9050600087878481811061077e5761077e611807565b905060200201359050600086868581811061079b5761079b611807565b90506020020135905060008b8b868181106107b8576107b8611807565b90506020020160208101906107cd919061165e565b6001600160a01b03851660009081526004602052604090205490915083111561082d5760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742066756e647360701b6044820152606401610488565b6000610839838561181d565b90506000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610888576040519150601f19603f3d011682016040523d82523d6000602084013e61088d565b606091505b50509050806108ae5760405162461bcd60e51b8152600401610488906117d9565b6001600160a01b038616600090815260046020526040812080548792906108d690849061181d565b9091555050604051849083906001600160a01b038616907fdf273cb619d95419a9cd0ec88123a0538c85064229baa6363788f743fff90deb90600090a4505050505050808061092490611830565b915050610737565b50505050505050505050565b600061094381610e24565b8147101561098a5760405162461bcd60e51b8152602060048201526014602482015273494e53554646494349454e545f42414c414e434560601b6044820152606401610488565b6040516001600160a01b038416908390600081818185875af1925050503d80600081146109d3576040519150601f19603f3d011682016040523d82523d6000602084013e6109d8565b606091505b505050505050565b60008051602061189a8339815191526109f881610e24565b6001600160a01b03851660009081526004602052604090205483811015610a565760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742066756e647360701b6044820152606401610488565b6000610a62848661181d565b90506000866001600160a01b03168260405160006040518083038185875af1925050503d8060008114610ab1576040519150601f19603f3d011682016040523d82523d6000602084013e610ab6565b606091505b5050905080610ad75760405162461bcd60e51b8152600401610488906117d9565b6001600160a01b03881660009081526004602052604081208054889290610aff90849061181d565b9091555050604051859083906001600160a01b038a16907fdf273cb619d95419a9cd0ec88123a0538c85064229baa6363788f743fff90deb90600090a45050505050505050565b600060608060008060006060610b5a610f2f565b610b62610f61565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60009182526002602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610bc281610e24565b50565b60003411610c155760405162461bcd60e51b815260206004820152601f60248201527f56616c75652073686f756c6420657175616c2068696768657374207a65726f006044820152606401610488565b336000908152600460205260409020543490610c3182826117c6565b336000818152600460205260408082208490555192935084927fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9190a35050565b600082815260026020526040902060010154610c8d81610e24565b6106e38383610ec2565b610c9f610d66565b60003411610cef5760405162461bcd60e51b815260206004820152601f60248201527f56616c75652073686f756c6420657175616c2068696768657374207a65726f006044820152606401610488565b6001600160a01b0381166000908152600460205260409020543490610d1482826117c6565b6001600160a01b0384166000818152600460205260408082208490555192935084927fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9190a35050610bc26001600355565b600260035403610d8957604051633ee5aeb560e01b815260040160405180910390fd5b6002600355565b6000610433610d9d610f8e565b8360405161190160f01b8152600281019290925260228201526042902090565b600080600080610dcd86866110b9565b925092509250610ddd8282611106565b5090949350505050565b610df18282610b8c565b610e205760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610488565b5050565b610bc28133610de7565b6000610e3a8383610b8c565b610eba5760008381526002602090815260408083206001600160a01b03861684529091529020805460ff19166001179055610e723390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610433565b506000610433565b6000610ece8383610b8c565b15610eba5760008381526002602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610433565b6060610f5c7f000000000000000000000000000000000000000000000000000000000000000060006111bf565b905090565b6060610f5c7f000000000000000000000000000000000000000000000000000000000000000060016111bf565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015610fe757507f000000000000000000000000000000000000000000000000000000000000000046145b1561101157507f000000000000000000000000000000000000000000000000000000000000000090565b610f5c604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b600080600083516041036110f35760208401516040850151606086015160001a6110e58882858561126a565b9550955095505050506110ff565b50508151600091506002905b9250925092565b600082600381111561111a5761111a611849565b03611123575050565b600182600381111561113757611137611849565b036111555760405163f645eedf60e01b815260040160405180910390fd5b600282600381111561116957611169611849565b0361118a5760405163fce698f760e01b815260048101829052602401610488565b600382600381111561119e5761119e611849565b03610e20576040516335e2f38360e21b815260048101829052602401610488565b606060ff83146111d9576111d283611339565b9050610433565b8180546111e59061185f565b80601f01602080910402602001604051908101604052809291908181526020018280546112119061185f565b801561125e5780601f106112335761010080835404028352916020019161125e565b820191906000526020600020905b81548152906001019060200180831161124157829003601f168201915b50505050509050610433565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411156112a5575060009150600390508261132f565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa1580156112f9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166113255750600092506001915082905061132f565b9250600091508190505b9450945094915050565b6060600061134683611378565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b600060ff8216601f81111561043357604051632cd44ac360e21b815260040160405180910390fd5b6000602082840312156113b257600080fd5b81356001600160e01b0319811681146113ca57600080fd5b9392505050565b6000602082840312156113e357600080fd5b5035919050565b6001600160a01b0381168114610bc257600080fd5b60008083601f84011261141157600080fd5b50813567ffffffffffffffff81111561142957600080fd5b60208301915083602082850101111561144157600080fd5b9250929050565b6000806000838503608081121561145e57600080fd5b606081121561146c57600080fd5b506040516060810167ffffffffffffffff828210818311171561149f57634e487b7160e01b600052604160045260246000fd5b81604052863591506114b0826113ea565b818352602087013560208401526040870135604084015282955060608701359250808311156114de57600080fd5b50506114ec868287016113ff565b9497909650939450505050565b6000806040838503121561150c57600080fd5b82359150602083013561151e816113ea565b809150509250929050565b60008083601f84011261153b57600080fd5b50813567ffffffffffffffff81111561155357600080fd5b6020830191508360208260051b850101111561144157600080fd5b6000806000806000806000806080898b03121561158a57600080fd5b883567ffffffffffffffff808211156115a257600080fd5b6115ae8c838d01611529565b909a50985060208b01359150808211156115c757600080fd5b6115d38c838d01611529565b909850965060408b01359150808211156115ec57600080fd5b6115f88c838d01611529565b909650945060608b013591508082111561161157600080fd5b5061161e8b828c01611529565b999c989b5096995094979396929594505050565b6000806040838503121561164557600080fd5b8235611650816113ea565b946020939093013593505050565b60006020828403121561167057600080fd5b81356113ca816113ea565b6000806000806080858703121561169157600080fd5b843561169c816113ea565b935060208501356116ac816113ea565b93969395505050506040820135916060013590565b6000815180845260005b818110156116e7576020818501810151868301820152016116cb565b506000602082860101526020601f19601f83011685010191505092915050565b60ff60f81b881681526000602060e08184015261172760e084018a6116c1565b8381036040850152611739818a6116c1565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825283870192509083019060005b8181101561178b5783518352928401929184019160010161176f565b50909c9b505050505050505050505050565b6020815260006113ca60208301846116c1565b634e487b7160e01b600052601160045260246000fd5b80820180821115610433576104336117b0565b6020808252601490820152732330b4b632b2103a379039b2b7321022ba3432b960611b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b81810381811115610433576104336117b0565b600060018201611842576118426117b0565b5060010190565b634e487b7160e01b600052602160045260246000fd5b600181811c9082168061187357607f821691505b60208210810361189357634e487b7160e01b600052602260045260246000fd5b5091905056fe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929a2646970667358221220e1995302174198b3312796b9698d91b77e80ba8460cbdce78363cbe890b5ad7364736f6c634300081500330000000000000000000000000d0d5ff3cfef8b7b2b1cac6b6c27fd0846c09361000000000000000000000000381c031baa5995d0cc52386508050ac947780815
Deployed Bytecode
0x60806040526004361061011f5760003560e01c806391d14854116100a0578063d0e30db011610064578063d0e30db014610374578063d547741f1461037c578063f340fa011461039c578063f5b541a6146103af578063ffa1ad74146103d157600080fd5b806391d14854146102b7578063a217fddf146102d7578063a26759cb146102ec578063a3f4df7e146102f4578063c084b10b1461033e57600080fd5b80633dd744bc116100e75780633dd744bc146101f957806350d6368c146102195780636834e3a8146102395780637bfe950c1461026f57806384b0196e1461028f57600080fd5b806301ffc9a714610124578063248a9ca3146101595780632b571420146101975780632f2ff15d146101b957806336568abe146101d9575b600080fd5b34801561013057600080fd5b5061014461013f3660046113a0565b610402565b60405190151581526020015b60405180910390f35b34801561016557600080fd5b506101896101743660046113d1565b60009081526002602052604090206001015490565b604051908152602001610150565b3480156101a357600080fd5b506101b76101b2366004611448565b610439565b005b3480156101c557600080fd5b506101b76101d43660046114f9565b6106be565b3480156101e557600080fd5b506101b76101f43660046114f9565b6106e9565b34801561020557600080fd5b506101b761021436600461156e565b61071c565b34801561022557600080fd5b506101b7610234366004611632565b610938565b34801561024557600080fd5b5061018961025436600461165e565b6001600160a01b031660009081526005602052604090205490565b34801561027b57600080fd5b506101b761028a36600461167b565b6109e0565b34801561029b57600080fd5b506102a4610b46565b6040516101509796959493929190611707565b3480156102c357600080fd5b506101446102d23660046114f9565b610b8c565b3480156102e357600080fd5b50610189600081565b6101b7610bb7565b34801561030057600080fd5b5061033160405180604001604052806011815260200170149d589e5cd8dbdc9957d1195c1bdcda5d607a1b81525081565b604051610150919061179d565b34801561034a57600080fd5b5061018961035936600461165e565b6001600160a01b031660009081526004602052604090205490565b6101b7610bc5565b34801561038857600080fd5b506101b76103973660046114f9565b610c72565b6101b76103aa36600461165e565b610c97565b3480156103bb57600080fd5b5061018960008051602061189a83398151915281565b3480156103dd57600080fd5b5061033160405180604001604052806005815260200164302e302e3160d81b81525081565b60006001600160e01b03198216637965db0b60e01b148061043357506301ffc9a760e01b6001600160e01b03198316145b92915050565b610441610d66565b60008360200151116104915760405162461bcd60e51b81526020600482015260146024820152735a65726f20616d6f756e7420746f20636c61696d60601b60448201526064015b60405180910390fd5b82516001600160a01b0316600090815260056020526040908190205490840151146104f15760405162461bcd60e51b815260206004820152601060248201526f139bdb98d9481a5cc81a5b9d985b1a5960821b6044820152606401610488565b60006105737f8b351c81dc4dffd686ef891d4e3d63ac440147e1ab6ed7a39c6d33d187188d4285600001518660200151876040015160405160200161055894939291909384526001600160a01b039290921660208401526040830152606082015260800190565b60405160208183030381529060405280519060200120610d90565b90506105cc60008051602061189a8339815191526105c78386868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610dbd92505050565b610de7565b83516001600160a01b031660009081526005602052604081208054600192906105f69084906117c6565b9091555050835160208501516040516000926001600160a01b031691908381818185875af1925050503d806000811461064b576040519150601f19603f3d011682016040523d82523d6000602084013e610650565b606091505b50509050806106715760405162461bcd60e51b8152600401610488906117d9565b602085015185516040516001600160a01b03909116907fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a90600090a350506106b96001600355565b505050565b6000828152600260205260409020600101546106d981610e24565b6106e38383610e2e565b50505050565b6001600160a01b03811633146107125760405163334bd91960e11b815260040160405180910390fd5b6106b98282610ec2565b60008051602061189a83398151915261073481610e24565b60005b8881101561092c5760008a8a8381811061075357610753611807565b9050602002016020810190610768919061165e565b9050600087878481811061077e5761077e611807565b905060200201359050600086868581811061079b5761079b611807565b90506020020135905060008b8b868181106107b8576107b8611807565b90506020020160208101906107cd919061165e565b6001600160a01b03851660009081526004602052604090205490915083111561082d5760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742066756e647360701b6044820152606401610488565b6000610839838561181d565b90506000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610888576040519150601f19603f3d011682016040523d82523d6000602084013e61088d565b606091505b50509050806108ae5760405162461bcd60e51b8152600401610488906117d9565b6001600160a01b038616600090815260046020526040812080548792906108d690849061181d565b9091555050604051849083906001600160a01b038616907fdf273cb619d95419a9cd0ec88123a0538c85064229baa6363788f743fff90deb90600090a4505050505050808061092490611830565b915050610737565b50505050505050505050565b600061094381610e24565b8147101561098a5760405162461bcd60e51b8152602060048201526014602482015273494e53554646494349454e545f42414c414e434560601b6044820152606401610488565b6040516001600160a01b038416908390600081818185875af1925050503d80600081146109d3576040519150601f19603f3d011682016040523d82523d6000602084013e6109d8565b606091505b505050505050565b60008051602061189a8339815191526109f881610e24565b6001600160a01b03851660009081526004602052604090205483811015610a565760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742066756e647360701b6044820152606401610488565b6000610a62848661181d565b90506000866001600160a01b03168260405160006040518083038185875af1925050503d8060008114610ab1576040519150601f19603f3d011682016040523d82523d6000602084013e610ab6565b606091505b5050905080610ad75760405162461bcd60e51b8152600401610488906117d9565b6001600160a01b03881660009081526004602052604081208054889290610aff90849061181d565b9091555050604051859083906001600160a01b038a16907fdf273cb619d95419a9cd0ec88123a0538c85064229baa6363788f743fff90deb90600090a45050505050505050565b600060608060008060006060610b5a610f2f565b610b62610f61565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60009182526002602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610bc281610e24565b50565b60003411610c155760405162461bcd60e51b815260206004820152601f60248201527f56616c75652073686f756c6420657175616c2068696768657374207a65726f006044820152606401610488565b336000908152600460205260409020543490610c3182826117c6565b336000818152600460205260408082208490555192935084927fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9190a35050565b600082815260026020526040902060010154610c8d81610e24565b6106e38383610ec2565b610c9f610d66565b60003411610cef5760405162461bcd60e51b815260206004820152601f60248201527f56616c75652073686f756c6420657175616c2068696768657374207a65726f006044820152606401610488565b6001600160a01b0381166000908152600460205260409020543490610d1482826117c6565b6001600160a01b0384166000818152600460205260408082208490555192935084927fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9190a35050610bc26001600355565b600260035403610d8957604051633ee5aeb560e01b815260040160405180910390fd5b6002600355565b6000610433610d9d610f8e565b8360405161190160f01b8152600281019290925260228201526042902090565b600080600080610dcd86866110b9565b925092509250610ddd8282611106565b5090949350505050565b610df18282610b8c565b610e205760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610488565b5050565b610bc28133610de7565b6000610e3a8383610b8c565b610eba5760008381526002602090815260408083206001600160a01b03861684529091529020805460ff19166001179055610e723390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610433565b506000610433565b6000610ece8383610b8c565b15610eba5760008381526002602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610433565b6060610f5c7f5275627973636f72655f4465706f73697400000000000000000000000000001160006111bf565b905090565b6060610f5c7f302e302e3100000000000000000000000000000000000000000000000000000560016111bf565b6000306001600160a01b037f0000000000000000000000003d52d95d58fcb53814ea37d580601d2af2b4cc9816148015610fe757507f000000000000000000000000000000000000000000000000000000000000210546145b1561101157507fff4e4d4b39a7c3948eab88be82843e7e66af7fc86fdd2d46826779a9ece8038090565b610f5c604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f3302b057a7919e47e04a6d089f72ec3a638016a0b27a87141a22e9959e7ca092918101919091527fae209a0b48f21c054280f2455d32cf309387644879d9acbd8ffc19916381188560608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b600080600083516041036110f35760208401516040850151606086015160001a6110e58882858561126a565b9550955095505050506110ff565b50508151600091506002905b9250925092565b600082600381111561111a5761111a611849565b03611123575050565b600182600381111561113757611137611849565b036111555760405163f645eedf60e01b815260040160405180910390fd5b600282600381111561116957611169611849565b0361118a5760405163fce698f760e01b815260048101829052602401610488565b600382600381111561119e5761119e611849565b03610e20576040516335e2f38360e21b815260048101829052602401610488565b606060ff83146111d9576111d283611339565b9050610433565b8180546111e59061185f565b80601f01602080910402602001604051908101604052809291908181526020018280546112119061185f565b801561125e5780601f106112335761010080835404028352916020019161125e565b820191906000526020600020905b81548152906001019060200180831161124157829003601f168201915b50505050509050610433565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411156112a5575060009150600390508261132f565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa1580156112f9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166113255750600092506001915082905061132f565b9250600091508190505b9450945094915050565b6060600061134683611378565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b600060ff8216601f81111561043357604051632cd44ac360e21b815260040160405180910390fd5b6000602082840312156113b257600080fd5b81356001600160e01b0319811681146113ca57600080fd5b9392505050565b6000602082840312156113e357600080fd5b5035919050565b6001600160a01b0381168114610bc257600080fd5b60008083601f84011261141157600080fd5b50813567ffffffffffffffff81111561142957600080fd5b60208301915083602082850101111561144157600080fd5b9250929050565b6000806000838503608081121561145e57600080fd5b606081121561146c57600080fd5b506040516060810167ffffffffffffffff828210818311171561149f57634e487b7160e01b600052604160045260246000fd5b81604052863591506114b0826113ea565b818352602087013560208401526040870135604084015282955060608701359250808311156114de57600080fd5b50506114ec868287016113ff565b9497909650939450505050565b6000806040838503121561150c57600080fd5b82359150602083013561151e816113ea565b809150509250929050565b60008083601f84011261153b57600080fd5b50813567ffffffffffffffff81111561155357600080fd5b6020830191508360208260051b850101111561144157600080fd5b6000806000806000806000806080898b03121561158a57600080fd5b883567ffffffffffffffff808211156115a257600080fd5b6115ae8c838d01611529565b909a50985060208b01359150808211156115c757600080fd5b6115d38c838d01611529565b909850965060408b01359150808211156115ec57600080fd5b6115f88c838d01611529565b909650945060608b013591508082111561161157600080fd5b5061161e8b828c01611529565b999c989b5096995094979396929594505050565b6000806040838503121561164557600080fd5b8235611650816113ea565b946020939093013593505050565b60006020828403121561167057600080fd5b81356113ca816113ea565b6000806000806080858703121561169157600080fd5b843561169c816113ea565b935060208501356116ac816113ea565b93969395505050506040820135916060013590565b6000815180845260005b818110156116e7576020818501810151868301820152016116cb565b506000602082860101526020601f19601f83011685010191505092915050565b60ff60f81b881681526000602060e08184015261172760e084018a6116c1565b8381036040850152611739818a6116c1565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825283870192509083019060005b8181101561178b5783518352928401929184019160010161176f565b50909c9b505050505050505050505050565b6020815260006113ca60208301846116c1565b634e487b7160e01b600052601160045260246000fd5b80820180821115610433576104336117b0565b6020808252601490820152732330b4b632b2103a379039b2b7321022ba3432b960611b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b81810381811115610433576104336117b0565b600060018201611842576118426117b0565b5060010190565b634e487b7160e01b600052602160045260246000fd5b600181811c9082168061187357607f821691505b60208210810361189357634e487b7160e01b600052602260045260246000fd5b5091905056fe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929a2646970667358221220e1995302174198b3312796b9698d91b77e80ba8460cbdce78363cbe890b5ad7364736f6c63430008150033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000d0d5ff3cfef8b7b2b1cac6b6c27fd0846c09361000000000000000000000000381c031baa5995d0cc52386508050ac947780815
-----Decoded View---------------
Arg [0] : admin (address): 0x0d0D5Ff3cFeF8B7B2b1cAC6B6C27Fd0846c09361
Arg [1] : operator (address): 0x381c031bAA5995D0Cc52386508050Ac947780815
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000d0d5ff3cfef8b7b2b1cac6b6c27fd0846c09361
Arg [1] : 000000000000000000000000381c031baa5995d0cc52386508050ac947780815
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$115.00
Net Worth in ETH
0.040168
Token Allocations
ETH
56.80%
POL
32.78%
GUSDT
10.42%
Multichain Portfolio | 35 Chains
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.