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.
- 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.
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.
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").
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 |
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.
Sample EOA Transaction generated with run-eoa
- Claims REAL GNO Validator Rewards
- Swaps the claimed amount for COW token.
- See the order in explorer.
Sample Safe Programatic Order execution
- Claims Validator Rewards
- Swaps balance for COW token.
- 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.
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.