diff --git a/contracts/staking/P12MineUpgradeable.sol b/contracts/staking/P12MineUpgradeable.sol index 0854cba..2cd2ce3 100644 --- a/contracts/staking/P12MineUpgradeable.sol +++ b/contracts/staking/P12MineUpgradeable.sol @@ -303,7 +303,7 @@ contract P12MineUpgradeable is @notice Get pending rewards @param lpToken Address of lpToken */ - function claim(address lpToken) public virtual override nonReentrant whenNotPaused { + function claim(address lpToken) public virtual override nonReentrant whenNotPaused returns (uint256){ uint256 pid = getPid(lpToken); require(userInfo[pid][msg.sender].amount > 0, 'P12Mine: no staked token'); PoolInfo storage pool = poolInfos[pid]; @@ -312,12 +312,13 @@ contract P12MineUpgradeable is uint256 pending = (user.amount * pool.accP12PerShare) / ONE - user.rewardDebt; user.rewardDebt = (user.amount * pool.accP12PerShare) / ONE; _safeP12Transfer(msg.sender, pending); + return pending; } /** @notice Get all pending rewards */ - function claimAll() public virtual override nonReentrant whenNotPaused { + function claimAll() public virtual override nonReentrant whenNotPaused returns (uint256){ uint256 length = poolInfos.length; uint256 pending = 0; for (uint256 pid = 0; pid < length; pid++) { @@ -331,6 +332,7 @@ contract P12MineUpgradeable is user.rewardDebt = (user.amount * pool.accP12PerShare) / ONE; } _safeP12Transfer(msg.sender, pending); + return pending; } /** @@ -356,7 +358,7 @@ contract P12MineUpgradeable is pool.amount -= amount; user.rewardDebt = (user.amount * pool.accP12PerShare) / ONE; IERC20Upgradeable(pool.lpToken).safeTransfer(address(_who), amount); - emit ExecuteWithdraw(_who, pid, amount, user.amount, pool.amount); + emit ExecuteWithdraw(_who, pid,id, amount, user.amount, pool.amount); } /** diff --git a/contracts/staking/interfaces/IGaugeController.sol b/contracts/staking/interfaces/IGaugeController.sol index 0beec88..ccb75aa 100644 --- a/contracts/staking/interfaces/IGaugeController.sol +++ b/contracts/staking/interfaces/IGaugeController.sol @@ -9,7 +9,7 @@ interface IGaugeController { event ApplyOwnership(address admin); - event AddType(string, int128 typeId); + event AddType(string name, int128 typeId); event NewTypeWeight(int128 typeId, uint256 time, uint256 weight, uint256 totalWeight); diff --git a/contracts/staking/interfaces/IP12MineUpgradeable.sol b/contracts/staking/interfaces/IP12MineUpgradeable.sol index 04e28e6..0b34978 100644 --- a/contracts/staking/interfaces/IP12MineUpgradeable.sol +++ b/contracts/staking/interfaces/IP12MineUpgradeable.sol @@ -7,7 +7,7 @@ import './IGaugeController.sol'; interface IP12MineUpgradeable { event Deposit(address indexed user, uint256 indexed pid, uint256 amount, uint256 userAmount, uint256 poolAmount); // deposit lpToken log - event ExecuteWithdraw(address indexed user, uint256 indexed pid, uint256 amount, uint256 userAmount, uint256 poolAmount); // withdraw lpToken log + event ExecuteWithdraw(address indexed user, uint256 indexed pid,bytes32 indexed withdrawId, uint256 amount, uint256 userAmount, uint256 poolAmount); // withdraw lpToken log event QueueWithdraw( address indexed user, uint256 pid, @@ -68,9 +68,9 @@ interface IP12MineUpgradeable { address gameCoinCreator ) external; // add lpToken info for gameCoin creator when first time - function claim(address lpToken) external; // get pending rewards + function claim(address lpToken) external returns (uint256); // get pending rewards - function claimAll() external; // get all pending rewards + function claimAll() external returns (uint256); // get all pending rewards - function checkpoint(address lpToken) external; + function checkpoint(address lpToken) external ; }