Unchain X
  • INTRODUCTION
    • UNCHAIN X Introduction
    • UNCHAIN X Protocol
    • UNCHAIN X Cautions
    • Privacy Policy
    • Audits
  • TOKENOMICS
    • UNX
  • PRODUCT
    • Swap
    • Pair Deposit(v2)
      • Concentrated Liquidity(v3)
    • Governance
      • Governance Voting Policy
    • X-Launcher
      • Initial Sale
      • Token Launch Process
      • Launch Review
      • Bonding Curve Pool Creation
      • Conclusion
    • X DROP
    • RWA MARKET
  • DEVELOPER
    • Launchpad
      • ILaunchpad
      • Launchpad
Powered by GitBook
On this page
  • updateReward
  • checkActive
  • constructor
  • deposit
  • adjustDeposit
  • withdrawRefund
  • emergencyWithdrawRefund
  • withdrawReward
  • emergenctWithdrawReward
  • claim
  • initialize
  • pause
  • unpause
  • setPool
  • setBonusRewardSupply
  • setMiningPeriod
  • setClaimSchedule
  • setBonusMiningMultiplier
  • setBonusMiningMultiplierBatch
  • earned
  • earnedForAllOptions
  • lastBlockRewardApplicable
  • rewardPerToken
  • totalMiningRewards
  • poolInfoListByTokens
  • depositedPoolsByAccount
  • depositInfoListByToken
  • calculateRefund
  • _transferERC20
  • _transferFromERC20
  • _transferETH
  • _withdrawRefund
  • _updateReward
  • _verifyDeadline
  • rewardToken
  • collector
  • totalAllocationPerBlock
  • bonusRewardSupply
  • stakingStartBlock
  • stakingEndBlock
  • claimLimit
  • pools
  • refundOf
  • bonusMiningMultipliers
  • depositInfo
  • count
  • claimableBlock
  • totalUserRewards
  • claimable
  • isWithdrawn
  1. DEVELOPER
  2. Launchpad

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

function deposit(struct ILaunchpadStaking.Depositparams params) external payable returns (uint256)

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

function adjustDeposit(struct ILaunchpadStaking.AdjustDepositParams params) external returns (uint256)

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

function withdrawRefund(address stakingToken) external returns (uint256 refund, uint256 rewards)

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

Parameters

Name
Type
Description

stakingToken

address

Token address for withdraw.

emergencyWithdrawRefund

function emergencyWithdrawRefund(address account, address stakingToken) external returns (uint256 refund)

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

function withdrawReward(address to, uint256 amount) external

Withdraw reward token by owner.

Parameters

Name
Type
Description

to

address

The address of receiver.

amount

uint256

emergenctWithdrawReward

function emergenctWithdrawReward(address to) external

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

Parameters

Name
Type
Description

to

address

The address of receiver.

claim

function claim() external returns (uint256 rewards)

Claim rewards. Should be execute after {withdrawRefund}.

Return Values

Name
Type
Description

rewards

uint256

claimable rewards.

initialize

function initialize(struct ILaunchpadStaking.InitializeParams params) external

Initialize configuration for mining protocol.

Parameters

Name
Type
Description

params

struct ILaunchpadStaking.InitializeParams

{InitializeParams}

pause

function pause() external

Pause mining protocol

unpause

function unpause() external

Unpause mining protocol

setPool

function setPool(struct ILaunchpadStaking.PoolConfig params) public

Set staking pool. Only execute before start mining.

Parameters

Name
Type
Description

params

struct ILaunchpadStaking.PoolConfig

{PoolConfig}

setBonusRewardSupply

function setBonusRewardSupply(uint256 amount) public

Set {bonusRewardSupply}.

Parameters

Name
Type
Description

amount

uint256

Amount of bonus reward supply.

setMiningPeriod

function setMiningPeriod(uint256 startBlock, uint256 endBlock) public

Set staking period.

Parameters

Name
Type
Description

startBlock

uint256

The staking start block.

endBlock

uint256

The staking end block.

setClaimSchedule

function setClaimSchedule(struct ILaunchpadStaking.ClaimConfig params) public

setBonusMiningMultiplier

function setBonusMiningMultiplier(struct ILaunchpadStaking.MiningMultiplierParams params) public

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

function setBonusMiningMultiplierBatch(struct ILaunchpadStaking.MiningMultiplierParams[] params) public

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

function earned(address account, address stakingToken, uint8 refundOption) public view returns (uint256)

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

function earnedForAllOptions(address account, address stakingToken) public view returns (uint256 rewards)

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

function lastBlockRewardApplicable() public view returns (uint256)

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

rewardPerToken

function rewardPerToken(address stakingToken) public view returns (uint256)

Return reward per token deposited pool.

Parameters

Name
Type
Description

stakingToken

address

Staking token address.

totalMiningRewards

function totalMiningRewards() public view returns (uint256)

Return total mining rewards.

Return Values

Name
Type
Description

[0]

uint256

totalMiningRewards total minting reward.

poolInfoListByTokens

function poolInfoListByTokens(address[] tokens) public view returns (struct ILaunchpadStaking.PoolInfoResponse[])

Return poolInfo list.

Parameters

Name
Type
Description

tokens

address[]

Array of token address getting {PoolInfoResponse}.

depositedPoolsByAccount

function depositedPoolsByAccount(address account) public view returns (address[])

Return user's deposited pools.

Parameters

Name
Type
Description

account

address

User's account.

depositInfoListByToken

function depositInfoListByToken(address account, address token) public view returns (struct ILaunchpadStaking.DepositInfoResponse[])

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

function calculateRefund(uint8 refundOption, uint256 amount) public pure returns (uint256 refund)

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

function _transferERC20(address to, address token, uint256 amount) internal

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

function _transferFromERC20(address from, address to, address token, uint256 amount) internal

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

function _transferETH(address to, uint256 amount) internal

Call send ETH.

Parameters

Name
Type
Description

to

address

Receiver address.

amount

uint256

Amount for tranfser.

_withdrawRefund

function _withdrawRefund(address account, address stakingToken) internal returns (uint256 refund)

Withdraw token to account.

Parameters

Name
Type
Description

account

address

Receiver address.

stakingToken

address

Token address for transfer.

_updateReward

function _updateReward(address account, address stakingToken, uint8 refundOption) internal

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

function _verifyDeadline(uint256 target, uint256 deadline) internal pure

rewardToken

address rewardToken

The reward token address.

collector

address collector

The address for collect non-refund amount.

totalAllocationPerBlock

uint256 totalAllocationPerBlock

The reward allocation per block for all pool.

bonusRewardSupply

uint256 bonusRewardSupply

Total bonus rewards for refund option.

stakingStartBlock

uint256 stakingStartBlock

The Staking start block number.

stakingEndBlock

uint256 stakingEndBlock

The Staking end block number.

claimLimit

uint256 claimLimit

The claim limit.

pools

mapping(address => struct ILaunchpadStaking.PoolInfo) pools

Pool token address => Pool Info.

refundOf

mapping(address => mapping(address => uint256)) refundOf

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

bonusMiningMultipliers

mapping(uint8 => uint256) bonusMiningMultipliers

Bonus mining multipliers each refundOption.

depositInfo

mapping(address => mapping(address => mapping(uint8 => struct ILaunchpadStaking.DepositInfo))) depositInfo

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

count

mapping(address => uint256) count

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

claimableBlock

mapping(uint256 => uint256) claimableBlock

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

totalUserRewards

mapping(address => uint256) totalUserRewards

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

claimable

mapping(address => bool) claimable

User's claimable status.

isWithdrawn

mapping(address => mapping(address => bool)) isWithdrawn
PreviousILaunchpad