Launchpad

This staking reward contract follows a typical staking reward system but has a unique feature called the refund option. The refund option is a selectable value for the percentage of the deposit to be refunded after the staking period ends. Setting the refund option lower allows users to receive additional bonus rewards in addition to the rewards allocated to the staking pool. The refund option for an already deposited contract can only be changed to a lower percentage. Claiming rewards can be done after users withdraw their deposits following the end of the staking period, and rewards can be received divided into a total of 10 cycles, each defined cycle.

User's Withdrawal status.

updateReward

modifier updateReward(address stakingToken, uint8 refundOption)

The modifier to run when executing deposit and withdraw functions. It must be run whenever the staking pool's deposit information changes.

Parameters

Name
Type
Description

stakingToken

address

The address of staking token.

refundOption

uint8

The refund option for update.

checkActive

modifier checkActive(address stakingToken)

Checking staking pool is active.

Parameters

Name
Type
Description

stakingToken

address

The address of staking token.

constructor

constructor(address rewardToken_, address collector_) public

deposit

Deposit to staking pool.

Parameters

Name
Type
Description

params

struct ILaunchpadStaking.Depositparams

Parameters for deposit.

Return Values

Name
Type
Description

[0]

uint256

acculated deposit.

adjustDeposit

Adjust return options on user's deposit info. It must adjust refund option to downward.

Parameters

Name
Type
Description

params

struct ILaunchpadStaking.AdjustDepositParams

Parameters for adjust deposit.

Return Values

Name
Type
Description

[0]

uint256

acculated deposit.

withdrawRefund

Withdraw from all refund options of specific staking token pool when claimable.

Parameters

Name
Type
Description

stakingToken

address

Token address for withdraw.

emergencyWithdrawRefund

Emergency withdraw from all refund options of specific staking pool deposited by account. should be execute when paused.

Parameters

Name
Type
Description

account

address

Depositor address.

stakingToken

address

Token address for withdraw.

Return Values

Name
Type
Description

refund

uint256

Amount of refund.

withdrawReward

Withdraw reward token by owner.

Parameters

Name
Type
Description

to

address

The address of receiver.

amount

uint256

emergenctWithdrawReward

Emergency withdraw reward token by owner. Should be execute when paused.

Parameters

Name
Type
Description

to

address

The address of receiver.

claim

Claim rewards. Should be execute after {withdrawRefund}.

Return Values

Name
Type
Description

rewards

uint256

claimable rewards.

initialize

Initialize configuration for mining protocol.

Parameters

Name
Type
Description

params

struct ILaunchpadStaking.InitializeParams

{InitializeParams}

pause

Pause mining protocol

unpause

Unpause mining protocol

setPool

Set staking pool. Only execute before start mining.

Parameters

Name
Type
Description

params

struct ILaunchpadStaking.PoolConfig

{PoolConfig}

setBonusRewardSupply

Set {bonusRewardSupply}.

Parameters

Name
Type
Description

amount

uint256

Amount of bonus reward supply.

setMiningPeriod

Set staking period.

Parameters

Name
Type
Description

startBlock

uint256

The staking start block.

endBlock

uint256

The staking end block.

setClaimSchedule

setBonusMiningMultiplier

Set {bonusMiningMultipliers}.

Parameters

Name
Type
Description

params

struct ILaunchpadStaking.MiningMultiplierParams

{MiningMultiplierParams}. refundOption: Refund option. multiplier: Bonus mining multiplier. If mining power is 100.0 %, multiplier is 1000.

setBonusMiningMultiplierBatch

Set batch {bonusMiningMultipliers}.

Parameters

Name
Type
Description

params

struct ILaunchpadStaking.MiningMultiplierParams[]

Batch of bonus mining multipliers. If mining power is 100.0 %, multiplier is 1000.

earned

Return user's rewards for a specific refund option in the staking pool.

Parameters

Name
Type
Description

account

address

User's account address.

stakingToken

address

Staking token address.

refundOption

uint8

Refund option.

earnedForAllOptions

Return user's rewards for all refund options in the staking pool.

Parameters

Name
Type
Description

account

address

User's account address.

stakingToken

address

Staking token address.

lastBlockRewardApplicable

If current block number greater than or equal to {stakingEndBlock}, return {stakingEndBlock}. Else return current block number.

rewardPerToken

Return reward per token deposited pool.

Parameters

Name
Type
Description

stakingToken

address

Staking token address.

totalMiningRewards

Return total mining rewards.

Return Values

Name
Type
Description

[0]

uint256

totalMiningRewards total minting reward.

poolInfoListByTokens

Return poolInfo list.

Parameters

Name
Type
Description

tokens

address[]

Array of token address getting {PoolInfoResponse}.

depositedPoolsByAccount

Return user's deposited pools.

Parameters

Name
Type
Description

account

address

User's account.

depositInfoListByToken

Return user's deposited pool info for a specific refund option.

Parameters

Name
Type
Description

account

address

User's account.

token

address

Staking token address.

calculateRefund

Return refund.

Parameters

Name
Type
Description

refundOption

uint8

Refund option.

amount

uint256

Deposit amount.

Return Values

Name
Type
Description

refund

uint256

Refund calculated by returnOption.

_transferERC20

Call transfer() function to ERC20 Contract.

Parameters

Name
Type
Description

to

address

Receiver address.

token

address

Token address for transfer.

amount

uint256

Amount for transfer.

_transferFromERC20

Call transferFrom() function to ERC20 Contract.

Parameters

Name
Type
Description

from

address

Sender address.

to

address

Receiver address.

token

address

Token address for transfer.

amount

uint256

Amount for transfer.

_transferETH

Call send ETH.

Parameters

Name
Type
Description

to

address

Receiver address.

amount

uint256

Amount for tranfser.

_withdrawRefund

Withdraw token to account.

Parameters

Name
Type
Description

account

address

Receiver address.

stakingToken

address

Token address for transfer.

_updateReward

Update information related to reward.

Parameters

Name
Type
Description

account

address

User's address for update.

stakingToken

address

Token address for update.

refundOption

uint8

Refund option for update.

_verifyDeadline

rewardToken

The reward token address.

collector

The address for collect non-refund amount.

totalAllocationPerBlock

The reward allocation per block for all pool.

bonusRewardSupply

Total bonus rewards for refund option.

stakingStartBlock

The Staking start block number.

stakingEndBlock

The Staking end block number.

claimLimit

The claim limit.

pools

Pool token address => Pool Info.

refundOf

User's refund by staking token (user address => staking token => refund).

bonusMiningMultipliers

Bonus mining multipliers each refundOption.

depositInfo

Deposit info by account, staking token address, refund option.

count

User's claim count(account => count).

claimableBlock

Block number per count(count => block number).

totalUserRewards

User's total reward amount(account => amount).

claimable

User's claimable status.

isWithdrawn