My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
0x27461a79cfcd8786f47997cff00b1966827293dcb4118635c1779c265084e98c | Initialize | 443579 | 304 days 1 hr ago | Boba Network: Deployer | IN | Boba Network: Boba Billing Contract | 0 Ether | 0.000473094 | |
0xc7f5148e00cc58fd58586583e59b0b915d4647a1053c07ef7806fba1bfee9584 | 0x60806040 | 443575 | 304 days 1 hr ago | Boba Network: Deployer | IN | Create: L2BillingContract | 0 Ether | 0.001730699 |
[ Download CSV Export ]
Latest 25 internal transaction
[ Download CSV Export ]
Contract Name:
L2BillingContract
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 10000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity >0.7.5; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; contract L2BillingContract { using SafeERC20 for IERC20; /************* * Variables * *************/ address public owner; address public feeTokenAddress; address public l2FeeWallet; uint256 public exitFee; /************* * Events * *************/ event TransferOwnership(address, address); event UpdateExitFee(uint256); event CollectFee(address, uint256); event Withdraw(address, uint256); /************* * Modifiers * *************/ modifier onlyNotInitialized() { require(feeTokenAddress == address(0), "Contract has been initialized"); _; } modifier onlyInitialized() { require(feeTokenAddress != address(0), "Contract has not been initialized"); _; } modifier onlyOwner() { require(owner == msg.sender, "Caller is not the owner"); _; } /************* * Functions * *************/ function initialize(address _feeTokenAddress, address _l2FeeWallet, uint256 _exitFee) public onlyNotInitialized { require(_feeTokenAddress != address(0), "Fee token address cannot be zero"); require(_l2FeeWallet != address(0), "L2 fee wallet cannot be zero"); require(_exitFee > 0, "exit fee cannot be zero"); feeTokenAddress = _feeTokenAddress; l2FeeWallet = _l2FeeWallet; exitFee = _exitFee; owner = msg.sender; } function transferOwnership(address _newOwner) public onlyOwner { require(_newOwner != address(0), "Ownable: new owner is the zero address"); address oldOwner = owner; owner = _newOwner; emit TransferOwnership(oldOwner, _newOwner); } function updateExitFee(uint256 _exitFee) public onlyOwner() { require(_exitFee > 0, "exit fee cannot be zero"); exitFee = _exitFee; emit UpdateExitFee(_exitFee); } function collectFee() external onlyInitialized { IERC20(feeTokenAddress).safeTransferFrom(msg.sender, address(this), exitFee); emit CollectFee(msg.sender, exitFee); } function withdraw() external onlyInitialized { uint256 balance = IERC20(feeTokenAddress).balanceOf(address(this)); require(balance >= 150e18, "Balance is too low"); IERC20(feeTokenAddress).safeTransfer(l2FeeWallet, balance); emit Withdraw(l2FeeWallet, balance); } }
// SPDX-License-Identifier: MIT 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); }
// SPDX-License-Identifier: MIT 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"); } } }
// SPDX-License-Identifier: MIT 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); } } } }
{ "optimizer": { "enabled": true, "runs": 10000 }, "metadata": { "bytecodeHash": "none", "useLiteralContent": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"},{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"CollectFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"},{"indexed":false,"internalType":"address","name":"","type":"address"}],"name":"TransferOwnership","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"UpdateExitFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"},{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"collectFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"exitFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_feeTokenAddress","type":"address"},{"internalType":"address","name":"_l2FeeWallet","type":"address"},{"internalType":"uint256","name":"_exitFee","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"l2FeeWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_exitFee","type":"uint256"}],"name":"updateExitFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50610e26806100206000396000f3fe608060405234801561001057600080fd5b50600436106100a35760003560e01c80636284ae4111610076578063b8df0dea1161005b578063b8df0dea14610159578063d4d5d32a14610179578063f2fde38b1461018157600080fd5b80636284ae41146101225780638da5cb5b1461013957600080fd5b80630a32dfbf146100a85780631234605e146100bd5780631794bb3c146101075780633ccfd60b1461011a575b600080fd5b6100bb6100b6366004610cac565b610194565b005b6002546100dd9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100bb610115366004610cee565b61028c565b6100bb610471565b61012b60035481565b6040519081526020016100fe565b6000546100dd9073ffffffffffffffffffffffffffffffffffffffff1681565b6001546100dd9073ffffffffffffffffffffffffffffffffffffffff1681565b6100bb610673565b6100bb61018f366004610d2a565b610769565b60005473ffffffffffffffffffffffffffffffffffffffff1633146102005760405162461bcd60e51b815260206004820152601760248201527f43616c6c6572206973206e6f7420746865206f776e657200000000000000000060448201526064015b60405180910390fd5b600081116102505760405162461bcd60e51b815260206004820152601760248201527f65786974206665652063616e6e6f74206265207a65726f00000000000000000060448201526064016101f7565b60038190556040518181527fdf63f901294f7738179b8d0f8ad5000f9086f5d580b2c386c95dce4d13824cc2906020015b60405180910390a150565b60015473ffffffffffffffffffffffffffffffffffffffff16156102f25760405162461bcd60e51b815260206004820152601d60248201527f436f6e747261637420686173206265656e20696e697469616c697a656400000060448201526064016101f7565b73ffffffffffffffffffffffffffffffffffffffff83166103555760405162461bcd60e51b815260206004820181905260248201527f46656520746f6b656e20616464726573732063616e6e6f74206265207a65726f60448201526064016101f7565b73ffffffffffffffffffffffffffffffffffffffff82166103b85760405162461bcd60e51b815260206004820152601c60248201527f4c32206665652077616c6c65742063616e6e6f74206265207a65726f0000000060448201526064016101f7565b600081116104085760405162461bcd60e51b815260206004820152601760248201527f65786974206665652063616e6e6f74206265207a65726f00000000000000000060448201526064016101f7565b6001805473ffffffffffffffffffffffffffffffffffffffff9485167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805493909416928116929092179092556003919091556000805490911633179055565b60015473ffffffffffffffffffffffffffffffffffffffff166104fc5760405162461bcd60e51b815260206004820152602160248201527f436f6e747261637420686173206e6f74206265656e20696e697469616c697a6560448201527f640000000000000000000000000000000000000000000000000000000000000060648201526084016101f7565b6001546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561056657600080fd5b505afa15801561057a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059e9190610d45565b9050680821ab0d44149800008110156105f95760405162461bcd60e51b815260206004820152601260248201527f42616c616e636520697320746f6f206c6f77000000000000000000000000000060448201526064016101f7565b6002546001546106239173ffffffffffffffffffffffffffffffffffffffff9182169116836108df565b6002546040805173ffffffffffffffffffffffffffffffffffffffff9092168252602082018390527f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243649101610281565b60015473ffffffffffffffffffffffffffffffffffffffff166106fe5760405162461bcd60e51b815260206004820152602160248201527f436f6e747261637420686173206e6f74206265656e20696e697469616c697a6560448201527f640000000000000000000000000000000000000000000000000000000000000060648201526084016101f7565b60035460015461072a9173ffffffffffffffffffffffffffffffffffffffff90911690339030906109b8565b6003546040805133815260208101929092527fdfeef5879c25440d1418a79a16489f0e739d22ac040c8c76f7b998fc704edeb8910160405180910390a1565b60005473ffffffffffffffffffffffffffffffffffffffff1633146107d05760405162461bcd60e51b815260206004820152601760248201527f43616c6c6572206973206e6f7420746865206f776e657200000000000000000060448201526064016101f7565b73ffffffffffffffffffffffffffffffffffffffff81166108595760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016101f7565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527f5c486528ec3e3f0ea91181cff8116f02bfa350e03b8b6f12e00765adbb5af85c910160405180910390a15050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526109b39084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610a1c565b505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052610a169085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401610931565b50505050565b6000610a7e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610b0e9092919063ffffffff16565b8051909150156109b35780806020019051810190610a9c9190610d5e565b6109b35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016101f7565b6060610b1d8484600085610b27565b90505b9392505050565b606082471015610b9f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016101f7565b843b610bed5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101f7565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610c169190610dac565b60006040518083038185875af1925050503d8060008114610c53576040519150601f19603f3d011682016040523d82523d6000602084013e610c58565b606091505b5091509150610c68828286610c73565b979650505050505050565b60608315610c82575081610b20565b825115610c925782518084602001fd5b8160405162461bcd60e51b81526004016101f79190610dc8565b600060208284031215610cbe57600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610ce957600080fd5b919050565b600080600060608486031215610d0357600080fd5b610d0c84610cc5565b9250610d1a60208501610cc5565b9150604084013590509250925092565b600060208284031215610d3c57600080fd5b610b2082610cc5565b600060208284031215610d5757600080fd5b5051919050565b600060208284031215610d7057600080fd5b81518015158114610b2057600080fd5b60005b83811015610d9b578181015183820152602001610d83565b83811115610a165750506000910152565b60008251610dbe818460208701610d80565b9190910192915050565b6020815260008251806020840152610de7816040850160208701610d80565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea164736f6c6343000809000a
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.