Skip to content

Stakeable

aboudjem edited this page Jun 7, 2024 · 1 revision

Stakeable

Git Source

Inherits: Ownable, IStakeable

Provides functionality to stake, unlock, and withdraw Ether on an EntryPoint.


Functions

constructor

constructor(address newOwner);

addStake

Stakes a certain amount of Ether on an EntryPoint.

The contract should have enough Ether to cover the stake.

function addStake(address epAddress, uint32 unstakeDelaySec) external payable onlyOwner;

Parameters

Name Type Description
epAddress address The address of the EntryPoint where the stake is added.
unstakeDelaySec uint32 The delay in seconds before the stake can be unlocked.

Important

Ensure the contract has sufficient Ether before calling addStake. Insufficient funds will cause the transaction to fail.


unlockStake

Unlocks the stake on an EntryPoint.

This starts the unstaking delay after which funds can be withdrawn.

function unlockStake(address epAddress) external onlyOwner;

Parameters

Name Type Description
epAddress address The address of the EntryPoint from which the stake is to be unlocked.

Note

Unstaking delay must be considered before planning to unlock the stake. The funds cannot be withdrawn immediately after unlocking.


withdrawStake

Withdraws the stake from an EntryPoint to a specified address.

This can only be done after the unstaking delay has passed since the unlock.

function withdrawStake(address epAddress, address payable withdrawAddress) external onlyOwner;

Parameters

Name Type Description
epAddress address The address of the EntryPoint where the stake is withdrawn from.
withdrawAddress address payable The address to receive the withdrawn stake.

Caution

Ensure the unstaking delay has passed before attempting to withdraw the stake. Attempting to withdraw before the delay has passed will result in a failed transaction.


Errors

InvalidEntryPointAddress

Error thrown when an invalid EntryPoint address is provided.

error InvalidEntryPointAddress();

Warning

Double-check the EntryPoint address provided to avoid triggering the InvalidEntryPointAddress error.