StakingManager

The StakingManager allows an ERC20 token to be staked by users and distributes pro-rata ETH rewards from Flaunch stream to staking users.

Initialization

/**
 * Parameters passed during manager initialization.
 *
 * @member stakingToken The address of the token to be staked
 * @member minEscrowDuration The minimum duration that the creator's NFT is locked for
 * @member minStakeDuration The minimum duration that the user's tokens are locked for
 * @member creatorShare The share that a creator will earn from their token
 * @member ownerShare The share that the manager owner will earn from their token
 */
struct InitializeParams {
    address stakingToken;
    uint minEscrowDuration;
    uint minStakeDuration;
    uint creatorShare;
    uint ownerShare;
}

Deposit

Public Calls

stake(uint amount)

Allows a caller to stake the defined ERC20 token.

unstake(uint amount)

Allows a caller to unstake the defined ERC20 token and claim any pending ETH fees

Before unstaking, the function validates that the user’s stake is no longer time-locked and that they have sufficient balance.

claim() returns (uint)

Allows a caller to withdraw their pending ETH rewards earned from staking.

It calculates all owed balances, updates internal snapshots, transfers ETH to the caller, and returns the total amount claimed.

balances(address user) returns(uint balance)

Allows the caller to check the total claimable ETH balance for a given address.

getUserStakeInfo(address user) returns (uint amount_, uint timelockUntil_, uint pendingETHRewards_)

Allows the caller to view detailed staking data for any user, including the amount of tokens currently staked, the timestamp when the stake unlocks, and the pending ETH rewards accrued so far.

Creator Calls

escrowWithdraw(FlaunchToken calldata _flaunchToken)

Allows the token creator to withdraw their ERC721 after the escrow lock period has passed by verifying ownership and time-based unlock conditions.

extendEscrowDuration(FlaunchToken calldata _flaunchToken, uint _extendBy)

Allows the token creator to increase the escrow lock period by a specified duration, delaying when the ERC721 can be withdrawn.

Who is using the StakingManager?

The StakingManager is designed for protocols launching ecosystem tokens that want to offer staking yield, DAOs looking to distribute ETH rewards to stakers or contributors, meme or gamefi projects aiming to gamify attention and trading activity, and artist collectives or collaborative economies that want to coordinate shared upside through ETH-based rewards.

Last updated

Was this helpful?