---
# System prepended metadata

title: Smart Invoice (Escrow v2)
tags: [RIPs, ' escrow']

---

---
tags: RIPs, escrow
---

# Smart Invoice (Escrow v2)

## Project Submitted By
@Spencer


## Background
In 2020, we built the Raid Guild escrow to facilitate a better payments system for raids. With the escrow, raiders get assurances that funds exist to pay them for their work, and clients get assurances that they will only pay if the raiders deliver. Further, we automated the payment of spoils to the guild.

To date, a handful of clients have used the escrow, and it has worked as intended. That said, we have identified a number of changes that can make the escrow even better. And we would also like to build on the spoils automation to streamline even more of what we can call the "raid ops" process.

The guild's migration to xDAI will make many of these changes possible due to the significantly lower gas prices. LexDAO has an arbitration account set up on xDAI to handle potential escrow disputes.

## Summary
This RIP has two interrelated components. 



### 1) Improve the RG escrow
This portion will draw on our learnings from the first version of our escrow system to make it better. We will build on top of the Smart Invoice foundation. The result will deliver the following benefits / improvements over the existing RG escrow system:

* **Variable amount milestones**. This will support more complex raid delivery structures. For example, a raid could have a small setup milestone, a couple larger build milestones, and then a smaller test / wrap-up milestone.
* **Clients can deposit as milestones are completed**. Currently, clients have to deposit the entire payment upfront, which can be a burden on them especially for larger raids. The new escrow will allow clients to deposit into each milestone individually; work can proceed safely as long as the next milestone is covered.
* **Safer / more flexible deposits**. Each escrow will get its own contract, allowing clients to deposit with direct token transfers or to deposit from multiple addresses. This change also prevents funds from being lost in the escrow if tokens are sent via direct transfer.
* **Flexible final milestone**. The final milestone will be able to handle any payment amount over the originally agreed-upon milestone size. This enables clients to leave a tip, or for raiders and clients to handle additional scope/payment without having to create a whole new escrow.

### 2) Additional Raid Ops automations
This portion will make it even easier for raid parties to get set up to be paid by clients. Here is what we will build:

* **Officially make each raid its own Series LLC**. This. requires a passed proposal by the DAO.
* **Automatically create a gnosis safe for each raid**, with the raiders as signers (option to use an existing safe).
* **Automatically create an escrow for each raid** with the relevant raid parameters (e.g. the payment amount, milestones, and raid party multisig)
* **Spoils will continue to be automatically paid to the DAO** when funds are released from escrow. The Smart Invoice escrow contracts do not include a recipient splitter, so we will build a helper contract that handles the splitting.


#### Expected flow:
1. Cleric / sales team comes to an agreement with the client on raid terms, including total payment, individual milestones, and an expected timeline
1. Cleric / sales team creates a proposal in the DAO to initiate the raid. This is done via a wrapped proposal, which, taking as inputs the info from #1, does the following as soon as it is created:
    * Initiates a DAO vote on whether to pass the proposal
    * Creates a new Gnosis Safe for the raid party
    * Creates an escrow for the raid with the info from #1
    * The client can deposit as soon as this is done. Though if there is not a rush to begin, they can wait until the DAO vote passes (3 days) to be sure that the raid will be approved by the DAO.
4. Once the DAO vote passes, the raid (and raiders) is now protected under its own series LLC (child of the RG LLC)
    * the vote is understood largely as a formality, necessary for the creation of the series LLC

## Why should we build this?
* better, more flexibly structured raids and payment plans
* better, more automated raid ops

## Raid Party Skills Needed
Archery / Ranging - modifying the Smart Invoice design to support RG escrow needs & ensure it works for Clerics and clients 
Scribing - internal and client-friendly documentation & instructions for how to use the escrow
Wizardry - writing & integrating contracts with the existing escrow contract
Warrioring - modifying the Smart Invoice front end to support RG escrow needs
Monking - guide the project from end to end

##  Cost (in USD)
$6000