The Smart Contract Composer in the Aragon App gives you the ability to interact with external contracts directly from your DAO. You can compose a series of actions that become executable if a vote passes. This means your DAO can connect to almost any application in web3!
For example, with the Smart Contract Composer you can….
In this guide, we’ll cover the steps of interacting with an external contract from your DAO. We’ll use a Uniswap token swap as our example.
Let’s dive in!
To compose smart contracts that initiate a series of actions from your DAO, you’ll need to create and pass a proposal. If the proposal passes, the actions become executable. From the DAO Dashboard, click "New proposal." Or, go to the Governance tab and create a proposal from there.
Write a concise title that explains what your proposal is about and add a summary so voters can get a sense of what your proposal contains quickly. Then, write the full text of the proposal in the text box below. You can also add links to relevant resources, like a link to the original proposal on your DAO forum or to a tweet thread where voters can share it.
In this step, you’ll set when the vote will start and how long it will last. You can choose to start the vote now or at a specific date and time in the future. The duration will be automatically set to the minimum duration you chose when you created your DAO. You can increase the duration if you’d like.
You can withdraw assets, mint tokens, or connect to any external contract using the Smart Contract Composer. Click “Add action” and choose “interact with a contract.”
Now it’s time to connect a smart contract to your DAO. Click “Connect smart contract.”
A smart contract is a self-executing digital contract that is written with code and stored on a blockchain. It automatically executes predefined actions and enforces the terms and conditions agreed upon by the involved parties without the need for intermediaries.
Paste in the address of the smart contract you would like to interact with.
This is a security step to ensure you’re interacting with the contract you believe you are. After you paste ion the address, click “Validate contract address.”
Contract validation/verification is the process of evaluating a smart contract to ensure it operates as intended and meets the specified requirements. It involves analyzing the contract's functionality, conducting thorough testing, and verifying its compliance with predefined rules and logic.
Once the contract has been successfully verified by one source, click “Create action.”
In our example:
Now, because we’re interacting with two contracts in this example, we’re going to repeat steps 5 and 6 to connect the Uniswap V2 Router. You can add as many contracts as you need to interact with to complete your desired action. If you’re just interacting with one contract, you will not need to repeat these steps and can proceed to step 7.
When we’ve completed steps 5 and 6 for our second contract, we’ll have both the Uni and UniwswapV2 Router contracts available to interact with.
Click into the contract on the lefthand side. You'll see all the actions that you can complete listed below it. Choose the action you want, which will open up information fields to complete.
When you're done filling out the fields, click "Add action."
In our example:
Open the Uni contract and choose the "approve" function. Fill in the following fields:
Now, you can see that one action has been created and added to your proposal. If the proposal passes, the action will be executable, meaning any wallet can approve it.
You may want to complete just one action. In that case, click "Next" to add this action to your proposal and prepare the proposal for vote.
If you want to add more actions, click "Add action" to open up the Smart Contract Composer again.
In our example:
To complete this swap, we’re going to add another action: interacting with the Uniswap V2 Router.
Click “Add action” to open up the Smart Contract Composer again.
Click “Interact with a contract” then open the Uniswap V2 Router contract. Scroll down and choose “swapExacttokensforEth.”
Fill in the following fields:
When these steps are complete, click “Add action.”
Once you're done adding actions in the Smart Contract Composer, you can publish the proposal! Review the actions and click “Next.”
Review the proposal and click “Publish proposal.”
If the proposal passes, the actions will be available to execute. All you need to do then is click "Execute" and the tokens swapped in your DAO treasury!
If the proposal does not pass and you still want to execute the action, you’ll need to start the process again with a new proposal.
Stay tuned for more guides and videos on performing specific actions in the App!
Launch your DAO on the Aragon App to start using the Smart Contract Composer and the other powerful tools in the App!
How to create a DAO on Arbitrum with the Aragon App
Learn how to launch a DAO on Arbitrum using the Aragon App.
How to update your Aragon DAO
Access optional security and feature updates for your DAO on the Aragon App