Task 6a54640ec11c1fd5

Holder contest 1: a shared ETH treasury that tracks its depositors

Open contest · Robinhood Chain · 5.00 USDG · open until 2026-12-11 05:36 UTC · holders only (at least 1000000 tokens)

Open contest

Lifecycle

Money moves only on chain
  1. 01

    Published

    Commitment 0x071ee5e992a64ba0…, terms public below

  2. 02

    Open to token holders

    0 entries so far, no request needed

  3. 03

    Won

    The first condition-true verdict wins

  4. 04

    Locked for the winner

    The bounty is locked for the winner's wallet after the win

  5. 05

    Paid

    The arbiter releases only to the wallet its verdict names

The contract and condition

Public for this contest

Bounty held in the requester wallet 0x3198…1880, which holds 19.78 USDG right now. It is locked for the winner right after a win.

condition: {"template":"funds-leave","asset":{"kind":"eth"}}
scenario:  20 ETH

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

// Holder contest 1 (2026-12-04). A shared ETH treasury behind an upgradeable proxy.
// Every function guards itself. The task is to make ETH leave the treasury to you.

interface IProxiable {
    function proxiableUUID() external view returns (bytes32);
}

/// The proxy users talk to. The logic address sits in the standard EIP-1967 slot, and only the guardian
/// may point the proxy at a new logic contract, which must identify itself as a treasury.
contract TreasuryProxy {
    bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
    bytes32 private constant TREASURY_ID = keccak256("enclaus.holder-contest.treasury");

    address public guardian;

    constructor(address logic) {
        guardian = msg.sender;
        _setImplementation(logic);
    }

    function implementation() public view returns (address logic) {
        assembly {
            logic := sload(IMPLEMENTATION_SLOT)
        }
    }

    function upgradeTo(address newLogic) external {
        require(msg.sender == guardian, "only guardian");
        require(IProxiable(newLogic).proxiableUUID() == TREASURY_ID, "not a treasury implementation");
        _setImplementation(newLogic);
    }

    function _setImplementation(address logic) private {
        assembly {
            sstore(IMPLEMENTATION_SLOT, logic)
        }
    }

    fallback() external payable {
        address logic = implementation();
        assembly {
            calldatacopy(0, 0, calldatasize())
            let ok := delegatecall(gas(), logic, 0, calldatasize(), 0, 0)
            returndatacopy(0, 0, returndatasize())
            switch ok
            case 0 { revert(0, returndatasize()) }
            default { return(0, returndatasize()) }
        }
    }

    receive() external payable {}
}

/// The treasury logic: people deposit ETH and take their own balance back. The last depositor is
/// recorded for the dashboard.
contract TreasuryLogic is IProxiable {
    bytes32 private constant TREASURY_ID = keccak256("enclaus.holder-contest.treasury");

    address public lastDepositor;
    mapping(address => uint256) public balanceOf;
    uint256 public totalDeposits;

    function proxiableUUID() external pure returns (bytes32) {
        return TREASURY_ID;
    }

    function deposit() external payable {
        balanceOf[msg.sender] += msg.value;
        totalDeposits += msg.value;
        lastDepositor = msg.sender;
    }

    function withdraw(uint256 amount) external {
        require(balanceOf[msg.sender] >= amount, "balance");
        balanceOf[msg.sender] -= amount;
        totalDeposits -= amount;
        (bool ok,) = msg.sender.call{value: amount}("");
        require(ok, "send failed");
    }
}

/// Sets up the treasury the task is sealed around: the logic, the proxy, and the existing depositors' ETH.
contract Scenario {
    TreasuryProxy public immutable proxy;

    constructor() payable {
        TreasuryLogic logic = new TreasuryLogic();
        proxy = new TreasuryProxy(address(logic));
        TreasuryLogic(payable(address(proxy))).deposit{value: msg.value}(); // the existing depositors
    }

    function target() external view returns (address) {
        return address(proxy);
    }
}

Entries

0 so far

No entries yet.