DAPPCON 2024: Smart Account Role-Play - Jan Felix Schwarz
DappCon 2024 · May 2024 · 15:30
Explores smart Account Role-Play.
Speakers
Topics
From DappCon 2024, hosted by Dappcon Berlin.
Transcript
welcome everyone I'm Yan from nosis Guild nosis Guild is a small team incubated at nosis but now working independently and yeah our C our interest and expertise is centered around research design implementation of onchain organizations um governance Access Control Systems and Trust minimized applications we are probably best known as stewards of the zodiac open standard for modular da tools and um as of today more than 150 unchain entities utilize our modules safeguarding more than 2 and a half billion
assets working in the space of dows and looking at onchain organizations of today led us to a somewhat dissatisfying conclusion most Dows operate trustfully or inefficiently it's inefficient to have a top level vote on every single action that's why most Dows delegate certain responsibilities to you a smaller group of people and this is generally a good thing as it's much more efficient for decision- making however also means that a small group of people is you know has broad control over the D and it's this dilemma that we see a lot of organizations struggle with um in
many cases they even get the worst of both sides like they overwhelm token holder attention through some form of decentralization C while in the end it's actually a bunch of people on the multis who are in control so for today I thought um yeah let's learn from and look at one of the few Dows that actually are successful that do it right ens the eum naming service it's governed in a truly decentralized fashion while still operating effectively and yeah to to understand how they do it I thought i' briefly walk you through the history the NS project was started in 2017 by Nick and Alex from the ethereum foundation
but the ens da really only came to life in 2021 with an air drop to over 100,000 eligible addresses and yeah everyone claiming that airdrop chooses a delegate and the delegate is a Community member you trust to represent your opinion and governance then governance happens through two forms of proposals there are proposals for social consensus on Snapshot and anyone with a total delegated voting power of 10K ens is allowed to post them so yeah this mechanism mainly serves to weed out spammers but then to actually execute stuff um you need to submit an executable proposal and the bar for that
is higher 100K ens with a quorum of 1 million um since it would be asking a bit too much of from delegates if they have to pay attention to every single action the Dow takes the ens Dow shortly after the airdrop already introduced working groups and working groups allow decisions to be made and funds to be distributed um without being passed by the da through an executable or um yeah social proposal each working group has three stewards and these stewards are elected for a six month term and then the working group can request funding from the da and yeah spend this spend
these funds at their own discretion in order to stay long-term sustainable even in the face of a long bear Market with low name registration income the ens Dow in March last year formed the ens endowment and the idea here is to set aside a substantial amount of the Dow treasury to generate yield from defi Investments and these Investments are actively managed in order to reduce risks this requires control over a much broader share of the Dow treasury compared to what a working group would usually request and this brings us back to the conundrum mentioned earlier so we need a small group of fund managers that
are in control and able to move quickly but in order to like react to Market or risk events but if we have this group they can of course also do other things so do we really want to trust such a small group of people with such a major part of the da treasury um the answer to this conundrum lies in the Zodiac roll modifier our roll mod is an Unchained permission module for smart accounts it allows onchain entities to extend secure transaction permissions to any address through customizable roles allowing member addresses to act on behalf of the account so why do we call it a modifier
it's a it's a module you can enable on your account but why do we call it a modifier in our zodiac design system we have three kinds of building blocks at the bottom we have the smart account so the thing that holds all the assets and that you actually want to control and on top of that you can enable modules other smart contracts enhancing the account functionality and then there's this special class of modules we call modifier and um these modules are special in that they expose the Avatar interface again meaning you can enable other modules and stack other modules on top of them so looking um at the ens endowment
setup they basically spun up a fresh save to hold all the assets ear marked for Investments and this save is fully owned by the da meaning it can only be controlled through executable proposals but then they equip the safe with the roll modifier and on top of the rol modifier we can enable other accounts to act as role members so the treasury management team they use their own safe to interact with the different defi protocols on their d today operations and this safe gets enabled and a role called manager is assigned to it a new role in the rol mod generally starts with no access whatsoever so as the next step we need to define the permissions for the
role role permissions can be as broad as allowing all calls to a given Target address or you can scope a Target to allow role members to only call to selected functions of their contract and sometimes might even want to enforce certain restrictions on how to call a function like the allow parameter values that a function may be called with and for that the Ros mod brings a powerful system of conditions so conditions um yeah allow you to basically Define the acceptable field values and call data and for that um you have a range of expressions like logical Expressions allow you to Define um
combinations like to enforce certain combinations of parameter values or um to allow multiple different variants of calling to a function um and we even have complex Expressions allowing you to drill down to nested tupal fields or to enforce restrictions over elements of an array and finally conditions also allow you to tie in allowances and allowances are a mechanism to enforce rates and limits so each allowance is centrally defined on the rolls mod and Carries these fields of information refill is the amount by which the um allowance is topped up for
each period until it reaches the max refill threshold and the period just defines the duration of that refilling interval the balance field tracks the current allowance balance so it is increased for each period and decreases with usage once defined you can consume allowances through conditions and for this we have three different condition Expressions um using a within allowance expression you can apply an allowance on a parameter field so this works for un type parameters and as a role member makes a call through the role The observed value of that parameter will be checked
against the current allowance balance if it fits the call passes and the allowance balance will be reduced by The observed amount if not the call would be rejected and in a similar fashion you can also enforce allowances on the esa value sent with transactions or you can also restrict like the call Rays like how often a function may be called in each period so with this General overview of the Roll Mod's capability uh capabilities let's come back to the setup for the ens Dow um I thought I'd walk you through the process of actually setting up these permission based on an example of a fresh new role so the idea
here is to make the operations of the treasury managers more efficient by automating certain um repetitive tasks such as claiming rewards from liquidity positions and for this purpose we want to define a new harvesting role and assign this role to a bot and this bot could then on a daily basis automatically claim the accumulated rewards from different defi protocols to make them available for reinvestments and yeah compounding returns so how do we do this how do we configure this role a good starting point is our permission starter kit um project that you find in our GitHub and
with a click on this button you can copy this template into your own GitHub account to start your own permissions Repository once you clone this repository and open it in a local editor you can start working it and the first thing you do is yeah basically opening the included contracts file and in this file you can just paste all the contract addresses you want to allow row members to call so the NF Dow holds positions on Unis swap V3 so we include the positions nft contract and they also use compound so we add the comet Rewards contract which uh distributes rewards to lenders and
borrowers on compound and you can basically choose whatever structure you like for this file so this is really just meant to label and organize the contract to be able to refer to them in the next step when defining permissions so defining permissions happens in the roles permissions file and you can simply add a new entry to it by typing allow and you would see the editor automatically suggesting you the contract entries that we defined before so here we select the compound Comet rewards contract and it would then start suggesting the um functions of that contract so we can select that we want to allow the claim function effectively allowing role members to claim accumulated comp uh compound rewards
back into the endowment save already before we've added an entry for the Unis swap um collect function and if we look at the parameters of that function we can see that there's a re recipient field and we don't want the bot um to be able to claim rewards to any other address than the ens endowment save because if the bot's private Keys got leaked this would open the doors for anybody to steal accumulated rewards so what we can do here is set a condition on the recipient field so in this case we force it to be equal to the Avatar address so all calls with a different address would be rejected
so with these permissions in place the next step is applying them to the actual rose mod we deployed for the ens Dow and this happens by running a simple command um the command apply followed by the identifier of the role and the address of the Rose modifier um by running it this would open a browser window taking us right to the Zodiac rolls app inside the ens endowment save and this gives us an overview of the configuration updates that we are applying so basically provides a comparison view of the permissions we just defined in code comparing them to the conditions that are uh permissions that are currently configured on
chain and if we scroll down on this page we find an execute button or we can just simply copy the transaction payload and post it as an executable proposal on tally and once he this proposal passes and the da confirms these permissions we could launch our harvesting but and do even more more efficient treasury Management in the future just like ens we have a couple of other Dows using the rollot for trust minimized treasury management so we have nois Dow balancer cow protocol and this list is steadily growing but the rose mode is also useful for other use cases in fact every single transaction
you make with your nosis pay credit card goes through a roll mud it's a component that allows the C payment settlement service to withdraw monium Euros from your safe without having any other control over it and also the Ros mod allowance mechanism is used to enforce the card's daily spending limit so with that I hope I could give you a glimpse of the powers and possibilities enabled by the rosm it really is a foundational primitive for unchain permissions and we hope that it will inspire like new Access Control patterns for example instead of every protocol building their own flavor of in
of Delegation we could have apps propose role configuration to extend strictly scop permissions to some delegate address and in this Spirit we hope that rolls opens up the space for play and experimentation and for new ways of interacting with our decentralized systems yeah the best place to get started is rolls. no.org and yeah don't hesitate to reach out to us on our Discord we always happy to help and support you on the journey and I think we have maybe time for one question not sure um yeah we have time answer question for sure is there anyone in the audience that wants to ask
anything anyone okay I think not really all right thank you so much that was F for