Skip to content
Verified contractPartialMIT

Implementation

Address0x757dc896554e51666cafc9ccb967e8de38d91d35
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.28

 

Same code

2 more contracts

 

Details

Compiler
solc 0.8.28+commit.7893614a
Language
solidity
Optimization
Yes, 200 runs
EVM version
cancun
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,384,796
Creation transaction
0x873b8b3d8f…6500c44242

src/Fixtures.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

interface IRegistry {
    function lastCredibleBlock() external view returns (uint256);
}

abstract contract Guarded {
    address public immutable owner;
    IRegistry public immutable registry;

    constructor(address registry_, address owner_) {
        registry = IRegistry(registry_);
        owner = owner_;
    }

    modifier controlled() {
        require(msg.sender == owner, "test owner only");
        _;
    }

    modifier credible(uint256 deadline) {
        require(block.number <= deadline, "test attempt expired");
        // A storage-backed marker is required even during zero-price simulation.
        require(block.number != 0 && registry.lastCredibleBlock() == block.number, "marker missing");
        _;
    }
}

contract TestToken {
    string public constant name = "Titan Integration Test Token";
    string public constant symbol = "TITEST";
    uint8 public constant decimals = 0;
    address public immutable owner;
    mapping(address => uint256) public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;
    event Transfer(address indexed from, address indexed to, uint256 amount);
    event Approval(address indexed owner, address indexed spender, uint256 amount);

    constructor(address owner_) {
        owner = owner_;
    }

    function mint(address to, uint256 amount) external {
        require(msg.sender == owner, "test owner only");
        balanceOf[to] += amount;
        emit Transfer(address(0), to, amount);
    }

    function approve(address spender, uint256 amount) external returns (bool) {
        allowance[msg.sender][spender] = amount;
        emit Approval(msg.sender, spender, amount);
        return true;
    }

    function transfer(address to, uint256 amount) external returns (bool) {
        _transfer(msg.sender, to, amount);
        return true;
    }

    function transferFrom(address from, address to, uint256 amount) external returns (bool) {
        allowance[from][msg.sender] -= amount;
        _transfer(from, to, amount);
        return true;
    }

    function _transfer(address from, address to, uint256 amount) private {
        balanceOf[from] -= amount;
        balanceOf[to] += amount;
        emit Transfer(from, to, amount);
    }
}

contract FlowVault is Guarded {
    TestToken public immutable token;

    constructor(address registry_, address owner_, address token_) Guarded(registry_, owner_) {
        token = TestToken(token_);
    }

    function withdraw(uint256 amount, uint256 deadline) external controlled credible(deadline) {
        require(token.transfer(owner, amount), "transfer failed");
    }

    function deposit(uint256 amount, uint256 deadline) external controlled credible(deadline) {
        require(token.transferFrom(owner, address(this), amount), "transfer failed");
    }
}

contract Probe is Guarded {
    uint256 public value; // slot 0: the lifecycle assertion watches this.
    uint256 public work; // slot 1: requested gas burn per load assertion.
    event Executed(uint256 indexed sequence, uint256 work, uint256 blockNumber);

    constructor(address registry_, address owner_) Guarded(registry_, owner_) {}

    function set(uint256 value_, uint256 deadline) external controlled credible(deadline) {
        value = value_;
        emit Executed(value_, work, block.number);
    }

    function step(uint256 expected, uint256 work_, uint256 deadline) external controlled credible(deadline) {
        require(value == expected, "predecessor missing");
        require(work_ <= 300000, "work limit");
        work = work_;
        value = expected + 1;
        emit Executed(value, work_, block.number);
    }
}

contract Implementation {
    uint256 public immutable version;

    constructor(uint256 version_) {
        version = version_;
    }
}

contract TestProxy is Guarded {
    bytes32 private constant SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    constructor(address registry_, address owner_, address implementation_) Guarded(registry_, owner_) {
        assembly { sstore(SLOT, implementation_) }
    }

    function implementation() external view returns (address result) {
        assembly { result := sload(SLOT) }
    }

    function upgradeTo(address implementation_, uint256 deadline) external controlled credible(deadline) {
        require(implementation_.code.length > 0, "implementation missing");
        assembly { sstore(SLOT, implementation_) }
    }

    fallback() external {
        assembly {
            calldatacopy(0, 0, calldatasize())
            let ok := delegatecall(gas(), sload(SLOT), 0, calldatasize(), 0, 0)
            returndatacopy(0, 0, returndatasize())
            if iszero(ok) { revert(0, returndatasize()) }
            return(0, returndatasize())
        }
    }
}
Compiler settingsShow
{
  "viaIR": false,
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "cancun",
  "remappings": [
    "credible-std/=/home/user/workspace/credible-std/src/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.