Skip to main content

P12MineUpgradeable

P12MineUpgradeable

ONE

uint256 ONE

WEEK

uint256 WEEK

setP12CoinFactory

function setP12CoinFactory(address newP12CoinFactory) external virtual

set new p12CoinFactory  @param newP12CoinFactory address of p12CoinFactory

setGaugeController

function setGaugeController(contract IGaugeController newGaugeController) external virtual

set new gaugeController

NameTypeDescription
newGaugeControllercontract IGaugeControlleraddress of gaugeController

poolLength

function poolLength() external view virtual returns (uint256)

Get pool len

withdrawEmergency

function withdrawEmergency() external virtual

​ * @notice withdraw token Emergency

checkpoint

function checkpoint(address lpToken) external

update checkpoint for pool

NameTypeDescription
lpTokenaddressAddress of lpToken

pause

function pause() public

unpause

function unpause() public

initialize

function initialize(address owner_, address p12Token_, address p12CoinFactory_, contract IGaugeController gaugeController_, uint256 delayK_, uint256 delayB_, uint256 rate_) public

Contract initialization

NameTypeDescription
owner_address
p12Token_addressAddress of p12Token
p12CoinFactory_addressAddress of p12CoinFactory
gaugeController_contract IGaugeControlleraddress of gaugeController
delayK_uint256delayK_ is a coefficient
delayB_uint256delayB_ is a coefficient
rate_uint256

getWithdrawUnlockTimestamp

function getWithdrawUnlockTimestamp(address lpToken, uint256 amount) public view virtual returns (uint256)

get withdraw unlockTimestamp

NameTypeDescription
lpTokenaddressAddress of lpToken
amountuint256Number of lpToken

getPid

function getPid(address lpToken) public view virtual returns (uint256)

Get pool id

NameTypeDescription
lpTokenaddressAddress of lpToken

getUserLpBalance

function getUserLpBalance(address lpToken, address user) public view virtual returns (uint256)

Get user lpToken balance

NameTypeDescription
lpTokenaddressAddress of lpToken
useraddressLpToken holder
NameTypeDescription
[0]uint256Get lpToken balance

addLpTokenInfoForGameCreator

function addLpTokenInfoForGameCreator(address lpToken, uint256 amount, address gameCoinCreator) public virtual

This method is only used when creating game coin in p12CoinFactory

NameTypeDescription
lpTokenaddressAddress of lpToken
amountuint256
gameCoinCreatoraddressuser of game coin creator

emergency

function emergency() public virtual

set the isEmergency to true

createPool

function createPool(address lpToken) public virtual

Create a new pool

NameTypeDescription
lpTokenaddressAddress of lpToken

setDelayK

function setDelayK(uint256 newDelayK) public virtual returns (bool)

Set delayK value

NameTypeDescription
newDelayKuint256Is a coefficient
NameTypeDescription
[0]boolGet bool result

setDelayB

function setDelayB(uint256 newDelayB) public virtual returns (bool)

Set delayB value

NameTypeDescription
newDelayBuint256Is a coefficient
NameTypeDescription
[0]boolGet bool result

setRate

function setRate(uint256 newRate) public virtual returns (bool)

set new rate

NameTypeDescription
newRateuint256is p12 token inflation rate

checkpointAll

function checkpointAll() public virtual

update checkpoint for all pool

deposit

function deposit(address lpToken, uint256 amount) public virtual

Deposit lpToken

NameTypeDescription
lpTokenaddressAddress of lpToken
amountuint256Number of lpToken

queueWithdraw

function queueWithdraw(address lpToken, uint256 amount) public virtual

Withdraw lpToken delay

NameTypeDescription
lpTokenaddressAddress of lpToken
amountuint256Number of lpToken

claim

function claim(address lpToken) public virtual returns (uint256)

Get pending rewards

NameTypeDescription
lpTokenaddressAddress of lpToken

claimAll

function claimAll() public virtual returns (uint256)

Get all pending rewards

executeWithdraw

function executeWithdraw(address lpToken, bytes32 id) public virtual

Withdraw lpToken

NameTypeDescription
lpTokenaddressAddress of lpToken
idbytes32Withdraw id

withdrawAllLpTokenEmergency

function withdrawAllLpTokenEmergency() public virtual

​ * @notice withdraw lpToken Emergency

withdrawLpTokenEmergency

function withdrawLpTokenEmergency(address lpToken) public virtual

​ * @notice withdraw all lpToken Emergency

NameTypeDescription
lpTokenaddressaddress of lpToken

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal

upgrade function

_safeP12Transfer

function _safeP12Transfer(address to, uint256 amount) internal virtual

Transfer p12 to user

NameTypeDescription
toaddressThe address of receiver
amountuint256Number of p12

_createWithdrawId

function _createWithdrawId(address lpToken, uint256 amount, address to) internal virtual returns (bytes32 hash)

Create withdraw id

NameTypeDescription
lpTokenaddressAddress of lpToken
amountuint256Number of lpToken
toaddressAddress of receiver
NameTypeDescription
hashbytes32Get a withdraw Id

_checkpoint

function _checkpoint(uint256 pid) internal virtual

update checkpoint for pool

NameTypeDescription
piduint256Pool Id

_checkEmergency

function _checkEmergency() private view

for saving gas, extract to a function to call in a modifier

onlyLpTokenExist

modifier onlyLpTokenExist(address lpToken)

onlyLpTokenNotExist

modifier onlyLpTokenNotExist(address lpToken)

onlyP12FactoryOrOwner

modifier onlyP12FactoryOrOwner()

onlyP12Factory

modifier onlyP12Factory()

onlyEmergency

modifier onlyEmergency()