文件 1 的 5:Address.sol
pragma solidity ^0.8.1;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
文件 2 的 5:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
文件 3 的 5:SafeERC20.sol
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
文件 4 的 5:TGCStaking.sol
pragma solidity 0.8.2;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
interface ITGC {
function lockedAmount(address account) external view returns (uint256);
function lockToken(uint256 amount, address user) external;
function unlockToken(uint256 amount, address user) external;
function unlockSend(uint256 amount, address user) external;
}
contract TGCStaking {
using SafeERC20 for IERC20;
address public immutable TGC;
struct UserInfo {
uint256 amount;
uint256 rewardDebt;
uint256 startTime;
uint256 claimed;
uint256 lockClaimed;
uint256 locked;
uint256 pendingToClaimed;
}
struct UserInfoLock {
uint256 amount;
uint256 startTime;
uint256 endTime;
uint256 rewardDebt;
}
struct HighestAstaStaker {
uint256 deposited;
address addr;
}
uint256 public totalStaked;
uint256 public totalLocked;
uint256 public totalStaker;
uint256 public accTokenPerShare;
uint256 public accTokenPerShareLock;
uint256 public accTokenPerShareLastTxn;
uint256 public harvestFee;
uint256 public lockFee;
uint256 public precisionFactor;
uint256 public immutable minStakingToken;
uint256 public immutable topStakerNumber;
mapping(address => UserInfo) public mapUserInfo;
mapping(address => mapping(uint256 => UserInfoLock)) public mapUserInfoLock;
mapping(uint256 => HighestAstaStaker[]) public highestStakerInPool;
mapping(address => uint256) public lockCount;
event MigrateTokens(address tokenRecovered, address receiver, uint256 amount);
event Deposit(address user, uint256 amount);
event Withdraw(address user, uint256 amount);
event NewUnlockFeeUpdated(uint256 newFee);
event PoolUpdated(uint256 amount);
event Lock(uint256 amount, uint256 period);
constructor () {
harvestFee = 100;
lockFee = 3000;
topStakerNumber = 100;
minStakingToken = 1 * 10**18;
precisionFactor = 10**18;
TGC = address(0x5c7AD3EB8264eF91dD4d756Ef9759F7aa86744e7);
}
function deposit(uint256 amount) external {
require(IERC20(TGC).balanceOf(msg.sender) - ITGC(TGC).lockedAmount(msg.sender) >= amount, "balance not available for staking");
require(amount >= minStakingToken, "amount is less than minimum staking amount");
if(mapUserInfo[msg.sender].amount > 0)
{
uint256 pending = pendingReward(msg.sender);
if(pending > 0)
{
mapUserInfo[msg.sender].pendingToClaimed += pending;
}
}
if(mapUserInfo[msg.sender].amount == 0) {
totalStaker++;
}
mapUserInfo[msg.sender].amount += amount;
mapUserInfo[msg.sender].startTime = block.timestamp;
mapUserInfo[msg.sender].rewardDebt = (mapUserInfo[msg.sender].amount * accTokenPerShare) / (precisionFactor);
totalStaked += amount;
ITGC(TGC).lockToken(amount, msg.sender);
addHighestStakedUser(mapUserInfo[msg.sender].amount, msg.sender);
emit Deposit(msg.sender, amount);
}
function lock(uint256 amount, uint256 period) external {
require(mapUserInfo[msg.sender].amount - mapUserInfo[msg.sender].locked >= amount, "amount is greater than available");
require(period >= 90 days, "min 90 day locking is required");
require(period <= 3650 days, "max locking period is 10 years");
lockCount[msg.sender] += 1;
mapUserInfo[msg.sender].locked += amount;
totalLocked += amount;
mapUserInfoLock[msg.sender][lockCount[msg.sender]].amount = amount;
mapUserInfoLock[msg.sender][lockCount[msg.sender]].startTime = block.timestamp;
mapUserInfoLock[msg.sender][lockCount[msg.sender]].endTime = block.timestamp + period;
mapUserInfoLock[msg.sender][lockCount[msg.sender]].rewardDebt = (amount * accTokenPerShareLock) / (precisionFactor);
emit Lock(amount, period);
}
function unlock(uint256[] calldata lockID) external {
for(uint i=0; i < lockID.length; i++)
{
if(mapUserInfoLock[msg.sender][lockID[i]].amount > 0)
{
uint256 pending = pendingRewardLock(msg.sender, lockID[i]);
if(pending > 0)
{
uint256 burnAmount;
uint256 period = mapUserInfoLock[msg.sender][lockID[i]].endTime - mapUserInfoLock[msg.sender][lockID[i]].startTime;
if(period >= 9 * 365 days)
{
burnAmount = 0;
}
else if(period >= 8 * 365 days)
{
burnAmount = pending * 5 / 100;
}
else if(period >= 7 * 365 days)
{
burnAmount = pending * 10 / 100;
}
else if(period >= 6 * 365 days)
{
burnAmount = pending * 15 / 100;
}
else if(period >= 5 * 365 days)
{
burnAmount = pending * 20 / 100;
}
else if(period >= 4 * 365 days)
{
burnAmount = pending * 25 / 100;
}
else if(period >= 3 * 365 days)
{
burnAmount = pending * 30 / 100;
}
else if(period >= 2 * 365 days)
{
burnAmount = pending * 35 / 100;
}
else if(period >= 365 days)
{
burnAmount = pending * 40 / 100;
}
else
{
burnAmount = pending * 45 / 100;
}
if(burnAmount > 0)
{
mapUserInfo[msg.sender].lockClaimed += pending - burnAmount;
IERC20(TGC).safeTransfer(address(0x000000000000000000000000000000000000dEaD), burnAmount);
IERC20(TGC).safeTransfer(address(msg.sender), pending - burnAmount);
}
else
{
mapUserInfo[msg.sender].lockClaimed += pending;
IERC20(TGC).safeTransfer(address(msg.sender), pending);
}
}
totalLocked -= mapUserInfoLock[msg.sender][lockID[i]].amount;
mapUserInfo[msg.sender].locked -= mapUserInfoLock[msg.sender][lockID[i]].amount;
if(mapUserInfoLock[msg.sender][lockID[i]].endTime > block.timestamp)
{
uint256 fee = mapUserInfoLock[msg.sender][lockID[i]].amount * lockFee / 10000;
ITGC(TGC).unlockSend(fee, msg.sender);
_updatePoolLock(fee);
uint256 pendingR = pendingReward(msg.sender);
if(pendingR > 0)
{
mapUserInfo[msg.sender].pendingToClaimed += pendingR;
}
totalStaked -= fee;
mapUserInfo[msg.sender].startTime = block.timestamp;
mapUserInfo[msg.sender].amount -= fee;
mapUserInfo[msg.sender].rewardDebt = (mapUserInfo[msg.sender].amount * accTokenPerShare) / (precisionFactor);
}
mapUserInfoLock[msg.sender][lockID[i]].amount = 0;
mapUserInfoLock[msg.sender][lockID[i]].startTime = 0;
mapUserInfoLock[msg.sender][lockID[i]].endTime = 0;
mapUserInfoLock[msg.sender][lockID[i]].rewardDebt = 0;
}
}
}
function withdrawReward() external {
if(mapUserInfo[msg.sender].amount > 0)
{
uint256 pending = pendingReward(msg.sender);
pending += mapUserInfo[msg.sender].pendingToClaimed;
if (pending > 0)
{
IERC20(TGC).safeTransfer(address(msg.sender), pending);
mapUserInfo[msg.sender].rewardDebt = (mapUserInfo[msg.sender].amount * accTokenPerShare) / (precisionFactor);
mapUserInfo[msg.sender].claimed += pending;
mapUserInfo[msg.sender].pendingToClaimed = 0;
emit Withdraw(msg.sender, pending);
}
}
}
function withdrawRewardLock(uint256[] calldata lockID) external {
for(uint i=0; i < lockID.length; i++)
{
if(mapUserInfoLock[msg.sender][lockID[i]].amount > 0)
{
uint256 pending = pendingRewardLock(msg.sender, lockID[i]);
if(pending > 0)
{
mapUserInfoLock[msg.sender][lockID[i]].rewardDebt += pending;
uint256 period = mapUserInfoLock[msg.sender][lockID[i]].endTime - mapUserInfoLock[msg.sender][lockID[i]].startTime;
uint256 burnAmount;
if(period >= 9 * 365 days)
{
burnAmount = 0;
}
else if(period >= 8 * 365 days)
{
burnAmount = pending * 5 / 100;
}
else if(period >= 7 * 365 days)
{
burnAmount = pending * 10 / 100;
}
else if(period >= 6 * 365 days)
{
burnAmount = pending * 15 / 100;
}
else if(period >= 5 * 365 days)
{
burnAmount = pending * 20 / 100;
}
else if(period >= 4 * 365 days)
{
burnAmount = pending * 25 / 100;
}
else if(period >= 3 * 365 days)
{
burnAmount = pending * 30 / 100;
}
else if(period >= 2 * 365 days)
{
burnAmount = pending * 35 / 100;
}
else if(period >= 365 days)
{
burnAmount = pending * 40 / 100;
}
else
{
burnAmount = pending * 45 / 100;
}
if(burnAmount > 0)
{
mapUserInfo[msg.sender].lockClaimed += pending - burnAmount;
IERC20(TGC).safeTransfer(address(0x000000000000000000000000000000000000dEaD), burnAmount);
IERC20(TGC).safeTransfer(address(msg.sender), pending - burnAmount);
}
else
{
mapUserInfo[msg.sender].lockClaimed += pending;
IERC20(TGC).safeTransfer(address(msg.sender), pending);
}
emit Withdraw(msg.sender, pending);
}
}
}
}
function withdraw(uint256 amount) external {
require(mapUserInfo[msg.sender].amount - mapUserInfo[msg.sender].locked >= amount, "amount is greater than available");
if(mapUserInfo[msg.sender].amount > amount)
{
uint256 pending = pendingReward(msg.sender);
pending += mapUserInfo[msg.sender].pendingToClaimed;
if(pending > 0)
{
IERC20(TGC).safeTransfer(address(msg.sender), pending);
}
totalStaked -= amount;
removeHighestStakedUser(msg.sender);
mapUserInfo[msg.sender].startTime = block.timestamp;
mapUserInfo[msg.sender].amount -= amount;
mapUserInfo[msg.sender].rewardDebt = (mapUserInfo[msg.sender].amount * accTokenPerShare) / (precisionFactor);
mapUserInfo[msg.sender].claimed += pending;
mapUserInfo[msg.sender].pendingToClaimed = 0;
uint256 fee = amount * harvestFee / 10000;
ITGC(TGC).unlockSend(fee, msg.sender);
ITGC(TGC).unlockToken(amount - fee, msg.sender);
_updatePool(fee);
addHighestStakedUser(mapUserInfo[msg.sender].amount, msg.sender);
emit Withdraw(msg.sender, pending + amount);
}
else
{
uint256 pending = pendingReward(msg.sender);
pending += mapUserInfo[msg.sender].pendingToClaimed;
if(pending > 0)
{
IERC20(TGC).safeTransfer(address(msg.sender), pending);
}
totalStaked -= amount;
uint256 fee = amount * harvestFee / 10000;
ITGC(TGC).unlockSend(fee, msg.sender);
ITGC(TGC).unlockToken(amount - fee, msg.sender);
_updatePool(fee);
totalStaker--;
removeHighestStakedUser(msg.sender);
mapUserInfo[msg.sender].startTime = 0;
mapUserInfo[msg.sender].amount = 0;
mapUserInfo[msg.sender].rewardDebt = 0;
mapUserInfo[msg.sender].claimed += pending;
mapUserInfo[msg.sender].pendingToClaimed = 0;
emit Withdraw(msg.sender, pending + amount);
}
}
function _updatePoolLock(uint256 amount) internal {
if(totalLocked > 0)
{
accTokenPerShareLock = accTokenPerShareLock + (amount * precisionFactor) / totalLocked;
}
emit PoolUpdated(amount);
}
function _updatePool(uint256 amount) internal {
if(totalStaked > 0)
{
accTokenPerShare = accTokenPerShare + (amount * precisionFactor) / totalStaked;
accTokenPerShareLastTxn = amount;
}
emit PoolUpdated(amount);
}
function updatePool(uint256 amount) external {
require(msg.sender == address(TGC), "sender not allowed");
_updatePool(amount);
}
function pendingReward(address user) public view returns (uint256) {
if(mapUserInfo[user].amount > 0)
{
uint256 pending = (mapUserInfo[user].amount * accTokenPerShare) / (precisionFactor) - mapUserInfo[user].rewardDebt;
return pending;
}
else
{
return 0;
}
}
function pendingRewardLock(address user, uint256 id) public view returns (uint256) {
if(mapUserInfoLock[user][id].amount > 0)
{
uint256 pending = (mapUserInfoLock[user][id].amount * accTokenPerShareLock) / (precisionFactor) - mapUserInfoLock[user][id].rewardDebt;
return pending;
}
else
{
return 0;
}
}
function quickSort(uint256 pid, uint256 left, uint256 right) internal {
HighestAstaStaker[] storage arr = highestStakerInPool[pid];
if (left >= right) return;
uint256 divtwo = 2;
uint256 p = arr[(left + right) / divtwo].deposited;
uint256 i = left;
uint256 j = right;
while (i < j)
{
while (arr[i].deposited < p) ++i;
while (arr[j].deposited > p) --j;
if (arr[i].deposited > arr[j].deposited) {
(arr[i].deposited, arr[j].deposited) = (
arr[j].deposited,
arr[i].deposited
);
(arr[i].addr, arr[j].addr) = (arr[j].addr, arr[i].addr);
} else ++i;
}
if (j > left) quickSort(pid, left, j - 1);
quickSort(pid, j + 1, right);
}
function addHighestStakedUser(uint256 amount, address user) private {
uint256 i;
HighestAstaStaker[] storage highestStaker = highestStakerInPool[0];
for (i = 0; i < highestStaker.length; i++) {
if (highestStaker[i].addr == user) {
highestStaker[i].deposited = amount;
quickSort(0, 0, highestStaker.length - 1);
return;
}
}
if(highestStaker.length < topStakerNumber)
{
highestStaker.push(HighestAstaStaker(amount, user));
quickSort(0, 0, highestStaker.length - 1);
}
else
{
if (highestStaker[0].deposited < amount)
{
highestStaker[0].deposited = amount;
highestStaker[0].addr = user;
quickSort(0, 0, highestStaker.length - 1);
}
}
}
function removeHighestStakedUser(address user) private {
HighestAstaStaker[] storage highestStaker = highestStakerInPool[0];
for (uint256 i = 0; i < highestStaker.length; i++) {
if (highestStaker[i].addr == user) {
delete highestStaker[i];
return;
}
}
}
function checkHighestStaker(address user) external view returns (bool){
HighestAstaStaker[] storage highestStaker = highestStakerInPool[0];
uint256 i = 0;
for (i; i < highestStaker.length; i++) {
if (highestStaker[i].addr == user) {
return true;
}
}
return false;
}
}
文件 5 的 5:draft-IERC20Permit.sol
pragma solidity ^0.8.0;
interface IERC20Permit {
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
function nonces(address owner) external view returns (uint256);
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
{
"compilationTarget": {
"contracts/TGCStaking.sol": "TGCStaking"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"period","type":"uint256"}],"name":"Lock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenRecovered","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MigrateTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"NewUnlockFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PoolUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"TGC","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accTokenPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accTokenPerShareLastTxn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accTokenPerShareLock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"checkHighestStaker","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"harvestFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"highestStakerInPool","outputs":[{"internalType":"uint256","name":"deposited","type":"uint256"},{"internalType":"address","name":"addr","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lockCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"mapUserInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"claimed","type":"uint256"},{"internalType":"uint256","name":"lockClaimed","type":"uint256"},{"internalType":"uint256","name":"locked","type":"uint256"},{"internalType":"uint256","name":"pendingToClaimed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"mapUserInfoLock","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minStakingToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"pendingRewardLock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"precisionFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"topStakerNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStaker","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"lockID","type":"uint256[]"}],"name":"unlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"lockID","type":"uint256[]"}],"name":"withdrawRewardLock","outputs":[],"stateMutability":"nonpayable","type":"function"}]