Skip to content

Send protocol earnings to a named treasury - #79

Open
Enochthedev wants to merge 1 commit into
mainfrom
wavedidwhat/gho-40-fees-accrue-in-two-places-and-can-only-leave-through-cast
Open

Send protocol earnings to a named treasury#79
Enochthedev wants to merge 1 commit into
mainfrom
wavedidwhat/gho-40-fees-accrue-in-two-places-and-can-only-leave-through-cast

Conversation

@Enochthedev

Copy link
Copy Markdown
Collaborator

Closes GHO-40.

withdrawFees(address to, uint256) validated to only as non-zero, and there was no treasury address anywhere in the system — so "where does the 2% rake go" answered "wherever the owner types, at the moment they type it". That is a product question, not an operational one: "a 2% rake" and "a 2% rake to an address the owner picks later" are different things.

Owner-settable treasury (chosen from three options), defaulting to the owner, repointed by setTreasury with a TreasurySet event. Both withdrawals drop their to.

  • Settable rather than immutable: a treasury address is exactly the thing that has to change, and with immutable the maintenance operation is redeploying the protocol — which contradicts GHO-51/52. setTreasury cannot move a token; against the status quo it narrows what the withdrawals accept.
  • No constructor argument. Every unchanged constructor arg is one less thing for the next redeploy to get wrong.
  • The bound is on screen and under test: withdrawFees is capped by protocolFees, not the token balance, so a market holding 400 of which 8 are the protocol's cannot have the other 392 touched.
  • The panel distinguishes "this contract predates the treasury" from "still loading" — the deployed contracts have no treasury(), and left alone it would spin forever and offer a button that cannot land.

The issue's cited 0.8 mUSDC is stale (pre-redeploy). Live today: the Chainlink market holds 4.00 mUSDC of rake, five times that, with nothing in the app saying so.

Unrelated finding: regenerating the Go ABIs showed CollateralVault.json was missing GHO-31's entire pause surface and GHO-45's BadDebtWrittenOff — two issues of drift in a checked-in generated file nothing verifies. Inert, which is why it survived. Regenerated here; a CI guard is noted on GHO-32.

328 contract tests pass. Detail in ADR 0046 and runbook Part 7.53.

withdrawFees and withdrawReserves took the destination as a parameter,
validated only as non-zero. There was no treasury address anywhere in the
system, so where the rake went was decided inside the transaction that
moved it.

Adds Treasured: a stored treasury, defaulting to the owner, repointed by
setTreasury with an event. Both withdrawals drop their `to` parameter.
Settable rather than immutable because a treasury address is exactly the
thing that has to change, and with immutable the maintenance operation is
redeploying the protocol.

Adds a fees panel to the operator console with both balances, the
destination stated before signing, and the bounds written on screen:
withdrawFees is capped by protocolFees rather than the token balance, so
stakes still owed to users are unreachable.

Also regenerates the backend ABIs, which were missing GHO-31's pause
surface and GHO-45's BadDebtWrittenOff. Noted on GHO-32.
@linear-code

linear-code Bot commented Aug 28, 2026

Copy link
Copy Markdown

GHO-40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant