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.
DAOToken
) at a set initial price (usually in the native currency, e.g., ETH).DAO
contract through specific proposal types (proposePresale
, proposePresalePause
, proposePresaleWithdraw
).(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 purchase DAOToken
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 controlling DAO
(via proposePresaleWithdraw
proposal) to withdraw the collected native currency from the presale contract to the DAOTreasury
.setPaused(bool pause)
: Allows the controlling DAO
(via proposePresalePause
proposal) to pause or unpause the sale (e.g., stop buyTokens
calls).initialize(address token, address treasury, uint256 amount, uint256 initialPrice)
: An initializer function called by the proxy during deployment (triggered by _executePresale
in DAOExecutor
), setting up the presale parameters (token being sold, treasury address for withdrawals, total amount for sale, price).(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.Uses the UUPS proxy pattern. Upgrades are managed via the DAO
contract’s proposeModuleUpgrade
governance process, specifically targeting the DAOPresaleProxy
address.