Skip to content

Commit

Permalink
bugfix: approve collInput on borrow
Browse files Browse the repository at this point in the history
  • Loading branch information
brucedonovan committed Nov 8, 2021
1 parent ded50dc commit 1c40ac9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/hooks/actionHooks/useBorrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SettingsContext } from '../../contexts/SettingsContext';
import { UserContext } from '../../contexts/UserContext';
import { ICallData, IVault, ActionCodes, LadleActions, ISeries } from '../../types';
import { cleanValue, getTxCode } from '../../utils/appUtils';
import { ETH_BASED_ASSETS, BLANK_VAULT } from '../../utils/constants';
import { ETH_BASED_ASSETS, BLANK_VAULT, MAX_256 } from '../../utils/constants';
import { buyBase, calculateSlippage } from '../../utils/yieldMath';
import { useChain } from '../useChain';
import { useAddCollateral } from './useAddCollateral';
Expand Down Expand Up @@ -50,7 +50,7 @@ export const useBorrow = () => {

/* if approveMAx, check if signature is required */
const alreadyApproved = approveMax
? (await ilk.baseContract.allowance(account, ilk.joinAddress)).gt(_input)
? (await ilk.baseContract.allowance(account, ilk.joinAddress)).gt(_collInput)
: false;

/* Gather all the required signatures - sign() processes them and returns them as ICallData types */
Expand All @@ -60,7 +60,7 @@ export const useBorrow = () => {
target: ilk,
spender: ilk.joinAddress,
message: `Allow Yield Protocol to move ${ilk.symbol}`,
amount: _input,
amount: _collInput,
ignoreIf: alreadyApproved || ETH_BASED_ASSETS.includes(selectedIlkId) || _collInput.eq(ethers.constants.Zero),
},
],
Expand Down

0 comments on commit 1c40ac9

Please sign in to comment.