LexLocker - Crypto Law Codified
LexLocker is a multi-track, arbitrable escrow for Ethereum business transactions summoned by LexDAO legal engineers.
LexLocker is designed for peer/peer smart contracts and has been battle-tested on Ethereum over the past month. The latest build, following earlier PoCs in Prod, can be reviewed in the LexDAO legal engineering library (“LexCorpus”) 📕, and the mainnet contract is referenced at the LexLocker.eth ENS domain 🔒. Making updates to the github code and actually using LexLocker are both rewarded in LexDAO governance, $LEX. (~Join the Journey~) ☄️ Like any LexDAO joint, the solidity and legal is lean.
Design Overview 🗺️
LexLocker combines a number of escrow functions engineered over the past year by LexDAO and community friends like Raid Guild to serve the practical business of “locking money in a smart contract. Having recourse if something goes wrong” ⚔️.
Using LexLocker, users don’t need to trust centralized servers or third-parties to record evidence of their legal agreements and settle the payments encoded therein. Further, they have recourse to any on-chain arbitration provider they need in case of dispute or other issue after deposit. Each deposit further has a safety-valve timer that allows depositors to withdraw after termination. Never trust a firm, database or bank again to do business online with complex conditions.
Taking key features of LexLocker in turn: 🧙
: on-chain agreements📜
Each locker registration has a `details` field that stores legal terms immutably on the Ethereum blockchain. This reference can be pulled as a simple ID from the `marketTerms` array library maintained in LexLocker by LexDAO votes. Legal templates can be suggested as PRs to LexCorpus here ✍️.
: multi-track deposits 💸🛣
:: lump sum 💰
Clients to an escrow (e.g., Bob locks 1000 $DAI for 100 GOODS) can deposit a lump sump and save gas with the `depositLockerSingleMilestone()` function in any erc20 token or ETH (see below on ETH wrapping).
:: milestones 💰💰💰
Or better yet, clients can program milestone payments in different amounts with `depositLocker()`, such as 100 $DAI for “Press Release Draft”, 300 $DAI for “Finished PR.”
:: invoicing 🧾🙋
A `provider` to LexLocker-managed deals can call the `registerLocker()` function to request a deposit from a `client` in either lump sump or a milestone array.
The requested client can confirm and complete a deposit by calling the `confirmLocker()` function.
*for fully on-chain folks, email and other off-chain notices can be avoided, as all parties to LexLocker registrations are easily found and updated via the `latestLockerRegistration’ and ‘lockerRegistrations’ getter functions 🔎.
:: ETH support 🍬
For all deposits, LexLocker supports ETH by natively wrapping into tokenized wETH where `msg.value` matches a wETH deposit `sum.`
To demonstrate this and UX of “1 click deposit”, check out this simple dApp to start: LexLocker Deposit Demo Dapp ✨
:: timelocking ⏰
These deposits can be set to a `termination` epoch time and allow the `client` to withdraw whatever is remaining in escrow after such period. For example, if a few milestones are undelivered by a `provider` and no dispute is raised before time runs out, LexLocker presumes breach and allows the client to reclaim their remaining deposit without a fee.
:: oracles 🔮
Clients to any locker can designate a `clientOracle` to watch over their deal and call the `release()` payment and `withdraw()` functions. This might be a DAO, bot or other relatively trusted participant to “watch the till”. Clients can always call the `assignClientOracle()` function to cancel or transfer this helper role.
: arbitration marketplace 🧑⚖️
LexLocer escrows can be `lock()`-ed by the `client` or `provider` to each registration for timely resolution by their selected `resolver`. This means that the remaining unpaid sum in the registration will be split by the resolver, minus a fee (currently 5%, adjustable, but not retroactive, by LexDAO). All such resolutions are reported events on Ethereum and update the respective `adr` object for each locker.
Again, the four corners of LexLockers dealings can be entirely contained and operated by a single smart contact. And, to reiterate, any account or DAO can serve as arbitrator here. Aragon Court, Kleros, and yes, even the humble guild of LexDAO engineers referenced in our arbitration protocol. Read LexDAO Resolution Terms.
The arbitration account that can ultimately call `resolve()` is also fire-able by the deal parties at any time before passing a resolution 🚫. The risk of a resolver account losing their keys or otherwise providing unsatisfactory service should be met with recourse. To this end, there is an internal process provided for each registration, by means of the `clientProposeResolver()` and `providerProposeReolver()` functions, respectively ✋. (Effectively, for a given LexLocker adr to be updated, the suggestion calls by parties must match and become confirmed proposals.)
:: direct deposit resolution 💃
Some LexLocker users may not have a deal contemplated, but just want to use the escrow functionality to put a lump sump up for resolution by another account on Ethereum. Pure arbitration goodness. For these purposes, users can call `requestLockerResolution()` and have their deposit locked immediately for judgment. For example, Bob might lock 10,000 $DAI per the arbitration clause provided by LexDAO in order to get legal finality and a financial settlement against a complaint by Alice. Or, in other use cases, Bob might just want their resolver to hold them to a bet that benefits charity from a LexLocker deposit if they bilk a goal, like running the NYC marathon in 2021.
:: swift resolution by LexDAO⚡
Each LexLocker registration may opt into a fast-track “swift” resolution of disputes by confirming the `swiftResolution` option on deposit. If this option is selected, any member of LexDAO Corps. DAO, or in future, other accounts holding `swiftResolverToken` balances (such as resolver dao consortium….) can individually call to resolve the disputed LexLocker. This is expected to almost always be a faster track to finality than DAO panels within the LexDAO network. The roster of current LexDAO legal engineers eligible to serve can be reviewed here 🗡️.
If you want to follow LexDAO procedures for resolving LexLocker and similar smart contract states, hit us up on lexdao.chat #hack-chat channel 🗣. Follow LexDAO on Twitter 🐦 to tracky dummy disputes in “Proof of Judgment” series and other similar updates 📡. Follow our custom dApp build using scaffold-eth magick 🏗.