npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@vitriollabs/elastivault

v0.1.0

Published

An infinitely elastic smart contract wallet

Downloads

3

Readme


The ElastiVaultFactory was created to deploy instances of the OwnableElastiVault, ECDSAElastiVault, and ECDSAMultisigElastiVault.

This repository includes contracts related to the ElastiVault, an infinitely elastic smart contract wallet. What this means, is that you can execute any on-chain action without needing to deploy predefined logic smart contracts.

Think of it this way; your current web3 UX can be quite cumbersome. Often many of your actions need to be executed in separate transactions, or if you want to perform some grouped-actions a smart contract would need to be deployed and then called.

Each implementation of the ElastiVault offers a solution to this problem by allowing the user to execute arbitrary bytecode from the context of the wallet-vault. Basically, the vault allows users to specify "scripts" to run on-chain.

Consider this example: If you want to perform some complicated arbitrage of some erc20 from one dex to another:

  • approve dex1 to swap your token
  • call dex1 to perform a token swap
  • transfer the tokens
  • approve dex2 to swap your token
  • call dex2 to perform a token swap

This can be accomplished in 1 call to an ElastiVault, as the user can define a single script that performs ALL of these actions, executing it from their wallet-vault.

The ElastiVault allows for some pretty complicated use-cases, each in 1 transaction:

  • execute multiple swaps
  • interact with several protocols
  • read complicated state from several on-chain sources, and use that state to conditionally perform an action (require statements etc. are fully supported)

These on-chain scripts written/used here are all written in Solidity, but any language that complies to EVM-bytecode should be possible here.

Example Usage

HardHat Scripts

# start hardhat node
hardhat node
# deploy the ElastiVault factory contract
hardhat run scripts/deployVaultFactory.ts # returns <VAULT_ADDR> ex: 0x106297B870019eBbcC51E84E350899da495cE803
# deploy an "owned" vault using a chosen ElastiVault factory
hardhat --network localhost factoryDeployVault <VAULT_ADDR> owned <CHOSEN_SIGNER(S)> # returns <VAULT_ADDR>
# call a basic script from the context of a chosen ElastiVault (that the caller owns)
hardhat --network localhost callOwnableElastiVault <VAULT_ADDR> CallTest --call

HardHat Tests

# start hardhat node
hardhat node
# run the tests against the local node
hardhat test --network localhost

Factory Contract Deployments:

The ElastiVaultFactory has been deployed to 0x00000000131889aD41211C79fc63860c9720D4de on the following networks:

Future Plans

  • ZK ownership - Allow the use of Zero Knowledge proofs to verify ownership of a vault
  • Support ERC-4337 Account Abstraction

Notes

  • For maximum compatibility, if storing state (storage) in an ElastiVault we highly recommended using the Diamond storage pattern. This is not required, but helps to avoid storage collisions.
  • The tests included here are intended to be run against a mainnet/testnet fork due to availability of external dependencies. Currently the tests are set to run against the Goerli Testnet.
  • Also consult the HyVM repo in regards to memory layout, divergence, & EVM opcode compatibility.
  • Each ElastiVault implementation is by-design able to execute arbitrary bytecode (scripts) on-chain, and this comes with its associated dangers. Users of these vaults should be careful to sign transactions/bytecode, just as with any web3 interaction. Special steps should be taken by the user to ensure they are only executing bytecode they are familiar with. We invite external parties to help build out tooling that will make this safer for users.

Repo Layout:

Contracts/    
  # dynamic scripts to be executed on-chain
  sol_scripts/
  # ElastiVault owned by an arbitrary Signer
  ECDSAElastiVault.sol
  # ElastiVault owned by an arbitrary number of Signer(s), requiring some quorum
  ECDSAMultiSigElastiVault.sol
  # Factory contract used to deploy the other vaults
  ElastiVaultFactory.sol
  # ElastiVault using SafeOwnable ownership
  OwnableElastiVault.sol
deployment/
  # metadata related to the ElastiVaultFactory's deployment
  deployTx.json
scripts/
  # Hardhat tasks to interact with an ElastiVault Factory or to call/exec scripts in the context of an ElastiVault
  tasks/
  # deploy the ElastiVault Factory
  deployVaultFactory.ts
# code to enable arbitrary contract bytecode to be executable in the context of an ElastiVault
src/
# Basic tests also demonstrating how to interact with the ElastiVault implementations
test/

Authors / Mentions

This repo was created by Cameron White (Slvrfn) of Vitriol Labs, but would not have been possible without the contributions of:

Contributing

Contributions are welcome, please review CONTRIBUTIONS for more details.

License

The files contained therein are licensed under The MIT License (MIT). See the LICENSE file for more details.

Disclaimer

Please review the DISCLAIMER for more details.

External Dependencies

  • ElastiVaultFactory
    • ImmutableDeploymentFactory: Smart Contract used to facilitate "immutable" create2/3 contract deployments (which prevents deploying code to a preexisting contract address).
  • ElastiVault
    • The HyVM: Smart Contract that acts as an EVM, to allow for arbitrary bytecode to be executed on-chain.

Donations (beermoney):