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
The modifier to run when executing deposit and withdraw functions. It must be run whenever the staking pool's deposit information changes.
Parameters
stakingToken
address
The address of staking token.
refundOption
uint8
The refund option for update.
checkActive
Checking staking pool is active.
Parameters
stakingToken
address
The address of staking token.
constructor
deposit
Deposit to staking pool.
Parameters
params
struct ILaunchpadStaking.Depositparams
Parameters for deposit.
Return Values
[0]
uint256
acculated deposit.
adjustDeposit
Adjust return options on user's deposit info. It must adjust refund option to downward.
Parameters
params
struct ILaunchpadStaking.AdjustDepositParams
Parameters for adjust deposit.
Return Values
[0]
uint256
acculated deposit.
withdrawRefund
Withdraw from all refund options of specific staking token pool when claimable.
Parameters
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
account
address
Depositor address.
stakingToken
address
Token address for withdraw.
Return Values
refund
uint256
Amount of refund.
withdrawReward
Withdraw reward token by owner.
Parameters
to
address
The address of receiver.
amount
uint256
emergenctWithdrawReward
Emergency withdraw reward token by owner. Should be execute when paused.
Parameters
to
address
The address of receiver.
claim
Claim rewards. Should be execute after {withdrawRefund}.
Return Values
rewards
uint256
claimable rewards.
initialize
Initialize configuration for mining protocol.
Parameters
params
struct ILaunchpadStaking.InitializeParams
{InitializeParams}
pause
Pause mining protocol
unpause
Unpause mining protocol
setPool
Set staking pool. Only execute before start mining.
Parameters
params
struct ILaunchpadStaking.PoolConfig
{PoolConfig}
setBonusRewardSupply
Set {bonusRewardSupply}.
Parameters
amount
uint256
Amount of bonus reward supply.
setMiningPeriod
Set staking period.
Parameters
startBlock
uint256
The staking start block.
endBlock
uint256
The staking end block.
setClaimSchedule
setBonusMiningMultiplier
Set {bonusMiningMultipliers}.
Parameters
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
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
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
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
stakingToken
address
Staking token address.
totalMiningRewards
Return total mining rewards.
Return Values
[0]
uint256
totalMiningRewards total minting reward.
poolInfoListByTokens
Return poolInfo list.
Parameters
tokens
address[]
Array of token address getting {PoolInfoResponse}.
depositedPoolsByAccount
Return user's deposited pools.
Parameters
account
address
User's account.
depositInfoListByToken
Return user's deposited pool info for a specific refund option.
Parameters
account
address
User's account.
token
address
Staking token address.
calculateRefund
Return refund.
Parameters
refundOption
uint8
Refund option.
amount
uint256
Deposit amount.
Return Values
refund
uint256
Refund calculated by returnOption.
_transferERC20
Call transfer() function to ERC20 Contract.
Parameters
to
address
Receiver address.
token
address
Token address for transfer.
amount
uint256
Amount for transfer.
_transferFromERC20
Call transferFrom() function to ERC20 Contract.
Parameters
from
address
Sender address.
to
address
Receiver address.
token
address
Token address for transfer.
amount
uint256
Amount for transfer.
_transferETH
Call send ETH.
Parameters
to
address
Receiver address.
amount
uint256
Amount for tranfser.
_withdrawRefund
Withdraw token to account.
Parameters
account
address
Receiver address.
stakingToken
address
Token address for transfer.
_updateReward
Update information related to reward.
Parameters
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.