Skip to content

Commit 48b0303

Browse files
committed
symbiotoic+eigenlayer contracte deployed+tested
1 parent 96b4e0d commit 48b0303

File tree

11 files changed

+1423
-447
lines changed

11 files changed

+1423
-447
lines changed

eigen_offchain/src/abi.rs

Lines changed: 932 additions & 303 deletions
Large diffs are not rendered by default.

eigen_offchain/src/abii.json

Lines changed: 109 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
[
2+
{
3+
"inputs": [],
4+
"stateMutability": "nonpayable",
5+
"type": "constructor"
6+
},
27
{
38
"inputs": [
49
{
@@ -102,28 +107,6 @@
102107
"name": "OperationForbidden",
103108
"type": "error"
104109
},
105-
{
106-
"inputs": [
107-
{
108-
"internalType": "address",
109-
"name": "owner",
110-
"type": "address"
111-
}
112-
],
113-
"name": "OwnableInvalidOwner",
114-
"type": "error"
115-
},
116-
{
117-
"inputs": [
118-
{
119-
"internalType": "address",
120-
"name": "account",
121-
"type": "address"
122-
}
123-
],
124-
"name": "OwnableUnauthorizedAccount",
125-
"type": "error"
126-
},
127110
{
128111
"inputs": [],
129112
"name": "ParticipantExists",
@@ -195,17 +178,43 @@
195178
{
196179
"indexed": true,
197180
"internalType": "address",
198-
"name": "previousOwner",
181+
"name": "newOwner",
182+
"type": "address"
183+
}
184+
],
185+
"name": "OwnerAdded",
186+
"type": "event"
187+
},
188+
{
189+
"anonymous": false,
190+
"inputs": [
191+
{
192+
"indexed": true,
193+
"internalType": "address",
194+
"name": "owner",
199195
"type": "address"
200196
},
197+
{
198+
"indexed": false,
199+
"internalType": "uint256",
200+
"name": "unlockTime",
201+
"type": "uint256"
202+
}
203+
],
204+
"name": "OwnerRemovalRequested",
205+
"type": "event"
206+
},
207+
{
208+
"anonymous": false,
209+
"inputs": [
201210
{
202211
"indexed": true,
203212
"internalType": "address",
204-
"name": "newOwner",
213+
"name": "removedOwner",
205214
"type": "address"
206215
}
207216
],
208-
"name": "OwnershipTransferred",
217+
"name": "OwnerRemoved",
209218
"type": "event"
210219
},
211220
{
@@ -259,6 +268,19 @@
259268
"stateMutability": "view",
260269
"type": "function"
261270
},
271+
{
272+
"inputs": [
273+
{
274+
"internalType": "address",
275+
"name": "newOwner",
276+
"type": "address"
277+
}
278+
],
279+
"name": "addOwner",
280+
"outputs": [],
281+
"stateMutability": "nonpayable",
282+
"type": "function"
283+
},
262284
{
263285
"inputs": [],
264286
"name": "avsDirectory",
@@ -298,6 +320,19 @@
298320
"stateMutability": "nonpayable",
299321
"type": "function"
300322
},
323+
{
324+
"inputs": [
325+
{
326+
"internalType": "address",
327+
"name": "owner",
328+
"type": "address"
329+
}
330+
],
331+
"name": "executeRemoveOwner",
332+
"outputs": [],
333+
"stateMutability": "nonpayable",
334+
"type": "function"
335+
},
301336
{
302337
"inputs": [],
303338
"name": "getCurrentPeriod",
@@ -464,11 +499,6 @@
464499
},
465500
{
466501
"inputs": [
467-
{
468-
"internalType": "address",
469-
"name": "_owner",
470-
"type": "address"
471-
},
472502
{
473503
"internalType": "address",
474504
"name": "_parameters",
@@ -504,11 +534,11 @@
504534
"inputs": [
505535
{
506536
"internalType": "address",
507-
"name": "strategy",
537+
"name": "owner",
508538
"type": "address"
509539
}
510540
],
511-
"name": "isStrategyEnabled",
541+
"name": "isOwner",
512542
"outputs": [
513543
{
514544
"internalType": "bool",
@@ -520,15 +550,21 @@
520550
"type": "function"
521551
},
522552
{
523-
"inputs": [],
524-
"name": "owner",
525-
"outputs": [
553+
"inputs": [
526554
{
527555
"internalType": "address",
528-
"name": "",
556+
"name": "strategy",
529557
"type": "address"
530558
}
531559
],
560+
"name": "isStrategyEnabled",
561+
"outputs": [
562+
{
563+
"internalType": "bool",
564+
"name": "",
565+
"type": "bool"
566+
}
567+
],
532568
"stateMutability": "view",
533569
"type": "function"
534570
},
@@ -539,6 +575,35 @@
539575
"stateMutability": "nonpayable",
540576
"type": "function"
541577
},
578+
{
579+
"inputs": [
580+
{
581+
"internalType": "address",
582+
"name": "",
583+
"type": "address"
584+
}
585+
],
586+
"name": "pendingRemovals",
587+
"outputs": [
588+
{
589+
"internalType": "address",
590+
"name": "ownerAddress",
591+
"type": "address"
592+
},
593+
{
594+
"internalType": "uint256",
595+
"name": "requestTime",
596+
"type": "uint256"
597+
},
598+
{
599+
"internalType": "bool",
600+
"name": "isPending",
601+
"type": "bool"
602+
}
603+
],
604+
"stateMutability": "view",
605+
"type": "function"
606+
},
542607
{
543608
"inputs": [],
544609
"name": "proxiableUUID",
@@ -646,8 +711,14 @@
646711
"type": "function"
647712
},
648713
{
649-
"inputs": [],
650-
"name": "renounceOwnership",
714+
"inputs": [
715+
{
716+
"internalType": "address",
717+
"name": "owner",
718+
"type": "address"
719+
}
720+
],
721+
"name": "removeOwner",
651722
"outputs": [],
652723
"stateMutability": "nonpayable",
653724
"type": "function"
@@ -722,19 +793,6 @@
722793
"stateMutability": "view",
723794
"type": "function"
724795
},
725-
{
726-
"inputs": [
727-
{
728-
"internalType": "address",
729-
"name": "newOwner",
730-
"type": "address"
731-
}
732-
],
733-
"name": "transferOwnership",
734-
"outputs": [],
735-
"stateMutability": "nonpayable",
736-
"type": "function"
737-
},
738796
{
739797
"inputs": [],
740798
"name": "unpauseStrategy",

eigen_offchain/src/event_fetcher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl EventFetcher {
2929
}
3030

3131
pub async fn start_continuous_fetching(&self, contract: &EigenLayerRestaking<SignerMiddleware<Provider<Http>, LocalWallet>>, rpc_url: &str) -> Result<()> {
32-
let mut last_processed_block: U64 = 3445180.into();
32+
let mut last_processed_block: U64 = 3445973.into();
3333
println!("Starting continuous event fetching...");
3434

3535
loop {

eigen_offchain/src/lib.rs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,13 @@ impl EigenLayerClient {
132132
// Initialize the contract
133133
pub async fn initialize(
134134
&self,
135-
owner: Address,
136135
parameters: Address,
137136
eigenlayer_avs_directory: Address,
138137
eigenlayer_delegation_manager: Address,
139138
eigenlayer_strategy_manager: Address,
140139
restaking_helper: Address,
141140
) -> Result<()> {
142141
let tx = self.contract.initialize(
143-
owner,
144142
parameters,
145143
eigenlayer_avs_directory,
146144
eigenlayer_delegation_manager,
@@ -156,7 +154,39 @@ impl EigenLayerClient {
156154
pub async fn is_strategy_enabled(&self, strategy: Address) -> Result<bool> {
157155
Ok(self.contract.is_strategy_enabled(strategy).call().await?)
158156
}
157+
pub async fn add_owner(&self, new_owner: Address) -> Result<()> {
158+
let tx = self.contract.add_owner(new_owner);
159+
let pending_tx = tx.send().await?;
160+
println!("Owner added: {:?}", pending_tx.tx_hash());
161+
Ok(())
162+
}
163+
164+
// Remove an owner (initiates the removal process)
165+
pub async fn remove_owner(&self, owner: Address) -> Result<()> {
166+
let tx = self.contract.remove_owner(owner);
167+
let pending_tx = tx.send().await?;
168+
println!("Owner removal initiated: {:?}", pending_tx.tx_hash());
169+
Ok(())
170+
}
159171

172+
// Execute the removal of an owner (completes the removal process)
173+
pub async fn execute_remove_owner(&self, owner: Address) -> Result<()> {
174+
let tx = self.contract.execute_remove_owner(owner);
175+
let pending_tx = tx.send().await?;
176+
println!("Owner removal executed: {:?}", pending_tx.tx_hash());
177+
Ok(())
178+
}
179+
180+
// Check if an address is an owner
181+
pub async fn is_owner(&self, address: Address) -> Result<bool> {
182+
Ok(self.contract.is_owner(address).call().await?)
183+
}
184+
185+
// Get pending removal details
186+
pub async fn get_pending_removal(&self, owner: Address) -> Result<(Address, U256, bool)> {
187+
let pending_removal = self.contract.pending_removals(owner).call().await?;
188+
Ok((pending_removal.0, pending_removal.1, pending_removal.2))
189+
}
160190
// Get the contract owner
161191
pub async fn get_owner(&self) -> Result<Address> {
162192
Ok(self.contract.owner().call().await?)

eigen_offchain/src/main.rs

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@ struct Cli {
2323

2424
#[derive(Subcommand)]
2525
enum Commands {
26+
AddOwner {
27+
new_owner: String,
28+
},
29+
30+
/// Remove an owner
31+
RemoveOwner {
32+
owner: String,
33+
},
34+
35+
/// Execute owner removal
36+
ExecuteRemoveOwner {
37+
owner: String,
38+
},
39+
40+
/// Check if an address is an owner
41+
IsOwner {
42+
address: String,
43+
},
44+
2645
/// Get the interface version
2746
GetInterfaceVersion,
2847

@@ -117,7 +136,6 @@ enum Commands {
117136

118137
/// Initialize the contract
119138
Initialize {
120-
owner: String,
121139
parameters: String,
122140
avs_directory: String,
123141
delegation_manager: String,
@@ -301,10 +319,9 @@ async fn main() -> Result<()> {
301319
println!("Ownership transferred successfully");
302320
}
303321

304-
Commands::Initialize { owner, parameters, avs_directory, delegation_manager, strategy_manager, restaking_helper } => {
322+
Commands::Initialize { parameters, avs_directory, delegation_manager, strategy_manager, restaking_helper } => {
305323
client
306324
.initialize(
307-
Address::from_str(&owner)?,
308325
Address::from_str(&parameters)?,
309326
Address::from_str(&avs_directory)?,
310327
Address::from_str(&delegation_manager)?,
@@ -314,6 +331,33 @@ async fn main() -> Result<()> {
314331
.await?;
315332
println!("Contract initialized successfully");
316333
}
334+
Commands::AddOwner { new_owner } => {
335+
client
336+
.add_owner(Address::from_str(&new_owner)?)
337+
.await?;
338+
println!("Owner added successfully");
339+
}
340+
341+
Commands::RemoveOwner { owner } => {
342+
client
343+
.remove_owner(Address::from_str(&owner)?)
344+
.await?;
345+
println!("Owner removal request submitted successfully");
346+
}
347+
348+
Commands::ExecuteRemoveOwner { owner } => {
349+
client
350+
.execute_remove_owner(Address::from_str(&owner)?)
351+
.await?;
352+
println!("Owner removed successfully");
353+
}
354+
355+
Commands::IsOwner { address } => {
356+
let is_owner = client
357+
.is_owner(Address::from_str(&address)?)
358+
.await?;
359+
println!("Is Owner: {}", is_owner);
360+
}
317361

318362
Commands::FetchEvents => {
319363
// let contract_address = dotenv::var("CONTRACT_ADDRESS")?.parse()?;

0 commit comments

Comments
 (0)