DAO Garden is a DAO UI and library (in Javascript), to create new DAOs on top of the DAO SmartWeave contract, these are the contract's specs.
Holders = DAO Token Holders.
The DAO state has the following structure:
{
name: string,
ticker: string,
balances: {
[key: string]: number // Positive integer
},
vault: {
[key: string]: [{
balance: number, // Positive integer
end: number, // At what block the lock ends.
start: number // At what block the lock starts.
}]
},
votes: VoteInterface[],
roles: {
[key: string]: string
}
quorum: number, // quorum is between 0.01 and 0.99
support: number, // between 0.01-0.99, how much % yays for a proposal to be approved
voteLength: number, // How many blocks to leave a proposal open
lockMinLength: number, // Minimum lockLength allowed
lockMaxLength: number // Maximum lockLength allowed
}
Here's an example of what the state when creating the contract should look like:
{
"name": "My DAO Name",
"ticker": "TICK",
"balances": {
"uhE-QeYS8i4pmUtnxQyHD7dzXFNaJ9oMK-IM-QPNY6M": 10000000
},
"vault": {},
"votes": [],
"roles": {},
"quorum": 0.5,
"voteLength": 2000,
"lockMinLength": 100,
"lockMaxLength": 10000
}
VoteInterface is:
interface VoteInterface {
status?: 'active' | 'quorumFailed' | 'passed' | 'failed';
type?: 'mint' | 'mintLocked' | 'burnVault' | 'indicative' | 'set';
id?: number;
totalWeight?: number;
recipient?: string;
target?: string;
qty?: number;
key?: string;
value?: any;
note?: string;
yays?: number;
nays?: number;
voted?: string[];
start?: number;
lockLength?: number;
}
Holders are able to transfer them to someone else on Arweave, not only to other DAO members but to anyone else.
- target: To whom the balance is going to be transfered.
- qty: How many tokens to transfer.
{ state }
Check the current total balance (unlocked and in vault) of an account.
- target: To whom check the balance. If not provided, caller is used.
result: {
target: address,
balance: target's balance
}
Check the current unlocked balance of an account.
- target: To whom check the balance. If not provided, caller is used.
result: {
target: address,
balance: target's balance
}
Lock a balance to increase it's vote weight on the DAO. The voting weight is: lockedBalance * (end - start)
.
- qty: Balance amount to lock.
- lockLength: How many blocks qty will be locked.
{ state }
Unlock all locked balances that are over the end set while locking.
{ state }
Increase a locked balance lockedLength.
- id: The vault ID to be locked longer.
- lockLength: How many more blocks this vault will be locked.
Check the current locked balance of an account.
- target: To whom check the balance. If not provided, caller is used.
result: {
target: address,
balance: target's total locked balance
}
Holders are able to propose a new vote, this will create a new proposal.
type: Vote type. One of the following:
- Mint
To mint tokens to an Arweave address.
Requires:
- recipient: Arweave address recipient
- qty: Amount of tokens to mint
- note: Proposal description
- MintLocked
To mint locked tokens to an Arweave address.
- recipient: Arweave address recipient
- qty: Amount of tokens to mint
- note: Proposal description
- lockLength: How many blocks qty will be locked.
- BurnVault
To burn a vault with it's tokens. Warning: This will completely remove the tokens and it's vault, use with caution.
- target: Arweave address target
- id: Vault ID (index) to be burned.
- Set
To update the DAO settings.
Requires:
- key: Setting key
- value: Setting value
- Indicative
To send a general non-fixed proposal. A yes/no question.
Requires:
- note: Proposal description
Allowed keys to be set are:
- quorum
- support
- lockMinLength
- lockMaxLength
- role
- role value must be:
{target: address, role: 'name'}
- role value must be:
{ state }
Cast a vote on one of the proposals.
- id: Proposal ID.
- cast: What vote are you casting
'yay' || 'nay'
.
{ state }
After a vote is concluded, we should call finalize to make it in effect. It will update the vote status to passed
, and execute if needed, or failed
.
- id: Proposal ID.
{ state }