# safeApprove vs safeIncreaseAllowance vs permit

**URL:** <https://forum.openzeppelin.com/t/safeapprove-vs-safeincreaseallowance-vs-permit/30137>\
**Category:** Smart Contracts\
**Tags:** erc20\
**Created:** [July 3, 2022, 12:38pm UTC](https://forum.openzeppelin.com/t/safeapprove-vs-safeincreaseallowance-vs-permit/30137 "2022-07-03T12:38:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bblanc42](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/bblanc42/32/15358_2.png) [@bblanc42](https://forum.openzeppelin.com/u/bblanc42)\
**Post date:** [July 3, 2022, 12:38pm UTC](https://forum.openzeppelin.com/t/safeapprove-vs-safeincreaseallowance-vs-permit/30137/1 "2022-07-03T12:38:39Z")

</div>

Hi there,

I am slightly confused between the usage of `safeApprove` vs `safeIncreaseAllowance` vs `permit`. Say I have a staking contract that allows a user to deposit some tokens (maybe $UNI or $SUSHI, tokens that I did not implement) into it,

```auto
contract A {
  function deposit(address token, uint256 amount) {
    IERC20(token).safeTransferFrom(msg.sender, address(this), amount);
  }
  
  function approveA(address token, uint256 amount) external {
    IERC20(token).safeIncreaseAllowance(address(this), amount);
  }

  function approveB(address token, uint256 amount) external {
    IERC20(token).approve(address(this), amount);
  }

  function approveC(address token, uint256 amount) external {
    // what should v, r, s be if the user should call this before they can call deposit()?
    IERC20Permit(token).permit(msg.sender, address(this), amount, deadline, v, r, s)
  }
}

```

the user has to "approve" the token before they can call the `deposit()` function. Which approve function should I include in my contract? I tried doing `approveA()` but I'm running into `ERC20: insufficient allowance`. I want to do `approveC()` but I do not know what are the v, r, s if I were to run tests on it.

What is the magic function to add to the contract such that users on the front end can call the function to approve and stake their tokens into the contract?
