Skip to content

Commit

Permalink
fix checking allowance
Browse files Browse the repository at this point in the history
  • Loading branch information
tubackkhoa committed Feb 27, 2023
1 parent 7c3f802 commit 2815379
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/pages/Pools/LiquidityModal/LiquidityModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,15 @@ const LiquidityModal: FC<ModalProps> = ({
displayToast(TToastType.TX_BROADCASTING);

try {
if (!!token1AllowanceToPair && +token1AllowanceToPair < amount1) {
if (!!token1AllowanceToPair && token1AllowanceToPair < BigInt(amount1)) {
await increaseAllowance(
'9'.repeat(30),
token1InfoData!.contractAddress!,
address
);
refetchToken1Allowance();
}
if (!!token2AllowanceToPair && +token2AllowanceToPair < amount2) {
if (!!token2AllowanceToPair && token2AllowanceToPair < BigInt(amount2)) {
await increaseAllowance(
'9'.repeat(30),
token2InfoData!.contractAddress!,
Expand Down
9 changes: 5 additions & 4 deletions src/rest/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,15 @@ async function fetchTokenAllowance(
tokenAddr: string,
walletAddr: string,
spender: string
) {
// hard code with token orai
// if (!tokenAddr) return '999999999999999999999999999999';
): Promise<bigint> {
// hard code with native token
if (!tokenAddr) return BigInt('999999999999999999999999999999');

const data = await Contract.token(tokenAddr).allowance({
owner: walletAddr,
spender
});
return data.allowance;
return BigInt(data.allowance);
}

async function fetchRewardInfo(
Expand Down

0 comments on commit 2815379

Please sign in to comment.