CosmWasm Governance Voting Event: Simulate UniFi DAO funding
By: Orkun Kulce
Tags: Dao, Cosmos Network, Smart Contracts, Governance, Cosmwasm

Photo by David Clode on Unsplash

Introduction

These days, the most basic way of accounting for a DAO is collecting tokens under a multisig/escrow account and sending them out with collection participant signatures. This procedure usually works but lacks functionality.

Let’s say we want to grow the DAO multisig maintainers from 5 to 10, all the tokens need to be moved to the new multisig account for each owner change. Also, a pre-defined proportion of owner signatures must be collected for every action. As you can see maintaining a multisig account is not scalable.

cw1-subkeys smart contract is here to help.

cw1-subkeys contract is a basic proxy contract with permission and allowance functionality. Basically DAO members collect tokens in a smart contract, contract admins can give permissions to subkeys to spend tokens up to an allowance limit. This is the workflow for non-permissioned CosmWasm networks. Let’s see how it will work for governed chains on a live event.

Event

Voting Start: Thursday 24 September 2020 Contract Instantiation: 27–30 September 2020

First, the code store proposal must go through governance.

As Confio, we will take care of submitting the proposal. The only thing you need to do is go to the ballot boxes and vote YES.

Sample wasm code upload proposal:



--source “

—-builder “cosmwasm/workspace-optimizer:0.10.3” \

—-title “Enable cw1-subkeys functionality” \

—-description “DAO and DSOs need this!” \

—-instantiate-everybody “true” \

—-run-as $(gaiaflex keys show -a account)

—-deposit “10000umuon”

--from account gaiaflex tx gov submit-proposal wasm-store cw1-subkeys.wasm \--source “ https://github.com/CosmWasm/cosmwasm-plus " \—-builder “cosmwasm/workspace-optimizer:0.10.3” \—-title “Enable cw1-subkeys functionality” \—-description “DAO and DSOs need this!” \—-instantiate-everybody “true” \—-run-as $(gaiaflex keys show -a account)—-deposit “10000umuon”--from account

And the proposal is ready for voting.

Notice the line instantiate-everybody “true" ?

This line indicates that after upload, anybody can instantiate a smart contract for themselves. run-as is the code creator.

Vote yes:

gaiaflex tx gov vote [proposal-id] yes --from account

After the proposal passes the code will be deployed. Now you can initiate a subkey for the DAO.

Let’s simulate UniFi DAO UP-101 proposal funding case:

1. 5 admins instantiate the contract

2. Community collects token at contract address

3. Admins give allowances to the developers

4. Developers use the funds

Sounds cool right!

INIT=’{“admins”: [“cosmos12at9uplen85jt2vrfc5fs36s9ed4ahgduclk5a”,”cosmos1v7mjgfyxvlqt7tzj2j9fwee82fh6ra0jvhrxyp”,”cosmos18rkzfn65485wq68p3ylv4afhgguq904djepfkk”,”cosmos1xxkueklal9vejv9unqu80w9vptyepfa95pd53u”], “mutable”: true}’ gaiaflex tx wasm instantiate [code_id] “$INIT” \

--label “UP-101 Funding Account”

—-amount 2000000uatom

--from account

Great! After executing this, CLI will give you the contract address, community can collect the funds in this address, then admins can add developer addresses as subkeys and allocate tokens between them.

The downside of using cw1-subkeys for this case:

Any admin can

- Edit the allowances

- Mess up with permissions

- Worst: Drain the account

To secure this attack, after all the steps(funding, subkey-allowance setup) are done, an admin can remove all the admins from the configuration. Now only subkeys can interact with the contract.

But come on, why do hacky moves when you can just develop a smart contract with governance capabilities?

The CW3 smart contract family is being developed for providing the best governance and DAO tooling.

As you can see smart contracts bring a lot of value to decentralized organizations and funding schemes.

If this excites you, why not join our channels?