Contract 0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9 8

Contract Overview

Balance:
0 Ether
Txn Hash
Method
Block
From
To
Value
0x4f3065a0c1dbe69ef0853d7279810bfef6ec0ea31b4369639b5d41df94ca5c3c0x6080604094471872021-10-11 15:32:12268 days 3 hrs ago0x42479654251c6d2561dcf352d4eb39f9c4a45ccd IN  Create: ERC20FeeProxy0 Ether0.000508921.00000035
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ERC20FeeProxy

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
File 1 of 1 : ERC20FeeProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @title ERC20FeeProxy
 * @notice This contract performs an ERC20 token transfer, with a Fee sent to a third address and stores a reference
 */
contract ERC20FeeProxy {
  // Event to declare a transfer with a reference
  event TransferWithReferenceAndFee(
    address tokenAddress,
    address to,
    uint256 amount,
    bytes indexed paymentReference,
    uint256 feeAmount,
    address feeAddress
  );

  // Fallback function returns funds to the sender
  receive() external payable {
    revert("not payable receive");
  }

  /**
    * @notice Performs a ERC20 token transfer with a reference
              and a transfer to a second address for the payment of a fee
    * @param _tokenAddress Address of the ERC20 token smart contract
    * @param _to Transfer recipient
    * @param _amount Amount to transfer
    * @param _paymentReference Reference of the payment related
    * @param _feeAmount The amount of the payment fee
    * @param _feeAddress The fee recipient
    */
  function transferFromWithReferenceAndFee(
    address _tokenAddress,
    address _to,
    uint256 _amount,
    bytes calldata _paymentReference,
    uint256 _feeAmount,
    address _feeAddress
    ) external
    {
    require(safeTransferFrom(_tokenAddress, _to, _amount), "payment transferFrom() failed");
    if (_feeAmount > 0 && _feeAddress != address(0)) {
      require(safeTransferFrom(_tokenAddress, _feeAddress, _feeAmount), "fee transferFrom() failed");
    }
    emit TransferWithReferenceAndFee(
      _tokenAddress,
      _to,
      _amount,
      _paymentReference,
      _feeAmount,
      _feeAddress
    );
  }

  /**
   * @notice Call transferFrom ERC20 function and validates the return data of a ERC20 contract call.
   * @dev This is necessary because of non-standard ERC20 tokens that don't have a return value.
   * @return result The return value of the ERC20 call, returning true for non-standard tokens
   */
  function safeTransferFrom(address _tokenAddress, address _to, uint256 _amount) internal returns (bool result) {
    /* solium-disable security/no-inline-assembly */
    // check if the address is a contract
    assembly {
      if iszero(extcodesize(_tokenAddress)) { revert(0, 0) }
    }
    
    // solium-disable-next-line security/no-low-level-calls
    (bool success, ) = _tokenAddress.call(abi.encodeWithSignature(
      "transferFrom(address,address,uint256)",
      msg.sender,
      _to,
      _amount
    ));

    assembly {
        switch returndatasize()
        case 0 { // not a standard erc20
            result := 1
        }
        case 32 { // standard erc20
            returndatacopy(0, 0, 32)
            result := mload(0)
        }
        default { // anything else, should revert for safety
            revert(0, 0)
        }
    }

    require(success, "transferFrom() has been reverted");

    /* solium-enable security/no-inline-assembly */
    return result;
  }
}

Settings
{
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"bytes","name":"paymentReference","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"feeAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"feeAddress","type":"address"}],"name":"TransferWithReferenceAndFee","type":"event"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_paymentReference","type":"bytes"},{"internalType":"uint256","name":"_feeAmount","type":"uint256"},{"internalType":"address","name":"_feeAddress","type":"address"}],"name":"transferFromWithReferenceAndFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b50610848806100206000396000f3fe6080604052600436106100225760003560e01c8063c219a14d1461006757610062565b36610062576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100599061061b565b60405180910390fd5b600080fd5b34801561007357600080fd5b5061008e600480360381019061008991906103ba565b610090565b005b61009b8787876101c7565b6100da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100d19061063b565b60405180910390fd5b6000821180156101175750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b15610167576101278782846101c7565b610166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161015d9061067b565b60405180910390fd5b5b8383604051610177929190610561565b60405180910390207f9f16cbcc523c67a60c450e5ffe4f3b7b6dbe772e7abcadb2686ce029a9a0a2b688888886866040516101b69594939291906105c8565b60405180910390a250505050505050565b6000833b6101d457600080fd5b60008473ffffffffffffffffffffffffffffffffffffffff1633858560405160240161020293929190610591565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161028c919061057a565b6000604051808303816000865af19150503d80600081146102c9576040519150601f19603f3d011682016040523d82523d6000602084013e6102ce565b606091505b505090503d600081146102e857602081146102f157600080fd5b600192506102fd565b60206000803e60005192505b508061033e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103359061065b565b60405180910390fd5b509392505050565b600081359050610355816107e4565b92915050565b60008083601f84011261036d57600080fd5b8235905067ffffffffffffffff81111561038657600080fd5b60208301915083600182028301111561039e57600080fd5b9250929050565b6000813590506103b4816107fb565b92915050565b600080600080600080600060c0888a0312156103d557600080fd5b60006103e38a828b01610346565b97505060206103f48a828b01610346565b96505060406104058a828b016103a5565b955050606088013567ffffffffffffffff81111561042257600080fd5b61042e8a828b0161035b565b945094505060806104418a828b016103a5565b92505060a06104528a828b01610346565b91505092959891949750929550565b61046a816106c2565b82525050565b600061047c83856106a6565b93506104898385846106fe565b82840190509392505050565b60006104a08261069b565b6104aa81856106a6565b93506104ba81856020860161070d565b80840191505092915050565b60006104d36013836106b1565b91506104de82610740565b602082019050919050565b60006104f6601d836106b1565b915061050182610769565b602082019050919050565b60006105196020836106b1565b915061052482610792565b602082019050919050565b600061053c6019836106b1565b9150610547826107bb565b602082019050919050565b61055b816106f4565b82525050565b600061056e828486610470565b91508190509392505050565b60006105868284610495565b915081905092915050565b60006060820190506105a66000830186610461565b6105b36020830185610461565b6105c06040830184610552565b949350505050565b600060a0820190506105dd6000830188610461565b6105ea6020830187610461565b6105f76040830186610552565b6106046060830185610552565b6106116080830184610461565b9695505050505050565b60006020820190508181036000830152610634816104c6565b9050919050565b60006020820190508181036000830152610654816104e9565b9050919050565b600060208201905081810360008301526106748161050c565b9050919050565b600060208201905081810360008301526106948161052f565b9050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b60006106cd826106d4565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b8381101561072b578082015181840152602081019050610710565b8381111561073a576000848401525b50505050565b7f6e6f742070617961626c65207265636569766500000000000000000000000000600082015250565b7f7061796d656e74207472616e7366657246726f6d2829206661696c6564000000600082015250565b7f7472616e7366657246726f6d282920686173206265656e207265766572746564600082015250565b7f666565207472616e7366657246726f6d2829206661696c656400000000000000600082015250565b6107ed816106c2565b81146107f857600080fd5b50565b610804816106f4565b811461080f57600080fd5b5056fea2646970667358221220cc6595442e7ae393fbeb38e765d8ef75474c311fde1a279246463540e019fe7e64736f6c63430008040033

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.