This repository has been archived by the owner on Jul 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c6f43a
commit 3a3a624
Showing
4 changed files
with
63 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { useCallback } from 'react' | ||
|
||
import useBao from './useBao' | ||
import { useWallet } from 'use-wallet' | ||
|
||
import { getMasterChefContract, emergencyWithdraw } from '../bao/utils' | ||
|
||
const useEmergencyWithdraw = (pid: number) => { | ||
const { account } = useWallet() | ||
const bao = useBao() | ||
const masterChefContract = getMasterChefContract(bao) | ||
|
||
const handleUnstake = useCallback( | ||
async (amount: string) => { | ||
const txHash = await emergencyWithdraw(masterChefContract, pid, account) | ||
console.log(txHash) | ||
}, | ||
[account, pid, bao], | ||
) | ||
|
||
return { onUnstake: handleUnstake } | ||
} | ||
|
||
export default useEmergencyWithdraw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters