跳到主要內容

StakingPoolForUniswapV2Tokens

It is a staking pool for Uniswap V2 LP tokens (stake Uniswap V2 LP tokens -> get LOOKS).

rewardToken = LOOKS tokens stakedToken = UniswapV2 LP tokens

Methods

PRECISION_FACTOR

function PRECISION_FACTOR() external view returns (uint256)

Returns

NameTypeDescription
PRECISION_FACTORuint256-

START_BLOCK

function START_BLOCK() external view returns (uint256)

Returns

NameTypeDescription
START_BLOCKuint256start block for the staking

accTokenPerShare

function accTokenPerShare() external view returns (uint256)

Returns

NameTypeDescription
accTokenPerShare()uint256accumulated token per share

adminRewardWithdraw

function adminRewardWithdraw(uint256 amount) external nonpayable

Withdraw rewards (for admin)

Only callable by owner.

Parameters

NameTypeDescription
amountuint256amount to withdraw (in looksRareToken)

calculatePendingRewards

function calculatePendingRewards(address user) external view returns (uint256)

View function to see pending rewards on frontend.

Parameters

NameTypeDescription
useraddressaddress of the user

Returns

NameTypeDescription
-uint256pending rewards (in rewardToken)

deposit

function deposit(uint256 amount) external nonpayable

Deposit staked tokens and collect reward tokens (if any)

Parameters

NameTypeDescription
amountuint256amount to deposit (in stakedToken)

emergencyWithdraw

function emergencyWithdraw() external nonpayable

Withdraw staked tokens and give up rewards

Only for emergency. It does not update the pool.

endBlock

function endBlock() external view returns (uint256)

Returns

NameTypeDescription
endBlockuint256end block for the staking

harvest

function harvest() external nonpayable

Harvest tokens that are pending

lastRewardBlock

function lastRewardBlock() external view returns (uint256)

Returns

NameTypeDescription
lastRewardBlockuint256last reward block

looksRareToken

function looksRareToken() external view returns (contract IERC20)

Returns

NameTypeDescription
looksRareTokencontract IERC20address of the LOOKS Token

owner

function owner() external view returns (address)

Returns the address of the current owner.

Returns

NameTypeDescription
owneraddressaddress of the current owner

pause

function pause() external nonpayable

Pause It allows calling emergencyWithdraw

paused

function paused() external view returns (bool)

Returns true if the contract is paused, and false otherwise.

Returns

NameTypeDescription
-boolwhether the contract is paused (true if paused, false if unpaused)

renounceOwnership

function renounceOwnership() external nonpayable

Leaves the contract without owner. It will not be possible to call onlyOwner functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

rewardPerBlock

function rewardPerBlock() external view returns (uint256)

Returns

NameTypeDescription
rewardPerBlockuint256reward per block (in rewardToken)

stakedToken

function stakedToken() external view returns (contract IERC20)

Returns

NameTypeDescription
stakedTokencontract IERC20address of the stakedToken (i.e., Uniswap V2 LP tokens)

transferOwnership

function transferOwnership(address newOwner) external nonpayable

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Parameters

NameTypeDescription
newOwneraddressaddress of the new owner

unpause

function unpause() external nonpayable

Unpause

updateRewardPerBlockAndEndBlock

function updateRewardPerBlockAndEndBlock(uint256 newRewardPerBlock, uint256 newEndBlock) external nonpayable

Update reward per block and the end block

Parameters

NameTypeDescription
newRewardPerBlockuint256new reward per block
newEndBlockuint256new end block

userInfo

function userInfo(address) external view returns (uint256 amount, uint256 rewardDebt)

Parameters

NameTypeDescription
useraddressaddress of the user

Returns

NameTypeDescription
amountuint256amount of tokens staked
rewardDebtuint256reward debt

withdraw

function withdraw(uint256 amount) external nonpayable

Withdraw staked tokens and collect reward tokens

Parameters

NameTypeDescription
amountuint256amount to withdraw (in stakedToken)

Events

AdminRewardWithdraw

event AdminRewardWithdraw(uint256 amount)

Parameters

NameTypeDescription
amountuint256amount of tokens withdrawn by the owner (in rewardToken)

Deposit

event Deposit(address indexed user, uint256 amount, uint256 harvestedAmount)

Parameters

NameTypeDescription
user indexedaddressuser address
amountuint256amount deposited (in stakedToken)
harvestedAmountuint256amount harvested (in rewardToken)

EmergencyWithdraw

event EmergencyWithdraw(address indexed user, uint256 amount)

It is only callable if the contract status is paused.

Parameters

NameTypeDescription
user indexedaddressuser address
amountuint256amount withdrawn (in stakedToken)

Harvest

event Harvest(address indexed user, uint256 harvestedAmount)

Parameters

NameTypeDescription
user indexedaddressuser address
harvestedAmountuint256harvestedAmount (in rewardToken)

NewRewardPerBlockAndEndBlock

event NewRewardPerBlockAndEndBlock(uint256 rewardPerBlock, uint256 endBlock)

Parameters

NameTypeDescription
rewardPerBlockuint256reward per block (in rewardToken)
endBlockuint256new end block for the staking

OwnershipTransferred

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Parameters

NameTypeDescription
previousOwner indexedaddressaddress of the previous owner
newOwner indexedaddressaddress of the new owner

Paused

event Paused(address account)

Parameters

NameTypeDescription
accountaddress-

Unpaused

event Unpaused(address account)

Parameters

NameTypeDescription
accountaddress-

Withdraw

event Withdraw(address indexed user, uint256 amount, uint256 harvestedAmount)

Parameters

NameTypeDescription
user indexedaddressuser address
amountuint256amount withdrawn (in stakedToken)
harvestedAmountuint256harvested amount (in rewardToken)