# Ownership Transfer to DAO

#### Objective

To transfer the authority of the DAO smart contract from the initial admin to a decentralized voting wallet or contract, enabling full decentralization.

#### Logic

The contract contains an `authority` field that determines who can execute critical functions. Once the DAO is mature, the admin can call `transfer_authority` to assign control to a DAO-controlled wallet or smart contract.

#### Anchor Code

```
pub fn transfer_authority(ctx: Context<TransferAuthority>) -> Result<()> {
    let dao_account = &mut ctx.accounts.dao_account;
    dao_account.authority = ctx.accounts.dao_voting_wallet.key();
    Ok(())
}

```

#### Security Notes

* Only the current admin (authority) can trigger this transfer.
* Once transferred, control over the treasury and protocol is held by the DAO.
* Ownership can optionally be locked permanently by removing upgrade privileges.
