Skip to content

Commit

Permalink
Walk through all README.md files and update or correct any incorrect …
Browse files Browse the repository at this point in the history
…spots
  • Loading branch information
TheDeeKay committed May 19, 2024
1 parent 5f253e2 commit f34a866
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 83 deletions.
26 changes: 0 additions & 26 deletions contracts/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/enterprise-facade-v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

This is the implementation of Enterprise facade for v1 DAOs (the DAO form launched in the original Enterprise release).

Operates on the old enterprise contract (v1, i.e. DAO v2 when contracts have been split up).
Operates on the old enterprise contract ('v1', or versions below 1.0.0).
2 changes: 1 addition & 1 deletion contracts/enterprise-facade-v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

This is the implementation of Enterprise facade for v2 DAOs (the DAO form launched with cross-chain functionality).

Operates on the new enterprise contract.
Operates on the new enterprise contract (versions 1.0.0 and later).
5 changes: 2 additions & 3 deletions contracts/enterprise-facade/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Enterprise facade

This contract retains the original Enterprise's query API and several execute messages that do not take into
account the sender.
This contract retains the original Enterprise's API.

It allows the frontend and indexers to retain the old API, even though the structure of Enterprise contracts has been
significantly revamped since the original.

This contract will simply take an Enterprise address, determine which version it is, and forward the calls to an
appropriate version of another facade contract.
appropriate version of the version-specific facade contract.
8 changes: 5 additions & 3 deletions contracts/enterprise-factory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

A proxy contract for creating Enterprise DAOs.

Mainly serves the purpose of having an on-chain centralized storage of all Enterprise DAO addresses, as well as storing several important pieces of global configuration, namely:
- all valid code IDs of Enterprise contracts stored on the chain, used for upgrading Enterprise DAOs;
- global DAO configurations, such as whitelisted treasury assets.
Main functions:

- instantiate all the components of a DAO in the proper order, and wire them up;
- on-chain centralized storage of all Enterprise DAO addresses;
- on-chain storage of global DAO configurations, such as whitelisted treasury assets.
6 changes: 5 additions & 1 deletion contracts/enterprise-governance-controller/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Enterprise governance controller

Enterprise governance controller is a contract that binds the logic of enterprise-governance contract together with
A contract that binds the logic of enterprise-governance contract together with
membership contracts, and executes proposals centrally, dispatching messages to other contracts as needed.

This contract has privileges over other contracts (it's set to their admin, usually) that allows it to control all their
settings and privileged behaviors.

The contract contains several big pieces of functionality:

- Proposal meta-data (proposal actions, which membership type it is associated with, etc.)
- General-members-type governance (creating proposals, voting on them, and executing them)
- Council-type governance, where a council of select members is defined to run specific types of proposals
6 changes: 3 additions & 3 deletions contracts/enterprise-governance/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Enterprise governance

A contract for managing Enterprise's proposals.
A contract for managing Enterprise's polls.
Essentially a proxy to the poll-engine library.

Mainly serves to:

- create and store essential proposal data (proposer, voting period, quorum, threshold)
- calculate appropriate proposal status when trying to execute or query it.


Does not validate voters or calculate their voting power.
Does not validate who can vote or calculate their voting power.
4 changes: 2 additions & 2 deletions contracts/enterprise-outposts/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Enterprise outposts

Enterprise outposts contract deals with treasuries deployed to other chains.
This contract deals with treasuries deployed to other chains.

It keeps a registry of proxies and treasuries for each of the chains where they're deployed, and handles the logic
of instantiating them.
of instantiating them and communicating with them.
7 changes: 5 additions & 2 deletions contracts/enterprise-versioning/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Enterprise versioning contract

A contract for managing Enterprise's versions.
Contains all the different contracts' code IDs for each of Enterprise's versions, so that we can migrate
DAOs easily to new versions and use matching code IDs for each of the contracts.

Serves as a global repository that maps Enterprise's versions to code IDs used for all DAO-specific contracts for that
Enterprise version.

Deploying a new Enterprise version is done essentially by adding a new version mapping here.
13 changes: 3 additions & 10 deletions contracts/enterprise/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
# Enterprise

Enterprise contract represents a single DAO and holds all its belonging assets (staked governance assets, proposal deposits, and treasury).
Enterprise contract is the central 'repository' holding all the other DAO contracts together (has all their addresses).
It also holds the DAO's metadata (name, logo, etc.).

The contract contains several big pieces of functionality:
- Membership management and queries
- General-members-type governance (creating proposals, voting on them, and executing them) and staking of governance assets
- Council-type governance, where a council of select members is defined to run specific types of proposals
- Treasury definition and queries

## Dependencies

The contract relies on reference [CW20](https://github.com/CosmWasm/cw-plus/tree/main/contracts/cw20-base) and [CW721](https://github.com/CosmWasm/cw-nfts/tree/main/contracts/cw721-base) implementations to create and run token and NFT DAOs, respectively.
Additionally, it is the on-chain admin for all the other contracts, so it performs migrations on them.
20 changes: 12 additions & 8 deletions contracts/funds-distributor/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# Funds distributor

A contract for distributing a DAO's funds to its stakers.
A contract for distributing a DAO's funds to its members.

Receives funds and updates indices on how many funds each user can claim.
Users can then query and claim their share of the distributed funds.

Relies on Enterprise contract to inform it of any changes in staking.


## How rewards are stored and calculated

The method for calculating a user's rewards for each individual asset is as follows:

1. A global index for the asset is tracked, denoting how many units of the asset have been rewarded per user weight since the beginning of time.
1. A global index for the asset is tracked, denoting how many units of the asset have been rewarded per user weight
since the beginning of time.
2. For each user and a given asset, we store their pending (unclaimed) rewards.
3. In addition to pending rewards, we store each user's reward index for the given asset. This index represents the last global index of the asset at which we calculated the user's pending rewards.

- Whenever we distribute new rewards for an asset, we simply increase its global index by (new amount distributed / total weight of eligible users).
- Whenever the user's weight changes, we calculate the rewards accrued since we last updated their rewards indices, and we add that to their pending rewards, setting their reward index to the global index.
- Whenever a user claims their rewards, we send them their pending rewards plus anything accrued since last calculation of their pending rewards. Then we set pending rewards to 0, and their index to current global index.
3. In addition to pending rewards, we store each user's reward index for the given asset. This index represents the last
global index of the asset at which we calculated the user's pending rewards.

- Whenever we distribute new rewards for an asset, we simply increase its global index by (new amount distributed /
total weight of eligible users).
- Whenever the user's weight changes, we calculate the rewards accrued since we last updated their rewards indices, and
we add that to their pending rewards, setting their reward index to the global index.
- Whenever a user claims their rewards, we send them their pending rewards plus anything accrued since last calculation
of their pending rewards. Then we set pending rewards to 0, and their index to current global index.
12 changes: 5 additions & 7 deletions contracts/ics721-callback-proxy/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# NFT staking membership
# ICS721 callback proxy

A contract for managing an NFT (CW721) staking membership for an Enterprise DAO.
Essentially a proxy to the nft-staking library.
A proxy that implements Ark's ICS721 contract's callbacks.

Mainly serves to:
- store users' NFT stakes
- provide an interface to stake, unstake, and claim user NFTs
- provide queries for user and total stakes, and user claims
Allows receiving of callbacks together with incoming NFTs, and enables forwarding them to specific DAOs.

Meant as a single global instance that works for all DAOs.
16 changes: 0 additions & 16 deletions contracts/package.json

This file was deleted.

0 comments on commit f34a866

Please sign in to comment.