Contracts

BrickReserve

The vault's ETH and its log in one contract. ETH leaves only as numbered withdrawals, and boxes are appended, never removed.

BrickReserve, example entries

  1. In0.0511 ETH from BrickFeeRouter (harvest)
  2. Out #10.2600 ETH to the purchasing wallet, memo 10307 Eiffel Tower
  3. Box #00110307, $629.99, paid by withdrawal #1, hash 0x3b1c…
  4. Custody#001 In transit, tracking attached
  5. Custody#001 Vaulted, shelf photo with vault card
  6. Box #00221058, $129.99, paid by withdrawal #2

Append only. Nothing above this line can change.

How the log reads over time. Each line is one transaction.

Functions

FunctionWhoWhat it does
receive()AnyoneAccepts ETH. Harvests arrive this way.
withdraw(to, amount, memo)OwnerThe only way ETH leaves. Numbered and stored.
recordAcquisition(…)OwnerAppends box #n with its cost, withdrawal and metadata hash.
updateCustody(n, status, uri)OwnerOrdered, In transit, Vaulted or Opened.
amendMetadata(n, uri, hash, reason)OwnerReplaces a document with a public reason. The old one stays in the event history.
withdrawToken(asset, to, amount, memo)OwnerMoves an ERC-20 someone sent the reserve.
acquisition(n), acquisitions(from, count)ViewOne box, or a page of the log.
withdrawal(id), withdrawalCount()ViewMoney out.
totalReceived(), totalWithdrawn()ViewRunning totals, in wei.

What a record holds

An acquisition stores the set number, time, cost in cents, withdrawal id, custody state, metadata URI and metadata hash. A withdrawal stores its destination, time and amount. Both are readable by anyone, forever. How a box is logged walks through filling them in.

Events

  • Deposited(from, amount)
  • Withdrawn(id, to, amount, memo)
  • AcquisitionRecorded(number, setNumber, costUsdCents, withdrawalId, metadataURI, metadataHash)
  • CustodyUpdated(number, status, evidenceURI)
  • AcquisitionAmended(number, metadataURI, metadataHash, reason)

Rules it keeps

  • Numbers start at 1 and only go up. There is no delete.
  • A withdrawal id cited by a box must already exist.
  • Ownership moves in two steps and can't be renounced, because a reserve with no owner would lock its ETH forever.