An open API service indexing awesome lists of open source software.

https://github.com/tangle-network/eigenlayer-contract-deployer

A library containing Rust bindings for contracts and tools for deploying contracts
https://github.com/tangle-network/eigenlayer-contract-deployer

Last synced: 7 months ago
JSON representation

A library containing Rust bindings for contracts and tools for deploying contracts

Awesome Lists containing this project

README

          

![Tangle Network Banner](https://raw.githubusercontent.com/tangle-network/tangle/refs/heads/main/assets/Tangle%20%20Banner.png)

Eigenlayer Contract Deployer

A Rust library for generating bindings and deploying smart contracts for Eigenlayer AVSs.


Build Status
Latest Release
License
Discord
Telegram

## Overview

The Eigenlayer Contract Deployer is a Rust library that provides bindings for smart contracts commonly used in blueprints created with the Blueprint SDK. It focuses on EigenLayer/EVM blueprints and includes tools for deploying contracts and setting up environments for blueprints.

The library contains:

1. **Rust Bindings for Smart Contracts**: Automatically generated Rust bindings for specified contracts.
2. **Deployment Tools**: Helper functions for deploying contracts and setting up permissions.
3. **Environment Setup**: Utilities for setting up environments for blueprints, specifically for EigenLayer AVSs.

Currently, the library includes specific support for the EigenLayer Incredible Squaring blueprint, with plans to make it more general-purpose for any AVS.

## Features

- **Automatic Binding Generation**: Uses a build script to generate Rust bindings from Solidity contracts.
- **Core Contract Deployment**: Functions to deploy EigenLayer core contracts.
- **AVS Contract Deployment**: Functions to deploy AVS-specific contracts for EigenLayer.
- **Permission Management**: Utilities to set up permissions between aforementioned contracts.

## Usage

### Prerequisites

- Rust 1.86
- Forge (for contract compilation and binding generation)

### Installation

Add the library to your Cargo.toml:

```toml
[dependencies]
eigenlayer-contract-deployer = { git = "https://github.com/tangle-network/eigenlayer-contract-deployer" }
```

### Example: Deploying EigenLayer AVS Contracts

```rust
use eigenlayer_contract_deployer::deploy::deploy_avs_contracts;
use eigenlayer_contract_deployer::core::deploy_core_contracts;
use alloy_primitives::Address;

async fn deploy_my_avs() -> Result<(), Box> {
// Deploy core contracts first
let core_contracts = deploy_core_contracts(
"http://localhost:8545",
"private_key",
deployer_address,
config_data,
None,
None,
).await?;

// Deploy AVS contracts
let avs_contracts = deploy_avs_contracts(
"http://localhost:8545",
"private_key",
deployer_address,
1, // num_quorums
core_contracts.permission_controller,
core_contracts.allocation_manager,
core_contracts.avs_directory,
core_contracts.delegation_manager,
core_contracts.pauser_registry,
core_contracts.rewards_coordinator,
core_contracts.strategy_factory,
task_generator_addr,
aggregator_addr,
100, // task_response_window_block
).await?;

// Setup permissions
setup_avs_permissions(
&core_contracts,
&avs_contracts,
&wallet,
deployer_address,
"metadata_uri".to_string(),
).await?;

Ok(())
}
```

## Architecture

The library is structured as follows:

- **build.rs**: Handles the automatic generation of Rust bindings from Solidity contracts.
- **src/bindings/**: Contains the generated Rust bindings for contracts.
- **src/core.rs**: Functions for deploying EigenLayer core contracts.
- **src/deploy.rs**: Functions for deploying AVS-specific contracts.
- **src/helpers.rs**: Utility functions for contract deployment.
- **src/permissions.rs**: Functions for setting up permissions between contracts.

## 📜 License

Licensed under either of

* Apache License, Version 2.0
([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)

at your discretion.