Restaking smart contracts reference

Instructions for manual restaking in Ditto AVS.

Getting strategy tokens

Acquire strategy tokens via swap in your wallet UI or in third-party service (e.g. Uniswap, Lido).

Swapping via wallet UI is not available for holesky testnet.

You need to use other means of obtaining tokens - manually wraping via smart contract or via provider side (e.g. https://stake.lido.fi/wrap)

Depositing into strategy

  1. Call approve method with the amount you want to deposit into strategy.

  2. After successful approval call depositIntoStrategy method with the same amount to deposit tokens into strategy.

Delegate

Call the delegateTo method providing desired operator.

You can only delegate to a single operator.

Undelegate

Call undelegate method providing address of you wallet.

When undelegating all delegates assets will be queued to withdrawal.

Withdraw

  1. Manually queue withdrawals with queueWithdrawal or undelegate

Methods

Approve

Write method approve can be found on token smart contracts.

Address: Token address.

Arguments:

  1. spender — Address of the strategy you want to use

  2. amount — Amount of tokens to approve

Token address and strategy address to provide in input parameters can be found here.

Output: Success/failure of the call

Deposit into strategy

Write method depositIntoStrategy can be found on Eigenlayer Strategy Manager smart contract.

Address: Strategy manager address. Select from here depending on the network you're using.

Arguments:

  1. strategy — Address of the strategy you want to use

  2. token — Token address.

  3. amount — Amount of tokens you want to approve.

Token address and strategy address to provide in input parameters can be found here.

Output: Amount of tokens deposited into strategy.

Delegate

Write method delegateTo can be found on Eigenlayer Delegation Manager smart contact.

Address: Delegation manager address. Select from here depending on the network you're using.

Arguments:

  1. operator — Operator address

  2. approverSignatureAndExpiry — Leave it empty. Type info.

  3. approverSalt — Pass zero bytes

Output: Delegation status

Undelegate

Write method undelegate can be found on Eigenlayer Delegation Manager smart contact.

Address: Delegation manager address. Select from here depending on the network you're using.

Arguments:

  1. staker — Address of your wallet

Output: withdrawalRoots array

Emits events: StakerUndelegated, WithdrawalQueued

Queue withdrawal

Write method queueWithdrawals can be found on on Eigenlayer Delegation Manager smart contact.

Address: Delegation manager address. Select from here depending on the network you're using.

Arguments:

  1. withdrawals — array of QueuedWithdrawalParams structures

Output: withdrawalRoots array

Emits events: WithdrawalQueued

Complete queued withdrawal

Write method completeQueuedWithdrawal can be found on Eigenlayer Delegation manager smart contact.

Address: Delegation manager address. Select from here depending on the network you're using.

Arguments:

  1. withdrawal — structure from WithdrawalQueuedEvent

  2. tokens — array of tokens (optional)

  3. middlewareTimesIndex — empty

  4. receiveAsTokens — boolean

Output: confirmation of withdrawal

Emits events: WithdrawalCompleted

Complete queued withdrawals

Write method completeQueuedWithdrawals can be found on Eigenlayer Delegation manager smart contact.

Address: Delegation manager address. Select from here depending on the network you're using.

Arguments:

  1. withdrawal — array of structures from WithdrawalQueuedEvent

  2. tokens — array of tokens (optional)

  3. middlewareTimesIndex — empty

  4. receiveAsTokens — boolean

Output: confirmation of multiple withdrawals

Emits events: WithdrawalCompleted

Eigenlater Emited Events

StakerUndelegated

event StakerUndelegated(address indexed staker, address indexed operator);

WithdrawalQueued

event WithdrawalQueued(bytes32 withdrawalRoot, Withdrawal withdrawal);

WithdrawalCompleted

event WithdrawalCompleted(bytes32 withdrawalRoot);

Eigenlayer Data Formats

SignatureWithExpiry

struct SignatureWithExpiry {
    // the signature itself, formatted as a single bytes object
    bytes signature;
    // the expiration timestamp (UTC) of the signature
    uint256 expiry;
}

QueuedWithdrawalParams

struct QueuedWithdrawalParams {
    // Array of strategies that the QueuedWithdrawal contains
    IStrategy[] strategies;
    // Array containing the amount of shares in each Strategy in the `strategies` array
    uint256[] shares;
    // The address of the withdrawer
    address withdrawer;
}

Withdrawal

 /**
   * Struct type used to specify an existing queued withdrawal. Rather than storing the entire struct, only a hash is stored.
   * In functions that operate on existing queued withdrawals -- e.g. completeQueuedWithdrawal`, the data is resubmitted and the hash of the submitted
   * data is computed by `calculateWithdrawalRoot` and checked against the stored hash in order to confirm the integrity of the submitted data.
 */
struct Withdrawal {
   // The address that originated the Withdrawal
   address staker;
   // The address that the staker was delegated to at the time that the Withdrawal was created
   address delegatedTo;
   // The address that can complete the Withdrawal + will receive funds when completing the withdrawal
   address withdrawer;
   // Nonce used to guarantee that otherwise identical withdrawals have unique hashes
   uint256 nonce;
   // Block number when the Withdrawal was created
   uint32 startBlock;
   // Array of strategies that the Withdrawal contains
   IStrategy[] strategies;
   // Array containing the amount of shares in each Strategy in the `strategies` array
   uint256[] shares;
}

Eigenlayer Contracts

Mainnet

  • Strategy Manager — 0x858646372CC42E1A627fcE94aa7A7033e7CF075A

  • Delegation Manager — 0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A

Holesky

  • Strategy Manager — 0xdfb5f6ce42aaa7830e94ecfccad411bef4d4d5b6

  • Delegation Manager — 0xA44151489861Fe9e3055d95adC98FbD462B948e7

Strategies

Lido (stETH) strategy

Mainnet

  • Token address — 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84

  • Strategy address — 0x93c4b944D05dfe6df7645A86cd2206016c51564D

Holesky

  • Token address — 0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034

  • Strategy address — 0x7D704507b76571a51d9caE8AdDAbBFd0ba0e63d3

wETH strategy

Mainnet

  • Token address — 0x94373a4919B3240D86eA41593D5eBa789FEF3848

  • Strategy address — 0x80528D6e9A2BAbFc766965E0E26d5aB08D9CFaF9

Holesky

  • Token address — 0x94373a4919B3240D86eA41593D5eBa789FEF3848

  • Strategy address — 0x80528D6e9A2BAbFc766965E0E26d5aB08D9CFaF9

Stader (ETHx) strategy

Mainnet

  • Token address — 0xA35b1B31Ce002FBF2058D22F30f95D405200A15b

  • Strategy address — 0x9d7eD45EE2E8FC5482fa2428f15C971e6369011d

Holesky

  • Token address — 0xB4F5fc289a778B80392b86fa70A7111E5bE0F859

  • Strategy address — 0x31B6F59e1627cEfC9fA174aD03859fC337666af7

Last updated