Optional Modules
DAOPresale Contract
Reference for the DAOPresale.sol implementation contract.
Source: contracts/DAOPresale.sol
(Note: Update link if necessary)
The DAOPresale.sol
contract provides the implementation logic for an optional token presale module. Instances of this contract are deployed via DAOPresaleProxy
contracts, initiated through a proposePresale
governance proposal executed by the DAO
contract.
Key Concepts
- Optional Module: Not deployed by default with a new DAO. Added later via governance.
- Token Sale: Facilitates the sale of a specified amount of the DAO’s governance token (
DAOToken
) at a set initial price (usually in the native currency, e.g., ETH). - DAO Controlled: Deployment, funding (transferring tokens from Treasury), pausing/unpausing, and withdrawal of collected funds are all controlled by the main
DAO
contract through specific proposal types (proposePresale
,proposePresalePause
,proposePresaleWithdraw
).
Expected Functionality (Based on common patterns and DAO interactions)
(This section is a placeholder and will be updated after analyzing DAOPresale.sol
)
buyTokens()
: A payable function allowing users to send native currency (e.g., ETH) to purchaseDAOToken
at the defined price during the active sale period.claimTokens()
: If tokens are not transferred immediately upon purchase (e.g., vesting or post-sale claim), this function allows buyers to claim their purchased tokens.withdrawToTreasury()
: Allows the controllingDAO
(viaproposePresaleWithdraw
proposal) to withdraw the collected native currency from the presale contract to theDAOTreasury
.setPaused(bool pause)
: Allows the controllingDAO
(viaproposePresalePause
proposal) to pause or unpause the sale (e.g., stopbuyTokens
calls).initialize(address token, address treasury, uint256 amount, uint256 initialPrice)
: An initializer function called by the proxy during deployment (triggered by_executePresale
inDAOExecutor
), setting up the presale parameters (token being sold, treasury address for withdrawals, total amount for sale, price).
Events
(This section is a placeholder)
TokensBought(address indexed buyer, uint256 ethAmount, uint256 tokenAmount)
: Emitted when a user successfully buys tokens.TokensClaimed(address indexed claimer, uint256 amount)
: Emitted when a user claims purchased tokens (if applicable).Withdrawal(address indexed treasury, uint256 amount)
: Emitted when collected funds are withdrawn to the treasury.PausedStateChanged(bool isPaused)
: Emitted when the presale contract is paused or unpaused.
Upgradeability
Uses the UUPS proxy pattern. Upgrades are managed via the DAO
contract’s proposeModuleUpgrade
governance process, specifically targeting the DAOPresaleProxy
address.