Skip to content
Verified contractExactMIT

InstallmentRelease

Address0xbc76b5a4792ac75fc4b5080f6622605d370b2db2
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.37

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.37+commit.f401782d
Language
solidity
EVM version
cancun
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,450,869
Creation transaction
0xc3f1b88dda…592e44d5cc

InstallmentRelease.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/// @notice Five fixed ETH installments forwarded atomically to the destination.
/// @dev Only the specified source address may call fundAndRelease.
contract InstallmentRelease {
    address public constant destination = address(bytes20(hex"7a1dde2b82d6c4e864d537cf6e93f2cc7045cb38"));
    address public constant reportedSource = address(bytes20(hex"59708733fbbf64378d9293ec56b977c011a08fd2"));
    uint256 public constant firstFundingBlock = 26458502;
    uint256 public constant lastFundingBlock = 26459401;
    uint256 public totalReleased;
    bool[5] public released;
    bool private entered;

    event PlanCreated(address indexed deployer, address indexed destination, address reportedSource, uint256 firstBlock, uint256 lastBlock, uint256 totalWei);
    event InstallmentReleased(uint256 indexed installment, address indexed funder, address indexed destination, uint256 amountWei);

    constructor() {
        require(block.number < firstFundingBlock, "Funding window already started");
        emit PlanCreated(msg.sender, destination, reportedSource, firstFundingBlock, lastFundingBlock, 5386.48 ether);
    }

    function installmentAmount(uint256 installment) public pure returns (uint256) {
        require(installment < 5, "Unknown installment");
        uint256[5] memory amounts = [uint256(1052.34 ether), 1106.18 ether, 1068.92 ether, 1089.57 ether, 1069.47 ether];
        return amounts[installment];
    }

    /// @notice Call with installment 0..4 and its exact ETH amount within the inclusive funding block window.
    /// @dev A failed recipient transfer reverts the funding and all state changes.
    function fundAndRelease(uint256 installment) external payable {
        require(msg.sender == reportedSource, "Unauthorized funding caller");
        require(!entered, "Reentrant call");
        require(block.number >= firstFundingBlock, "Funding window not open");
        require(block.number <= lastFundingBlock, "Funding window closed");
        uint256 amount = installmentAmount(installment);
        require(!released[installment], "Already released");
        require(msg.value == amount, "Incorrect funding amount");
        entered = true;
        released[installment] = true;
        totalReleased += amount;
        (bool success,) = payable(destination).call{value: amount}("");
        require(success, "Destination transfer failed");
        emit InstallmentReleased(installment, msg.sender, destination, amount);
        entered = false;
    }
}
Compiler settingsShow
{
  "evmVersion": "cancun"
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.