-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DAO-532 Implemented allowance step (#69)
- Loading branch information
1 parent
9f45820
commit 4ff3921
Showing
6 changed files
with
129 additions
and
41 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
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,37 @@ | ||
import { useStakingContext } from '@/app/user/Stake/StakingContext' | ||
import { StakePreview } from '@/app/user/Stake/StakePreview' | ||
import { StepProps } from '@/app/user/Stake/types' | ||
import { useStakeRIF } from '@/app/user/Stake/hooks/useStakeRIF' | ||
|
||
export const StepAllowance = ({ onGoNext, onCloseModal }: StepProps) => { | ||
const { | ||
amount, | ||
tokenToSend, | ||
tokenToReceive, | ||
stakePreviewFrom: from, | ||
stakePreviewTo: to, | ||
} = useStakingContext() | ||
|
||
const { shouldEnableConfirm, customFooter } = useStakeRIF( | ||
amount, | ||
tokenToSend.contract, | ||
tokenToReceive.contract, | ||
) | ||
|
||
const actionText = !shouldEnableConfirm | ||
? 'You need to request allowance before staking.' | ||
: 'You have enough allowance to stake.' | ||
const onGoNextStep = () => onGoNext?.() | ||
return ( | ||
<StakePreview | ||
onConfirm={onGoNextStep} | ||
onCancel={onCloseModal ? onCloseModal : () => {}} | ||
disableConfirm={!shouldEnableConfirm} | ||
from={from} | ||
to={to} | ||
actionName="Allowance" | ||
actionText={actionText} | ||
customComponentBeforeFooter={customFooter} | ||
/> | ||
) | ||
} |
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