Skip to content
Verified contractPartialMIT

SettledSync

Address0x7a41430dbebb1287745353b83c0b4b403a4f34f9
Balance

0 ETH

 

Transactions

18

 

Compiler

solc 0.8.28

 

Same code

Only this contract

 

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,400,186
Creation transaction
0x12db78e342…cc41d57031

src/periphery/SettledSync.sol

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

interface ISettledSyncGame {
    function sync() external returns (uint256 work);
    function upkeep(uint256 maxCount) external returns (uint256 work);
    function capitalIn() external view returns (uint256);
    function pool() external view returns (ISettledSyncPool);
}

interface ISettledSyncPool {
    function unsettledAcquisitionCount() external view returns (uint256);
}

/// @title SettledSync
/// @notice Runs the game's `sync` and `upkeep` and reverts if the call drew capital from the vault while any FWA draw was
///         still in flight. The game counts cover for draws in flight as capital it needs, and capital it draws is never
///         returned before retirement (mainnet finding, 2026-11-11). With keeper pay set to zero, the owner's keepers
///         call the game only through here.
/// @dev The check runs after the call, in the same transaction, so it sees what the call actually did: a draw bought
///      earlier in the block, or a need the call's own booking created, cannot slip past it. `_sync` books settled draws
///      before it funds (`CollectionGame._sync`), so the count read after the call is the count when funding ran.
///      No owner and no state: anyone may call it. Keeper pay the game sends here goes on to the caller in the same
///      call. It does not stop anyone calling the game or the vault directly.
contract SettledSync {
    ISettledSyncGame public immutable game;

    error PulledWhileInFlight(uint256 count);
    error PayRefused();

    constructor(ISettledSyncGame game_) {
        game = game_;
    }

    function sync() external returns (uint256 work) {
        uint256 before = game.capitalIn();
        work = game.sync();
        _check(before);
        uint256 pay = address(this).balance;
        if (pay != 0) {
            (bool ok,) = msg.sender.call{value: pay}("");
            if (!ok) revert PayRefused();
        }
    }

    function upkeep(uint256 maxCount) external returns (uint256 work) {
        uint256 before = game.capitalIn();
        work = game.upkeep(maxCount);
        _check(before);
    }

    function _check(uint256 before) internal view {
        uint256 n = game.pool().unsettledAcquisitionCount();
        if (n != 0 && game.capitalIn() != before) revert PulledWhileInFlight(n);
    }

    receive() external payable {}
}
Compiler settingsShow
{
  "viaIR": false,
  "metadata": {
    "appendCBOR": false,
    "bytecodeHash": "none",
    "useLiteralContent": false
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "cancun",
  "remappings": [
    "forge-std/=lib/forge-std/src/",
    "solady/=lib/solady/src/",
    "shapes/=lib/shapes/src/",
    "ladder/=lib/shapes/ladders/mainnet/",
    "@openzeppelin/contracts/=lib/shapes/lib/openzeppelin-contracts/contracts/",
    "@uniswap/v4-core/=lib/v4-core/",
    "v4-core/=lib/v4-core/src/",
    "@uniswap/v4-periphery/=lib/v4-periphery/",
    "packs/=lib/shape-packs/src/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.