0

I'm currently looking at the DAO.sol contract and I cannot find:

  • the specific permission I need for the deposit function (so that I can deposit assets into the DAO).
  • any withdraw function so that I can withdraw assets from the DAO.

Using the new aragonOSx protocol, how would I go about doing such things?

1 Answer 1

0

Deposit

In regards to deposit, anyone can deposit assets into a DAO. You don't need any specific permission to do that.

Withdraw

Withdrawing of course is riskier, so permissions are needed.

The way you would withdraw is actually calling on the execute function from the DAO.sol contract. So in order to call it, the address needs the EXECUTE permission.

You would then call something like this:

_dao.execute(
   bytes32(_proposalId),
   _actions,
   _allowFailureMap
);
  • If you want to simply transfer ETH, you would add an action like { to: recipientAddress, value: ethAmount, data: null }
  • If you want to transfer an ERC20, you would add an action like { to: tokenContractAddress, value: 0, data: "<encoded-transfer(to, value)>"}
  • If you want to send an NFT, same as above.
  • If you want to swap Uniswap tokens, you would encode { to: uniswapPoolAddr, value: 0, data: "<encoded-swap(...)>" }

All of these actions you can encode and decode using the aragonOSx SDK (https://github.com/aragon/sdk).

Withdraw Examples

Here's an example of how to set it when you want to transfer funds upon a proposal approval:

proposal.actions = [
   { to: recipient, value },   // ETH
   { to: daiContract, value: 0, data: abiEncode(transfer, ...) },  // ERC20
   // ...
];

Here's an example of how it can be set up within a plugin: code snippet (Thank you @AbuUsama for the code snippet!)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.