Contract Source Code:
File 1 of 1 : CustomFeeTransaction.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; contract CustomFeeTransaction { address public constant FEE_RECIPIENT = 0x5255eF6956a77143D3F18978555c6cdCd4F2aA0A; uint256 public constant FIXED_FEE = 30000000000000; // 0.00003 ETH event TransactionSent(address indexed from, address indexed to); event FeesWithdrawn(uint256 amount); modifier onlyFeeRecipient() { require(msg.sender == FEE_RECIPIENT, "Only fee recipient can call this"); _; } function sendTransactionWithFee(address payable _to) external payable { require(msg.value == FIXED_FEE, "Must send exactly 0.00003 ETH"); // Store fee in contract emit TransactionSent(msg.sender, _to); } function getFeeAmount() external pure returns (uint256) { return FIXED_FEE; } function getContractBalance() external view returns (uint256) { return address(this).balance; } function withdrawFees() external onlyFeeRecipient { uint256 balance = address(this).balance; require(balance > 0, "No fees to withdraw"); (bool success, ) = payable(FEE_RECIPIENT).call{value: balance}(""); require(success, "Withdrawal failed"); emit FeesWithdrawn(balance); } }
Please enter a contract address above to load the contract details and source code.
Please DO NOT store any passwords or private keys here. A private note (up to 100 characters) can be saved and is useful for transaction tracking.
This website uses cookies to improve your experience. By continuing to use this website, you agree to its Terms and Privacy Policy.