Treasury

circle-info

πŸ“‹ Contract Overview

Property
Value

πŸ“ File

src/Treasury.sol

πŸ”§ Type

Upgradeable UUPS Proxy

βš™οΈ Solidity

0.8.33

πŸ“œ License

MIT

circle-info

🎯 Purpose: Multi-token vault holding DAO funds with built-in safety rails that prevent rapid drainageβ€”even through governance attacks.


πŸ›‘οΈ Treasury Safety Rails

circle-exclamation
Limit
Value
Purpose

πŸ“ Per Proposal

10%

Prevents single large withdrawal

πŸ“… Daily

5%

Limits daily outflow

πŸ“† Monthly

20%

Caps monthly spending

🏦 Reserve Floor

15%

Maintains minimum reserves


πŸ”§ Functions

πŸ“₯ Deposit Functions

Deposit Tokens

function deposit(address token, uint256 amount) external

Access: Anyone (typically REVENUE_SOURCE_ROLE)

Deposits supported tokens into treasury.

Deposit ETH

function depositETH() external payable

Access: Anyone

Deposits ETH into treasury.


πŸ›‘οΈ Safety Rail Mechanics

circle-check

Daily limit resets every 24 hours.


πŸ”’ Attack Resistance

circle-exclamation
Scenario
Without Limits
With Limits

🎯 Governance attack

100% drained

Max 10% per proposal

πŸ”“ Compromised multisig

Rapid drainage

Max 5% daily

⏱️ Extended attack

Full drainage

Max 20% monthly

πŸ›‘οΈ Any attack

Empty treasury

15% always preserved

Attack Timeline

Day
Max Damage
Cumulative
Response Time

1

5%

5%

Community alerted

2

5%

10%

Investigation begins

3

5%

15%

Countermeasures deployed

Week 1

~20%

~20%

Monthly cap hit


πŸ“œ Events & Errors


πŸ”— Contract Interactions

Contract
Interaction

βš–οΈ Governance

Calls withdraw after proposal approval

Deposits revenue

Deposits rent payments

πŸͺ BLTBYBank

Transfers token sale proceeds

Receives allocated funds


πŸ”„ Upgrade Considerations

circle-info

Treasury is upgradeable via UUPS proxy to allow future improvements.

Upgrade Reason
Example

πŸ›‘οΈ New safety features

Additional rate limits

πŸ› Bug fixes

Security patches

πŸͺ™ New token types

Support new assets

πŸ“Š Enhanced reporting

Better analytics

Upgrades require governance approval.


chevron-rightπŸ’» Integration Exampleshashtag

Depositing Revenue

Governance Withdrawal

Checking Available


Governancechevron-righthttps://github.com/urbanarray/builtbydocs/blob/main/docs/developers/contracts/operating-budget.mdchevron-righthttps://github.com/urbanarray/builtbydocs/blob/main/docs/developers/contracts/dao-business.mdchevron-rightTreasurychevron-right

Last updated