A bot that monitors and participates in Leverage Token rebalancing auctions.
- Monitors leverage tokens for rebalancing auctions
- Participates in auctions when profitable opportunities are found
- Supports multiple leverage tokens simultaneously
- Emits alerts to Slack when important events occur
- Node.js
- Docker (optional)
- Foundry (for smart contract development)
- Clone the repository:
git clone https://github.com/seamless-protocol/rebalance-bot.git
cd rebalance-bot- Install dependencies:
npm install- Install Foundry (if you plan to work with smart contracts):
curl -L https://foundry.paradigm.xyz | bash
foundryup- Create a
.envfile in the root directory (see .env.example)
- Build the project:
npm run build- Start the bot:
npm start- Build the Docker image:
docker build -t rebalance-bot .- Run the container:
docker run -it --env-file .env rebalance-botnpm run dev: Run in development mode with hot-reloadingnpm run dev:watch: Run in development mode with file watchingnpm run build: Build the project for productionnpm run start: Start the production servernpm run lint: Run ESLint to check code qualitynpm run lint:fix: Run ESLint and automatically fix issuesnpm run format: Check code formatting with Prettiernpm run format:fix: Format code with Prettiernpm run type-check: Run TypeScript type checking
- Start the development server:
npm run dev-
Make your changes - the server will automatically reload
-
Before committing:
npm run lint:fix # Fix linting issues
npm run format:fix # Format code
npm run type-check # Check types- Build for production:
npm run buildThe project uses Foundry for smart contract development. The contracts are located in the contracts/ directory.
- Build contracts:
cd contracts
forge build- Run tests:
forge test- Format Solidity code:
forge fmt- Generate gas snapshots:
forge snapshot- Deploy contracts:
forge script script/DeployRebalancer.s.sol:DeployRebalancer --rpc-url <your_rpc_url> --private-key <your_private_key>For more information about Foundry, see the official documentation.
Slack alerts can be emitted by setting the following environment variables:
SLACK_ALERT_CHANNEL_ID: Slack channel ID that the alerts should be published toSLACK_AUTH_TOKEN: OAuth token for a Slack App with permissions to write in the channel
See here for information on setting up a Slack App.