Forkchoice Ethereum Mainnet

Address Contract Verified

Address 0x6BF3Bfda3464bB890393D4A71604Da97AE0Aff36
Balance 0 ETH
Nonce 1
Code Size 1380 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

1380 bytes
0x60806040526004361061004d5760003560e01c8062362a9514610059578063469048401461006e5780639012c4a8146100ab578063b8606eef146100cb578063e1f1c4a7146100ef57600080fd5b3661005457005b600080fd5b61006c61006736600461047d565b610105565b005b34801561007a57600080fd5b5060015461008e906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100b757600080fd5b5061006c6100c63660046104ad565b61035f565b3480156100d757600080fd5b506100e160025481565b6040519081526020016100a2565b3480156100fb57600080fd5b506100e161271081565b61010d610424565b600034116101525760405162461bcd60e51b815260206004820152600d60248201526c09aeae6e840e6cadcc8408aa89609b1b60448201526064015b60405180910390fd5b6001600160a01b03811661019a5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206368617269747960881b6044820152606401610149565b6002543490600090612710906101b090846104dc565b6101ba91906104f9565b905060006101c8828461051b565b6001546040519192506000916001600160a01b039091169084908381818185875af1925050503d806000811461021a576040519150601f19603f3d011682016040523d82523d6000602084013e61021f565b606091505b50509050806102665760405162461bcd60e51b8152602060048201526013602482015272119959481d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610149565b6000856001600160a01b03168360405160006040518083038185875af1925050503d80600081146102b3576040519150601f19603f3d011682016040523d82523d6000602084013e6102b8565b606091505b50509050806102ff5760405162461bcd60e51b815260206004820152601360248201527213995d081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610149565b60408051868152602081018590529081018590526001600160a01b0387169033907f51297710db35bfe3f03247b2601c68b45cdab2ca01be3f3be727346c408f0f259060600160405180910390a3505050505061035c6001600055565b50565b6001546001600160a01b031633146103aa5760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b6044820152606401610149565b6127108111156103e95760405162461bcd60e51b815260206004820152600a602482015269466565203e203130302560b01b6044820152606401610149565b60028190556040518181527f8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c769060200160405180910390a150565b6002600054036104765760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610149565b6002600055565b60006020828403121561048f57600080fd5b81356001600160a01b03811681146104a657600080fd5b9392505050565b6000602082840312156104bf57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176104f3576104f36104c6565b92915050565b60008261051657634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156104f3576104f36104c656fea26469706673582212208d918dbc1f3617e84de6c40dda5edd61c1776bcdbb2ed7d17e03127926fc02a364736f6c63430008170033

Verified Source Code Full Match

Compiler: v0.8.23+commit.f704f362 EVM: paris Optimization: Yes (200 runs)
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;
    }
}
Contract.sol 90 lines
pragma solidity ^0.8.12;

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

/**
 * @title EthSplitV1
 * @notice Accepts ETH donations, splits out a platform fee, forwards the remainder to the charity, and emits an event.
 */
contract EthSplitV1 is ReentrancyGuard {
    address payable public feeRecipient;
    uint256 public feeBasisPoints;
    uint256 public constant BASIS_POINTS = 10_000;

    /// @dev Emitted when the fee basis points is updated
    event FeeUpdated(uint256 newFeeBasisPoints);

    /**
     * @dev
     * {
     *   "name": "DonationForwarded",
     *   "type": "event",
     *   "anonymous": false,
     *   "inputs": [
     *     { "type": "address",   "name": "donor",      "indexed": true  },
     *     { "type": "address",   "name": "charity",    "indexed": true  },
     *     { "type": "uint256",   "name": "fullAmount", "indexed": false },
     *     { "type": "uint256",   "name": "netAmount",  "indexed": false },
     *     { "type": "uint256",   "name": "fee",        "indexed": false }
     *   ]
     * }
     */
    event DonationForwarded(
        address indexed donor,
        address indexed charity,
        uint256 fullAmount,
        uint256 netAmount,
        uint256 fee
    );

    modifier onlyAdmin() {
        require(msg.sender == feeRecipient, "Not authorized");
        _;
    }

    /**
     * @param _feeRecipient          Wallet that captures the fee
     * @param _initialFeeBasisPoints Fee in basis points (0–10000)
     */
    constructor(address payable _feeRecipient, uint256 _initialFeeBasisPoints) {
        require(_feeRecipient != address(0), "Invalid fee recipient");
        require(_initialFeeBasisPoints <= BASIS_POINTS, "Fee > 100%");
        feeRecipient = _feeRecipient;
        feeBasisPoints = _initialFeeBasisPoints;
    }

    /**
     * @notice Updates the platform fee
     * @param _bps New fee in basis points
     */
    function updateFee(uint256 _bps) external onlyAdmin {
        require(_bps <= BASIS_POINTS, "Fee > 100%");
        feeBasisPoints = _bps;
        emit FeeUpdated(_bps);
    }

    receive() external payable {}

    /**
     * @notice Accepts ETH ⇒ splits out fee ⇒ forwards remainder ⇒ emits DonationForwarded
     * @param charity Receiver of net donation
     */
    function donate(address payable charity) external payable nonReentrant {
        require(msg.value > 0, "Must send ETH");
        require(charity != address(0), "Invalid charity");

        uint256 fullAmount = msg.value;
        uint256 fee = (fullAmount * feeBasisPoints) / BASIS_POINTS;
        uint256 netAmount = fullAmount - fee;

        // 1) Pay platform fee
        (bool feeSent, ) = feeRecipient.call{value: fee}("");
        require(feeSent, "Fee transfer failed");

        // 2) Forward net remainder
        (bool netSent, ) = charity.call{value: netAmount}("");
        require(netSent, "Net transfer failed");

        emit DonationForwarded(msg.sender, charity, fullAmount, netAmount, fee);
    }
}

Read Contract

BASIS_POINTS 0xe1f1c4a7 → uint256
feeBasisPoints 0xb8606eef → uint256
feeRecipient 0x46904840 → address

Write Contract 2 functions

These functions modify contract state and require a wallet transaction to execute.

donate 0x00362a95
address charity
updateFee 0x9012c4a8
uint256 _bps

Recent Transactions

No transactions found for this address