OpenFi => DeFi in 10 min with Aragon Agent

Why do we build dApps and protocols in the first place? Because we want trustless collaboration across borders, censorship resistance, and all the other blockchain things. For simple contracts that will never need upgrading this is easy. You deploy your code to mainnet and there it lives, autonomously, forever. However, if your contracts require upgradeability or parameter adjustments, you run into the problem of governance.

Aragon is a modular platform focused on optimizing governance of decentralized organizations. Aragon does a lot of things, but the goal of this article is to demonstrate how you can go from owner == msg.sender to Aragon DAO in less than 30 min.

The way we’re going to do this is via Aragon Agent. Agent is an Aragon App that allows a DAO to interact with any Ethereum dApp just like a regular account does. This means with Aragon and Agent, you get upgradable governance of your dapp or protocol without changing one line of your code. Keep reading to see how this works.


  1. Deploy a protocol with a single owner
  2. Deploy a DAO
  3. Transfer ownership of the protocol to the DAO
  4. Use the DAO to change the parameters of the protocol

Our Smart contract

pragma solidity ^0.5.16;

contract AwesomeProtocolProxy {
    address public owner;
    address public code;
    address public revenue;
    uint256 public fee;
    constructor () public {
        owner = msg.sender;
        fee = 1;
        revenue = msg.sender;
        code = 0xBe19dBee25F447133d0FA3cA05b88D8Ff2a9CB8f;

    //  Awesome Protocol Code Goes Here !!  //

// ------------------------  Admin Functions ------------------------------------- 

    * @notice Transfers ownership of the contract to a new account.
    function transferOwnership(address newOwner) external onlyOwner {
        owner = newOwner;

    * @notice Sets the Fee for Protocol
    function setProtocolFee(uint256 _fee) external onlyOwner {
            fee = _fee;
    * @notice Sets the Fee for Protocol
    function setRevenue(address _revenue) external onlyOwner {
            revenue = _revenue;

    * @notice Update the Protocol logic contract codeowner to `newCode`
    function updateCode(address newCode) external onlyOwner {
        code = newCode;

    modifier onlyOwner() {
        require (owner == msg.sender, "NOT_OWNER");

This is the proxy for our awesome DeFi protocol. Notice that the deploying account will be set as the owner and our protocol needs an admin to adjust three state variables:

  • fee: the fee our protocol charges
  • revenue: the address that collects fees
  • code: the implementation of our protocol

Lets deploy this contract to Rinkeby:

  • Go to
  • Create a new file called AwesomeProtocolProxy.sol
  • Copy & paste contract
  • Unlock your frame account
  • Switch to injected web3
  • Deploy contract

You’ll notice that we have unilateral power to change the fee, address, and functionality of the protocol. This is a centralised protocol running on decentralised architecture. We can do better.


Aragon DAOs

Aragon DAOs are incredibly flexible. All the core functionalities of a DAO (token management, Finances, etc) are modular smart contracts called Apps. Apps have permission to perform specific actions on other Apps.

Templates are pre-configured patterns for different types of organisational types. In part 2 of this series we will install a new app into our DAO and introduce a new tool, aragonCLI.

But for the purposes of this exercise, we will stick with the membership template.

Membership Template

Select Membership Template

A “Membership” organization that uses a non-transferable token to represent membership in the DAO. Decisions are made via “one-member-one-vote”. This fits well for our current stage of the project where we have three core devs and a relatively small community.


Claim An ENS Domain

Aragon uses the Ethereum Name Service (ENS) to assign names to organizations. Choose your DAO name wisely. Once chosen, The organization’s ENS name cannot be changed.

Set Voting Parameters

“Support” is the percentage of votes on a proposal that the total “Yes” votes must be greater than for the proposal to be passed. This voting App will have the authority to sign transactions on behalf of agent, and agent owns our protocol, so we want decisions to be unanimous.

“Minimum Approval %” is the percentage of the total token supply that support for a proposal must be greater than for the proposal to be considered valid. we will set this to one third, since every member has an effective veto.

“Vote Duration” is the length of time that the vote will be open for participation. we will leave this as the default.

Create Token

Choose a token name, Ticker and bootstrap the DAO with its founding members. Note: Do not add more than a few tokenholders to your organization on this screen or the transaction to create your organization may fail; you can add more tokenholders after the organization has been created.


Success! :tada:

Guided tour of our DAO

Now that we’ve created a DAO, let’s explore the apps and features that we’re going to use in this tutorial.


The Tokens app allows you to mint new tokens and assign them to yourself or other entities. Tokens minted by the Tokens app confer voting abilities to holders of the tokens such that one token equals one vote. Tokens in a Membership organization are non-transferable, and each tokenholder can only hold a maximum of one token minted by the organization at a time


Taking actions in an Aragon Membership DAO requires approval by members. This is made possible via the Voting app. Any time an action is taken, it is sent through the Voting app before it can be executed. For example, assigning tokens and signing transactions with Agent requires a vote by members (token holders) of the DAO.


Before we go back to our smart contract, we need to get the address of our DAO’s Agent. Every component of an Aragon DAO is it’s own contract. All the info for all the components your DAO uses can be found in the SYSTEM/Organization page. All you need to do here is click on the Agent address and then copy it.

Transferring Ownership

Back in remix, we are going to transfer ownership to our DAOs Agent. Here’s how:

  • on the DEPLOY & RUN TRANSACTIONS tab and open the deployed instance of our contract
  • open the drop down for the changeOwner function, paste the Agents address, send transaction
  • call getter for owner check it is set to agent
  • Success🎉

Our DeFi protocol is now owned by our DAO. Only our DAOs Agent can call the three admin functions. Any of the three token holders can open a vote for Agent to call the functions, and thats what we are going to do next

Interacting with Agent

Let’s explore how to use Agent with the Aragon Client console:

  • In the Aragon client, click on the gear icon in the top right of the page
  • Select ‘Help & Feedback’
  • Enable the console toggle
  • Open the console

Change parameters

The console exposes two aragonCLI commands:

  • Exec: enables you to directly call a function in a Aragon App
  • Act: enables you to call functions on other smartcontracts using Agent

We are only going to use Act. Currently, the DAO is the owner of our protocol, however, the address where the revenue is still sent to the previous account. We want to call the setRevenue() and change the address to Agent.

the syntax of the act command is

act/agentProxyAddress/targetAddress/methodName(type: arg)

agentProxyAddress : is the Address of our agent

targetAddress : is the address of the smartcontract

methodName(type: arg) : is the function we are calling

Putting it all together we get:

act/0x5a43dbb51bae8f571d54f8d1b42b691a531503be/0x8BBAa8C008e438f1Ed3ECb2fce47365f140D1e54/setRevenue(address: 0x5a43dbb51bae8f571d54f8d1b42b691a531503be)

Finally, press send and sign the transaction. since we don’t have unilateral permission to call functions using agent, the action is forwarded to a vote.

Vote in Your DAO!

Head back to your DAO. We now have a new vote in the Voting App! Vote, it is your destiny. After the vote passes head back to remix. If all goes well, you should see that the fee has been updated!

Wrap up

We have gone from 0 to DAO in less than an hour. Congratulations! While this is cool, we have only scratched the surface of what’s possible. In future tutorials we will show you how to install apps into your DAO, modify permissions, and explore new workflows for Agent

Need Help?

If you have any questions or would like expert help implementing a governance solution for your dApp or protocol please reach out to us! We’re happy to walk you through this process and answer any questions you might have. You can reach out to us for help on this use case specifically via the Agent Support Survey, or any of the channels listed below. Look forward to talking soon! :slight_smile:

Recommended Readings

Motivations · Aragon Developer Portal


Riding the EVM with Aragon Agent and EVM scripts

How to use Aragon Agent · Aragon Developer Portal


This post also exists on our new Aragon Community Medium blog :slight_smile:

Boom! Congrats @burrrata and special mention to @Aaron for this slick video. Finally some cool guides to share :wink:


Yeah @Aaron put it together, I just helped make it look pretty lol


This is great! I just looked into the agent the other day. Could have definitely used this. Question, why does the vote list the function called as “unknown function”? It seems like my co owners would be confused what I’m trying to do. Are getting function names a feature planned for release?

1 Like

I’m worried it’s too early for me.

I’m worried I could easily make mistakes typing parameters in the command line.

I can totally imagine situation when telling Agent to act and then not getting my parameters correctly:

  • 0 no, 1 yes
  • 0 abstain, 1 no, 2 yes

I like the UI way, that uses Frame, less error-prone.

Obviously - much respect - the Aragon and Agent and OS and command line and frame you guys are pushing quality code like crazy :zap::zap::zap:

1 Like

Awesome! I would love to hear use case for Agent :slight_smile:

100% this is not great UX. I believe its an issue with radspec however @sohkai can give a better answer to that

Thanks @mars, that is great feedback!

The idea behind the guide is to go from 0 to DAO in the shortest time possible. @burrrata and I wrote it in the build-up to Eth London so thinking about what would be most useful to hackers was the driving force. It was cool seeing you again too :slight_smile:

Day to day, when im working with Agent I use the CLI. its the most robust and powerful way of interacting with your DAO as a whole, especially so with Agent.

one of the benefits of using the terminal is it’s possible to set environment variables. it is so easy to make mistakes when dealing with loads of addresses, using environment variables, you can assign human-readable names to them making the commands legible.

On Eth London, go and shoe these guys some :heart: They built an awesome project. They built a dapp that enabled you to offset your carbon footprint generated on ethereum with tokenised carbon credits #PoweredByAragon :eagle:

Indeed, this is an issue with the client not being able to know what function hashes map to which descriptions.

If you have a specific function in mind that you consistently use, please let us know so we can add it to the known list for now!

1 Like

My Dapp deals with locally centered bets. Very small p2p betting, so naturally the problem arises when two betters disagree. If I’m understanding it correctly, agent will help me move the relevant data for my disputes from my app contracts to Aragon contracts. Things like the potID number, amount in betting pot, current votes etc.

1 Like

sorry for the slow response. Not quite, Agent enables of your DAO to call functions on any smart contract. In the article this is your own smart contract but it could be any smartcontract on the network your DAO is deployed on.

so for example, Your DAO can use agent to open a CDP in maker or invest DAI on compound. The advantage of using Agent is that you dont need to have to write a separate app for every smartcontract your DAO wants to interact with.

for the use case where your users disagree and you need some kind of arbitration, Aragon Court would be the ideal solution.

I hope that answers your question

1 Like

Ok I see. I could have one appk let’s call it Betting) that’s based on my apps contracts. From there I could use agent to call a string storage contract that will save the name of the winner of the bet. Without agent, I’d need a separate Winner app this?

So Say you have a smart contract that allows users to bet on some arbitrary event. If the outcome cannot be automatically deduced, and you had to set the winner manually, then someone has to have permission on your smart-contract so set the winner.

you would probably have something like owner = msg.sender this in the constructor and restrict the function that can set the winner to owner. The problem with this is it is centralised. One person is making this decision. Now that might be ok and even ideal in some circumstances, but what if you want the decision to be made by 3 or 5 people? Well in this situation you will have to write something custom.

what Agent allows you to do is to make these decisions collectively with a DAO. Furthermore, the same group of people can collectively make the decision to call any function on any smart-contract without writing any code whatsoever


AHA! Your example is actually exactly my use case. I see now. That aligns with my understanding, I’m just poor at explaining

1 Like

That’s fine :slightly_smiling_face:, I can jump on a call with you some time to work through your use case provide some technical support of the DAO side of things

O man, sure thing. That’s awesome of you to do! I just finished finalizing some ideas. Super down to run them by you

Cool, I’ll let sync off the forum. I’m mostly available on telegram and keybase for messaging

Telegram @AaronFoster
Keybase @AaronFosterReal

But book a time in my calendar also for a call when you’re ready