How to convert THE DAO tokens to ETH

in etherium •  8 years ago 

http://ethereum.stackexchange.com/questions/7204/how-do-i-convert-my-the-dao-tokens-into-ethers-using-the-withdrawal-contract-aft

Withdrawing Using Ethereum Wallet

Make sure that you have downloaded Ethereum Wallet 0.8.1 or later.

Start Ethereum Wallet and select "Yes" to the question "Do you want to activate the chain in which funds linked to the exploit are restored to a contract where they can be withdrawn by The DAO token holders?".

If you have not already added a watch on The DAO contract, see The DAO - How to add and watch the DAO contract. This step will give you access to approve the transfer of DAOs to the Withdrawal contract.

Add a watch on The DAO Withdrawal contact. Use the same procedure as in the link directly above, but set:

Contract Name: The DAO Withdrawal
Contract Address: 0xbf4ed7b27f1d666546e30d74d50d173d20bca754
JSON Interface: [{"constant":false,"inputs":[],"name":"trusteeWithdraw","outputs":[],"type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"mainDAO","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[],"name":"trustee","outputs":[{"name":"","type":"address"}],"type":"function"}]
NOTE that the steps below have not been tested yet and I'll update this answer when I've tested it after the hard fork

Get the balance of your accounts The DAO token balance by calling The DAO's balanceOf() with your account as the parameter.
Execute The DAO's approve() function with following parameters:
The Withdrawal contract address 0xbf4ed7b27f1d666546e30d74d50d173d20bca754; and
The DAO token balance of the address from step 1. above.
Execute The DAO Withdrawal's withdraw() function.

Withdrawal Process Explanation

There is a two step process to convert your DAOs into ETHs.

a) Approve The Transfer Of DAOs From The DAO To The Withdrawal Contract

The first step is to approve the transfer of DAOs from The DAO into the Withdrawal contract. This is done by calling The DAO's approve(...) function, listed below:

From The DAO's source code, here is the TokenInterface.approve() function definition:

/// @notice msg.sender approves _spender to spend _amount tokens on
/// its behalf
/// @param _spender The address of the account able to transfer the tokens
/// @param _amount The amount of tokens to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _amount) returns (bool success);
Here is the Token.approve(...) function that implements the function defined above:

function approve(address _spender, uint256 _amount) returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
Once you have called The DAO's approve(...) function, you have created an approval for the Withdrawal contract to transfer your DAOs into the Withdrawal contract.

b) Convert Your DAOs Into ETHs With The Withdrawal Contract

The second step is to call the Withdrawal contract's withdraw() function to transfer DAOs from The DAO into the Withdrawal contract, and for the Withdrawal contract to send your account the equivalent amount in ETH.

Here is the source code for the withdraw() function:

function withdraw(){
uint balance = mainDAO.balanceOf(msg.sender);

if (!mainDAO.transferFrom(msg.sender, this, balance) || !msg.sender.send(balance))
    throw;

}

Source of information

User @lefteris in thedao.slack.com stated that The DAO Withdrawal contract can be found at 0xbf4ed7b27f1d666546e30d74d50d173d20bca754 and the process to convert DAOs into ETHs are the following:
a) call dao.approve("0xbf4ed7b27f1d666546e30d74d50d173d20bca754", dao.balanceOf(youraccount))
b) call withdrawContract.withdraw()

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!