Git Product home page Git Product logo

karvest's Introduction

Karvest

This project combines CoW Hooks with Composable CoW into a Safe App for the purpose of Claiming/Harvesting Rewards (e.g. Gnosis Chain Validator, or Balancer Staking) and swapping (eventually restaking -- with post hooks) on Cowswap.

Screenshot

Content

  • app/: the web app to interact with the Karvest protocol from a Safe or EOA.
  • contracts/: the contracts for the hooked programmatic cow with helpers and claimable contracts.
  • sdk/: the development kit to interact with the Karvest protocol.

Transaction Example

CowExplorer | GnosisScan

tx tx2

The Beneficiary

safe A Safe multisig configured with a custom FallbackHandler and ComposableCow as domain verifier by this transaction.

More details on this setup can be found here.

Getting Started

Safe Web App

An Interface for initializing Claim & Swap

cd app/
yarn install
yarn start

Then the app can be added manually in the Safe App interface ("Add Custom Safe App").

Contracts

Contract Description Address on Gnosis Chain
ClaimAndSwap Hooked programmatic cow 0x35f29f3cb53bddb11b6e286a0454a9224dd3adaa
TransferBalance Helper for the programmatic cow 0xD4121d2d90CE7C5F7FB66c4E96815fc377481635
SBCDepositContractMock Example of claim contract:
Mock of the beacon chain deposit contract
0xF07AFCEe9dD0B859edD41603A3D725b70086fEF6

Deploy the Claim & Swap Contract

From the contracts directory:

yarn
yarn hardhat run  scripts/deployClaimAndSwap.ts --network gnosis

This contract is deployed and verified at 0x35f29f3cb53bddb11b6e286a0454a9224dd3adaa.

It points to the ComposableCow Contract, but uses a MockSBCDepositContract (for the purpose of the hackathon) which emits WXDAI instead of GNO.

SDK

Sample EOA Transaction generated with run-eoa

  1. Claims REAL GNO Validator Rewards
  2. Swaps the claimed amount for COW token.
  3. See the order in explorer.

Sample Safe Programatic Order execution

  1. Claims Validator Rewards
  2. Swaps balance for COW token.
  3. See order in explorer

Env file requires PRIVATE_KEY

yarn
source .env
# Runs EOA claim and swap
yarn run-eoa
# Create AppData Post and Generate Safe Create Order Params
yarn run create-order-params

Currently we create the order via Safe Transaction Builder, but it is web app can invoke this.

Generate and Post App Data

This library can also - Generate and POST new App Data (something that should happen before order creation via the Safe App). However, these methods are not exposed in script format at the moment. For this, refer to sdk/AppData.ts

The ultimate goal is to implement Post Hooks that can "restake" the claimed GNO. This can be achieved by the user precreating their validator keys and uploading them. The Validator's public key info is needed to invoke the deposit method, but can absolutely be generated via this Safe App / Post Composable Order compatible project.

karvest's People

Contributors

bh2smith avatar jaybuidl avatar xalava avatar

Watchers

 avatar  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.