Address Contract Partially Verified
Address
0x68D3E3034475Bd172E20cb0DA0829EfE709372c6
Balance
0 ETH
Nonce
1
Code Size
8074 bytes
Creator
0x5C305C7F...94b9 at tx 0x6cf39aa3...f24436
Indexed Transactions
0
Contract Bytecode
8074 bytes
0x608060405234801561001057600080fd5b50600436106100885760003560e01c80637168aedf1161005b5780637168aedf146101295780637b9205ca146101595780637f955c1714610189578063f0a86a19146101a757610088565b806310228dc31461008d5780631227922c146100bd57806321d0034b146100db5780636109069a146100f9575b600080fd5b6100a760048036038101906100a29190611289565b6101b1565b6040516100b49190611313565b60405180910390f35b6100c561030c565b6040516100d291906113ec565b60405180910390f35b6100e361039a565b6040516100f091906113ec565b60405180910390f35b610113600480360381019061010e919061140e565b610428565b6040516101209190611313565b60405180910390f35b610143600480360381019061013e919061140e565b61047e565b6040516101509190611313565b60405180910390f35b610173600480360381019061016e9190611584565b6104d3565b6040516101809190611313565b60405180910390f35b6101916106b8565b60405161019e9190611313565b60405180910390f35b6101af6106cf565b005b600083600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610223576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021a90611676565b60405180910390fd5b600460009054906101000a900460ff16610272576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610269906116e2565b60405180910390fd5b600061027f863087610805565b90508573ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fefbf9e71b8b9415ed6723cea57670470f2fa0e9cc6c4aebe4c25d90e4c68827784886040516102f792919061177f565b60405180910390a46001925050509392505050565b6060600280548060200260200160405190810160405280929190818152602001828054801561039057602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610346575b5050505050905090565b6060600380548060200260200160405190810160405280929190818152602001828054801561041e57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116103d4575b5050505050905090565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610561576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610558906117fb565b60405180910390fd5b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166105ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e390611867565b60405180910390fd5b60005b83518161ffff161015610647576000848261ffff168151811061061557610614611887565b5b60200260200101519050610633868260000151868460200151610a4c565b50808061063f906118f3565b9150506105ef565b508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f2507215ab1d5d43708a53d0ea2dcbfb63ea4003b92cf3431497ec3f742a293b7856040516106a59190611a0a565b60405180910390a3600190509392505050565b6000600460009054906101000a900460ff16905090565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661075b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610752906117fb565b60405180910390fd5b600460009054906101000a900460ff166107aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a1906116e2565b60405180910390fd5b6000600460006101000a81548160ff021916908315150217905550600460009054906101000a900460ff1615157f2a6621eea69f4fd8903c41e48fe39c9b68ff173291711f44ba20b7261d6d4d3360405160405180910390a2565b600083600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086e90611676565b60405180910390fd5b82600081116108bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b290611a78565b60405180910390fd5b600086905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231886040518263ffffffff1660e01b81526004016108fb9190611aa7565b602060405180830381865afa158015610918573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093c9190611ad7565b905061096b3388888573ffffffffffffffffffffffffffffffffffffffff16610cf7909392919063ffffffff16565b60008273ffffffffffffffffffffffffffffffffffffffff166370a08231896040518263ffffffff1660e01b81526004016109a69190611aa7565b602060405180830381865afa1580156109c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e79190611ad7565b9050600082826109f79190611b04565b905087811115610a3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3390611b84565b60405180910390fd5b8096505050505050509392505050565b8060008111610a90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8790611a78565b60405180910390fd5b83600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610b00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af790611676565b60405180910390fd5b83600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610b70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6790611c16565b60405180910390fd5b600086905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610bb09190611aa7565b602060405180830381865afa158015610bcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf19190611ad7565b905085811015610c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2d90611c82565b60405180910390fd5b8815610c6c57610c6787878473ffffffffffffffffffffffffffffffffffffffff16610d809092919063ffffffff16565b610cec565b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb88886040518363ffffffff1660e01b8152600401610ca7929190611ca2565b6020604051808303816000875af1158015610cc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cea9190611ce0565b505b505050505050505050565b610d7a846323b872dd60e01b858585604051602401610d1893929190611d0d565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610e06565b50505050565b610e018363a9059cbb60e01b8484604051602401610d9f929190611ca2565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610e06565b505050565b6000610e68826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610ece9092919063ffffffff16565b9050600081511480610e8a575080806020019051810190610e899190611ce0565b5b610ec9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec090611db6565b60405180910390fd5b505050565b6060610edd8484600085610ee6565b90509392505050565b606082471015610f2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2290611e48565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610f549190611eaf565b60006040518083038185875af1925050503d8060008114610f91576040519150601f19603f3d011682016040523d82523d6000602084013e610f96565b606091505b5091509150610fa787838387610fb3565b92505050949350505050565b6060831561101557600083510361100d57610fcd85611028565b61100c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100390611f12565b60405180910390fd5b5b829050611020565b61101f838361104b565b5b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60008251111561105e5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110929190611f32565b60405180910390fd5b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006110da826110af565b9050919050565b6110ea816110cf565b81146110f557600080fd5b50565b600081359050611107816110e1565b92915050565b6000819050919050565b6111208161110d565b811461112b57600080fd5b50565b60008135905061113d81611117565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6111968261114d565b810181811067ffffffffffffffff821117156111b5576111b461115e565b5b80604052505050565b60006111c861109b565b90506111d4828261118d565b919050565b600067ffffffffffffffff8211156111f4576111f361115e565b5b6111fd8261114d565b9050602081019050919050565b82818337600083830152505050565b600061122c611227846111d9565b6111be565b90508281526020810184848401111561124857611247611148565b5b61125384828561120a565b509392505050565b600082601f8301126112705761126f611143565b5b8135611280848260208601611219565b91505092915050565b6000806000606084860312156112a2576112a16110a5565b5b60006112b0868287016110f8565b93505060206112c18682870161112e565b925050604084013567ffffffffffffffff8111156112e2576112e16110aa565b5b6112ee8682870161125b565b9150509250925092565b60008115159050919050565b61130d816112f8565b82525050565b60006020820190506113286000830184611304565b92915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611363816110cf565b82525050565b6000611375838361135a565b60208301905092915050565b6000602082019050919050565b60006113998261132e565b6113a38185611339565b93506113ae8361134a565b8060005b838110156113df5781516113c68882611369565b97506113d183611381565b9250506001810190506113b2565b5085935050505092915050565b60006020820190508181036000830152611406818461138e565b905092915050565b600060208284031215611424576114236110a5565b5b6000611432848285016110f8565b91505092915050565b611444816112f8565b811461144f57600080fd5b50565b6000813590506114618161143b565b92915050565b600067ffffffffffffffff8211156114825761148161115e565b5b602082029050602081019050919050565b600080fd5b600080fd5b6000604082840312156114b3576114b2611498565b5b6114bd60406111be565b905060006114cd848285016110f8565b60008301525060206114e18482850161112e565b60208301525092915050565b60006115006114fb84611467565b6111be565b9050808382526020820190506040840283018581111561152357611522611493565b5b835b8181101561154c5780611538888261149d565b845260208401935050604081019050611525565b5050509392505050565b600082601f83011261156b5761156a611143565b5b813561157b8482602086016114ed565b91505092915050565b60008060006060848603121561159d5761159c6110a5565b5b60006115ab86828701611452565b935050602084013567ffffffffffffffff8111156115cc576115cb6110aa565b5b6115d886828701611556565b92505060406115e9868287016110f8565b9150509250925092565b600082825260208201905092915050565b7f7472616e7366657220746f6b656e20697320746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006116606022836115f3565b915061166b82611604565b604082019050919050565b6000602082019050818103600083015261168f81611653565b9050919050565b7f54686520636f6e74726163742068617320616c7265616479206275726e656400600082015250565b60006116cc601f836115f3565b91506116d782611696565b602082019050919050565b600060208201905081810360008301526116fb816116bf565b9050919050565b61170b8161110d565b82525050565b600081519050919050565b60005b8381101561173a57808201518184015260208101905061171f565b60008484015250505050565b600061175182611711565b61175b81856115f3565b935061176b81856020860161171c565b6117748161114d565b840191505092915050565b60006040820190506117946000830185611702565b81810360208301526117a68184611746565b90509392505050565b7f4e6f7420746865206f776e657200000000000000000000000000000000000000600082015250565b60006117e5600d836115f3565b91506117f0826117af565b602082019050919050565b60006020820190508181036000830152611814816117d8565b9050919050565b7f77697468647261772061646472657373206e6f7420616c6c6f77656400000000600082015250565b6000611851601c836115f3565b915061185c8261181b565b602082019050919050565b6000602082019050818103600083015261188081611844565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061ffff82169050919050565b60006118fe826118e5565b915061ffff8203611912576119116118b6565b5b600182019050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6119528161110d565b82525050565b60408201600082015161196e600085018261135a565b5060208201516119816020850182611949565b50505050565b60006119938383611958565b60408301905092915050565b6000602082019050919050565b60006119b78261191d565b6119c18185611928565b93506119cc83611939565b8060005b838110156119fd5781516119e48882611987565b97506119ef8361199f565b9250506001810190506119d0565b5085935050505092915050565b60006020820190508181036000830152611a2481846119ac565b905092915050565b7f616d6f756e74206d7573742062652067726561746572207468616e207a65726f600082015250565b6000611a626020836115f3565b9150611a6d82611a2c565b602082019050919050565b60006020820190508181036000830152611a9181611a55565b9050919050565b611aa1816110cf565b82525050565b6000602082019050611abc6000830184611a98565b92915050565b600081519050611ad181611117565b92915050565b600060208284031215611aed57611aec6110a5565b5b6000611afb84828501611ac2565b91505092915050565b6000611b0f8261110d565b9150611b1a8361110d565b9250828203905081811115611b3257611b316118b6565b5b92915050565b7f46696e616c416d6f756e74206973206572726f72000000000000000000000000600082015250565b6000611b6e6014836115f3565b9150611b7982611b38565b602082019050919050565b60006020820190508181036000830152611b9d81611b61565b9050919050565b7f7769746864726177206164647265737320697320746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611c006024836115f3565b9150611c0b82611ba4565b604082019050919050565b60006020820190508181036000830152611c2f81611bf3565b9050919050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b6000611c6c6014836115f3565b9150611c7782611c36565b602082019050919050565b60006020820190508181036000830152611c9b81611c5f565b9050919050565b6000604082019050611cb76000830185611a98565b611cc46020830184611702565b9392505050565b600081519050611cda8161143b565b92915050565b600060208284031215611cf657611cf56110a5565b5b6000611d0484828501611ccb565b91505092915050565b6000606082019050611d226000830186611a98565b611d2f6020830185611a98565b611d3c6040830184611702565b949350505050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000611da0602a836115f3565b9150611dab82611d44565b604082019050919050565b60006020820190508181036000830152611dcf81611d93565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b6000611e326026836115f3565b9150611e3d82611dd6565b604082019050919050565b60006020820190508181036000830152611e6181611e25565b9050919050565b600081519050919050565b600081905092915050565b6000611e8982611e68565b611e938185611e73565b9350611ea381856020860161171c565b80840191505092915050565b6000611ebb8284611e7e565b915081905092915050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000611efc601d836115f3565b9150611f0782611ec6565b602082019050919050565b60006020820190508181036000830152611f2b81611eef565b9050919050565b60006020820190508181036000830152611f4c8184611746565b90509291505056fea2646970667358221220b7afcfd69f68c6c9114d60e2d3fd44cafa9120a07d80aaaf5cc159c353074ade64736f6c63430008110033
Verified Source Code Partial Match
Compiler: v0.8.17+commit.8df45f5f
EVM: london
Optimization: No
BlockATMCustomer.sol 689 lines
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @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
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or 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 {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the 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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
// File: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
/**
* @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;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.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));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
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");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
* 0 before setting it to a non-zero value.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @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");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// 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 cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}
// File: contracts/BlockCommon.sol
pragma solidity >=0.8.0 <=0.8.17;
contract BlockCommon {
using SafeERC20 for IERC20;
modifier checkAmount(uint256 amount) {
require(amount > 0, "amount must be greater than zero");
_;
}
// "transfer token is the zero address"
modifier checkTokenAddress(address tokenAddress){
require(tokenAddress != address(0), "transfer token is the zero address");
_;
}
modifier checkWithdrawAddress(address withdrawAddress){
require(withdrawAddress != address(0), "withdraw address is the zero address");
_;
}
function transferCommon(address tokenAddress,address to,uint256 amount) internal checkTokenAddress(tokenAddress) checkAmount(amount) returns(uint256) {
IERC20 erc20 = IERC20(tokenAddress);
uint256 beforeAmount = erc20.balanceOf(to);
erc20.safeTransferFrom(msg.sender, to, amount);
uint256 afterAmount = erc20.balanceOf(to);
uint256 finalAmount = afterAmount - beforeAmount;
require(finalAmount <= amount, "FinalAmount is error");
return finalAmount;
}
function withdrawCommon(bool flag,address tokenAddress,address withdrawAddress,uint256 amount) internal checkAmount(amount) checkTokenAddress(tokenAddress) checkWithdrawAddress(withdrawAddress) {
IERC20 erc20 = IERC20(tokenAddress);
uint256 balance = erc20.balanceOf(address(this));
require(balance >= amount, "Insufficient balance");
if(flag){
erc20.safeTransfer(withdrawAddress, amount);
} else {
erc20.transfer(withdrawAddress, amount);
}
}
}
// File: contracts/BlockATMCustomer.sol
pragma solidity >=0.8.0 <=0.8.17;
contract BlockATMCustomer is BlockCommon {
mapping(address => bool) private withdrawMap;
mapping(address => bool) private ownerMap;
address[] private withdrawList;
address[] private ownerList;
bool private activeFlag;
struct Withdraw{
address tokenAddress;
uint256 amount;
}
constructor(address[] memory newWithdrawList,address[] memory newOwnerList) {
require(newWithdrawList.length > 0, "withdraw address is empty");
for (uint i = 0; i < newWithdrawList.length; i++) {
require(newWithdrawList[i] != address(0), "withdraw token is the zero address");
withdrawMap[newWithdrawList[i]] = true;
}
withdrawList = newWithdrawList;
require(newOwnerList.length > 0, "owner address is empty");
for (uint i = 0; i < newOwnerList.length; i++) {
require(newOwnerList[i] != address(0), "owner is the zero address");
ownerMap[newOwnerList[i]] = true;
}
ownerList = newOwnerList;
activeFlag = true;
}
event TransferToken(address indexed from, address indexed to, address indexed token, uint256 amount,string orderId);
event WithdrawToken(address indexed from, address indexed to, Withdraw[] withdrawInfo);
event SetActiveFlag(bool indexed activeFlag);
modifier onlyOwner() {
require(ownerMap[msg.sender], "Not the owner");
_;
}
function transferToken(address tokenAddress,uint256 amount,string memory orderId) public checkTokenAddress(tokenAddress) returns (bool) {
require(activeFlag, "The contract has already burned");
uint256 finalAmount = super.transferCommon(tokenAddress,address(this),amount);
emit TransferToken(msg.sender, address(this), tokenAddress, finalAmount,orderId);
return true;
}
function withdrawToken(bool safeFlag,Withdraw[] memory withdrawInfo,address withdrawAddress) public onlyOwner returns (bool) {
// check withdrawAddress
require(withdrawMap[withdrawAddress], "withdraw address not allowed");
// check
for(uint16 i = 0; i < withdrawInfo.length; i++ ){
Withdraw memory info = withdrawInfo[i];
super.withdrawCommon(safeFlag,info.tokenAddress,withdrawAddress,info.amount);
}
emit WithdrawToken(msg.sender, withdrawAddress, withdrawInfo);
return true;
}
function getActiveFlag() public view returns (bool) {
return activeFlag;
}
function getWithdrawAddressList() public view returns(address[] memory){
return withdrawList;
}
function getWithdrawAddressFlag(address withdrawAddress) public view returns(bool){
return withdrawMap[withdrawAddress];
}
function getOwnerAddressFlag(address ownerAddress) public view returns(bool){
return ownerMap[ownerAddress];
}
function getOwnerAddressList() public view returns(address[] memory){
return ownerList;
}
function setActiveFlag() public onlyOwner {
require(activeFlag, "The contract has already burned");
activeFlag = false;
emit SetActiveFlag(activeFlag);
}
}
Read Contract
getActiveFlag 0x7f955c17 → bool
getOwnerAddressFlag 0x6109069a → bool
getOwnerAddressList 0x21d0034b → address[]
getWithdrawAddressFlag 0x7168aedf → bool
getWithdrawAddressList 0x1227922c → address[]
Write Contract 3 functions
These functions modify contract state and require a wallet transaction to execute.
setActiveFlag 0xf0a86a19
No parameters
transferToken 0x10228dc3
address tokenAddress
uint256 amount
string orderId
returns: bool
withdrawToken 0xd88093d9
bool safeFlag
tuple[] withdrawInfo
address withdrawAddress
returns: bool
Recent Transactions
No transactions found for this address