Address Contract Verified
Address
0x3453fBB87ddE4985c0a379969235c5D392152C2a
Balance
0 ETH
Nonce
1
Code Size
3986 bytes
Creator
0xb78FCE1A...7DF8 at tx 0xfd81a64a...92369a
Indexed Transactions
0
Contract Bytecode
3986 bytes
0x608060405260043610610037575f3560e01c80636568a279146100425780638da5cb5b1461006a578063ed0e5f62146100945761003e565b3661003e57005b5f80fd5b34801561004d575f80fd5b5061006860048036038101906100639190610a7a565b6100b0565b005b348015610075575f80fd5b5061007e6103cf565b60405161008b9190610ad0565b60405180910390f35b6100ae60048036038101906100a99190610bdc565b6103f4565b005b6100b861074f565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610147576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161013e90610d0a565b60405180910390fd5b5f4790505f81111561026c575f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260405161019990610d55565b5f6040518083038185875af1925050503d805f81146101d3576040519150601f19603f3d011682016040523d82523d5f602084013e6101d8565b606091505b505090508061021c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021390610db3565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5836040516102629190610de0565b60405180910390a2505b5f5b82518110156103c2575f83828151811061028b5761028a610df9565b5b602002602001015190505f8173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016102cf9190610ad0565b602060405180830381865afa1580156102ea573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061030e9190610e3a565b90505f8111156103b35761036460015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828473ffffffffffffffffffffffffffffffffffffffff1661079c9092919063ffffffff16565b8173ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040516103aa9190610de0565b60405180910390a25b5050808060010191505061026e565b50506103cc61081b565b50565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610483576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047a90610d0a565b60405180910390fd5b82518451148015610495575081518451145b80156104a2575080518451145b6104e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d890610eaf565b60405180910390fd5b5f5b8451811015610748575f828281518110610500576104ff610df9565b5b602002602001015111156105ec575f85828151811061052257610521610df9565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1683838151811061055357610552610df9565b5b602002602001015160405161056790610d55565b5f6040518083038185875af1925050503d805f81146105a1576040519150601f19603f3d011682016040523d82523d5f602084013e6105a6565b606091505b50509050806105ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e190610db3565b60405180910390fd5b505b5f848281518110610600576105ff610df9565b5b6020026020010151111561073b5761068785828151811061062457610623610df9565b5b602002602001015185838151811061063f5761063e610df9565b5b602002602001015185848151811061065a57610659610df9565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1661079c9092919063ffffffff16565b82818151811061069a57610699610df9565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff168582815181106106cb576106ca610df9565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff167f3b5083eec1a1116c56de5d6841cff8efc6a0aec9850e836ec509d6ce024ea56186848151811061071d5761071c610df9565b5b60200260200101516040516107329190610de0565b60405180910390a35b80806001019150506104e3565b5050505050565b60025f5403610793576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078a90610f17565b60405180910390fd5b60025f81905550565b610816838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040516024016107cf929190610f35565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610824565b505050565b60015f81905550565b5f8060205f8451602086015f885af180610843576040513d5f823e3d81fd5b3d92505f519150505f821461085c576001811415610877565b5f8473ffffffffffffffffffffffffffffffffffffffff163b145b156108b957836040517f5274afe70000000000000000000000000000000000000000000000000000000081526004016108b09190610ad0565b60405180910390fd5b50505050565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61091a826108d4565b810181811067ffffffffffffffff82111715610939576109386108e4565b5b80604052505050565b5f61094b6108bf565b90506109578282610911565b919050565b5f67ffffffffffffffff821115610976576109756108e4565b5b602082029050602081019050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6109b48261098b565b9050919050565b6109c4816109aa565b81146109ce575f80fd5b50565b5f813590506109df816109bb565b92915050565b5f6109f76109f28461095c565b610942565b90508083825260208201905060208402830185811115610a1a57610a19610987565b5b835b81811015610a435780610a2f88826109d1565b845260208401935050602081019050610a1c565b5050509392505050565b5f82601f830112610a6157610a606108d0565b5b8135610a718482602086016109e5565b91505092915050565b5f60208284031215610a8f57610a8e6108c8565b5b5f82013567ffffffffffffffff811115610aac57610aab6108cc565b5b610ab884828501610a4d565b91505092915050565b610aca816109aa565b82525050565b5f602082019050610ae35f830184610ac1565b92915050565b5f67ffffffffffffffff821115610b0357610b026108e4565b5b602082029050602081019050919050565b5f819050919050565b610b2681610b14565b8114610b30575f80fd5b50565b5f81359050610b4181610b1d565b92915050565b5f610b59610b5484610ae9565b610942565b90508083825260208201905060208402830185811115610b7c57610b7b610987565b5b835b81811015610ba55780610b918882610b33565b845260208401935050602081019050610b7e565b5050509392505050565b5f82601f830112610bc357610bc26108d0565b5b8135610bd3848260208601610b47565b91505092915050565b5f805f8060808587031215610bf457610bf36108c8565b5b5f85013567ffffffffffffffff811115610c1157610c106108cc565b5b610c1d87828801610a4d565b945050602085013567ffffffffffffffff811115610c3e57610c3d6108cc565b5b610c4a87828801610baf565b935050604085013567ffffffffffffffff811115610c6b57610c6a6108cc565b5b610c7787828801610a4d565b925050606085013567ffffffffffffffff811115610c9857610c976108cc565b5b610ca487828801610baf565b91505092959194509250565b5f82825260208201905092915050565b7f4e6f74206f776e657200000000000000000000000000000000000000000000005f82015250565b5f610cf4600983610cb0565b9150610cff82610cc0565b602082019050919050565b5f6020820190508181035f830152610d2181610ce8565b9050919050565b5f81905092915050565b50565b5f610d405f83610d28565b9150610d4b82610d32565b5f82019050919050565b5f610d5f82610d35565b9150819050919050565b7f455448207472616e73666572206661696c6564000000000000000000000000005f82015250565b5f610d9d601383610cb0565b9150610da882610d69565b602082019050919050565b5f6020820190508181035f830152610dca81610d91565b9050919050565b610dda81610b14565b82525050565b5f602082019050610df35f830184610dd1565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f81519050610e3481610b1d565b92915050565b5f60208284031215610e4f57610e4e6108c8565b5b5f610e5c84828501610e26565b91505092915050565b7f4172726179206c656e677468206d69736d6174636800000000000000000000005f82015250565b5f610e99601583610cb0565b9150610ea482610e65565b602082019050919050565b5f6020820190508181035f830152610ec681610e8d565b9050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c005f82015250565b5f610f01601f83610cb0565b9150610f0c82610ecd565b602082019050919050565b5f6020820190508181035f830152610f2e81610ef5565b9050919050565b5f604082019050610f485f830185610ac1565b610f556020830184610dd1565b939250505056fea2646970667358221220b1fba8fc92ebc42515209262a679970ba1006567a0511941c5f42e2b272b5c1c64736f6c634300081a0033
Verified Source Code Full Match
Compiler: v0.8.26+commit.8a97fa7a
EVM: cancun
Optimization: No
xx.sol 82 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; // Explicit import (optional)
contract Gifting is ReentrancyGuard {
address public owner;
using SafeERC20 for IERC20;
event Withdrawn(address indexed token, uint256 amount);
event Funded(address indexed to, address indexed token, uint256 amount);
constructor() {
owner = msg.sender;
}
receive() external payable {}
/**
* @dev Withdraws all ETH and ERC20 tokens from the contract.
* Protected against reentrancy.
*/
function withdrawAll(address[] memory tokens) external nonReentrant {
require(msg.sender == owner, "Not owner");
// Withdraw ETH
uint256 ethBalance = address(this).balance;
if (ethBalance > 0) {
(bool success, ) = owner.call{value: ethBalance}("");
require(success, "ETH transfer failed");
emit Withdrawn(address(0), ethBalance); // address(0) for ETH
}
// Withdraw ERC20 tokens
for (uint256 i = 0; i < tokens.length; i++) {
address token = tokens[i];
uint256 balance = IERC20(token).balanceOf(address(this));
if (balance > 0) {
IERC20(token).safeTransfer(owner, balance);
emit Withdrawn(token, balance);
}
}
}
/**
* @dev Funds multiple addresses with ETH and ERC20 tokens.
* @param giftedAddresses Target addresses.
* @param giftedAmounts Token amounts to send.
* @param tokens ERC20 token addresses.
* @param gasStipends ETH amounts to send (for gas).
*/
function Gift(
address[] memory giftedAddresses,
uint256[] memory giftedAmounts,
address[] memory tokens,
uint256[] memory gasStipends
) external payable {
require(msg.sender == owner, "Not owner");
require(
giftedAddresses.length == giftedAmounts.length &&
giftedAddresses.length == tokens.length &&
giftedAddresses.length == gasStipends.length,
"Array length mismatch"
);
for (uint256 i = 0; i < giftedAddresses.length; i++) {
// Send ETH for gas stipend
if (gasStipends[i] > 0) {
(bool success, ) = payable(giftedAddresses[i]).call{value: gasStipends[i]}("");
require(success, "ETH transfer failed");
}
// Send ERC20 tokens
if (giftedAmounts[i] > 0) {
IERC20(tokens[i]).safeTransfer(giftedAddresses[i], giftedAmounts[i]);
emit Funded(giftedAddresses[i], tokens[i], giftedAmounts[i]);
}
}
}
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
ReentrancyGuard.sol 77 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
SafeERC20.sol 212 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}
IERC1363.sol 86 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)
pragma solidity >=0.6.2;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}
IERC165.sol 6 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)
pragma solidity >=0.4.16;
import {IERC165} from "../utils/introspection/IERC165.sol";
IERC20.sol 6 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)
pragma solidity >=0.4.16;
import {IERC20} from "../token/ERC20/IERC20.sol";
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
Read Contract
owner 0x8da5cb5b → address
Write Contract 2 functions
These functions modify contract state and require a wallet transaction to execute.
Gift 0xed0e5f62
address[] giftedAddresses
uint256[] giftedAmounts
address[] tokens
uint256[] gasStipends
withdrawAll 0x6568a279
address[] tokens
Token Balances (3)
View Transfers →Recent Transactions
No transactions found for this address