Skip to content

Commit

Permalink
Remove stakeWithPermit function and its related interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
hujw77 committed Feb 6, 2024
1 parent a32155b commit c23f5a0
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/KTONStakingRewards.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contract StakingRewards is IStakingRewards, RewardsDistributionRecipient, Reentr
IERC20 public stakingToken;
uint256 public periodFinish = 0;
uint256 public rewardRate = 0;
uint256 public rewardsDuration = 60 days;
uint256 public rewardsDuration = 7200;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;

Expand Down Expand Up @@ -76,18 +76,6 @@ contract StakingRewards is IStakingRewards, RewardsDistributionRecipient, Reentr

/* ========== MUTATIVE FUNCTIONS ========== */

function stakeWithPermit(uint256 amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external nonReentrant updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
_totalSupply = _totalSupply.add(amount);
_balances[msg.sender] = _balances[msg.sender].add(amount);

// permit
IUniswapV2ERC20(address(stakingToken)).permit(msg.sender, address(this), amount, deadline, v, r, s);

stakingToken.safeTransferFrom(msg.sender, address(this), amount);
emit Staked(msg.sender, amount);
}

function stake(uint256 amount) external nonReentrant updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
_totalSupply = _totalSupply.add(amount);
Expand Down Expand Up @@ -160,7 +148,3 @@ contract StakingRewards is IStakingRewards, RewardsDistributionRecipient, Reentr
event Withdrawn(address indexed user, uint256 amount);
event RewardPaid(address indexed user, uint256 reward);
}

interface IUniswapV2ERC20 {
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}

0 comments on commit c23f5a0

Please sign in to comment.