Emerald Vault is a simple DAO template which acts as a fixed-term deposit savings vault with optional rewards scheme, designed to show off features of UTXO DeFi capabilities built with CashTokens L1 primitives (activating on BCH mainnet on May 15)
Imagine a big empty vault with a bunch of numbered slots, each slot can fit a safebox.
When you want to make a deposit, you put your coins into a safebox and place it into the vault’s next available slot.
The moment you insert your safebox into the slot a *click* is heard, it’s locked in position, and a keycard is released from an opening next to the safebox.
You try to use it to take out the safebox but you can’t, you hear “access denied, timelock not expired!”. Ok, so the keycard will be able to access the safebox, but not before some timer expires.
The keycard has your slot# and deposited amount printed on it, it’s an NFT that you can move around or try to sell at face value if you want liquidity before the safebox’s timelock expires.
You notice something else too, the amount printed on the keycard is a little more than what you actually put in, how can that be? When you put the box in, the vault’s system dropped a little extra into your safebox! From where did it come from? From anyone who voluntarily donated. Anyone can add to the vault’s rewards pool to incentivize depositors, and it will be distributed pro-rata to next depositors as a little airdrop into their box, a crowdfunded savings scheme.
At some point in the future, the timers in the vault will expire. Whomever comes to the vault with the keycard can insert it into a matching safebox, and take out the coins! The NFT gets destroyed and coins are released!
Does this make sense?
Here’s the TX flow diagram:
Here are the actual TXes on testnet:
– Designer creating the “DAO Blueprint” and funding it with a bounty + initial reward pool:
– User claiming a bounty to create the DAO instance with the token genesis TX:
– User deposit #01
– Donator adding to reward’s pool:
– User deposit #02:
– User withdrawal from deposit #02:
Here’s the BitAuthIDE template:
BitAuthIDE is our main tooling for low-level contract design (high-level is CashScript). It’s like a power-user BCH smart wallet and I successfully used it to:
– Design a BCH DAO in WYSIWYG mode while debugging all spending paths
– Import my testnet wallet’s xpriv to sign for actual on-chain UTXOs
– Build & broadcast the TX!
It’s not a full wallet, tho, as it requires manual labor to select UTXOs, bring their data into the IDE, and adjust input/output amounts etc., and then copy&paste the produced raw TX to broadcast it.