Send protocol earnings to a named treasury - #79
Open
Enochthedev wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes GHO-40.
withdrawFees(address to, uint256)validatedtoonly 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
setTreasurywith aTreasurySetevent. Both withdrawals drop theirto.immutablethe maintenance operation is redeploying the protocol — which contradicts GHO-51/52.setTreasurycannot move a token; against the status quo it narrows what the withdrawals accept.withdrawFeesis capped byprotocolFees, not the token balance, so a market holding 400 of which 8 are the protocol's cannot have the other 392 touched.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.jsonwas missing GHO-31's entire pause surface and GHO-45'sBadDebtWrittenOff— 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.