forked from Joystream/atlas
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⛑️ Revenue share amm restriction (Joystream#6416)
* Add new hook to unify the token lock logic * Implement new hook throughout the app * Correct logic to follow runtime
- Loading branch information
Showing
6 changed files
with
41 additions
and
30 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
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,16 @@ | ||
// import { useRef } from 'react' | ||
import { FullCreatorTokenFragment } from '@/api/queries/__generated__/fragments.generated' | ||
|
||
// import { useJoystreamStore } from '@/providers/joystream/joystream.store' | ||
|
||
export const useIsTokenInLockedMode = (token?: FullCreatorTokenFragment) => { | ||
// const currentBlockRef = useRef(useJoystreamStore((store) => store.currentBlock)) | ||
// 1. Check if there is any unfinalized revenue share | ||
const activeRevenueShare = token?.revenueShares.find((rS) => !rS.finalized) | ||
|
||
// 2. If ending block is not yet came for a user, consider that the token is locked | ||
// BUG: looks like runtime doesnt allow to make tx if the revenue share not finalized | ||
// const hasActiveRevenueShare = (activeRevenueShare?.endsAt ?? 0) > currentBlockRef.current | ||
|
||
return !!activeRevenueShare | ||
} |