Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- WSxETHL2DepositPool
- Optimization enabled
- true
- Compiler version
- v0.8.20+commit.a1b79de6
- Optimization runs
- 10000000
- EVM Version
- default
- Verified at
- 2024-04-27T12:03:18.001855Z
contracts/L2/WSxETHL2DepositPool.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import { IERC20, SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol"; import { Initializable } from "../utils/Initializable.sol"; interface IOracle { function getRate() external view returns (uint256); } contract WSxETHL2DepositPool is Initializable, AccessControl, ReentrancyGuard { using SafeERC20 for IERC20; IERC20 public wsxETH; uint256 public feeBps; // Basis points for fees uint256 public feeEarnedInETH; address public wsxETHOracle; bytes32 public constant BRIDGER_ROLE = keccak256("BRIDGER_ROLE"); event WSxETHDeposit( address indexed caller, address indexed recipient, uint256 wsxETHAmount, uint256 fee, bytes32 referralId ); event FeesWithdrawn(uint256 feeEarnedInETH); event AssetsMovedForBridging(uint256 ethBalanceMinusFees); event FeeBpsSet(uint256 feeBps); event OracleSet(address oracle); /// @dev Initialize the contract /// @param admin The admin address /// @param _wsxETH The wsxETH token address /// @param _feeBps The fee basis points /// @param _wsxETHOracle The wsxETHOracle address function initialize( address admin, address _wsxETH, uint256 _feeBps, address _wsxETHOracle ) public initializer { if (_wsxETH == address(0)) revert("wsxETH = address(0)"); if (_wsxETHOracle == address(0)) revert("wsxETH = address(0)"); _grantRole(DEFAULT_ADMIN_ROLE, admin); _setupRole(BRIDGER_ROLE, admin); wsxETH = IERC20(_wsxETH); feeBps = _feeBps; wsxETHOracle = _wsxETHOracle; } /// @dev Gets the rate from the wsxETHOracle function getRate() public view returns (uint256) { return IOracle(wsxETHOracle).getRate(); } /// @dev Swaps ETH for wsxETH /// @param referralId The referral id function deposit(bytes32 referralId) external payable nonReentrant { _deposit(referralId, msg.sender); } /// @dev Swaps ETH for wsxETH /// @param referralId The referral id /// @param recipient Address of the recipient function depositFor( bytes32 referralId, address recipient ) external payable nonReentrant { _deposit(referralId, recipient); } function _deposit(bytes32 referralId, address recipient) internal { uint256 amount = msg.value; if (amount == 0) revert("InvalidAmount"); (uint256 wsxETHAmount, uint256 fee, ) = ethToWSxETHAmountAndFee(amount); feeEarnedInETH += fee; wsxETH.safeTransfer(recipient, wsxETHAmount); emit WSxETHDeposit( msg.sender, recipient, wsxETHAmount, fee, referralId ); } /// @dev view function to get the wsxETH amount for a given amount of ETH /// @param amount The amount of ETH /// @return wsxETHAmount The amount of wsxETH that will be received /// @return fee The fee that will be charged in ETH terms function ethToWSxETHAmountAndFee( uint256 amount ) public view returns (uint256 wsxETHAmount, uint256 fee, uint256 available) { fee = (amount * feeBps) / 10_000; uint256 amountAfterFee = amount - fee; // rate of wsxETH in ETH uint256 wsxETHToETHrate = getRate(); // Calculate the final wsxETH amount wsxETHAmount = (amountAfterFee * 1e18) / wsxETHToETHrate; available = wsxETH.balanceOf(address(this)); } /*////////////////////////////////////////////////////////////// ACCESS RESTRICTED FUNCTIONS //////////////////////////////////////////////////////////////*/ /// @dev Withdraws fees earned by the pool function withdrawFees(address receiver) external onlyRole(BRIDGER_ROLE) { // withdraw fees in ETH uint256 amountToSendInETH = feeEarnedInETH; if (amountToSendInETH == 0) revert("feeEarned = 0"); feeEarnedInETH = 0; (bool success, ) = payable(receiver).call{ value: amountToSendInETH }( "" ); if (!success) revert("TransferFailed"); emit FeesWithdrawn(amountToSendInETH); } /// @dev Withdraws assets from the contract for bridging function moveAssetsForBridging() external onlyRole(BRIDGER_ROLE) { // withdraw ETH - fees uint256 ethBalanceMinusFees = address(this).balance - feeEarnedInETH; (bool success, ) = msg.sender.call{ value: ethBalanceMinusFees }(""); if (!success) revert("TransferFailed"); emit AssetsMovedForBridging(ethBalanceMinusFees); } /// @dev Sets the fee basis points /// @param _feeBps The fee basis points function setFeeBps(uint256 _feeBps) external onlyRole(DEFAULT_ADMIN_ROLE) { if (_feeBps > 10_000) revert("InvalidAmount"); feeBps = _feeBps; emit FeeBpsSet(_feeBps); } /// @dev Sets the wsxETHOracle address /// @param _wsxETHOracle The wsxETHOracle address function setWSxETHOracle( address _wsxETHOracle ) external onlyRole(DEFAULT_ADMIN_ROLE) { if (_wsxETHOracle == address(0)) revert("_wsxETHOracle = address(0)"); wsxETHOracle = _wsxETHOracle; emit OracleSet(_wsxETHOracle); } }
@openzeppelin/contracts/access/AccessControl.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../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: * * ``` * 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}: * * ``` * 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. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @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 override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @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 override 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. */ function grantRole(bytes32 role, address account) public virtual override 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. */ function revokeRole(bytes32 role, address account) public virtual override 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 `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @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 Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
@openzeppelin/contracts/access/IAccessControl.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @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. * * _Available since v3.1._ */ 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 `account`. */ function renounceRole(bytes32 role, address account) external; }
@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
@openzeppelin/contracts/security/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @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; 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() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
@openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
@openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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; } }
@openzeppelin/contracts/utils/Strings.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { 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_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
@openzeppelin/contracts/utils/introspection/ERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./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); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
@openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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); }
contracts/utils/Initializable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; /** * @title Base contract any contracts that need to initialize state after deployment. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require( initializing || !initialized, "Initializable: contract is already initialized" ); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; initialized = true; } _; if (isTopLevelCall) { initializing = false; } } uint256[50] private ______gap; }
Compiler Settings
{"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":10000000,"enabled":true},"metadata":{"useLiteralContent":true},"libraries":{}}
Contract ABI
[{"type":"event","name":"AssetsMovedForBridging","inputs":[{"type":"uint256","name":"ethBalanceMinusFees","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"FeeBpsSet","inputs":[{"type":"uint256","name":"feeBps","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"FeesWithdrawn","inputs":[{"type":"uint256","name":"feeEarnedInETH","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OracleSet","inputs":[{"type":"address","name":"oracle","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"previousAdminRole","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"newAdminRole","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"WSxETHDeposit","inputs":[{"type":"address","name":"caller","internalType":"address","indexed":true},{"type":"address","name":"recipient","internalType":"address","indexed":true},{"type":"uint256","name":"wsxETHAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"fee","internalType":"uint256","indexed":false},{"type":"bytes32","name":"referralId","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"BRIDGER_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"payable","outputs":[],"name":"deposit","inputs":[{"type":"bytes32","name":"referralId","internalType":"bytes32"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"depositFor","inputs":[{"type":"bytes32","name":"referralId","internalType":"bytes32"},{"type":"address","name":"recipient","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"wsxETHAmount","internalType":"uint256"},{"type":"uint256","name":"fee","internalType":"uint256"},{"type":"uint256","name":"available","internalType":"uint256"}],"name":"ethToWSxETHAmountAndFee","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"feeBps","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"feeEarnedInETH","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRate","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"admin","internalType":"address"},{"type":"address","name":"_wsxETH","internalType":"address"},{"type":"uint256","name":"_feeBps","internalType":"uint256"},{"type":"address","name":"_wsxETHOracle","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"moveAssetsForBridging","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFeeBps","inputs":[{"type":"uint256","name":"_feeBps","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setWSxETHOracle","inputs":[{"type":"address","name":"_wsxETHOracle","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawFees","inputs":[{"type":"address","name":"receiver","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"wsxETH","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"wsxETHOracle","inputs":[]}]
Contract Creation Code
0x608060405234801561000f575f80fd5b506001603455611c9b806100225f395ff3fe608060405260043610610162575f3560e01c80634cb312e7116100c657806391d148541161007c578063be20309411610057578063be2030941461040d578063c3c30a9e1461042c578063d547741f14610458575f80fd5b806391d1485414610396578063a217fddf146103e7578063b214faa5146103fa575f80fd5b8063687b0a11116100ac578063687b0a111461034e57806372c27b621461036257806390ed579b14610381575f80fd5b80634cb312e71461031b578063679aefce1461033a575f80fd5b806327b8f9e51161011b5780632f2ff15d116101015780632f2ff15d146102aa57806336568abe146102c95780633d75e451146102e8575f80fd5b806327b8f9e51461025d5780632a57d75c14610297575f80fd5b8063164e68de1161014b578063164e68de146101eb578063248a9ca31461020c57806324a9d85314610248575f80fd5b806301ffc9a7146101665780630e7d20681461019a575b5f80fd5b348015610171575f80fd5b506101856101803660046118e7565b610477565b60405190151581526020015b60405180910390f35b3480156101a5575f80fd5b506035546101c69073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b3480156101f6575f80fd5b5061020a61020536600461194e565b61050f565b005b348015610217575f80fd5b5061023a610226366004611967565b5f9081526033602052604090206001015490565b604051908152602001610191565b348015610253575f80fd5b5061023a60365481565b348015610268575f80fd5b5061027c610277366004611967565b6106ae565b60408051938452602084019290925290820152606001610191565b61020a6102a536600461197e565b61079e565b3480156102b5575f80fd5b5061020a6102c436600461197e565b610822565b3480156102d4575f80fd5b5061020a6102e336600461197e565b61084c565b3480156102f3575f80fd5b5061023a7fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a881565b348015610326575f80fd5b5061020a61033536600461194e565b6108ff565b348015610345575f80fd5b5061023a610a02565b348015610359575f80fd5b5061020a610a98565b34801561036d575f80fd5b5061020a61037c366004611967565b610bbc565b34801561038c575f80fd5b5061023a60375481565b3480156103a1575f80fd5b506101856103b036600461197e565b5f91825260336020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156103f2575f80fd5b5061023a5f81565b61020a610408366004611967565b610c68565b348015610418575f80fd5b5061020a6104273660046119a8565b610ceb565b348015610437575f80fd5b506038546101c69073ffffffffffffffffffffffffffffffffffffffff1681565b348015610463575f80fd5b5061020a61047236600461197e565b610f88565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061050957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b7fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a861053a8133610fad565b6037545f8190036105ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f6665654561726e6564203d20300000000000000000000000000000000000000060448201526064015b60405180910390fd5b5f603781905560405173ffffffffffffffffffffffffffffffffffffffff85169083908381818185875af1925050503d805f8114610605576040519150601f19603f3d011682016040523d82523d5f602084013e61060a565b606091505b5050905080610675576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f5472616e736665724661696c656400000000000000000000000000000000000060448201526064016105a3565b6040518281527f9800e6f57aeb4360eaa72295a820a4293e1e66fbfcabcd8874ae141304a76deb9060200160405180910390a150505050565b5f805f612710603654856106c29190611a1f565b6106cc9190611a36565b91505f6106d98386611a6e565b90505f6106e4610a02565b9050806106f983670de0b6b3a7640000611a1f565b6107039190611a36565b6035546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015291965073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015610770573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107949190611a81565b9496939550505050565b60026034540361080a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a3565b6002603455610819828261107e565b50506001603455565b5f8281526033602052604090206001015461083d8133610fad565b6108478383611195565b505050565b73ffffffffffffffffffffffffffffffffffffffff811633146108f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016105a3565b6108fb8282611287565b5050565b5f61090a8133610fad565b73ffffffffffffffffffffffffffffffffffffffff8216610987576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f5f7773784554484f7261636c65203d206164647265737328302900000000000060448201526064016105a3565b603880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091556040519081527f3f32684a32a11dabdbb8c0177de80aa3ae36a004d75210335b49e544e48cd0aa906020015b60405180910390a15050565b603854604080517f679aefce00000000000000000000000000000000000000000000000000000000815290515f9273ffffffffffffffffffffffffffffffffffffffff169163679aefce9160048083019260209291908290030181865afa158015610a6f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a939190611a81565b905090565b7fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a8610ac38133610fad565b5f60375447610ad29190611a6e565b6040519091505f90339083908381818185875af1925050503d805f8114610b14576040519150601f19603f3d011682016040523d82523d5f602084013e610b19565b606091505b5050905080610b84576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f5472616e736665724661696c656400000000000000000000000000000000000060448201526064016105a3565b6040518281527f52f82c8bf940e02934eb4517dd40f665fd2b0fa3f1d03a1e40edb3d4a12582ed9060200160405180910390a1505050565b5f610bc78133610fad565b612710821115610c33576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c6964416d6f756e740000000000000000000000000000000000000060448201526064016105a3565b60368290556040518281527f4f78c4ceb393a616bbd264a4584a9ad15d722042ce1e135e6a8380217f5cb42b906020016109f6565b600260345403610cd4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a3565b6002603455610ce3813361107e565b506001603455565b5f54610100900460ff1680610d0257505f5460ff16155b610d8e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016105a3565b5f54610100900460ff16158015610dcb575f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b73ffffffffffffffffffffffffffffffffffffffff8416610e48576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f777378455448203d20616464726573732830290000000000000000000000000060448201526064016105a3565b73ffffffffffffffffffffffffffffffffffffffff8216610ec5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f777378455448203d20616464726573732830290000000000000000000000000060448201526064016105a3565b610ecf5f86611195565b610ef97fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a886611340565b6035805473ffffffffffffffffffffffffffffffffffffffff8087167fffffffffffffffffffffffff000000000000000000000000000000000000000092831617909255603685905560388054928516929091169190911790558015610f81575f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555b5050505050565b5f82815260336020526040902060010154610fa38133610fad565b6108478383611287565b5f82815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166108fb576110048173ffffffffffffffffffffffffffffffffffffffff16601461134a565b61100f83602061134a565b604051602001611020929190611aba565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526105a391600401611b3a565b345f8190036110e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c6964416d6f756e740000000000000000000000000000000000000060448201526064016105a3565b5f806110f4836106ae565b50915091508060375f82825461110a9190611b8a565b90915550506035546111339073ffffffffffffffffffffffffffffffffffffffff16858461158e565b604080518381526020810183905290810186905273ffffffffffffffffffffffffffffffffffffffff85169033907f0ac761999db9645ec64434fef609f77e81ce11527730182284f8a66f5f05af949060600160405180910390a35050505050565b5f82815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166108fb575f82815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556112293390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b5f82815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156108fb575f82815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6108fb8282611195565b60605f611358836002611a1f565b611363906002611b8a565b67ffffffffffffffff81111561137b5761137b611b9d565b6040519080825280601f01601f1916602001820160405280156113a5576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000815f815181106113db576113db611bca565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061143d5761143d611bca565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053505f611477846002611a1f565b611482906001611b8a565b90505b600181111561151e577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106114c3576114c3611bca565b1a60f81b8282815181106114d9576114d9611bca565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a90535060049490941c9361151781611bf7565b9050611485565b508315611587576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105a3565b9392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff848116602483015260448083018590528351808403909101815260649092018352602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656490840152610847928692915f91611658918516908490611702565b80519091501561084757808060200190518101906116769190611c2b565b610847576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016105a3565b606061171084845f85611718565b949350505050565b6060824710156117aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016105a3565b843b611812576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105a3565b5f808673ffffffffffffffffffffffffffffffffffffffff16858760405161183a9190611c4a565b5f6040518083038185875af1925050503d805f8114611874576040519150601f19603f3d011682016040523d82523d5f602084013e611879565b606091505b5091509150611889828286611894565b979650505050505050565b606083156118a3575081611587565b8251156118b35782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a39190611b3a565b5f602082840312156118f7575f80fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611587575f80fd5b803573ffffffffffffffffffffffffffffffffffffffff81168114611949575f80fd5b919050565b5f6020828403121561195e575f80fd5b61158782611926565b5f60208284031215611977575f80fd5b5035919050565b5f806040838503121561198f575f80fd5b8235915061199f60208401611926565b90509250929050565b5f805f80608085870312156119bb575f80fd5b6119c485611926565b93506119d260208601611926565b9250604085013591506119e760608601611926565b905092959194509250565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8082028115828204841417610509576105096119f2565b5f82611a69577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b81810381811115610509576105096119f2565b5f60208284031215611a91575f80fd5b5051919050565b5f5b83811015611ab2578181015183820152602001611a9a565b50505f910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351611af1816017850160208801611a98565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351611b2e816028840160208801611a98565b01602801949350505050565b602081525f8251806020840152611b58816040850160208701611a98565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b80820180821115610509576105096119f2565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f81611c0557611c056119f2565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b5f60208284031215611c3b575f80fd5b81518015158114611587575f80fd5b5f8251611c5b818460208701611a98565b919091019291505056fea2646970667358221220c2cbeb34b0b7deefecf97b23428ab6c7ab5c121c9cfdc36fb7361620fd9f6c0f64736f6c63430008140033
Deployed ByteCode
0x608060405260043610610162575f3560e01c80634cb312e7116100c657806391d148541161007c578063be20309411610057578063be2030941461040d578063c3c30a9e1461042c578063d547741f14610458575f80fd5b806391d1485414610396578063a217fddf146103e7578063b214faa5146103fa575f80fd5b8063687b0a11116100ac578063687b0a111461034e57806372c27b621461036257806390ed579b14610381575f80fd5b80634cb312e71461031b578063679aefce1461033a575f80fd5b806327b8f9e51161011b5780632f2ff15d116101015780632f2ff15d146102aa57806336568abe146102c95780633d75e451146102e8575f80fd5b806327b8f9e51461025d5780632a57d75c14610297575f80fd5b8063164e68de1161014b578063164e68de146101eb578063248a9ca31461020c57806324a9d85314610248575f80fd5b806301ffc9a7146101665780630e7d20681461019a575b5f80fd5b348015610171575f80fd5b506101856101803660046118e7565b610477565b60405190151581526020015b60405180910390f35b3480156101a5575f80fd5b506035546101c69073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b3480156101f6575f80fd5b5061020a61020536600461194e565b61050f565b005b348015610217575f80fd5b5061023a610226366004611967565b5f9081526033602052604090206001015490565b604051908152602001610191565b348015610253575f80fd5b5061023a60365481565b348015610268575f80fd5b5061027c610277366004611967565b6106ae565b60408051938452602084019290925290820152606001610191565b61020a6102a536600461197e565b61079e565b3480156102b5575f80fd5b5061020a6102c436600461197e565b610822565b3480156102d4575f80fd5b5061020a6102e336600461197e565b61084c565b3480156102f3575f80fd5b5061023a7fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a881565b348015610326575f80fd5b5061020a61033536600461194e565b6108ff565b348015610345575f80fd5b5061023a610a02565b348015610359575f80fd5b5061020a610a98565b34801561036d575f80fd5b5061020a61037c366004611967565b610bbc565b34801561038c575f80fd5b5061023a60375481565b3480156103a1575f80fd5b506101856103b036600461197e565b5f91825260336020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156103f2575f80fd5b5061023a5f81565b61020a610408366004611967565b610c68565b348015610418575f80fd5b5061020a6104273660046119a8565b610ceb565b348015610437575f80fd5b506038546101c69073ffffffffffffffffffffffffffffffffffffffff1681565b348015610463575f80fd5b5061020a61047236600461197e565b610f88565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061050957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b7fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a861053a8133610fad565b6037545f8190036105ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f6665654561726e6564203d20300000000000000000000000000000000000000060448201526064015b60405180910390fd5b5f603781905560405173ffffffffffffffffffffffffffffffffffffffff85169083908381818185875af1925050503d805f8114610605576040519150601f19603f3d011682016040523d82523d5f602084013e61060a565b606091505b5050905080610675576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f5472616e736665724661696c656400000000000000000000000000000000000060448201526064016105a3565b6040518281527f9800e6f57aeb4360eaa72295a820a4293e1e66fbfcabcd8874ae141304a76deb9060200160405180910390a150505050565b5f805f612710603654856106c29190611a1f565b6106cc9190611a36565b91505f6106d98386611a6e565b90505f6106e4610a02565b9050806106f983670de0b6b3a7640000611a1f565b6107039190611a36565b6035546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015291965073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015610770573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107949190611a81565b9496939550505050565b60026034540361080a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a3565b6002603455610819828261107e565b50506001603455565b5f8281526033602052604090206001015461083d8133610fad565b6108478383611195565b505050565b73ffffffffffffffffffffffffffffffffffffffff811633146108f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016105a3565b6108fb8282611287565b5050565b5f61090a8133610fad565b73ffffffffffffffffffffffffffffffffffffffff8216610987576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f5f7773784554484f7261636c65203d206164647265737328302900000000000060448201526064016105a3565b603880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091556040519081527f3f32684a32a11dabdbb8c0177de80aa3ae36a004d75210335b49e544e48cd0aa906020015b60405180910390a15050565b603854604080517f679aefce00000000000000000000000000000000000000000000000000000000815290515f9273ffffffffffffffffffffffffffffffffffffffff169163679aefce9160048083019260209291908290030181865afa158015610a6f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a939190611a81565b905090565b7fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a8610ac38133610fad565b5f60375447610ad29190611a6e565b6040519091505f90339083908381818185875af1925050503d805f8114610b14576040519150601f19603f3d011682016040523d82523d5f602084013e610b19565b606091505b5050905080610b84576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f5472616e736665724661696c656400000000000000000000000000000000000060448201526064016105a3565b6040518281527f52f82c8bf940e02934eb4517dd40f665fd2b0fa3f1d03a1e40edb3d4a12582ed9060200160405180910390a1505050565b5f610bc78133610fad565b612710821115610c33576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c6964416d6f756e740000000000000000000000000000000000000060448201526064016105a3565b60368290556040518281527f4f78c4ceb393a616bbd264a4584a9ad15d722042ce1e135e6a8380217f5cb42b906020016109f6565b600260345403610cd4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a3565b6002603455610ce3813361107e565b506001603455565b5f54610100900460ff1680610d0257505f5460ff16155b610d8e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016105a3565b5f54610100900460ff16158015610dcb575f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b73ffffffffffffffffffffffffffffffffffffffff8416610e48576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f777378455448203d20616464726573732830290000000000000000000000000060448201526064016105a3565b73ffffffffffffffffffffffffffffffffffffffff8216610ec5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f777378455448203d20616464726573732830290000000000000000000000000060448201526064016105a3565b610ecf5f86611195565b610ef97fc809a7fd521f10cdc3c068621a1c61d5fd9bb3f1502a773e53811bc248d919a886611340565b6035805473ffffffffffffffffffffffffffffffffffffffff8087167fffffffffffffffffffffffff000000000000000000000000000000000000000092831617909255603685905560388054928516929091169190911790558015610f81575f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555b5050505050565b5f82815260336020526040902060010154610fa38133610fad565b6108478383611287565b5f82815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166108fb576110048173ffffffffffffffffffffffffffffffffffffffff16601461134a565b61100f83602061134a565b604051602001611020929190611aba565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526105a391600401611b3a565b345f8190036110e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c6964416d6f756e740000000000000000000000000000000000000060448201526064016105a3565b5f806110f4836106ae565b50915091508060375f82825461110a9190611b8a565b90915550506035546111339073ffffffffffffffffffffffffffffffffffffffff16858461158e565b604080518381526020810183905290810186905273ffffffffffffffffffffffffffffffffffffffff85169033907f0ac761999db9645ec64434fef609f77e81ce11527730182284f8a66f5f05af949060600160405180910390a35050505050565b5f82815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166108fb575f82815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556112293390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b5f82815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156108fb575f82815260336020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6108fb8282611195565b60605f611358836002611a1f565b611363906002611b8a565b67ffffffffffffffff81111561137b5761137b611b9d565b6040519080825280601f01601f1916602001820160405280156113a5576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000815f815181106113db576113db611bca565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061143d5761143d611bca565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053505f611477846002611a1f565b611482906001611b8a565b90505b600181111561151e577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106114c3576114c3611bca565b1a60f81b8282815181106114d9576114d9611bca565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a90535060049490941c9361151781611bf7565b9050611485565b508315611587576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105a3565b9392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff848116602483015260448083018590528351808403909101815260649092018352602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656490840152610847928692915f91611658918516908490611702565b80519091501561084757808060200190518101906116769190611c2b565b610847576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016105a3565b606061171084845f85611718565b949350505050565b6060824710156117aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016105a3565b843b611812576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105a3565b5f808673ffffffffffffffffffffffffffffffffffffffff16858760405161183a9190611c4a565b5f6040518083038185875af1925050503d805f8114611874576040519150601f19603f3d011682016040523d82523d5f602084013e611879565b606091505b5091509150611889828286611894565b979650505050505050565b606083156118a3575081611587565b8251156118b35782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a39190611b3a565b5f602082840312156118f7575f80fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611587575f80fd5b803573ffffffffffffffffffffffffffffffffffffffff81168114611949575f80fd5b919050565b5f6020828403121561195e575f80fd5b61158782611926565b5f60208284031215611977575f80fd5b5035919050565b5f806040838503121561198f575f80fd5b8235915061199f60208401611926565b90509250929050565b5f805f80608085870312156119bb575f80fd5b6119c485611926565b93506119d260208601611926565b9250604085013591506119e760608601611926565b905092959194509250565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8082028115828204841417610509576105096119f2565b5f82611a69577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b81810381811115610509576105096119f2565b5f60208284031215611a91575f80fd5b5051919050565b5f5b83811015611ab2578181015183820152602001611a9a565b50505f910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351611af1816017850160208801611a98565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351611b2e816028840160208801611a98565b01602801949350505050565b602081525f8251806020840152611b58816040850160208701611a98565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b80820180821115610509576105096119f2565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f81611c0557611c056119f2565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b5f60208284031215611c3b575f80fd5b81518015158114611587575f80fd5b5f8251611c5b818460208701611a98565b919091019291505056fea2646970667358221220c2cbeb34b0b7deefecf97b23428ab6c7ab5c121c9cfdc36fb7361620fd9f6c0f64736f6c63430008140033