Source: contracts/DAOTreasury.sol (Note: Update link if necessary)

The DAOTreasury.sol contract provides the implementation logic for the DAO’s treasury, responsible for holding and managing the DAO’s funds (native currency like ETH, and ERC20 tokens). It is used behind a DAOTreasuryProxy.

Key Concepts

  • Fund Custody: Holds the assets belonging to the DAO.
  • DAO Controlled: All outgoing transfers are initiated only by the associated DAO contract through the execution of successful governance proposals (specifically proposeTransfer proposals). Direct transfers by external accounts are not possible.
  • Asset Support: Designed to hold the native blockchain currency (e.g., ETH) and any ERC20 tokens.

Expected Functionality (Based on common patterns and DAO/Factory interactions)

(This section is a placeholder and will be updated after analyzing DAOTreasury.sol)

  • transferETH(address payable recipient, uint256 amount): Transfers native currency from the treasury. Should only be callable by the associated DAO contract.
  • transferERC20(address token, address recipient, uint256 amount): Transfers ERC20 tokens from the treasury. Should only be callable by the associated DAO contract.
  • initialize(address daoAddress): An initializer function called by the proxy during deployment (specifically, called by the DAOFactory after the DAO proxy is deployed), linking the treasury to its controlling DAO contract address.
  • Receive Ether: Likely implements a receive() external payable or fallback() external payable function to allow the treasury address to receive direct deposits of native currency.
  • ERC20 Deposits: ERC20 tokens can be transferred directly to the Treasury contract’s address using the standard transfer function of the respective ERC20 contract.

Events

(This section is a placeholder)

  • ETHTransfer(address indexed recipient, uint256 amount): Emitted when native currency is transferred out.
  • ERC20Transfer(address indexed token, address indexed recipient, uint256 amount): Emitted when ERC20 tokens are transferred out.
  • ETHReceived(address indexed sender, uint256 amount): Emitted when native currency is received directly.

Upgradeability

Uses the UUPS proxy pattern. Upgrades are managed via the DAO contract’s proposeUpgrade governance process.