DAPPCON 2019: Writing Adaptive Aragon DAOs - Cory Dickinson (Aragon)
DappCon 2019 · August 2019 · 1:49:54
At DappCon 2019, Cory Dickinson of Aragon discusses writing adaptive Aragon DAOs, covering how decentralized organizations built on Aragon's framework can update their own governance rules over time. He walks through smart contract patterns that let a DAO evolve its permissions and processes without a full redeployment. The talk offers practical guidance for developers building flexible governance into Ethereum-based DAOs.
Speakers
Topics
From DappCon 2019, hosted by Dappcon Berlin.
Transcript
awesome so how many people are familiar with Aragon platform just with the tech stack at all or has worked with it before anyone okay cool okay cool so for the like the first you know hour 45 minutes which is gonna give this like presentation to just go over everything in the tech stack and then we'll build this like demo app and we'll try to I'll try to explain how to structure your
permission system to make these days a little bit more adaptive but yeah as a prerequisite have node installed NPM I can when we when when we get to that workshop portion I can like walk around and help you guys install the CLI and the package manager so I have two package measures the the API stuff and all the rail of note packages but out of the box the ten there's like a template that should get you going so cool I guess I'm just gonna sit all right CI overview so these are the five main packages for Aragon we have the OS which
is the set of smart contracts that runs on the etherion blockchain the package manager which is also a set of contracts the COI which is the tool that you'll use to run your your def chain run ipfs also you know you can actually interact with the Dow's themselves you can configure the permissions you can launch a Dao from the CLI the API I'm not gonna go over the JavaScript API but I will go over the react API itself and and I'll explain sort of what that does like what that does what it takes care of before
you and if you don't like it where to go to to just use like a regular and then the UI which is just a design kit to standardize when you build Eragon apps we have like a design philosophy we want things to kind of feel the same we want the experiences to feel the same across all our different apps and so yeah at a higher level yeah this is this is essentially this layer right here this jo-jo layer right here is where the API comes in and as you can see it handles caching it handles your events so when your contract emits an event how you then consume that event and reduce your state itself wraps web 3 so you don't need to deal with any of
that you can just make your contract calls like through the API library and a messaging layer so yeah if you want to send a transaction or send a message like when when an event is processed you can do that through the window it's yeah and then the EVM so I'm gonna go over the kernel and the ACL the EVM scripts at is you know essentially you know the bytecode packed version of calls that you can make to other contracts there's a registry of those for the package manager but it's not super important that you need to know how to use it but if you want to use something like the forwarder which I'll kind of talk about
later it's really useful but the ACL is the access control list is everyone familiar with that terminology from like Linux so it's exactly the same thing you can very much view the aragón stack as a true OS on top of the blockchain in the sense that every app is sandbox and there are roles and entities that that manage those roles so yeah these are the three big components the kernel the ACL and the package management system which handles upgradability and so yeah this is essentially the kernel is a very
lightweight contract it has a mapping for all the apps installed for a particular down and the way that mapping is traversed is we encode these strings namely the URL to where this place where this thing lives in the registry and so yeah you can wait what what essentially there is is for every app there's a unique hash obviously it's gets created so like let's say as you see your name hash right voting Aragon PMD --the when when you publish your app it gets a domain such as this so you can publish on your
dev chain using the opened Aragon p.m. via East and that's set up by Aragon and themselves but if you want to publish to the main app like the main app registry there's like a process that they kind of audit your contracts because you know they don't want to let anyone publish because things will get very large and it has something called the app manager role and now the app manager role essentially is the the it is the permission that you set to configure other permissions for your application so you know when you're deploying one of these dows you might pick an address
that address will have the app manager role it will do all of the pre configuration steps and then ideally you would revoke permissions from that address when you're done configuring or Dao because this is like the highest level access that that any permission has been it so yeah these are the two functions that use the most with the kernel when that's exposed the namespace so yeah you you would encode your app name so let's say it's you know demo Aragon DMD Thor whatever you would encode that pass in sorry you first you would pass in the namespace so so we're
gonna do open dot Aragon PMD --the the app ID which we would encode the name let's say demo and then the address of where you're going to deploy it and then get up so when you launch a an Aragon dev chain some apps kind of come out of the box so we have voting as a token manager and those are the two main ones right now that are live that we'll be looking at but those you can just access you'll be able to get that code by just calling gap so you encode voting I don't even know how to pronounce yet pronounce that T sack kassak yeah k
check okay J yeah I've never had to say that word out loud actually so yeah you would encode that and then you're able to get the app code so when you publish your app others will also be able to pull your app down from that unique address so I kind of lied um the colonel isn't the app itself there there's an app proxy so we create instances of applications from the code repositories which I will show later on and essentially you are yeah you're pinning a new app like in you're pinning a an app proxy address to then deploy
one of the applications on the Aragon network so you're not actually referencing the same voting app address right across all apps you're creating a proxy that has the voting app deployed I'm sorry oh yeah yeah new app new app the app instance function returns the proxy the new pinned app instance is saying I I wanna yeah you basically want to pin that name for that particular proxy always so you're going to
[Music] yeah so when you want to upgrade you can technically if you have if you're if you're if you have the permission set up you should be able to pass a new address right and pin that new address yeah that's true programmatically like if we were gonna write a solidity contract to upgrade but I'm gonna show you how we can upgrade contracts for the CLI so it's kind of moot you might you because going this route is great when you want to build like a
template so let's say you have many different apps that you want to put in one down you would use this interface but you know usually what you can do is that you don't actually need to do this you can just use you can version the different apps in the registry and then pull down a new version from that registry so yeah the kernel exposes the ACL so if we want to upgrade the kernel this is essentially how you would do it the thing about upgrading the kernel is anyone you know that's very convertible anyone can do it but it's a huge
security risk part of ideally you should only upgrade the kernel to approved releases on the package manager so you can supply your own address and go with that or use a fork but it's strongly dissing couraged to do this I'm just showing this saying you can upgrade your kernel if you want to okay so the ACL I hope I'm not beating a dead horse here yeah it's just a set of rules about that described who has permissions to execute what action in an era gone out and it also describes who can grant and revoke those rules an entity or an app or
an address and entity just some some abstract that that abstraction essentially holds yeah all those permissions and and describes I'm sorry an entity hope so for example when you when you make a new app that app itself is an entity and so it has its own ACL compared to the voting app and if you want to access roles in other apps you have to you have to either use a foot forwarder to then you know encode that function call with the parameters and then execute it and that the the other app has to be configured right to know
that address is allowed to do that action or you can set up a set up a new unique role to perform that action because yeah each each each ACL is sandbox they don't they don't really talk to each other they just Traverse one another and so let's just look at the snippet really quick yeah so we bring in the Eragon app which has our kernel so we're gonna create a new role for this set receiver function we're going to expose who's going to be receiving such eath when you pay this when you send eath to the send funds function and as you can see here we have
we have a couple things one we have only in it which is a decorator that comes with the Eragon app but then also you see here we have external letting it know that it's a it's a public function calling you basically what this does is it says check to see if the address has permission or is this role and when we go into the the template and we actually build our app we'll see how we can you know permission like give permissions to to new addresses and we can either we can even give permissions to any address so we have a convention where if you do address 0 so address you know
parentheses your 0 address if you set that to one of the roles it basically means any entity can call this function so if you wanted to have just you know a vending machine right and one of the methods anyone can call that's how you do it but yeah there's this this seems pretty concise right does anyone want me to jump into anything and a snippet yeah this is this is just this is the the base contract for your Aragon app if
you were going to write a new one okay yeah so it's it's just for Aragon organization so other Aragon apps have access to the registry which we're not showing the architecture you'll see how this off this off decorator plays into why yeah only Aragon apps can kind of use
the roles system and how the package manager knows which apps are which and which app which roles stay they have exactly we'll get there yeah that's a really good question um I'll explain like the versioning and how you can you can either you know you can't force everyone to update so once someone picks a version so let's say it's 1.0 that's what they're well they're app is using
and then you bump your app to 1.0 one they can actually in their application hold a vote to upgrade which is one point zero one but it won't do it automatically it'll always right now with the contracts themselves the packet because then they would have to bump the version of their application when your application updates so there's like a it's a little bit more yeah it's a little bit more work but that sort of the work around with like using ipfs as this layer to deal with versioning yeah so i'll in one of these slides I'll show you I'll show you cool so this it's actually right
here yeah so this is how we deal with the upgrade ability and as you can see there are yet two main components there's the registry and then the repo itself so the repo actually contains the code inside at a certain IP FS ash location and the registry has the versions and the yeah has the versions for each of the apps so as you can see here the content changes right and you have these different blocks and a higher
level yeah so yes you have the code yeah the address where it's deployed and then yeah the content and we'll talk about what's we have this is the same called the air app JSON file and it describes the roles and kind of describes the directory structure of your project so yeah at a higher level this is the architecture for aragón p.m.
so yeah so when we were talking about the kernel right in the ACL we see here that the registry itself is a dau is an Aragon app and it has permissions and roles right to add subdomains to the ENS registrar then right through the kernel you're able to so so so once you have this once you have this link then when you get that named hash you get that pretty there colonel for that particular app and then yeah the red the the registry
also instantiate s-- and assigns permissions for the repo app this the repo app is where the code lives itself and yeah a dev can can either interact with the registry itself and create a new instance or through the CLI deploy a new instance of a Dao any questions yeah and when I go into the CLI like we have
a there's a command you know where you type Aragon APM versions and then you can see for that name hash all the different versions that exist for the application exactly I don't know if I understand your question okay okay so the ipfs hash has this yeah this this JSON file this data
this metadata about the contract for the versioning system so that's it it even has a link for you know what the previous version is and I'll go into that there's no source code on ipfs correct ID yeah no there's no there's no there's no direct yeah there's no like compiled yeah source code on ipfs no no there's just like the address of that particular repository which has that code I'm sorry ABI that's a good question I don't know if the ABI is I
don't believe so I want to say no the ABI is not uploaded I would VFS yeah I don't think so no that is stored on ipfs actually either it's like a there's a you you you actually publish your front-end with when you publish your contract yeah cool so this is like super straightforward and kind of redundant if you guys know versioning you know I'm just gonna go over how versioning works
um yeah so every individual repos an aircon app that leverages the ACO and the Aragon PM Dao after it checks the repo logic tries to vote out the upgrade version is allowed a version bump for a package is defined with following rules so yeah you can only increase by one every time you run the command version components to the left of the raise member must stay the same and the components to the right must be 0 so obviously if you do major you know the the first one gets bumped if you do minor the second one gets bumped if you do patch the last number and this gets bumped and yeah and so the
initial yeah and so yeah we start at zero point zero cool this is gonna be this is gonna make more sense when we actually start to dev but here are the main commands that we'll be using today and I wish I planned this a little bit better so I could share this slide with you guys these slides just because I have all the sources that you can click through but yeah so for publishing you just run Eragon publish major so like I said there's semantic versioning versioning
so you can either specify you know I'm trying to bump from X to Y or I can say it's a major publish it's a minor publish as a patch and when you act like commands it uses that same semantic versioning aragón run so this is how you essentially spin up or you know you're both your contract code and your front-end into a bundle and then Aragon dev chain is the local chain that uses ganache but already it has some contracts pre deployed so it has the
core Aragon apps already deployed and it has the registry deployed for you so when your Devon you are technically just publishing to your dev chain and then Aragon is is a wrapped version of ipfs I think it's go ipfs version six is the one that we use as a standard and both those commands need to be run prior to running you know Aragon publish or Aragon run to get you know your IP FS node going and to get ganache going you can run your own I think I'll talk about that later but cool so when we go through the template
you'll see this wrapped JSON yeah this is where your configuration rules live so this is where you in this JSON file you put okay here are all the roles inside of my application and here are the environments for my application so you can even specify different registries for whether or not you're deploying to rink B or D kovin or on your local train and yeah all that goes in there you can use your own ipfs node and but then you have to redeploy all those contracts and propagate all those C IDs to ipfs so it's recommended that you just use the IP FS that's bundled inside of the CLI but you know you can
set up you know your own web socket with your own node if you want to cool this case so back to your point about how do you know what versions there are this is how you can do it so basically you could go Aragon APM packages it defaults to Aragon pamby --the and it'll show you all the different packages and the latest versions that exist for each of those packages so it'll say you know voting 3.0 and and we can we can go through that and then kind of in the slide before this how you bump a major version it's very straightforward cool so now commands if you want to just spin
up a new Aragon Dao with the default template I won't go too much into templates but essentially templates are is a smart contract that configures the permissions and installs apps into your debt Aragon down when you want to launch a new one so right now if you do Aragon down new it uses this base template which basically gives you access to the voting app the token manager I think maybe finance app is now part of the base I'm not too sure and the vault which is essentially a multi-sig and so those kind of come out out of the box
for you your app is pre-installed with those things and has all the correct permissions configured for you and yeah can you just repeat the question I'm sorry yeah yeah those create those crate transactions yes so Aragon down you would create a transaction that no it does it would it does execute yeah yeah so there yeah there are
this would execute not on like main my not yet you would need to actually have an app you would have to configure the COI with the environment and make sure you have an address with some eath on it but for this since it wraps ganache you know you get ten contracts sorry ten addresses with some eath pre-loaded in there and it'll sign all these transactions and do all that work and that's why I really want I should have shared this with you guys because if you go here you know it shows you all the different parameters if you want to change your environment or pass in yeah all this other stuff and like I said we won't use the ACL commands but so you so you can debug your apps you can actually grant and revoke permissions directly
from the command line interface so let's say you're working on your template and something's not working and it's hitting a revert or something like that you can just yeah supply you basically supply the a proxy and the registry and the name of the role and in the name of the app and you're able to grant revoke permissions given the fact that that first address or as that default address set is has the app manager role if you've revoked that role from the root then you know obviously you can't run this or it won't let you cool
so yes it can work once it's deployed but you do need that root role to configure the Dow and yeah so that's a very common pattern like you'll that's why you have the Dow template because what the Dow template will do is it'll can it'll create that root contract configure all the different roles and then at the end it will revoke itself from having that permission so then it's kind of like locked in now cool awesome I'm gonna briefly touch on this but for the rest I'm just gonna do when we go more in depth I'm just gonna go through the demo but the Eragon API is just an abstraction layer on top of
web 3j s so you don't need to bring that in you can just use Aragon API to make your calls to a theorem you have this is where you get access to your application state so your the Aragon API actually caches your state and of your contract for you if you document your code correctly you have access to rad spec which is a way for do human readable transactions this is really nice because you can have like a nice prompt before something happens you know just so it's not just a bunch of form fields for some you know puts in their data and then they don't know what's going on rats
back essentially gives you the human readable version of what that transaction is going to do and then the background script is essentially how you're going to consume events from the Aragon API wrapper and reduce your state for your UI so very common concept and reacts you know sometimes you have pure components sometimes you have stateful components sometimes that state is like nested very deep into your Dom tree the background script allows you to you know write a reducer and and manipulate that state and ensure that when that new state update happens that you know
there's no side effects because the stay is immutable right cool and so yeah at a high level you have this wrapper which will wrap your whole app in this Aragon API and it and then inside of your app you have access to an API object and an app state object through the hooks API with this function use Aragon API so now you have an RPC to send messages to your to your application from your contract and so if we were to back up actually a little bit
so we have this function set receiver and let's say when I deployed my down for my provider let's send my providers meta mask write that address your default address there has that set receiver rule now let's say I have a button somewhere and I want to call that function all I would write was API call the name of that function and just right here if we just end that right here what you're gonna get in return is an observable and so your you have to handle that it's you can either if you don't care about what happens you
just write to promise and it'll when the promise resolves you'll get the value the return value of that observable and otherwise you can actually inside to promise write do some error handling or return like or format the values or do whatever logic that needs to be done based on different types of return values that you may get from your function so yeah this is sort of at a very high level what API does and then API dot events sets sense of a subscription to all of the events inside your contract and that's gone that's
cool that's going to be used in the background script to reduce the state and this will make a lot more sense when we kind of step through all the files and yeah we take a look at everything and like I said before you know you don't have to use this react rapper there's a standard rapper tinned JavaScript I'm not gonna go over it here because I'm going to be using this template to kind of get everybody started but you know if you if you're not a react person you can have access to to this pipeline through JavaScript still cool and then yeah this is the last thing so I've talked about it briefly we have a design kit there you go that's how you install
it we have a main higher-order component that defines all the base styles and then can be accessed throughout your app um the only real interesting command here is this copy Aragon UI assets public so basically you you yeah you make a copy of of those components I think I believe they're minified and then you it goes inside your application directory for your distribution and yeah when when we when we run the template you'll see kind of in the package dot JSON like the order of the events for when these things get called and so great let's do some stuff with all right this is good for people you
guys see let me zoom in more awesome so yeah so to start yeah so first let's get everybody's environment set up here so first you're gonna have to run NPM I I'm not going to do this but you know aragon CLI make sure you add in dash G make sure that's installed globally you need to have and here I'm gonna actually
guide everyone to we're gonna do this together now so yeah we're gonna make sure that you have the CLI installed oh yeah once that's done we're gonna install ipfs and I can just like walk around with people here but if man if I wish there was an easier way to share this but if you go to hacked aragón org slash Doc's slash CLI - intro it's gonna walk you through how to install all like all the CLI commands but like I said I can walk you guys through that but cool so
all right I make all this so all this command is doing is it's saying we have a script here to build a boilerplate app this is the name of your boilerplate app so this will be where the folder where it lives and we're just gonna use the react template just so that we don't have to really go through all of the examples that are on the site it has it all for you but this this will create a project for you so yeah while this does its thing does anyone have any questions very fun stuff I know
I also have one ready so yeah I'm not actually going to do this but yeah so go to hack died or gone downward about here and I'll show you yeah this one so yeah your app name and then you're gonna do react here so cool so before we go into the contracts
I just want to actually let's do the contract first and then let's talk about the Arab JSON file so first here's the template that I was mentioning earlier so this is essentially how you're going to deploy your aragón application so when everything gets installed maybe maybe I should um interesting okay weird sorry guys it's a little big but
okay so yeah so here we're gonna get ENS which is how we're gonna resolve our names inside their registry the Dow Factory which is actually what you know makes the Aragon down and as you can see in this constructor what we're doing is we're saying okay if we don't have a factory or we don't have an address already that that knows what kind of kit we want to deploy get the kit from APM and so as you can see here you can get a factory from that from that bear kit
which has I think like I said voting token manager the bolt and then this is this is essentially this is essentially how you configure it so like I said before oh I said as you see right I'm going to say negative one but if you want to have a contract use set up a role for a contract so that any contract address that's it you set this to negative one but in here and I really wish this doesn't look so bad okay so yeah this is sort of what we're doing here we're where do I start here alright so as you
can see at the top here we actually bring in the Eragon apps so this is how you essentially make like get the version like the latest version of of the contract code itself so you bring you bring these in right and then here what you're doing is you're actually using APM to get that contract data and as you can see here you're creating a new app instance with the voting ID with the latest version of the contract and so you know this comes out of the box of voting and token manager we have a convention to use safe ERC and then rap a safe our ERC 20 token with this thing
called a mini-me token these are the only ERC 20 tokens that aragón dow is allowed to have be managed by the token manager so yeah that's what this is this is code essentially is creating us an app token the parameters for this can specify how much get minted it's not that important I'm just showing you that you're configuring all these different apps and then down here when the app is initialized you can actually initialize your other app so you know we're gonna supply the token for the voting address we're gonna supply what the quorum rules are and here you'll see were granting permission so the first the first thing
right is we're gonna give the route token permission to mint tokens because the token manager is when when you supply a mini-me token to the token manager you can no longer use the ERC 20 mint method you have to use the token manager's mint role and yeah now we're gonna we're gonna set up all our permissions so we're basically saying okay for our voting app and for the voting creates voting role there are many other roles that in the documentation we're gonna say any entity so anyone can create a vote if we look at our the app that the very silly
app that this comes with which is a counter very exciting stuff so yeah this is a very small Eragon app right we're just we have a counter one one method increment say at one method that can read sit right we have two rules here right and look you can make it so that maybe only the voting app is allowed to increment but any entity and any condemned decrement a counter and so you're actually kind of going through all your different rules that you set up in your contract and setting who has permission to do what and this is the this is the base of how you're going to
deploy your Dao through a template yeah so an app is a dhow like every app is it out including the PM aragón PM is a dao but maybe i didn't miss a name not maybe not getting yeah so organization yeah so this is how you would yeah yeah exactly exactly but every day is an app so like you can have an app that loads other
apps and then that could be one out this is it does it make sense so I could have an app with like a bunch of different Aragon apps pre-installed and then that whole app is an app yeah so a little it's a little tricky but yeah back to your point when you were like hey do we need this app manager role as you can see you're revoking that permission from this contract like when it's done configuring cool so this is the template now let's look at the Eragon app JSON file so here you have to define all your roles we
[Music] it's just so just mini-me tokens the reason for that has to do with configuring the permissions of minting and when it got win and when you use the token manager to mint these tokens but I don't think there's a necessarily like hard technical challenge that's preventing support from regular TRC 20 it's just to allow the roles to be exposed in the way that the other Aragon
apps are expose so yeah we can increment the counter and as you can see a lot of this is like very redundant I know that you have to type you know oh here here are the prims of my permissions in my app here the name of my permissions in the in the file but this manifests essentially is what gets published to Eragon p.m. so this is how other apps know how to talk to your app and so yeah here you can set up your different environments and yeah it shows you if you want to use a different WebSocket your different networks and then yeah it you supply the path of but where your
app is right and in this bundle real real exciting stuff I know I know it's redundant but like I said this is this is what gets published and this is how what other apps know and this and this is also how you configure your own app for particular environments and studying the registries and lastly not too exciting but every app has a manifest.json file this is really common and a lot of web apps this is essentially for like how Google you know other search engines it makes it easier to crawl your app and to get that data you know for for search cool yeah so that's a really good question so
there is no checks other than kind of the hard check of when you want to publish to the main package manager repository so the the registry that exists on the dev chain it doesn't check at all you can publish to that freely that's that's that's yours to play with but if you wanted to like go live or publish your contract to rink B there's actually a process which is in the docks where you can reach out to the team and they kind of it's not really an audit but you know they will approve or not approve your ability to publish to the main packages and then it will show up in the list of apps that you can install when you spin up the app so we're gonna
do that right now actually and you'll see what I mean so cool let's oh yeah let's look at the package.json file sorry if this is getting messy okay awesome also today it does everybody that's trying to follow along from the command and everything go well doesn't it's going it's getting it's good okay is everybody good okay cool all right so like I said first thing we need to do is this and we also i know i
don't use tea mugs I know so yeah yeah so first in one window I have Aragon def chain any other window I got Aragon ipfs running so we're gonna wait for these things to start up oh sorry oh yeah sorry this is really small yeah so Aragon deaf chain to start your local ganache environment and Aragon ipfs to start your own ipfs environment yeah so if you yes you have your yeah you can
run your own ipfs instance but you have to then propagate all the content you'd have to propagate all the content that exists in the wrapped ipfs instance that Aragon comes with so you can run your own instance you can run your own version ipfs but you have to then configure and like redeploy all that data for all those apps that are on the registry you have to propagate I believe I believe so it's best to run and then I think I have it here but if you run you know Aragon IP after the CLI installs you can run Aragon ipfs install and then
Aragon deaf chain and soul or I think that actually the double chain comes out of the box for you yeah this is going very fast I know so in the meantime I'm going to struggle on top is anyone running into issues installing the CLI they won't need help no yeah yeah the templates themselves are like a lot and I can actually show you guys and I can send if
anyone's interested the repo of a bunch of different doubt templates so like we only talked about the bear template because that's what we're using in the in the react boilerplate that's given but there are other templates for like if you want to make a democracy or if you want to set up a multi-sig wallet like there yeah they yeah I can I can send those those way to anyone that wants to see the code on github so cool this finally happened so as you can see you're given an address root right that can deploy doubts so this address is what has that app manager role like out of the box and it shows you where ENS is deployed so
this is where your registry is and yeah this is the WebSocket right with our with our chain going and an IP FS cool we're good so yeah the Damon's not running all right awesome yeah sure surfer mainit listen yeah it's already in use so here I got you or if you want I mean the hijack unless - I what 80 80 right yeah you're gonna have
to kill these yeah yeah yeah I think it defaults to 80 84 yeah it's 80 84 ipfs and then it's a 545 for the deaf chain those two ports have to be open so kill those processes awesome so I'm gonna run the command you know IPM and hammer and start but like let's unpack that command so it runs star type EFS okay we go here bang what's the start ipfs okay we're going
to after the project is compiled we're going to run the distribution file and then we're going to start an HTTP server and then serve our distribution so this is all the things that the CLI handles for you this is this is how you actually run the template so as you can see here we're specifying the template that we're using and where this is this is a default environment variable but this is the ENS address of of where that bear kit exists and it defaults to open dot Aragon p.m. value so yeah let's let's you know
okay so yeah as you can see it checks to make sure that I think this is started okay it's adding local files so the first thing it's going to do is compile all the contracts I know very fast yeah yeah and yeah it's gonna apply a
virgin bump event if it needs to for the first time it bumps a major version right subsequent times it's just going to track to see if it's not zero and then use that version yeah if you wanted to meet potatoes they use Parcells to do the front-end wrapping yeah we do we don't yeah I have no real strong opinions I like par so it's really easy to use some people like what pack I don't know if there's any plans to support web pack for the platform but yeah this is what we use to build our front ends cool so as you can see it's venturing the
template right yeah it really fast but as you could see it was fetching the template using that that ens domain and now it's going to run that template and it's configure our roles it's not working for you are you okay this is the best part
yeah it does anyone have any questions about Aragon criticisms yeah yeah yeah yeah yeah we are good to go so as you can see when you know this runs it tells us all the good stuff so it tells us
where our dad was deployed and this is cool because let's say after I ran this template and stuff I wanted use the CLI to install new apps I could just now use this address because it's it's deployed to our depth chain and beautiful we're here so okay I can't perform this action obviously here let's yeah so this is a little bit of a challenge so here you can use meta masks as your provider but it suggested that you use frame it's a
little bit easier but yeah exactly and I don't have it like this one doesn't have any yeah this is the book my favorite part eat oh yeah I use this one then yeah so then I can do this
I sign out of this account and pour tea seed for is okay okay cool
okay ha all right boom so this is where the rat spec stuff I was talking about comes in so if we I mean this I don't know why I did this but sorry yeah so if I wanted to see yeah this is what's pretty cool about rats Beck like
I'm going to increment the counter by step and use this notation you set your parameter right step and it'll know now so like if you look at here because that's you know oh yeah and then we didn't we didn't actually look at this but and over here so look we brought in we brought in the app state and the API right using this use Aragon API and we wrapped our app in that high-level wrapper that I was talking about and we pass in our parameter right here so
that's how it knows what's happening beautiful so we create this transaction ah you use the one that's generated by the dev train yet import that seed phrase innovative ask and then you can just each each there's like ten addresses were like a hundred ethan it so boom okay we get a little notification which is pretty nice it's confirmed it updates and that's because as you can see we have our
reducer over here right it says okay if our state is null which it will be in the beginning right this will this is the base object that we're going to use the representor state and then in here scripts we have the juicy stuff over here so this is where we would reduce our state so we have a store right well first we bring in the API right and then
over here we're able to based on the events that we defined which get emitted right these are the same increment increment you can update the count and yeah this one if those are familiar with rxjs of is just saying when we get that object of all our states you know we're only looking for the one event over here so we're always going to initialize this event at the start of the store so always do this right but as you can see we can have when we get this event this
is what we want to do to our app we want to call value so we want to look at so after it so think of it this way so what this is saying is you increment the role right so it goes from zero to one but you don't know like you don't actually want to update your app state right like based on the action you we would rather wait for the contract to update and then display that action so that's essentially what's happening here so value is a public method right and so all you need to do is call API that call value right to promise we don't care about the result of this we just mean we know that it's going to return right and
in and yeah you update the count so it's doing this every single time do it on initialization right do when we increment do you remember when we decrement and and then in the app itself right the API actually knows what this functions name and so look it can just you can actually just call this function so everything is really it's nice because the flow of everything of all your events and what you write in your contract is like semantically linked to what you're gonna write in your front end but yeah it might be a little bit tedious let's just say to always update
to make sure that you update everything so to make sure that you update the contract the template the arab json and make sure all that is published so every single time you you make an update you should republish especially if your template is pulling down your contract if you if you create a template where you're gonna app after the initial publish you're gonna pull down from the APM so you have to make sure to do that each time cool did everyone get their stuff working are we good so cool so I guess let's play with this
a little bit and do something not basic or maybe also basic but a little bit more fun so I titled this talk how to build adapted those and the best way I could describe it is it's not anything you know fancy in the sense of some I'm going to show you some like super cool trick that's unique to the air like that I know I have found out after all the stuffing on the platform like I'm just gonna kind of talk about the philosophy for designing an app and how to not kind
of work yourself into a whole because sometimes when you see this like your immediate your immediate impression might be okay I have these different roles and I'm gonna create a role for every action that my app can do and that is a really good approach to start but you know you if you want to have if you want to have like flexibility it can be a little bit difficult later because unless you're using a forwarder so unless you're actually forwarding like your folk you're you're not actually calling those functions within the contract but you're you're running an
easy script to then call those functions setting up the permission to who's allowed to run the evm script can get really hairy really fast because yeah if you know you're gonna have to write a different EVM strip for every different function write it so you're you you're not really gonna be reusing roles you're gonna be yeah you're gonna be yeah setting up new roles every time so it's a little bit hairy so what I suggest is try to think of your app as or try to think of every app as adding something that none of the previous apps do so if you find yourself
writing a function or a method in one of your apps that just calls another function in another app you're not thinking about it correctly you should instead try to think about it what is the unique thing that this can do that this that what's the unique piece of work that this app is trying to accomplish and everything else I can every every other type of work I'm just gonna use the forwarder API on my client so in the client you'll actually be using web 3 to encode the function calls with the parameters and foot and then and then
forwarding those actions through the you guys so instead of trying to do it all inside of the contract take some of that logic put it into your client and bring in those other contracts and observe those other contract events make your calls there don't don't make all your calls inside of your contract these contracts should do very discrete things for a very discrete state um they shouldn't those states should not should generally not depend on the states of other apps in the ecosystem so yeah
let's say like is there anything let's try to build something cool so I don't know what do you is there anything that you guys want to see happen is there anything no I need ideas beautiful beautiful yes yeah it's more bad no I'm trying to think of oh you know what I actually show you guys one more thing before I guess I can walk around and help people or if people want
to like try their own ideas and it's not working like we can try to figure out like why it's not working but I just want to show you guys some of the yeah the medium potatoes of this so you were asking about that registry that that that's public right on may net or on rank P so when it's approved to be published it shows up in this app center so you can actually so right now survey app is ready agent is working I don't think these are published yeah I don't
think any of planning suite payrolls ready to go Pando I know and then in liquid democracy it's not ready to go but once those apps are published you can browse them here and part of that manifest.json that I was talking about like this is where it's getting all this information so when you when you propagate that content like this is of content that you're propagating and if we were to install an app here yeah this is this is where it shows up and if you need to get clear your cache it's in the settings it'll show you all the addresses of the different apps installed right this is good for debugging but let's try to do oh yeah
let's try to do this we're going to yeah so yeah so let's do vole so yeah now that you have yeah so now that now this is run you should be able to install an app
so you can do Aragon Dao install and then BOOM oops [Music] I'm sorry so yeah essentially what I'm
doing here is okay we deployed this day at this address and what I want to do now is install an existing application that's on the market place to that dow so instead of setting up a template and inside that template getting getting that contract I just want to use the CLI so I'm just demonstrating that yeah if you don't want to use the template in version like one because like let's say you're installing a bunch of apps you know the stack is gonna get too deep right on the function calls and it's kind of an issue so I'm just showing that like once things are published to
the package manager you're able to leverage that to install applications to your Dow so you don't have to use that template contract every single time yeah so if you go to I think it's Eric they have a registry somewhere but I don't know where we're sir man yeah so let's another thing you can
run is this oh yeah oh yeah we're gonna get all the apps Oh a PM packages and then yeah yeah so now it's gonna gather all the repos inside the registry and it's going to yeah show us the version so this is where you would find out like okay well do I have access to you basically and then BOOM so here are the ones that uh
yeah here they're the ones that are launched and now I think this is taking so long yeah so I guess I can talk about some challenges too about the platform so this is really awesome that you're able to do this I mean I think so I think it's really sick that you're there's like a package managed manager for four smart contracts but there is a size problem
so we are running into issues scaling as you can imagine these blobs will get very large as they stay linked together and that's a big reason why this takes a very long time one because you know not all the time does i PF s work but mainly because yeah the size of these blobs are getting bigger and bigger as each version gets bumped right and as they're linked right so this is good for right now but I know that the core team Aragon one is looking into solutions for scaling the package manager so that you
know anyone kind of like NPM where you can just publish your package you know the part of reason why we're not allowing that ability form a net is because otherwise it would just get clogged and then yeah it'll never work oh uh sorry yeah so there are so yeah this is where they are going to publish all of their official release apps
yeah in the okay in in the men of like in that manifest you can specify a git repo so you could find you would be able to expose it there is your question if someone publishes something on their own chain or is your question if they publish it to like maenette or rank beer or something like that yeah okay so so each instance over the registries are unique right so your local instance of the registry right well right now mirror
these core apps because that's what's coming out of the box at the CLI in the installation but it yeah you're right it won't have for example you know your app if you decide to publish it it wouldn't it wouldn't come with that you need to you would have to reassures to your local chain yeah yeah yeah unfortunately there's no easy way yet to see the gay repos I mean there
there's like the the repository like the repo that's that has the version of the code but it doesn't yeah there's no way to like expose that right just like see the room eh so that's why I was gonna just point you in this direction here are the main apps in these apps these are what's currently in the registry and then I mean I don't actually think they have a readme file here but this is where you would go if you wanted to audit yeah 100% yeah ie so Aragon black is another team in the ecosystem and they are working on a
package like a full package manager site where you can go exactly we were saying see the git repository see the latest version see who are the authors you know yes I think that's like super needed tool because right now it's very yeah obfuscated away like you kind of have to know you know this is where to look but I do agree yeah we need to find a better way to expose like the repositories themselves like wherever they're wherever they're published so people can can track their development and track the version updates when they happen so they don't always have to run you know Eragon a PM version this you know etho main you know cool so we have 30 minutes left I'm yeah I my plan was to just walk
around and help people with insulation stuff I yeah I don't really have much left and other than to like yeah take take more questions and yeah yeah so there are so yeah there's a couple ways here so the first way that I would suggest is don't make that call inside of the contract so instead of
doing something like like this where okay you know whatever I don't think this gonna compile because I don't know if I have this or no no it's gonna be something like this right and I'm so so one way right is to do something like this right where okay what we're gonna do here is we're gonna say okay when we write and then we're gonna say
right I don't want to say and then let's say okay let's say let's say let's just say we did it in increment then we can say first I actually don't want to do that I want to say yeah I know that's fine I'm gonna say over here right it's a step right I just double-check this API is what I
think it is and you know it's not really gonna work because we also needed to go in here and we're gonna have to we have to give the app the permission to mint tokens so we're gonna do is we're gonna say right and then the manager is yeah this no
yeah it's this so what this function okay so to go into this function what it's saying is this is who you grant this is this is the address of the contract you want to grant you want to grant the permission to you or sorry that creates the permission actually not not grant creates the permission this is this is the contract with the token with the app manager that has the role you specify the role here and then no I'm sorry this is this is the app you want to target with roles this is a specific
role and then this is the app manager the last one is the app manager here we may not want to do this maybe instead what we do is we do this so instead of creating a promote a new permission you would just do this you just grant permission here the difference is when you create a permission yes it's it's like creating the role for that particular app manager for that app so we've already did that once here but and this in this contract already is the app
is the app manager right right like this hump template contract is the app manager for for our counter app and so I can technically just grant my app permission but I think it's actually redundant because eat once it creates this role like I actually don't think you need this actually not I think about this you don't you don't need this at all actually this should be fine this should work because you've created you since the app oh no I take it back you do need it never mind this yeah so the template app is creating the permission but the app itself needs to have permission to men
so that's the that's the difference so because at the end here right we're going to revoke the template from being able to create permissions but it will still and from being the app manager but it will still be able to mint token so I could technically still mint tokens from this contract so yeah that's what that's what's going on right here right so you might be thinking oh this should work and I think it I think it does work it might work but I don't think it's going to work and
Aragon polish minor so the reason why I don't think it's going to work is because tech like technically speaking that app is trying to perform an action in another app and their sandbox right so I've grant I've granted permission for it to perform this action but the the yeah I think the app manager itself is going to prevent me from making that call that's why I was suggesting before
the best way to mint a token in that case would be to say to give a particular provider so give a particular address so like let's say okay the app is deployed and then you say okay this address can mint a token so the address it's in meta mask and then from there make a do an ABI encode pact call to that contract because now that like the role the the access role lists aren't sure that is not there's not a role in the counter app that's the same as the that's that's pointing to the role in the in the token manager because they're
there they have two separate lists right so now you're just yeah so that's because technically right the person that has because thing about it this way the person that has the increment role then is not the same role as the minting role and in that function that's what that's what that's implying so it's going to it's going to yell at me but yeah that's that was part of the top the idea of the talk was to kind of just push to get yeah the information out there that ideally speaking you should be able to yeah you should try to be able to call these contracts instead of these roles
completely isolated and try not to try out to be calling other methods and other apps when you ever role define because it doesn't make much sense right like it so anyway let me let's just see if it runs or not runs well let's see if let's see the tests here oh yeah maybe it maybe I can talk about this a little bit because it's actually pretty cool so the testing framework is just like ganache and yeah this is really encouraged to write tests for your apps
because I'm I think we're gonna we're gonna see right now it fails so but yeah just to step through this yeah so just unfold it like you in the test you actually go through all the
steps that your template does so another kind of rough point just because you wrote your template doesn't mean that it's synced up with your test so everything that you did in your template to configure your app you have to do in your tests so this is because you know it's like creating a new instance of your dau so the template is actually for deployment for deployment yeah I'm sorry exactly it's like a fact it's like like I said it's like a factory but then it also allows you to configure your permissions in a smart contract and
that's and that's what's kind of annoying here right is that in a test like we have to do all that work again and but if you kind of if we kind of just kind of step through it you know and we look at we look at the template itself they're doing basically the same thing like you know we are getting these apps you know from from the p.m. right and we're initializing we're initializing them and then we're setting up their permissions and that's exactly what's happening here new instance for new yeah yeah yeah yeah
yeah yeah yeah so that's what that's where it gets interesting right because you'd have to redeploy the whole Dow and that's what the app proxies for right because we have the proxy app for for our own app that points to these these other packages so you can't really do that button and then visit the Dow at the same address because you'd get a new address I'm saying when you up when you are I thought you meant when you
upgraded or oh okay I sorry I understand your question your question is I have an app installed I want to have a button like in that Explorer apps thing that hits install for each of those apps okay yeah yeah yeah so you would have to you would have to bump the version right when you installed that new app so there would just be some work with there probably just have to be some work to to upgrade that version and then there has to be a way to point the current address that it's currently deployed to that new version and I'm not too sure if there's a succinct way to do that but I could be
wrong I mean if that's something that you definitely want to answer to I can I can ask some of the core does yeah yeah sure ah yes doing that I love it so let's see oh nice you got to see more over here ah
you got to propagate the content yeah it's it's as you can see there's like a lot of redundant steps you gotta you have to do but um you know it's pretty it's still pretty cool yeah we got 15 minutes left guys and I don't I don't have much for you anything concerns oh yeah that's where we were in the middle of doing something
Oh didn't do this yeah sorry yeah so right now yeah the limiting factor is the CLI and yeah it has to be zero point four point two four it
doesn't like now all of the OS contracts support version 5 or 0.5 yeah I'm sorry um can we see okay this is going there Damon's going yeah something's
something's let's see we got here okay maybe try ok maybe try maybe try killing and then restarting this but did it give you a PID it doesn't it doesn't print you the cid huh oh no no it has it here alright let's see if it's here here see if see if this loads for you know yeah
so has a code of artifact oh so actually back to your question about where the ABI is the ABI does actually get put into the so yeah this is weird okay so we know it's there though and what do you change just so I can take a look beautiful this is a new version in interface but I
should see if you well let's see if we can do it major about see if it propagates oh yeah also with this back to that example so one one the issue was I didn't do this you know like I sorry I changed the I changed the initialization right and I need to pass it in now this
is another fun thing so when even when you do this though when you use Eragon run you still need to supply the address as part of the initialized initialization as like annotation parameter so often with this there will be a deploy script so this is not in the template that I just showed you because in this template or in this react boilerplate there was no need for it but a common thing to do would be to create a deploy script that does exactly what
kind of like I was showing you in ganache it does the same thing and you would pipe the output of that into Eragon run right so you you would pipe that array of addresses laughter you after you deploy them you get the address and then in Eragon run you do - - I think app and it args or something and then pipe the output of your display script with those addresses and because it calls initialize when Eragon run is executed but we have we have an issue here [Music] oh yeah
syntax error but that's weird I'd always change my version over here does anyone know actually this they know
how to change silks e-version and yeah yeah cuz then they have to read Dalit or whatever okay yeah so there is the forum so we have so there one there's the chat so Eragon chat over here there's devon devil people are very very responsive the team is super responsive that will answer everything from like the contracts themselves if you're having
issues to to you know if you're having environment issues super super helpful place Devon devil are yeah and then we have the forum so formed I Aragon doe org I don't see dev questions posted here often this seems like more of a good community place but I'm sure if you like posted a question here people would respond for sure yeah let's see what your I do what's going on which strange is like this link is
working right but then all right publishes in the transaction okay let's but does this work for you now sorry I just oh it is already started yeah so
we'll just close this actually because it would probably need you probably need to release this because it's gonna recompile the contract and then serve a new distribution with your code it that might have been the problem because then it was the way you propagate on ipfs was different than what the app was trying to run cool all right guys I don't have much for you anything it's a very good question I am NOT looped into like what the development
roadmap is for that but I do know that it can be used and it's like in a state where it can be used I know the ABI b2 encoder is not it's fully supported I don't think yeah I