Code Monkey home page Code Monkey logo

piggy-wallet's Introduction

๐Ÿ— Piggy Wallet

Piggy Wallet is a Smart Wallet that enables several functionality, similar to a form of no-code Smart Wallet. For instance, we support the following features:

  • Auto-conversion of incoming ERC20s to USDC
  • Task system to reward users / wallet owners for completing tasks
  • Timelock system to give non-owners access after a certain time

How it works

For the auto-conversion of ERC20 tokens to USDC, we allow any user to initiate a UserOp which simply converts some ERC20 that is currently in the Safe Smart Wallet. This is to enable non-wallet owners to initiate this transaction for these users, and thereby have the "automatic" conversion feature.

  • This will be enhanced with 1inch Fusion API, leveraging the Resolver network to fulfil this swap

For the task system, it is a simple mapping of task IDs to task details, which include the reward amount, token address, and deadline. There is no strict enforcement of whether the task has been completed satisfactorily, as the main use case is to reward individuals known to the sponsor, who can mediate this off-chain (e.g. parents and their children).

Timelock is implemented by defining a timestamp for when the user can access the Safe Smart Wallet again. This is meant to be used in conjunction with plugins that support multiple owners.

Implementation Details

Smart Wallet is implemented initially with Coinbase Smart Wallet, which we unfortunately were unable to deploy due to issues with the bundler. Read more in foundry.

We have since switched to using Module Kit to create plugins for the Safe ERC7579 smart wallet. Read more in module-kit.

Swapping of tokens is done through Uniswap V4, which is implemented in module-kit as well. See this test for more information.

Requirements

Before you begin, you need to install the following tools:

Quickstart

To get started, follow the steps below:

  1. Install dependencies if it was skipped in CLI:
yarn install
  1. Start NextJS app:
cd packages/nextjs
yarn start
  1. Run foundry tests:
cd packages/module-kit
forge test -vvv --evm-version=cancun

Video Demo

Watch the video

Acknowledgements

This is a fork of Scaffold-ETH 2.

piggy-wallet's People

Contributors

marcuspang avatar sofivasquez avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.