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
Name | Type | Description |
---|---|---|
newGaugeController | contract IGaugeController | address 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
Name | Type | Description |
---|---|---|
lpToken | address | Address 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
Name | Type | Description |
---|---|---|
owner_ | address | |
p12Token_ | address | Address of p12Token |
p12CoinFactory_ | address | Address of p12CoinFactory |
gaugeController_ | contract IGaugeController | address of gaugeController |
delayK_ | uint256 | delayK_ is a coefficient |
delayB_ | uint256 | delayB_ is a coefficient |
rate_ | uint256 |
getWithdrawUnlockTimestamp
function getWithdrawUnlockTimestamp(address lpToken, uint256 amount) public view virtual returns (uint256)
get withdraw unlockTimestamp
Name | Type | Description |
---|---|---|
lpToken | address | Address of lpToken |
amount | uint256 | Number of lpToken |
getPid
function getPid(address lpToken) public view virtual returns (uint256)
Get pool id
Name | Type | Description |
---|---|---|
lpToken | address | Address of lpToken |
getUserLpBalance
function getUserLpBalance(address lpToken, address user) public view virtual returns (uint256)
Get user lpToken balance
Name | Type | Description |
---|---|---|
lpToken | address | Address of lpToken |
user | address | LpToken holder |
Name | Type | Description |
---|---|---|
[0] | uint256 | Get lpToken balance |
addLpTokenInfoForGameCreator
function addLpTokenInfoForGameCreator(address lpToken, uint256 amount, address gameCoinCreator) public virtual
This method is only used when creating game coin in p12CoinFactory
Name | Type | Description |
---|---|---|
lpToken | address | Address of lpToken |
amount | uint256 | |
gameCoinCreator | address | user 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
Name | Type | Description |
---|---|---|
lpToken | address | Address of lpToken |
setDelayK
function setDelayK(uint256 newDelayK) public virtual returns (bool)
Set delayK value
Name | Type | Description |
---|---|---|
newDelayK | uint256 | Is a coefficient |
Name | Type | Description |
---|---|---|
[0] | bool | Get bool result |
setDelayB
function setDelayB(uint256 newDelayB) public virtual returns (bool)
Set delayB value
Name | Type | Description |
---|---|---|
newDelayB | uint256 | Is a coefficient |
Name | Type | Description |
---|---|---|
[0] | bool | Get bool result |
setRate
function setRate(uint256 newRate) public virtual returns (bool)
set new rate
Name | Type | Description |
---|---|---|
newRate | uint256 | is 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
Name | Type | Description |
---|---|---|
lpToken | address | Address of lpToken |
amount | uint256 | Number of lpToken |
queueWithdraw
function queueWithdraw(address lpToken, uint256 amount) public virtual
Withdraw lpToken delay
Name | Type | Description |
---|---|---|
lpToken | address | Address of lpToken |
amount | uint256 | Number of lpToken |
claim
function claim(address lpToken) public virtual returns (uint256)
Get pending rewards
Name | Type | Description |
---|---|---|
lpToken | address | Address of lpToken |
claimAll
function claimAll() public virtual returns (uint256)
Get all pending rewards
executeWithdraw
function executeWithdraw(address lpToken, bytes32 id) public virtual
Withdraw lpToken
Name | Type | Description |
---|---|---|
lpToken | address | Address of lpToken |
id | bytes32 | Withdraw id |
withdrawAllLpTokenEmergency
function withdrawAllLpTokenEmergency() public virtual
* @notice withdraw lpToken Emergency
withdrawLpTokenEmergency
function withdrawLpTokenEmergency(address lpToken) public virtual
* @notice withdraw all lpToken Emergency
Name | Type | Description |
---|---|---|
lpToken | address | address of lpToken |
_authorizeUpgrade
function _authorizeUpgrade(address newImplementation) internal
upgrade function
_safeP12Transfer
function _safeP12Transfer(address to, uint256 amount) internal virtual
Transfer p12 to user
Name | Type | Description |
---|---|---|
to | address | The address of receiver |
amount | uint256 | Number of p12 |
_createWithdrawId
function _createWithdrawId(address lpToken, uint256 amount, address to) internal virtual returns (bytes32 hash)
Create withdraw id
Name | Type | Description |
---|---|---|
lpToken | address | Address of lpToken |
amount | uint256 | Number of lpToken |
to | address | Address of receiver |
Name | Type | Description |
---|---|---|
hash | bytes32 | Get a withdraw Id |
_checkpoint
function _checkpoint(uint256 pid) internal virtual
update checkpoint for pool
Name | Type | Description |
---|---|---|
pid | uint256 | Pool 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()