Home

Awesome

Dharma Smart Wallet

Dharma Smart Wallet (dharma-smart-wallet)

An upgradeable, meta-transaction-enabled smart wallet for earning interest on stablecoins while retaining custody of funds, with an added security backstop provided by Dharma Labs.

Smart Wallet Version Key Ring Version License Build Status Coverage Audit Community

Summary

The Dharma Smart Wallet is a 2/2 "multisig" smart contract, controlled by the user's Dharma Key Ring and by Dharma Labs, that:

The Dharma Key Ring is an N/M "multisig" smart contract, controlled and configured by the user and set as one of the two signatories on their Dharma Smart Wallet, that:

These contracts have been audited by Trail of Bits - <a href="https://github.com/trailofbits/publications/blob/master/reviews/dharma-smartwallet.pdf" target="_blank">see their security assessment</a> for more information.

Table of Contents

Contract Deployment Addresses and Verified Source Code

Core ContractsImplementationsFactories
<a href="https://etherscan.io/address/0x00000000008a10a98969a000d1c0aba90f858d6a#code" target="_blank">DharmaUpgradeBeaconControllerManager</a><a href="https://etherscan.io/address/0x00000000009f22da6feb6735614563b9af0339fb#code" target="_blank">AdharmaSmartWalletImplementation</a><a href="https://etherscan.io/address/0xfc00c80b0000007f73004edb00094cad80626d8d#code" target="_blank">DharmaSmartWalletFactoryV1</a>
<a href="https://etherscan.io/address/0x00000000002226c940b74d674b85e4be05539663#code" target="_blank">DharmaUpgradeBeaconController</a><a href="https://etherscan.io/address/0x0000000010a653849f221a573e00f3a37c8c4082#code" target="_blank">DharmaSmartWalletImplementationV1</a>DharmaSmartWalletFactoryV2
<a href="https://etherscan.io/address/0x000000000026750c571ce882b17016557279adaa#code" target="_blank">DharmaUpgradeBeacon</a><a href="https://etherscan.io/address/0x000000000088387c42fe85a60df4dce8e34eea4e#code" target="_blank">DharmaSmartWalletImplementationV2</a>
<a href="https://etherscan.io/address/0x00000000011df015e8ad00d7b2486a88c2eb8210#code" target="_blank">DharmaKeyRingUpgradeBeaconController</a><a href="https://etherscan.io/address/0x0000000000861ff98a332571edd7e6ef73ab2b2b#code" target="_blank">DharmaSmartWalletImplementationV3</a>
<a href="https://etherscan.io/address/0x0000000000bda2152794ac8c76b2dc86cba57cad#code" target="_blank">DharmaKeyRingUpgradeBeacon</a><a href="https://etherscan.io/address/0x00000000004f319450e1e1ce5e40813e7e1fe0b4#code" target="_blank">DharmaSmartWalletImplementationV4</a>
<a href="https://etherscan.io/address/0x000000000067503c398f4c9652530dbc4ea95c02#code" target="_blank">DharmaUpgradeBeaconEnvoy</a><a href="https://etherscan.io/address/0x00000000001f2bec34d4a98c839cf711afc842c6#code" target="_blank">DharmaSmartWalletImplementationV5</a><a href="https://etherscan.io/address/0x00dd005247b300f700cfdff89c00e2acc94c7b00#code" target="_blank">DharmaKeyRingFactoryV1</a>
<a href="https://etherscan.io/address/0x000000005d7065eb9716a410070ee62d51092c98#code" target="_blank">DharmaKeyRegistryV1</a><a href="https://etherscan.io/address/0x0000000000ab32e9e7bd6bd3c37a7e99fb8c2d43#code" target="_blank">DharmaSmartWalletImplementationV6</a><a href="https://etherscan.io/address/0x2484000059004afb720000dc738434fa6200f49d#code" target="_blank">DharmaKeyRingFactoryV2</a>
<a href="https://etherscan.io/address/0x000000000d38df53b45c5733c7b34000de0bdf52#code" target="_blank">DharmaKeyRegistryV2</a><a href="https://etherscan.io/address/0x00000000000dbef74a0e053433503acae8dc80f5#code" target="_blank">DharmaSmartWalletImplementationV7</a>DharmaKeyRingFactoryV3
<a href="https://etherscan.io/address/0x0000000000dfed903ad76996fc07bf89c0127b1e#code" target="_blank">DharmaAccountRecoveryManagerV2</a><a href="https://etherscan.io/address/0x000000000053d1F0F8aA88b9001Bec1B49445B3c#code" target="_blank">AdharmaKeyRingImplementation</a>
<a href="https://etherscan.io/address/0x00000000005280b515004b998a944630b6c663f8#code" target="_blank">DharmaEscapeHatchRegistry</a><a href="https://etherscan.io/address/0x00000000ea0007cdab60e07437e59e9cc41c2e49#code" target="_blank">DharmaKeyRingImplementationV1</a>

Overview

The Dharma Smart Wallet and Dharma Key Ring are designed with the following assumptions in mind:

Dharma Smart Wallet

The current implementation of the Dharma Smart Wallet works as follows:

Dharma Key Ring

The Dharma Smart Wallet is controlled by the Dharma Key Ring:

Upgradeability

Both the Dharma Smart Wallet and the Dharma Key Ring are upgradeable:

Install

To install locally, you'll need Node.js 10 through 12 and Yarn (or npm). To get everything set up:

$ git clone https://github.com/dharma-eng/dharma-smart-wallet.git
$ cd dharma-smart-wallet
$ yarn install
$ yarn build

Usage

To run tests locally, start the testRPC, trigger the tests, run the linter, and tear down the testRPC (you can do all of this at once via yarn all if you prefer):

$ yarn start
$ yarn test
$ yarn lint
$ yarn stop

You can also run code coverage if you like:

$ yarn build
$ yarn coverage

There is also an option to run tests against a fork of mainnet - be warned that these tests take a very long time.

$ yarn forkStart
$ yarn test
$ yarn stop

Finally, there is an option to run code coverage against a mainnet fork (same caveat as above):

$ yarn build
$ yarn forkCoverage

Example Contracts and Notable Transactions

Example Contracts:

Notable Transactions:

Additional Information

Have any questions or feedback? Join the conversation in the <a href="https://discordapp.com/invite/qvKTDgR" target="_blank">Dharma_HQ Discord server</a>. Also, see the "<a href="https://blog.dharma.io/why-smart-wallets-should-catch-your-interest-c85e4401b89a" target="_blank">Why Smart Wallets Should Catch Your Interest</a>" article for a more informal discussion around some of the motivations, features, and design decisions of the Dharma Smart Wallet.