Address Details
contract
0x612cF8a29A9c8965a5fE512b7463165861c07EAa
- Contract Name
- ERC20FeeProxy
- Creator
- 0x8b4b31–3cca2f at 0x86403b–b14ef8
- Balance
- 0 CELO ( )
- Locked CELO Balance
- 0.00 CELO
- Voting CELO Balance
- 0.00 CELO
- Pending Unlocked Gold
- 0.00 CELO
- Tokens
-
Fetching tokens...
- Transactions
- 0 Transactions
- Transfers
- 0 Transfers
- Gas Used
- Fetching gas used...
- Last Balance Update
- 19657503
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- ERC20FeeProxy
- Optimization enabled
- true
- Compiler version
- v0.5.17+commit.d19bba13
- Optimization runs
- 200
- EVM Version
- istanbul
- Verified at
- 2021-06-03T16:09:26.909414Z
Contract source code
pragma solidity ^0.5.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 function() external payable { revert("not payable fallback"); } /** * @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 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; } }
Contract ABI
[{"type":"event","name":"TransferWithReferenceAndFee","inputs":[{"type":"address","name":"tokenAddress","internalType":"address","indexed":false},{"type":"address","name":"to","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"bytes","name":"paymentReference","internalType":"bytes","indexed":true},{"type":"uint256","name":"feeAmount","internalType":"uint256","indexed":false},{"type":"address","name":"feeAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"fallback","stateMutability":"payable","payable":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"transferFromWithReferenceAndFee","inputs":[{"type":"address","name":"_tokenAddress","internalType":"address"},{"type":"address","name":"_to","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"bytes","name":"_paymentReference","internalType":"bytes"},{"type":"uint256","name":"_feeAmount","internalType":"uint256"},{"type":"address","name":"_feeAddress","internalType":"address"}],"constant":false}]
Contract Creation Code
0x608060405234801561001057600080fd5b50610414806100206000396000f3fe60806040526004361061001e5760003560e01c8063c219a14d14610062575b6040805162461bcd60e51b81526020600482015260146024820152736e6f742070617961626c652066616c6c6261636b60601b604482015290519081900360640190fd5b34801561006e57600080fd5b5061010e600480360360c081101561008557600080fd5b6001600160a01b038235811692602081013590911691604082013591908101906080810160608201356401000000008111156100c057600080fd5b8201836020820111156100d257600080fd5b803590602001918460018302840111640100000000831117156100f457600080fd5b9193509150803590602001356001600160a01b0316610110565b005b61011b878787610263565b61016c576040805162461bcd60e51b815260206004820152601d60248201527f7061796d656e74207472616e7366657246726f6d2829206661696c6564000000604482015290519081900360640190fd5b60008211801561018457506001600160a01b03811615155b156101e557610194878284610263565b6101e5576040805162461bcd60e51b815260206004820152601960248201527f666565207472616e7366657246726f6d2829206661696c656400000000000000604482015290519081900360640190fd5b838360405180838380828437604080519390910183900383206001600160a01b03808f168552808e1660208601528483018d9052606085018a90528816608085015290519095507f9f16cbcc523c67a60c450e5ffe4f3b7b6dbe772e7abcadb2686ce029a9a0a2b694509182900360a001925050a250505050505050565b6000833b61027057600080fd5b604080513360248201526001600160a01b038581166044830152606480830186905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17815292518251600094928916939282918083835b602083106102ee5780518252601f1990920191602091820191016102cf565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610350576040519150601f19603f3d011682016040523d82523d6000602084013e610355565b606091505b505090503d6000811461036f576020811461037857600080fd5b60019250610384565b60206000803e60005192505b50806103d7576040805162461bcd60e51b815260206004820181905260248201527f7472616e7366657246726f6d282920686173206265656e207265766572746564604482015290519081900360640190fd5b50939250505056fea265627a7a7231582017fe764da99b0e7899d84ef153c4d904902c1799712760e81b8673feff49224a64736f6c63430005110032
Deployed ByteCode
0x60806040526004361061001e5760003560e01c8063c219a14d14610062575b6040805162461bcd60e51b81526020600482015260146024820152736e6f742070617961626c652066616c6c6261636b60601b604482015290519081900360640190fd5b34801561006e57600080fd5b5061010e600480360360c081101561008557600080fd5b6001600160a01b038235811692602081013590911691604082013591908101906080810160608201356401000000008111156100c057600080fd5b8201836020820111156100d257600080fd5b803590602001918460018302840111640100000000831117156100f457600080fd5b9193509150803590602001356001600160a01b0316610110565b005b61011b878787610263565b61016c576040805162461bcd60e51b815260206004820152601d60248201527f7061796d656e74207472616e7366657246726f6d2829206661696c6564000000604482015290519081900360640190fd5b60008211801561018457506001600160a01b03811615155b156101e557610194878284610263565b6101e5576040805162461bcd60e51b815260206004820152601960248201527f666565207472616e7366657246726f6d2829206661696c656400000000000000604482015290519081900360640190fd5b838360405180838380828437604080519390910183900383206001600160a01b03808f168552808e1660208601528483018d9052606085018a90528816608085015290519095507f9f16cbcc523c67a60c450e5ffe4f3b7b6dbe772e7abcadb2686ce029a9a0a2b694509182900360a001925050a250505050505050565b6000833b61027057600080fd5b604080513360248201526001600160a01b038581166044830152606480830186905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17815292518251600094928916939282918083835b602083106102ee5780518252601f1990920191602091820191016102cf565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610350576040519150601f19603f3d011682016040523d82523d6000602084013e610355565b606091505b505090503d6000811461036f576020811461037857600080fd5b60019250610384565b60206000803e60005192505b50806103d7576040805162461bcd60e51b815260206004820181905260248201527f7472616e7366657246726f6d282920686173206265656e207265766572746564604482015290519081900360640190fd5b50939250505056fea265627a7a7231582017fe764da99b0e7899d84ef153c4d904902c1799712760e81b8673feff49224a64736f6c63430005110032