05 / CONTRACT
EquityAcquisitionTreasuryV2
Everything the treasury can do is written in this one contract. Below is the verbatim source of the PMAX-edition treasury (v2) — the exact code that gets deployed and verified at launch — 471 lines of Solidity, no proxy, no upgrade slots.
- Language
- Solidity ^0.8.24
- License
- MIT
- Source lines
- 471
- Network
- Robinhood Chain
The four phases the contract encodes
- 1FUNDreceive()
The creator tax arrives from Pons as plain ETH; receive() books it and announces it.
- 2WITHDRAWwithdraw()
The operator moves funds toward the brokerage; amount, destination and purpose go on record.
- 3PURCHASEattestPurchase()
After settlement, the fill comes back on-chain: share count, price, and the broker slip's hash.
- 4PROGRESSownershipBps()
The contract keeps the whole acquisition ledger and counts the distance to the 13D rung.
Read this first: the trust model
The contract says it up front. The operator has full and immediate custody of the chest — declared in the NatSpec at the top of the source, not buried on a policy page.
NatSpec — TRUST MODEL
* TRUST MODEL — read before interacting: this is an experimental * project. The operator has full, immediate custody of the treasury: * `withdraw` moves ETH to any address with no delay, and `rescueToken` * recovers any ERC20 sent here. Real-world share purchases happen * off-chain and are only as true as the operator's attestations. The * contract guarantees transparency (every movement is an on-chain * event), not custody restrictions.Three thresholds, fixed as constants
The 5% filing line, the 50% control line and the 100% line are compile-time constants — three numbers no key, no vote and no upgrade can move.
Constants — 13D / control / full
/// @notice Share quantities are stored in micro-shares (1 share = 1e6 units) /// so fractional brokerage fills can be recorded exactly. uint256 public constant SHARE_SCALE = 1e6; /// @notice SEC Schedule 13D beneficial-ownership disclosure threshold. uint256 public constant DISCLOSURE_BPS = 500; // 5.00% /// @notice Simple-majority voting control threshold. uint256 public constant CONTROL_BPS = 5000; // 50.00% (+1 share) uint256 public constant FULL_BPS = 10000; // 100.00%Events
event FeeReceived(address indexed from, uint256 amountWei, uint256 totalFeesReceivedWei); event CreatorFeesClaimed(address indexed escrow, address indexed token, uint256 amount); event Executed(address indexed target, uint256 value, bytes data); event WithdrawalExecuted(uint256 indexed id, uint256 amountWei, address indexed to, string purpose); event TokenRescued(address indexed token, uint256 amount, address indexed to); event PurchaseAttested( uint256 indexed id, uint256 shareUnits, uint256 avgPriceUsdCents, uint256 costUsdCents, uint256 ethSpentWei, bytes32 brokerReceiptHash ); event MilestoneReached(uint256 indexed bps, uint256 totalSharesAcquiredUnits, uint256 timestamp); event SharesOutstandingUpdated(uint256 oldUnits, uint256 newUnits, string reason); event ReferencePricesUpdated(uint256 stockPriceUsdCents, uint256 ethPriceUsdCents); event OperatorTransferStarted(address indexed current, address indexed pending); event OperatorTransferred(address indexed previous, address indexed current);Errors
error NotOperator(); error ZeroAddress(); error ZeroAmount(); error InsufficientBalance(); error TransferFailed();The functions that move money, in full
Four pieces of code decide everything this treasury can do. They are short enough to read on a phone. Read them.
1 · FUND — receive()
/// @notice Pons v2 routes the creator tax here as plain ETH transfers. receive() external payable { totalFeesReceivedWei += msg.value; emit FeeReceived(msg.sender, msg.value, totalFeesReceivedWei); }2 · WITHDRAW — withdraw()
/** * @notice Withdraw treasury ETH. Immediate; destination is free; every * withdrawal is permanently recorded with its stated purpose. * @param amountWei amount to withdraw; pass 0 to withdraw the full balance * @param to destination address * @param purpose stated purpose, e.g. "Broker deposit #2 for PMAX buys" */ function withdraw(uint256 amountWei, address to, string calldata purpose) external onlyOperator returns (uint256 id) { if (to == address(0)) revert ZeroAddress(); uint256 amount = amountWei == 0 ? address(this).balance : amountWei; if (amount == 0) revert ZeroAmount(); if (amount > address(this).balance) revert InsufficientBalance(); id = withdrawals.length; withdrawals.push( Withdrawal({amountWei: amount, to: to, executedAt: uint64(block.timestamp), purpose: purpose}) ); totalWithdrawnWei += amount; (bool ok, ) = to.call{value: amount}(""); if (!ok) revert TransferFailed(); emit WithdrawalExecuted(id, amount, to, purpose); }3 · PURCHASE — attestPurchase()
/** * @notice Record a completed real-world purchase of target shares. * @param shareUnits micro-shares bought (1 share = 1e6 units) * @param avgPriceUsdCents average fill price per whole share, in USD cents * @param ethSpentWei ETH that was converted to fund this purchase * @param brokerReceiptHash keccak256 of the broker trade confirmation document * @param executedAt real-world execution timestamp * @param memo free-form note, e.g. broker order reference */ function attestPurchase( uint256 shareUnits, uint256 avgPriceUsdCents, uint256 ethSpentWei, bytes32 brokerReceiptHash, uint64 executedAt, string calldata memo ) external onlyOperator returns (uint256 id) { if (shareUnits == 0 || avgPriceUsdCents == 0) revert ZeroAmount(); uint256 costUsdCents = (shareUnits * avgPriceUsdCents) / SHARE_SCALE; id = purchases.length; purchases.push( Purchase({ shareUnits: shareUnits, avgPriceUsdCents: avgPriceUsdCents, costUsdCents: costUsdCents, ethSpentWei: ethSpentWei, executedAt: executedAt, attestedAt: uint64(block.timestamp), brokerReceiptHash: brokerReceiptHash, memo: memo }) ); totalSharesAcquiredUnits += shareUnits; totalCostUsdCents += costUsdCents; emit PurchaseAttested(id, shareUnits, avgPriceUsdCents, costUsdCents, ethSpentWei, brokerReceiptHash); _checkMilestone(DISCLOSURE_BPS); _checkMilestone(CONTROL_BPS); _checkMilestone(FULL_BPS); }4 · PROGRESS — _checkMilestone()
function _checkMilestone(uint256 bps) internal { if (milestoneReachedAt[bps] == 0 && ownershipBps() >= bps) { milestoneReachedAt[bps] = uint64(block.timestamp); emit MilestoneReached(bps, totalSharesAcquiredUnits, block.timestamp); } }getStats() — the dashboard's single read
/// @notice One-call snapshot of everything the dashboard needs. function getStats() external view returns ( uint256 balanceWei, uint256 _totalFeesReceivedWei, uint256 _totalWithdrawnWei, uint256 _totalCostUsdCents, uint256 _totalSharesAcquiredUnits, uint256 _sharesOutstandingUnits, uint256 _ownershipBps, uint256 unitsToDisclosure, uint256 unitsToControl, uint256 unitsToFull, uint256 _estimatedAcquirableShareUnits, uint256 _withdrawalsCount, uint256 _purchasesCount ) { return ( address(this).balance, totalFeesReceivedWei, totalWithdrawnWei, totalCostUsdCents, totalSharesAcquiredUnits, sharesOutstandingUnits, ownershipBps(), shareUnitsToMilestone(DISCLOSURE_BPS), shareUnitsToMilestone(CONTROL_BPS), shareUnitsToMilestone(FULL_BPS), estimatedAcquirableShareUnits(), withdrawals.length, purchases.length ); }Full source
EquityAcquisitionTreasuryV2.sol · 471 lines
EquityAcquisitionTreasuryV2.sol
// SPDX-License-Identifier: MITpragma solidity ^0.8.24; /** * @title EquityAcquisitionTreasuryV2 * @notice On-chain treasury for an experimental community campaign to acquire * real-world equity (NASDAQ: PMAX — Powell Max Limited) funded * by memecoin trading fees routed from the Pons v2 launchpad on * Robinhood Chain. * * V2 adds what v1 lacked: Pons pays creator fees into a pull-based * escrow ledger that only the fee recipient itself can claim, so the * recipient must be able to CALL the escrow. V2 can: * - claimCreatorFees / claimCreatorFeeToken — anyone may trigger a * claim; proceeds land in this treasury and are booked as fees. * - execute — operator-only generic call, so no external protocol * can ever strand funds addressed to this contract again. * * Lifecycle encoded in this contract: * 1. FUND — Pons routes the creator tax (ETH) to this contract. * 2. WITHDRAW — the operator withdraws ETH to fund the brokerage * account. Every withdrawal is recorded on-chain with * destination and purpose. * 3. PURCHASE — after real shares are bought off-chain through the * brokerage, the operator attests the purchase on-chain * with quantity, price and a hash of the broker receipt. * 4. PROGRESS — the contract keeps the full acquisition ledger and * exposes progress toward the SEC 13D disclosure * threshold (5%), voting control (50% + 1 share) and * full acquisition (100%). * * TRUST MODEL — read before interacting: this is an experimental * project. The operator has full, immediate custody of the treasury: * `withdraw` moves ETH to any address with no delay, and `rescueToken` * recovers any ERC20 sent here. Real-world share purchases happen * off-chain and are only as true as the operator's attestations. The * contract guarantees transparency (every movement is an on-chain * event), not custody restrictions. */contract EquityAcquisitionTreasuryV2 { // --------------------------------------------------------------------- // Constants // --------------------------------------------------------------------- /// @notice Share quantities are stored in micro-shares (1 share = 1e6 units) /// so fractional brokerage fills can be recorded exactly. uint256 public constant SHARE_SCALE = 1e6; /// @notice SEC Schedule 13D beneficial-ownership disclosure threshold. uint256 public constant DISCLOSURE_BPS = 500; // 5.00% /// @notice Simple-majority voting control threshold. uint256 public constant CONTROL_BPS = 5000; // 50.00% (+1 share) uint256 public constant FULL_BPS = 10000; // 100.00% // --------------------------------------------------------------------- // Target company metadata // --------------------------------------------------------------------- string public targetTicker; // "PMAX" string public targetName; // "Powell Max Limited" /// @notice Total shares outstanding of the target, in micro-shares. /// Operator-updatable to track splits, buybacks and new issuance. uint256 public sharesOutstandingUnits; // --------------------------------------------------------------------- // Role // --------------------------------------------------------------------- address public operator; address public pendingOperator; // --------------------------------------------------------------------- // Treasury accounting // --------------------------------------------------------------------- uint256 public totalFeesReceivedWei; // lifetime ETH inflow uint256 public totalWithdrawnWei; // lifetime ETH withdrawn uint256 public totalCostUsdCents; // lifetime USD deployed into shares uint256 public totalSharesAcquiredUnits; // micro-shares attested as bought // --------------------------------------------------------------------- // Withdrawals (instant, operator-only, fully recorded) // --------------------------------------------------------------------- struct Withdrawal { uint256 amountWei; address to; uint64 executedAt; string purpose; // e.g. "Broker deposit #3 for PMAX buys" } Withdrawal[] public withdrawals; // --------------------------------------------------------------------- // Purchase attestations // --------------------------------------------------------------------- struct Purchase { uint256 shareUnits; // micro-shares bought uint256 avgPriceUsdCents; // average fill price per whole share, in cents uint256 costUsdCents; // total USD cost of this purchase uint256 ethSpentWei; // ETH converted to fund this purchase uint64 executedAt; // real-world trade timestamp uint64 attestedAt; // block timestamp of this attestation bytes32 brokerReceiptHash; // keccak256 of the broker trade confirmation string memo; } Purchase[] public purchases; // --------------------------------------------------------------------- // Reference prices (operator-attested, for dashboard estimates only) // --------------------------------------------------------------------- uint256 public refStockPriceUsdCents; // last observed target price uint256 public refEthPriceUsdCents; // last observed ETH price uint64 public refPricesUpdatedAt; // --------------------------------------------------------------------- // Milestones // --------------------------------------------------------------------- mapping(uint256 => uint64) public milestoneReachedAt; // bps => timestamp // --------------------------------------------------------------------- // Events // --------------------------------------------------------------------- event FeeReceived(address indexed from, uint256 amountWei, uint256 totalFeesReceivedWei); event CreatorFeesClaimed(address indexed escrow, address indexed token, uint256 amount); event Executed(address indexed target, uint256 value, bytes data); event WithdrawalExecuted(uint256 indexed id, uint256 amountWei, address indexed to, string purpose); event TokenRescued(address indexed token, uint256 amount, address indexed to); event PurchaseAttested( uint256 indexed id, uint256 shareUnits, uint256 avgPriceUsdCents, uint256 costUsdCents, uint256 ethSpentWei, bytes32 brokerReceiptHash ); event MilestoneReached(uint256 indexed bps, uint256 totalSharesAcquiredUnits, uint256 timestamp); event SharesOutstandingUpdated(uint256 oldUnits, uint256 newUnits, string reason); event ReferencePricesUpdated(uint256 stockPriceUsdCents, uint256 ethPriceUsdCents); event OperatorTransferStarted(address indexed current, address indexed pending); event OperatorTransferred(address indexed previous, address indexed current); // --------------------------------------------------------------------- // Errors // --------------------------------------------------------------------- error NotOperator(); error ZeroAddress(); error ZeroAmount(); error InsufficientBalance(); error TransferFailed(); modifier onlyOperator() { if (msg.sender != operator) revert NotOperator(); _; } // --------------------------------------------------------------------- // Constructor // --------------------------------------------------------------------- /** * @param _operator operator address (full treasury custody) * @param _targetTicker e.g. "PMAX" * @param _targetName e.g. "Powell Max Limited" * @param _sharesOutstanding whole shares outstanding (NOT scaled), e.g. 1_770_000 */ constructor( address _operator, string memory _targetTicker, string memory _targetName, uint256 _sharesOutstanding ) { if (_operator == address(0)) revert ZeroAddress(); if (_sharesOutstanding == 0) revert ZeroAmount(); operator = _operator; targetTicker = _targetTicker; targetName = _targetName; sharesOutstandingUnits = _sharesOutstanding * SHARE_SCALE; } // --------------------------------------------------------------------- // 1. FUND — fee intake // --------------------------------------------------------------------- /// @notice Pons v2 routes the creator tax here as plain ETH transfers. receive() external payable { totalFeesReceivedWei += msg.value; emit FeeReceived(msg.sender, msg.value, totalFeesReceivedWei); } // --------------------------------------------------------------------- // 2. WITHDRAW — instant, operator-only, recorded // --------------------------------------------------------------------- /** * @notice Withdraw treasury ETH. Immediate; destination is free; every * withdrawal is permanently recorded with its stated purpose. * @param amountWei amount to withdraw; pass 0 to withdraw the full balance * @param to destination address * @param purpose stated purpose, e.g. "Broker deposit #2 for PMAX buys" */ function withdraw(uint256 amountWei, address to, string calldata purpose) external onlyOperator returns (uint256 id) { if (to == address(0)) revert ZeroAddress(); uint256 amount = amountWei == 0 ? address(this).balance : amountWei; if (amount == 0) revert ZeroAmount(); if (amount > address(this).balance) revert InsufficientBalance(); id = withdrawals.length; withdrawals.push( Withdrawal({amountWei: amount, to: to, executedAt: uint64(block.timestamp), purpose: purpose}) ); totalWithdrawnWei += amount; (bool ok, ) = to.call{value: amount}(""); if (!ok) revert TransferFailed(); emit WithdrawalExecuted(id, amount, to, purpose); } /** * @notice Recover any ERC20 tokens sent to this contract (airdrops, * mistaken transfers, the campaign memecoin itself). * @param token ERC20 token address * @param amount amount to transfer; pass 0 to transfer the full balance * @param to destination address */ function rescueToken(address token, uint256 amount, address to) external onlyOperator { if (to == address(0)) revert ZeroAddress(); uint256 bal = IERC20Minimal(token).balanceOf(address(this)); uint256 amt = amount == 0 ? bal : amount; if (amt == 0) revert ZeroAmount(); if (amt > bal) revert InsufficientBalance(); (bool ok, bytes memory ret) = token.call(abi.encodeWithSelector(IERC20Minimal.transfer.selector, to, amt)); // accept both no-return and bool-return ERC20s if (!ok || (ret.length > 0 && !abi.decode(ret, (bool)))) revert TransferFailed(); emit TokenRescued(token, amt, to); } // --------------------------------------------------------------------- // 2b. CLAIM — pull creator fees out of Pons's escrow ledger // --------------------------------------------------------------------- /** * @notice Claim this treasury's accrued ETH creator fees from a Pons fee * escrow. Callable by ANYONE — proceeds can only land here, so an * open trigger lets the community keep the treasury topped up. * The ETH arrives through {receive} and is booked as fee inflow. * @param escrow the Pons fee escrow contract (IPonsV2FeeEscrow) */ function claimCreatorFees(address escrow) external returns (uint256 amount) { amount = IPonsV2FeeEscrow(escrow).claim(); emit CreatorFeesClaimed(escrow, address(0), amount); } /// @notice Same as {claimCreatorFees} for launches whose quote asset is an /// ERC20 — the tokens land in this contract (recoverable via /// {rescueToken} or later swapped by the operator). function claimCreatorFeeToken(address escrow, address token) external returns (uint256 amount) { amount = IPonsV2FeeEscrow(escrow).claimToken(token); emit CreatorFeesClaimed(escrow, token, amount); } /** * @notice Operator-only generic call escape hatch. Exists so funds * addressed to this contract can never again be stranded inside * an external protocol whose interface we did not anticipate. * Every use is permanently public via the {Executed} event. */ function execute(address target, uint256 value, bytes calldata data) external onlyOperator returns (bytes memory result) { if (target == address(0)) revert ZeroAddress(); (bool ok, bytes memory ret) = target.call{value: value}(data); if (!ok) { // bubble the revert reason up if (ret.length > 0) { assembly { revert(add(ret, 32), mload(ret)) } } revert TransferFailed(); } emit Executed(target, value, data); return ret; } // --------------------------------------------------------------------- // 3. PURCHASE — on-chain attestation of real-world share purchases // --------------------------------------------------------------------- /** * @notice Record a completed real-world purchase of target shares. * @param shareUnits micro-shares bought (1 share = 1e6 units) * @param avgPriceUsdCents average fill price per whole share, in USD cents * @param ethSpentWei ETH that was converted to fund this purchase * @param brokerReceiptHash keccak256 of the broker trade confirmation document * @param executedAt real-world execution timestamp * @param memo free-form note, e.g. broker order reference */ function attestPurchase( uint256 shareUnits, uint256 avgPriceUsdCents, uint256 ethSpentWei, bytes32 brokerReceiptHash, uint64 executedAt, string calldata memo ) external onlyOperator returns (uint256 id) { if (shareUnits == 0 || avgPriceUsdCents == 0) revert ZeroAmount(); uint256 costUsdCents = (shareUnits * avgPriceUsdCents) / SHARE_SCALE; id = purchases.length; purchases.push( Purchase({ shareUnits: shareUnits, avgPriceUsdCents: avgPriceUsdCents, costUsdCents: costUsdCents, ethSpentWei: ethSpentWei, executedAt: executedAt, attestedAt: uint64(block.timestamp), brokerReceiptHash: brokerReceiptHash, memo: memo }) ); totalSharesAcquiredUnits += shareUnits; totalCostUsdCents += costUsdCents; emit PurchaseAttested(id, shareUnits, avgPriceUsdCents, costUsdCents, ethSpentWei, brokerReceiptHash); _checkMilestone(DISCLOSURE_BPS); _checkMilestone(CONTROL_BPS); _checkMilestone(FULL_BPS); } function _checkMilestone(uint256 bps) internal { if (milestoneReachedAt[bps] == 0 && ownershipBps() >= bps) { milestoneReachedAt[bps] = uint64(block.timestamp); emit MilestoneReached(bps, totalSharesAcquiredUnits, block.timestamp); } } // --------------------------------------------------------------------- // Operator maintenance // --------------------------------------------------------------------- function updateSharesOutstanding(uint256 newWholeShares, string calldata reason) external onlyOperator { if (newWholeShares == 0) revert ZeroAmount(); uint256 old = sharesOutstandingUnits; sharesOutstandingUnits = newWholeShares * SHARE_SCALE; emit SharesOutstandingUpdated(old, sharesOutstandingUnits, reason); } function updateReferencePrices(uint256 stockPriceUsdCents, uint256 ethPriceUsdCents) external onlyOperator { if (stockPriceUsdCents == 0 || ethPriceUsdCents == 0) revert ZeroAmount(); refStockPriceUsdCents = stockPriceUsdCents; refEthPriceUsdCents = ethPriceUsdCents; refPricesUpdatedAt = uint64(block.timestamp); emit ReferencePricesUpdated(stockPriceUsdCents, ethPriceUsdCents); } function transferOperator(address newOperator) external onlyOperator { if (newOperator == address(0)) revert ZeroAddress(); pendingOperator = newOperator; emit OperatorTransferStarted(operator, newOperator); } function acceptOperator() external { if (msg.sender != pendingOperator) revert NotOperator(); address old = operator; operator = pendingOperator; pendingOperator = address(0); emit OperatorTransferred(old, operator); } // --------------------------------------------------------------------- // 4. PROGRESS — views for the dashboard // --------------------------------------------------------------------- /// @notice Current beneficial ownership of the target, in basis points. function ownershipBps() public view returns (uint256) { return (totalSharesAcquiredUnits * FULL_BPS) / sharesOutstandingUnits; } function shareUnitsToMilestone(uint256 bps) public view returns (uint256) { uint256 needed = (sharesOutstandingUnits * bps) / FULL_BPS; return totalSharesAcquiredUnits >= needed ? 0 : needed - totalSharesAcquiredUnits; } /// @notice Micro-shares the current treasury balance could buy at the /// attested reference prices. Zero if prices are unset. function estimatedAcquirableShareUnits() public view returns (uint256) { if (refStockPriceUsdCents == 0 || refEthPriceUsdCents == 0) return 0; uint256 balanceUsdCents = (address(this).balance * refEthPriceUsdCents) / 1 ether; return (balanceUsdCents * SHARE_SCALE) / refStockPriceUsdCents; } function withdrawalsCount() external view returns (uint256) { return withdrawals.length; } function purchasesCount() external view returns (uint256) { return purchases.length; } /// @notice One-call snapshot of everything the dashboard needs. function getStats() external view returns ( uint256 balanceWei, uint256 _totalFeesReceivedWei, uint256 _totalWithdrawnWei, uint256 _totalCostUsdCents, uint256 _totalSharesAcquiredUnits, uint256 _sharesOutstandingUnits, uint256 _ownershipBps, uint256 unitsToDisclosure, uint256 unitsToControl, uint256 unitsToFull, uint256 _estimatedAcquirableShareUnits, uint256 _withdrawalsCount, uint256 _purchasesCount ) { return ( address(this).balance, totalFeesReceivedWei, totalWithdrawnWei, totalCostUsdCents, totalSharesAcquiredUnits, sharesOutstandingUnits, ownershipBps(), shareUnitsToMilestone(DISCLOSURE_BPS), shareUnitsToMilestone(CONTROL_BPS), shareUnitsToMilestone(FULL_BPS), estimatedAcquirableShareUnits(), withdrawals.length, purchases.length ); }} interface IERC20Minimal { function balanceOf(address) external view returns (uint256); function transfer(address to, uint256 amount) external returns (bool);} /// @dev Pons v2 shared fee escrow — a pull-based claimable balance ledger./// claim()/claimToken() pay out msg.sender's own accrued balance.interface IPonsV2FeeEscrow { function claim() external returns (uint256 amount); function claimToken(address token) external returns (uint256 amount); function balanceOf(address recipient) external view returns (uint256); function balanceOfToken(address recipient, address token) external view returns (uint256);}Contract addressBack to the method